Skip to content

printf: preserve failure status after character constant warning - #15033

Open
SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:printf-char-constant-status
Open

SichenLiang wants to merge 1 commit into
uutils:mainfrom
SichenLiang:printf-char-constant-status

Conversation

@SichenLiang

Copy link
Copy Markdown
Contributor

An invalid numeric argument sets the exit status to 1. A later quoted character constant with ignored trailing characters was resetting it to 0, so this command succeeded where GNU coreutils 9.12 fails:

LC_ALL=C printf '%d\n' bad "'ab"

Set the failure status only in the three numeric-error branches. The character-constant warning now leaves the current status unchanged. A warning by itself still exits 0, and POSIXLY_CORRECT still suppresses the warning without clearing an earlier failure.

The new test covers both the normal and POSIXLY_CORRECT cases.

Closes #15032

Set failure status for numeric parse errors, while leaving the current
status untouched when a quoted character constant has ignored trailing
characters. A warning alone still exits successfully; a prior numeric
error remains a failure. POSIXLY_CORRECT suppresses the warning without
clearing that earlier failure.
@codspeed

codspeed Bot commented Oct 2, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.28%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
✅ 390 untouched benchmarks
⏩ 54 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Simulation three_39_bit_primes 684.4 ms 536.1 ms +27.66%
⚡ Simulation five_38_bit_primes 1.7 s 1.6 s +11.03%
⚡ Simulation thirteen_39_bit_primes 9.3 s 8.8 s +5.31%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing SichenLiang:printf-char-constant-status (019d35d) with main (5b2e6e0)

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

printf: a character-constant warning clears an earlier failure status

1 participant