I still can reproduce this issue — at least on one machine. And I
can't reproduce it on another (and probably never could there). And I
now figured out what's the difference between those two machines:
As you might know, there are two awk implementations in Debian: mawk
and gawk. By default only mawk is installed (and is always there due
to "Priority: required") while gawk is optional (but IIRC default if installed).
On the system where "dlocate -lsbin" works, the symlinks look like this:
lrwxrwxrwx 1 root root 21 […] /usr/bin/awk -> /etc/alternatives/awk*
lrwxrwxrwx 1 root root 13 […] /etc/alternatives/awk -> /usr/bin/gawk*
On the system where "dlocate -lsbin" gives no output, the symlinks
look like this:
lrwxrwxrwx 1 root root 21 […] /usr/bin/awk -> /etc/alternatives/awk*
lrwxrwxrwx 1 root root 13 […] /etc/alternatives/awk -> /usr/bin/mawk*
Culprit is this call:
awk '!/^[^-]/ && /^-.{2,8}[xs]/ {print $2}'
mawk doesn't know about {x,y} quantifiers in regular expressions, and
since there is never a { at the second column in the output… Proof:
$ dlocate -L zsh | xargs -d '\n' -r stat -c '%A %n' | gawk '!/^[^-]/ && /^-.{2,8}[xs]/ {print $2}'
/bin/zsh
/bin/zsh5
/usr/share/bug/zsh
$ dlocate -L zsh | xargs -d '\n' -r stat -c '%A %n' | mawk '!/^[^-]/ && /^-.{2,8}[xs]/ {print $2}'
$
So "dlocate -lsbin" doesn't work with Debian's default awk
installation.
(And btw. the "!/^[^-]/" is redundant as "/^-…/" is
equivalent.)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 147:33:36 |
Calls: | 10,383 |
Calls today: | 8 |
Files: | 14,054 |
D/L today: |
2 files (1,861K bytes) |
Messages: | 6,417,731 |