gnucompability(tail): -c accepts some large units that gnu rejects
Hi, uutils mainteners
we confirmed that the uu tail -c accepted, some large units, without errors
relunsec@relunsec:~/software/coreutils/target/debug$ ./tail -c2z a
hello
relunsec@relunsec:~/software/coreutils/target/debug$ gnutail -c2z a
gnutail: invalid number of bytes: ‘2z’
relunsec@relunsec:~/software/coreutils/target/debug$ ./tail -c2e a
hello
relunsec@relunsec:~/software/coreutils/target/debug$ gnutail -c2e a
gnutail: invalid number of bytes: ‘2e’
relunsec@relunsec:~/software/coreutils/target/debug$ ./tail -c2g a
hello
relunsec@relunsec:~/software/coreutils/target/debug$ gnutail -c2g a
gnutail: invalid number of bytes: ‘2g’
relunsec@relunsec:~/software/coreutils/target/debug$
relunsec@relunsec:~/software/coreutils/target/debug$ ./tail -c2t a
hello
relunsec@relunsec:~/software/coreutils/target/debug$ gnutail -c2t a
gnutail: invalid number of bytes: ‘2t’
relunsec@relunsec:~/software/coreutils/target/debug$
We should not ivergent interface, but I think we can accept them as extension.
yes make that a cargo feature, i think
By defautl, not as optional feature.
ok
Should we modify the path resolution public library?
I'd like to work on this.
tail and head both parse their count argument through the same parse_signed_num_max helper, which uses the generic size parser with no allow list, so they accept every suffix that parser knows. I compared against GNU coreutils 9.11 by running the binaries and the accepted set for both utilities is the same: bare b, plus k m K M G T P E Z Y R Q each also valid with a B, iB or D suffix. Lowercase g t e z y r q p and a bare B/D are rejected, and b is bare-only.
I'll restrict the shared helper to that set and add tests for both utilities.