coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

seq allows unicode whitespace in number string

Open dlrobertson opened this issue 9 months ago • 1 comments

Expected result

$ seq "$(printf "\u2029 1")" 2
seq: invalid floating point argument: ‘\342\200\251 1’
Try 'seq --help' for more information.

Actual Result

$ cargo run seq "$(printf "\u2029 1")" 5
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/coreutils seq '
 1' 5`
1
2

Cause

seq has it's own number parsing implementation which makes use of trim_start here. This can be fixed by using the same number parsing as printf, or trim_ascii_start could be used instead of trim_start.

dlrobertson avatar Mar 20 '25 21:03 dlrobertson

Yeah, I'm slowly starting to hack away at seq: https://github.com/drinkcat/coreutils/commits/parse-bigdecimal-seq if you're curious...

But if you wanted to fix it in the current implementation, and add a test for it, it's still be useful I guess.

drinkcat avatar Mar 20 '25 22:03 drinkcat