Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 566868

Summary: sys-power/nut: libusb-0.1.so is loaded directly instead of libusb-0.1.so.4 (and libusb-compat does not provide libusb-0.1.{la,so})
Product: Gentoo Linux Reporter: Weedy <weedy2887>
Component: Current packagesAssignee: Robin Johnson <robbat2>
Status: UNCONFIRMED ---    
Severity: normal CC: base-system, ostroffjh, peter, prometheanfire, proxy-maint, robbat2
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Weedy 2015-11-26 01:13:27 UTC
This breaks sys-power/nut

# strace nut-scanner
...
...
open("/lib", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
getdents(3, /* 172 entries */, 32768)   = 6488
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/lib/libusb-0.1.la", O_RDONLY)    = -1 ENOENT (No such file or directory)
futex(0x7f8741fb4048, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/lib/libusb-0.1.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "Cannot load USB library (libusb-"..., 76Cannot load USB library (libusb-0.1) : file not found. USB search disabled.
) = 76
open("/usr/lib", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=135168, ...}) = 0
getdents(3, /* 811 entries */, 32768)   = 32768
getdents(3, /* 816 entries */, 32768)   = 32752
getdents(3, /* 808 entries */, 32768)   = 32728
getdents(3, /* 651 entries */, 32768)   = 26608
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/usr/lib32/opengl/nvidia/lib", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(3, /* 14 entries */, 32768)    = 496
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/usr/lib64/opengl/nvidia/lib", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
getdents(3, /* 14 entries */, 32768)    = 496
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/lib64", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
getdents(3, /* 172 entries */, 32768)   = 6488
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0
open("/lib64/libusb-0.1.la", O_RDONLY)  = -1 ENOENT (No such file or directory)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x38} ---
+++ killed by SIGSEGV +++
Segmentation fault


# ln -s libusb-0.1.so.4 /lib/libusb-0.1.so
# nut-scanner 
Scanning USB bus.
Scanning XML/HTTP bus.

All fixed.

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2015-12-13 02:51:45 UTC
the reason it's breaking is that nut uses libltdl to load "libusb-0.1", and ltdl will search for the linker script (.la) file in order to find out the full name.  since we trim it in libusb-compat, libltdl has to fall back to the .so, but that is also removed.

simpler answer would be to fix nut by either:
(1) use the USB api directly rather than trying to dlopen it
(2) use dlopen (not libltdl) on libusb-0.1.so.4 instead of libusb-0.1.so

loading the canonical link time "libusb-0.1.so" provides no ABI guarantees