find does not handle -size parameter 1 correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
findutils (Debian) |
Confirmed
|
Unknown
|
|||
findutils (Ubuntu) |
Opinion
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: findutils
When I use find, to find file smaller dan 1024 bytes like this
$ find -size -1024c
the example result is:
./Briefcase/
./Briefcase/
./Briefcase.meta
However, when switching to the k multiplier I don't get any result until I use 2, instead of 1:
$ find -size -1k
$ find -size -2k
./Briefcase/
./Briefcase/
./Briefcase.meta
The same is true for M and G; It seems there's a bug in handling 1's in the -size parameter.
ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: findutils 4.4.2-1ubuntu1
Uname: Linux 2.6.35 x86_64
Architecture: amd64
Date: Wed Oct 13 10:44:57 2010
ProcEnviron:
LANGUAGE=
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: findutils
Changed in findutils (Debian): | |
status: | Unknown → Confirmed |
This is not a bug.
Quoting the documentation:
------------------
-size n[bckwMG]
True if the file uses N units of space, rounding up.
[...]
The number can be prefixed with a `+' or a `-'. A plus sign
indicates that the test should succeed if the file uses at least N
units of storage (a common use of this test) and a minus sign
indicates that the test should succeed if the file uses less than
N units of storage.
------------------
Therefore -size -1k matches all empty files. Any nonempty files uses at least 1KB ("units of space,") if you you round up.