[libvirt] [PATCH] virt-wireshark.m4: Defer $(prefix) substitution

Boris Fiuczynski fiuczy at linux.vnet.ibm.com
Wed Oct 26 06:46:12 UTC 2016


On 10/24/2016 10:52 AM, Daniel P. Berrange wrote:
> On Thu, Oct 20, 2016 at 03:54:13PM +0800, Michal Privoznik wrote:
>> The problem with evaluating $(prefix) in configure phase is that
>> autoconf does a lot of magic with this variable. Firstly, if the
>> --prefix argument is not set for the configure script, the
>> variable will have value "NONE". Wait, wat? Secondly, even
>> autoconf scripts then have special cases for when variable is
>> "NONE". It's even worse - whenever they need to construct new
>> path based on prefix, they save its current value, substitute it
>> with proper value (like /usr/local/), do what they need and then
>> restore the original value. Le sigh.
>> This mad behaviour is, however, suppressed if there's --prefix on
>> the configure command line.
>> Now, the problem is that we tried to construct path for wireshark
>> plugin in the m4 file. Based on the knowledge described above, we
>> shouldn't do it and just construct the full path in Makefile
>> later where prefix has proper value.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  m4/virt-wireshark.m4 | 2 +-
>>  tools/Makefile.am    | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/m4/virt-wireshark.m4 b/m4/virt-wireshark.m4
>> index f383e2b..e1e4a59 100644
>> --- a/m4/virt-wireshark.m4
>> +++ b/m4/virt-wireshark.m4
>> @@ -38,7 +38,7 @@ AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
>>          if test "x$ws_prefix" = "x" ; then
>>            ws_prefix="/usr";
>>          fi
>> -        plugindir="${prefix}${plugindir#$ws_prefix}"
>> +        plugindir="${plugindir#$ws_prefix}"
>>        fi
>>      elif test "x$with_ws_plugindir" = "xno" || test "x$with_ws_plugindir" = "xyes"; then
>>        AC_MSG_ERROR([ws-plugindir must be used only with valid path])
>> diff --git a/tools/Makefile.am b/tools/Makefile.am
>> index e7e42c3..08e1680 100644
>> --- a/tools/Makefile.am
>> +++ b/tools/Makefile.am
>> @@ -398,7 +398,7 @@ EXTRA_DIST += \
>>
>>  if WITH_WIRESHARK_DISSECTOR
>>
>> -ws_plugindir = $(plugindir)
>> +ws_plugindir = $(prefix)$(plugindir)
>>  ws_plugin_LTLIBRARIES = wireshark/src/libvirt.la
>>  wireshark_src_libvirt_la_CPPFLAGS = \
>>  	-I wireshark/src $(WIRESHARK_DISSECTOR_CFLAGS)
>
> It looks like this patch has broken the RPM build
>
> https://ci.centos.org/view/libvirt-project/job/libvirt-master-rpm/82/systems=libvirt-fedora-23/console
>
> Notice at the make install phase:
>
>  /usr/bin/mkdir -p '/home/jenkins/rpmbuild/BUILDROOT/libvirt-2.4.0-1.fc23.x86_64/usr/usr/lib64/wireshark/plugins/1.12.12'
>  /bin/sh ../libtool   --mode=install /usr/bin/install -c   wireshark/src/libvirt.la '/home/jenkins/rpmbuild/BUILDROOT/libvirt-2.4.0-1.fc23.x86_64/usr/usr/lib64/wireshark/plugins/1.12.12'
> libtool: install: /usr/bin/install -c wireshark/src/.libs/libvirt.so /home/jenkins/rpmbuild/BUILDROOT/libvirt-2.4.0-1.fc23.x86_64/usr/usr/lib64/wireshark/plugins/1.12.12/libvirt.so
> libtool: install: /usr/bin/install -c wireshark/src/.libs/libvirt.lai /home/jenkins/rpmbuild/BUILDROOT/libvirt-2.4.0-1.fc23.x86_64/usr/usr/lib64/wireshark/plugins/1.12.12/libvirt.la
> libtool: warning: remember to run 'libtool --finish /usr/usr/lib64/wireshark/plugins/1.12.12'
>
>
> It is getting "/usr/usr" in the path which is very wrong.
>
> Regards,
> Daniel
>

I can confirm that the rpm build is broken with wireshark versions < 2.
The package config of these versions do not provide plugindir and the 
code change in this patch is only working correctly when it is provided 
and otherwise ends up with the scenario Daniel outlined above.

I think that line
http://libvirt.org/git/?p=libvirt.git;a=blob;f=m4/virt-wireshark.m4;h=e1e4a598d627899791832455c8619af72a88f575;hb=HEAD#l35
needs fixing but I have no good idea how to make the adjustment 
compatible with the changes in the else branch.

-- 
Mit freundlichen Grüßen/Kind regards
    Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294




More information about the libvir-list mailing list