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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 16, 2016 at 02:43:48PM +0100, Guido Günther wrote:
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

Oh yeah, so those with /bin (or /sbin) mentioned first will have a
problem.

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.
 …


That's what I was looking for and couldn't find.  Good to know I
remembered it correctly that it's 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


$PATH should be first, and I think we only need to append
':/sbin:/usr/sbin:/usr/local/sbin' for those binaries that might be
there when you're building as non-root (on distro where non-root users
don't have sbin directories in $PATH).  Everything else should omit the
last parameter and let default AC_PATH_PROG to $PATH IMHO.

So we could define our_SPATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" in
the configure and just use that or nothing in the whole configure.ac  So
that we don't run into similar problems as this (or 56022a293cea) again.


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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list


Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux