Comment 9 for bug 1489379

Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

I'm attaching a patch that solves the issue; verification steps below.
It disables -fexceptions when building multipath-udeb.

(I had in mind something more elegant, like only adding -fno-exceptions from debian/rules into DEB_CFLAGS_MAINT_APPEND as done w/ -static-libgcc, but that way it doesn't override the post-added -fexceptions in Makefile.inc).. and found no other variable that would override it w/ less changes. So it's adding a patch to Makefile.inc and it does the job.)

Some comments with more details/explanation of the issue were not mirrored yet; should be on their way.

Build verification:
------------------

Checking the build log, the 2 tur.o objects are built correctly:
1) multipath-udeb: with -static-libgcc and without -fexceptions
2) multipath deb: without -static-libgcc and with -fexceptions (default)

 $ dpkg-buildpackage 2>&1 | tee ../dpkg-buildpackage.log

 $ grep -- '-o tur.o' ../dpkg-buildpackage.log
 cc -g -O3 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -static-libgcc -D_FORTIFY_SOURCE=2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wunused -Wstrict-prototypes -fPIC -DLIB_STRING=\"lib\" -I.. -c -o tur.o tur.c
 cc -g -O3 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wunused -Wstrict-prototypes -fPIC -DLIB_STRING=\"lib\" -I.. -c -o tur.o tur.c

Checking the build output, the ELF objects (don't) dyn-link to libgcc_s as appropriate:
1) multipath-udeb: ELF objects don't dyn-link with libgcc_s
2) multipath deb: ELF objects dyn-link with libgcc_s

 $ find debian/tmp-multipath-udeb/ | while read file; do file $file | grep -q ELF && objdump -x $file | grep -q 'NEEDED.*libgcc_s' && echo $file needs libgcc_s; done
 $

 $ find debian/tmp/ | while read file; do file $file | grep -q ELF && objdump -x $file | grep -q 'NEEDED.*libgcc_s' && echo $file needs libgcc_s; done
 debian/tmp/lib/libmultipath.so.0 needs libgcc_s
 debian/tmp/lib/multipath/libchecktur.so needs libgcc_s
 debian/tmp/sbin/multipathd needs libgcc_s
 $

Installer verification:
-----------------------

Configure multipath.conf for using tur with QEMU/KVM SCSI disks:

 ~ # cat <<EOF >/etc/multipath.conf <<EOF
 defaults {
   user_friendly_names yes
   path_checker tur
 }
 blacklist_exceptions {
   property ID_SERIAL
 }
 EOF

Test (Not OK):

 ~ # multipath -v3
 ...
 <...> | A dynamic linking error occurred: (libgcc_s.so.1: cannot open shared object file: No such file or directory)
 ...
 <...> | A dynamic linking error occurred: (libgcc_s.so.1: cannot open shared object file: No such file or directory)
 uuid hcil dev dev_t pri dm_st chk_st vend/prod/rev dev_st
      0:0:1:0 sda 8:0 -1 undef faulty QEMU,QEMU HARDDISK running
      0:0:2:0 sdb 8:16 -1 undef faulty QEMU,QEMU HARDDISK running
 ...

Install the new udeb:

 ~ # udpkg -i multipath-udeb_0.5.0-7ubuntu3fexceptions1_ppc64el.udeb

Re-test (now OK):

 ~ # multipath -v3
 ...
 ===== paths list =====
 uuid hcil dev dev_t pri dm_st chk_st vend/prod/re
 0QEMU_QEMU_HARDDISK_helloworld 0:0:1:0 sda 8:0 1 undef ready QEMU,QEMU HA
 0QEMU_QEMU_HARDDISK_helloworld 0:0:2:0 sdb 8:16 1 undef ready QEMU,QEMU HA
 ...
 create: mpatha (0QEMU_QEMU_HARDDISK_helloworld) undef QEMU,QEMU HARDDISK
 size=128G features='0' hwhandler='0' wp=undef
 |-+- policy='round-robin 0' prio=1 status=undef
 | `- 0:0:1:0 sda 8:0 undef ready running
 `-+- policy='round-robin 0' prio=1 status=undef
   `- 0:0:2:0 sdb 8:16 undef ready running
 ...