Package: findutils
Version: 4.7.0-1
Severity: normal
File: /usr/bin/find

find do have rather annoying behaviour of dealing with entry points:

$ find -xdev -- /usr
find: unknown predicate `--'
$ find -name x -- /usr
find: unknown predicate `--'
$ find -name x /usr
find: paths must precede expression: `/usr'
find: possible unquoted pattern after predicate `-name'?
$ find -xdev /usr
find: paths must precede expression: `/usr'
find: possible unquoted pattern after predicate `-xdev'?
$

That is unfortunate. And always messes me up. Almost all tools in UNIX that can
take multiple raw paths at the end of the argument list, and if needed be used
with --. Not only that, it makes it weird to use find in some reliable scripts.

$ cd /tmp/
/tmp$ mkdir -- --foo
/tmp$ find --foo -type f
find: unknown predicate `--foo'
/tmp$ find -- --foo -type f  # Obviously is not going to work.
find: unknown predicate `--foo'
/tmp$ find ./--foo -type f
/tmp$ find -type f -- --foo
find: unknown predicate `--'
/tmp$ 

The need to use ./ is just a bit silly:

/tmp$ find ./--foo -type f
/tmp$ # WORKS.

I know this is a wishlist, and could possibly break POSIX compatibility, but I
don't see how, and if needed this functionality could be simply enabled via
extra flag or environment variable. There is already POSIXLY_CORRECT which could
be used for this. But the fact, that one could introduce -- to deal with it,
would make it pretty safe.


Thanks.



-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-2-amd64 (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages findutils depends on:
ii  libc6        2.29-2
ii  libselinux1  2.9-2+b2

findutils recommends no packages.

Versions of packages findutils suggests:
pn  mlocate | locate  <none>

-- no debconf information

Reply via email to