Hi!
On Wed, 2021-12-29 at 22:32:55 +0100, Axel Beckert wrote:
> 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.
I think that was a deficiency in mawk regex support. It seems to be
working fine now. So I think the main part of this report is no longer
relevant, but…
> (And btw. the "!/^[^-]/" is redundant as "/^-…/" is
> equivalent.)
…I've fixed this part though locally, and will be included in the next
upload, closing this report.
Thanks,
Guillem