On a Tuesday in 2025, Daniel P. Berrangé via Devel wrote:
Over the years we've made various changes to stop hardcoding paths
at
build time, but the work is incomplete.
This bit us significantly in Fedora 42 where they have merged the 'sbin'
and 'bin' dirs together. In the build environment we have a clean
install where '/sbin' and '/usr/sbin' are simply symlinks to
'/usr/bin'.
Our meson.build logic preferentially looks in '/sbin' and '/usr/sbin'
to find programs, and thus it finds *all* binaries in '/sbin' and then
hardcodes this path. This happens even for binaries that have always
been in '/usr/bin' and NEVER '/sbin' or '/usr/sbin'
On fresh Fedora installs this is fine as the symlinks match the build
environment.
On upgraded Fedora installs, however, '/sbin' and '/usr/sbin' remain
separate directories and inside they symlink individual binaries,
if-and-only-if the binary was in '/sbin' in Fedora 41.
Thus many of the binaries we found in /sbin don't actually exist and
libvirt thus breaks.
There is really no reason why we should be harcoding any paths at
build time. virCommand happily uses virFindFileInPath for any paths
which are not already absolute. $PATH includes '/sbin' and '/usr/sbin'
when we're running privileged, and when unprivileged we shouldn't need
to run binaries from there.
Does anyone happen to remember the original reason?
The only thing I can think of is saving the lookup time, but that has to
be negligible compared to the cost of fork and the command actually
doing something
Jano