On /coreutils-8.12/src/ls.c, I’ve found this comment:
/* POSIX requires that a file size be printed without a sign, even
when negative. Assume the typical case where negative sizes are
actually positive values that have wrapped around. */
on line 2639.
My questions are:
– What is this typical case they refer to?
– Can file size be a negative number, other than in overflowing problems with BIG files and old systems?
– If yes, why?(and why should I care like they are doing in the comment above?)
I’m interested also in other systems, not only POSIX
It may well mean that file sizes in POSIX should be treated as unsigned integers, not signed. A file size of > 2GB if represented as a 32-bit integer would appear negative, though it obviously isn’t.