Bug 16045 - find -size <number-without-suffix> handling not POSIX compliant
Summary: find -size <number-without-suffix> handling not POSIX compliant
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.37.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-21 13:57 UTC by Stephane Chazelas
Modified: 2024-04-21 13:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Chazelas 2024-04-21 13:57:44 UTC
Per POSIX (https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/find.html)

find . -size n

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 busybox (and toybox, which shares the same non-conformance), it only reports files whose size is exactly 512.

There are similar problems for `find . -size +n` and `find . -size -n`.

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 GNU `find`).

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.