Skip to content

redfishpower: fix const-correctness in calc_path() - #217

Merged
mergify[bot] merged 1 commit into
chaos:masterfrom
hector-cao:fix-const-ness-redfishpower
Jun 8, 2026
Merged

mergify[bot] merged 1 commit into
chaos:masterfrom
hector-cao:fix-const-ness-redfishpower

Conversation

@hector-cao

Copy link
Copy Markdown
Contributor

calc_path() receives lpath as const char * and only reads from the substring located with strstr().

On modern libc/toolchains, strstr() is const-preserving for const inputs. Assigning its result to char * therefore discards qualifiers and may fail with -Werror=discarded-qualifiers.

On latest Ubuntu release, powerman fails to build with following error:

redfishpower.c: In function ‘calc_path’:
redfishpower.c:199:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
199 | if ((ptr = strstr(lpath, "{{plug}}"))) {

@chu11 chu11 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me, thanks!

@chu11

chu11 commented Jun 1, 2026

Copy link
Copy Markdown
Member

i'll set MWP for you

@chu11

chu11 commented Jun 1, 2026

Copy link
Copy Markdown
Member

@Mergifyio rebase

@chu11
chu11 force-pushed the fix-const-ness-redfishpower branch from 5e953e6 to a3b68e4 Compare June 1, 2026 17:47
@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Deprecation notice: This pull request comes from a fork and was rebased using bot_account impersonation. This capability will be removed on July 1, 2026. After this date, the rebase action will no longer be able to rebase fork pull requests with this configuration. Please switch to the update action/command to ensure compatibility going forward.

@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

rebase

✅ Branch has been successfully rebased

@garlick

garlick commented Jun 8, 2026

Copy link
Copy Markdown
Member

@Mergifyio rebase

@mergify mergify Bot added the queued label Jun 8, 2026
@mergify

mergify Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-06-08 20:29 UTC · Rule: default
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-06-08 20:30 UTC · at 457f95a4be7bd5c3c819baa3ef95917dacb4ef0c · merge

This pull request spent 26 seconds in the queue, with no time running CI.

Required conditions to merge

calc_path() receives lpath as const char * and only reads from the
substring located with strstr().

On modern libc/toolchains, strstr() is const-preserving for const
inputs. Assigning its result to char * therefore discards qualifiers
and may fail with -Werror=discarded-qualifiers.
@mergify
mergify Bot force-pushed the fix-const-ness-redfishpower branch from a3b68e4 to 457f95a Compare June 8, 2026 20:30
@mergify

mergify Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

rebase

☑️ Nothing to do, the required conditions are not met

Details
  • queue-position = -1 [📌 rebase requirement]
  • any of:
    • #commits-behind > 0 [📌 rebase requirement]
    • -linear-history [📌 rebase requirement]
  • -closed [📌 rebase requirement]
  • -conflict [📌 rebase requirement]

@mergify
mergify Bot merged commit 113fda7 into chaos:master Jun 8, 2026
7 of 8 checks passed
@mergify mergify Bot removed the queued label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants