Editing FRU if the length of the field is not equal the original field will return EXIT_FAILURE #81

Closed
opened 2026-03-04 16:22:07 +01:00 by CrazyCat · 1 comment

I think it's a bug

When editing FRU, if the length of the field being modified does not match the original field, "ipmi_fru_set_field_string_rebuild" will be executed. This function returns 1 if successfully, yet the current logic sets rc= -1, resulting in the ipmitool command returning EXIT_FAILURE as its exit code.

Please see the code in ipmitool/lib/ipmi_fru.c:
image

I if "ipmi_fru_set_field_string_rebuild" returns 1, rc will be set 1

I think it's a bug When editing FRU, if the length of the field being modified does not match the original field, "**_ipmi_fru_set_field_string_rebuild_**" will be executed. This function returns 1 if successfully, yet the current logic sets **_rc= -1_**, resulting in the ipmitool command returning _EXIT_FAILURE_ as its exit code. Please see the code in _ipmitool/lib/ipmi_fru.c_: ![image](/attachments/6087e303-b648-4cee-9f42-ddf91110d0bf) I if "**_ipmi_fru_set_field_string_rebuild_**" returns 1, rc will be set 1

Thanks for the catch. This should be fixed in #82.

Nonetheless, I strongly recommend using https://codeberg.org/IPMITool/frugen for FRU modification, as it is much more versatile and flexible, plus it better supports the FRU specification.

You can use ipmitool fru read to read the binary file, then modify it with frugen, then write it back with ipmitool fru write.

Probably, at some point in the future I will bring libfru from frugen to ipmitool to replace the currently existing fru handling code, because to be honest, the currently existing code here is quite dirty.

Thanks for the catch. This should be fixed in #82. Nonetheless, I strongly recommend using https://codeberg.org/IPMITool/frugen for FRU modification, as it is much more versatile and flexible, plus it better supports the FRU specification. You can use `ipmitool fru read` to read the binary file, then modify it with `frugen`, then write it back with `ipmitool fru write`. Probably, at some point in the future I will bring `libfru` from `frugen` to `ipmitool` to replace the currently existing fru handling code, because to be honest, the currently existing code here is quite dirty.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
IPMITool/ipmitool#81
No description provided.