You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
head, tail: an invalid count with a leading zero is reported without the leading zeros #14229
head and tail strip leading zeros from the count argument before parsing it, and the resulting error names the stripped string rather than the argument as typed.
$ tail -c0fb atail: invalid number of bytes: 'fb'
$ tail -c007z atail: invalid number of bytes: '7z'
GNU names the argument as given:
$ tail -c0fb atail: invalid number of bytes: '0fb'
$ tail -c007z atail: invalid number of bytes: '007z'
head behaves the same way. The stripping happens in parse_signed_num_max (src/uucore/src/lib/features/parser/parse_signed_num.rs), where trimmed is passed to the size parser and so ends up in the error, while the caller formats whatever string the error carries.
Noticed while working on #13136; it is independent of that issue, which is about which suffixes are accepted.
Activity
head, tail: keep leading zeros in an invalid count message
head, tail: keep leading zeros in an invalid count message