part: Check whether partition exists before setting GPT attributes#1169
part: Check whether partition exists before setting GPT attributes#1169vojtechtrefny wants to merge 1 commit intostoraged-project:masterfrom
Conversation
Other "set" functions already have this check.
752f021 to
bcb74a9
Compare
📝 WalkthroughWalkthroughModified the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/plugins/part.c (1)
2226-2233: Minor: error message is less informative than the equivalent check in peer functions.The
fdisk_get_partitionfailure message uses the 0-basedpart_numinteger and omits the libfdisk error reason, whilebd_part_set_part_nameandbd_part_set_part_uuiduse the human-readablepartpath and includestrerror_l (-status, c_locale). For consistency:✏️ Suggested improvement
- g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, - "Failed to get partition '%d' on device '%s'.", part_num, disk); + g_set_error (error, BD_PART_ERROR, BD_PART_ERROR_FAIL, + "Failed to get partition '%s' on device '%s': %s", + part, disk, strerror_l (-ret, c_locale));🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/plugins/part.c` around lines 2226 - 2233, The error path after calling fdisk_get_partition currently logs the 0-based part_num and omits the libfdisk error text; update the g_set_error call in the fdisk_get_partition failure branch to reference the human-readable part path (the variable used elsewhere as "part") instead of part_num and append the libfdisk error string (use strerror_l(-ret, c_locale) or strerror_l(-status, c_locale) consistent with other functions). Ensure you still call close_context(cxt) and return FALSE; but replace the message text to match the style of bd_part_set_part_name / bd_part_set_part_uuid by including disk, part and the strerror_l(...) detail.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/plugins/part.c`:
- Around line 2226-2233: The error path after calling fdisk_get_partition
currently logs the 0-based part_num and omits the libfdisk error text; update
the g_set_error call in the fdisk_get_partition failure branch to reference the
human-readable part path (the variable used elsewhere as "part") instead of
part_num and append the libfdisk error string (use strerror_l(-ret, c_locale) or
strerror_l(-status, c_locale) consistent with other functions). Ensure you still
call close_context(cxt) and return FALSE; but replace the message text to match
the style of bd_part_set_part_name / bd_part_set_part_uuid by including disk,
part and the strerror_l(...) detail.
Other "set" functions already has this check.
Summary by CodeRabbit