-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find -size <number-without-suffix> not POSIX #499
Comments
There's a similar problem with the For instance |
Busybox having behaved this way 2007 and nobody noticed seem that strong an argument. Do you have a use case that broke because of this? 512 seems irrelevant (minimum block size of ext2 was 1024 back in the 1990s, even fat32 defaults to at least 4k these days). If we gave m units presumably it should round to the megabyte? |
Sharp edge here is that -size has any supplied units override the default (including c=bytes), but -time and -min don't (1kd days is 1000 days). |
Debian's find -size also implicitly selects -type f. |
Why would it do that?
|
It's quite well known busybox is not standard compliant and that one needs to adapt their script when porting to busybox. Common denominator for block device block size is still 512 bytes. But that's hardly relevant (and not the point of this question). Find's |
@stephane-chazelas while you have a point that there is deviation from the POSIX standard here, also the POSIX standard is imprecise, vague or outright lacking in many places, having been the playground of many corporate interests in the past decades. if you have an interesting solution to that problem, you can always submit a patch or pull request for review. |
Per POSIX
is meant to return the files whose size rounded up to an integer number of 512-byte units is 1.
For instance,
find . -size 1
is meant to report the files whose size ranges from 1 to 512 bytes (the ones that would typically occupy one sector of disk space in the olden days).But for toybox (and busybox, which shares the same non-conformance), it only reports files whose size is exactly 512.
There are similar problems for
find . -size +n
andfind . -size -n
.Like for the
test
utility (#498), there's also the separate problem thatfind . -size 010c
finds the files of size 8 instead of 10.Note the behaviour when using suffixes other than
c
is fine as out of the POSIX scope and is aligned with most other implementations that support those or some of those suffixes (except GNUfind
).See https://unix.stackexchange.com/questions/774817/what-are-the-file-size-options-for-find-size-command/774840#774840 for more of the gory details including comparison with other implementations.
The text was updated successfully, but these errors were encountered: