regression in meson build, AC_PATH_PROG lost
Martin Kletzander
mkletzan at redhat.com
Thu Nov 19 22:38:28 UTC 2020
On Thu, Nov 19, 2020 at 10:31:00PM +0100, Olaf Hering wrote:
>Am Thu, 19 Nov 2020 22:15:27 +0100
>schrieb Martin Kletzander <mkletzan at redhat.com>:
>
>> Libvirt needs to be able to handle that missing binary at runtime anyway
>
>It also needs to handle an existing binary. Just how is it supposed to handle it?
>
Um... run it?
>Right now with meson it is either a full path, or just the name in case it was missing at build time (I have not checked if the launcher actually consults $PATH).
>
Right now, IMHO, all meson checks for binaries that are not needed at build time
should be removed. During runtime we can just use the name of the binary. I
don't know whether it used to be the case that it was thought that there might
be security issues with supplying different binary in a directory in $PATH, but
frankly, if you have (different-)user-writable directory in $PATH or non-root
access to modifying system-wide $PATH then you have bigger problems to deal
with. Even though I do not have anything to back this claim I think that
might've been the original reason.
>Anyway, what would be the desired approach to tell libvirt the runtime path?
>
Find it at runtime with virFindFileInPath() just like we already do with a few
binaries (and did for some since 2009 or so) or even without it as virCommand()
already searches $PATH since:
commit e0d014f2379ddde175c0c3126273911221c3e645
Author: Daniel P. Berrangé <berrange at redhat.com>
Date: Tue Mar 15 16:58:28 2011 +0000
Ensure binary is resolved wrt $PATH in virExec
>I was thinking about something like:
> option('runtime_path_exe', type: 'string', value: 'exe', description: 'runtime path of exe')
> runtime_path_exe = get_option('runtime_path_exe')
> if not get_option('runtime_path_exe').enabled()
> runtime_path_exe = find_program(runtime_path_exe, required: true).path()
> conf.set_quoted('EXE', runtime_path_exe)
>
>Olaf
Just for the sake of completeness here are some examples on how to do it:
commit 274f09cbc5ed8be00127380327d9525b852a2d1d
Author: Stefan Berger <stefanb at us.ibm.com>
Date: Wed Apr 14 06:29:55 2010 -0400
nwfilter: use virFindFileInPath for needed CLI tools
commit 2e045a4f9bf2757199c0997b9842d8dd8510459f
Author: Daniel P. Berrangé <berrange at redhat.com>
Date: Thu Jan 19 10:27:11 2017 +0000
storage: avoid use of undefined GLUSTER_CLI variable
Martin
P.S.: It is not *strictly* necessary that the commit hash starts with '2' ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201119/aa1c006c/attachment-0001.sig>
More information about the libvir-list
mailing list