Skip to content

numfmt: --invalid=warn/ignore/fail ignores mode when rejecting scientific notation #11935

@sylvestre

Description

@sylvestre

Summary

Follow-on to #11655. Scientific-notation inputs are now correctly rejected in the default --invalid=abort mode, but the rejection path bypasses --invalid=warn/ignore/fail handling — uutils halts after the first invalid value and exits 2 regardless of the requested mode, while GNU prints the bad value, continues with the remaining inputs, and exits 0 for warn/ignore.

Regular invalid inputs (random garbage strings) behave correctly; only the scientific-notation rejection path is broken.

Found by fuzz_numfmt.

Reproduction

$ LC_ALL=C /usr/bin/numfmt --invalid=warn 100 1e5 200
100
numfmt: invalid suffix in input: '1e5'
1e5
200
(rc=0)

$ LC_ALL=C target/debug/numfmt --invalid=warn 100 1e5 200
100
numfmt: invalid suffix in input: '1e5'
(rc=2)

Same divergence for --invalid=ignore and --invalid=fail (for fail, both should exit 2 but GNU still prints all three numbers).

Sanity check — other invalid inputs handle --invalid=warn correctly:

$ numfmt --invalid=warn 100 garbage 200   # both print all three, rc=0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions