[libvirt] [PATCH] configure: Prefer /usr/bin over /bin for numad

Guido Günther agx at sigxcpu.org
Wed Nov 16 13:43:48 UTC 2016


On Wed, Nov 16, 2016 at 02:28:19PM +0100, Martin Kletzander wrote:
> On Tue, Nov 15, 2016 at 02:29:21PM +0100, Guido Günther wrote:
> > On Debian systems numad gets installed to /usr/bin. However some people
> > use usrmerge[0] which links /bin to /usr/bin. By changing the lookup
> > order we make sure the daemon is always found in /usr/bin (with or
> > without usrmerge installed).
> > 
> > This allows packages built on systems with usrmerge to run on systems
> > without usrmerge  which would otherwise fail since /bin/numad would be
> > hardcoded into libvirt.
> > 
> > Originally-Submitted-By: Guilhem Moulin
> > References: http://bugs.debian.org/843878
> > [0]: https://packages.debian.org/sid/usrmerge
> > ---
> > configure.ac | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 3ff4c42..65bcd4d 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1392,7 +1392,7 @@ AC_ARG_WITH([numad],
> > if test "$with_numad" != "no" ; then
> >   fail=0
> > 
> > -  AC_PATH_PROG([NUMAD], [numad], [], [/bin:/usr/bin:/usr/sbin])
> > +  AC_PATH_PROG([NUMAD], [numad], [], [/usr/bin:/bin:/usr/sbin])
> > 
> 
> Won't the same problem be there with iptables (the first one I saw in
> configure.ac) and maybe others?

AC_PATH_PROG looks like

  AC_PATH_PROG (variable, prog-to-check-for, [value-if-not-found], [path])

and iptables has

  AC_PATH_PROG([IPTABLES_PATH], [iptables], /sbin/iptables, [/usr/sbin:$PATH])

so the /sbin for iptables is used if it's not found. Since the lookup
starts at /usr/sbin everything is fine here. But this block will fail entierely:

  dnl External programs that we can use if they are available.
  dnl We will hard-code paths to these programs unless we cannot
  dnl detect them, in which case we'll search for the program
  dnl along the $PATH at runtime and fail if it's not there.
  …

since all the item below that have /sbin first. I missed that in my
initial grep since it's wrapped on several lines.

Looking further I found several tools that have $PATH first on the list
like

    AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])

while others have it at the end (like iptables above). I think adding
$PATH first is preferable since distros (and users) can set that
properly and it would solve the numad case too. This would also solve
the numad case. I'll send a patch that does just that.
Cheers,
 -- Guido

> 
> Also, this should also include $PATH, similarly to *all other* places in
> the code =D  It was removed by mistake 11 days after its introduction
> 4,5 years ago =)
> 
> >   if test "$with_numad" = "check"; then
> >     test "$with_numactl" = "yes" || fail=1
> > --
> > 2.10.2
> > 
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list





More information about the libvir-list mailing list