[BUG] 'find' does not support '--'

Martijn Dekker martijn at inlv.org
Wed Dec 19 22:17:31 UTC 2018


Op 19-12-18 om 20:47 schreef Martijn Dekker:
> Op 19-12-18 om 20:24 schreef Eli Schwartz:
> [...]
>> The correct way to play this game is to never use -- with find. Its only
>> POSIX-defined purpose is to be silently ignored.
> 
> That's a perfectly fair point. Nevertheless, that purpose is defined by 
> POSIX so busybox should accept it, if only for the sake of consistency 
> and standards compliance.

Note also that the POSIX 'find' spec does not allow skipping the path 
operands, and non-GNU, non-Busybox 'find' implementations (such as BSD 
and Solaris 'find') adhere to that. At least one path is mandatory, even 
if it's just '.'.

That means the -- is only useless on GNU and Busybox 'find', which 
violate POSIX by allowing the first operand to be interpreted as a primary.

Maybe then it's better not to accept the -- as it raises false 
expectations of compatibility. But, as you point out, GNU 'find' does 
accept it, so accepting it would at least increase compatibility with 
GNU 'find'.

A real solution would be for both Busybox and GNU 'find' to follow the 
POSIX standard, at least if the POSIXLY_CORRECT environment variable is set.

- M.


More information about the busybox mailing list