bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43282: tail -c +N / --bytes +N manpage wrong (off by 1)


From: Martin Taibr
Subject: bug#43282: tail -c +N / --bytes +N manpage wrong (off by 1)
Date: Tue, 08 Sep 2020 17:50:50 +0200 (CEST)

Currently the manpage says:





-c, --bytes=[+]NUM

              output the last NUM bytes; or use -c +NUM to output starting
with byte NUM of each file




Most (all?) hex editors number bytes from 0 so it's natural to assume tail -
c +0 will print the entire file, tail -c +1 will cut off the first byte and
so on. That's not the case, tail seems to "index" bytes from 1, not 0, so +0
and +1 both print the entire file.




I'd suggest

1) the manpage should mention counting starts from 1 (so you need to add 1
when copy pasting offsets from most other programs)


2) +0 should print a warning since its usage indicates the user likely
thinks tail counts from 0

3) -n / --lines docs should be changed to match (though counting lines from
1 is more common)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]