#816368 /usr/bin/whereis: 'whereis -b bash' reports /etc/bash.bashrc as a binary

Package:
util-linux
Source:
util-linux
Description:
miscellaneous system utilities
Submitter:
Andrew Lawrence DeMarsh
Date:
2024-11-16 14:18:01 UTC
Severity:
normal
Tags:
#816368#5
Date:
2016-03-01 09:09:41 UTC
From:
To:
Dear Maintainer,

Upon working with a script where the path to bash can not allway's be assumed
I decided to use whereis to locate the bash binary. Upon specifying the -b
flag I found that annoyingly wheris reported the main systems bashrc file
located at /etc/bash.bashrc . This is odd behaviour at least as the Filesystem
Hierarchy Specified by LSB practically disallows placing binaries in /etc .
Odder still is that there seems to be no mark or metadata surrounding the
bashrc file to mark it as a binary. I believe this is merely an oversight and
could be easily fixed as it seems to me the FreeBSD version of whereis should
not suffer from this same bug. My fix was to truncate the response after the
first response but that seems an easy way to cause problems down the line due
to possible implementation changes.

#816368#10
Date:
2016-03-01 09:42:24 UTC
From:
To:
Hello Andrew Lawrence DeMarsh.

Thanks for your bug report.

You can see /etc (among many others) being included in the list of
directories to search for binaries in
http://sources.debian.net/src/util-linux/2.27.1-3/misc-utils/whereis.c/#L96

Still /etc is full of binaries, not the least in /etc/init.d for example.

"binary" is only about limiting the search paths, not about the files
being binary. The file name matches the search string.

It seems to me your expectations are closer to those provided by
the 'which' utility. Maybe you should look into using that instead.

Either way, the reported issue is definitely not Debian-specific
and should be discussed on the upstream mailing list and handled
via the standard upstream development process. I'm thus marking
this with the tags for upstream as well as wontfix. The wontfix
means that in case someone comes up with a patch I'm not willing
to deviate from upstream behaviour by applying it only in Debian.
If changes happen upstream I'm ofcourse happy to incorporate them
in Debian (assuming they don't cause any major Debian-specific
regressions which I consider unlikely).

Regards,
Andreas Henriksson