Bug 997880 - RFE: Switch to use libusbx instead of libusb
RFE: Switch to use libusbx instead of libusb
Product: Fedora
Classification: Fedora
Component: libgphoto2 (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tim Waugh
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-08-16 07:14 EDT by Daniel Berrange
Modified: 2013-08-16 09:56 EDT (History)
3 users (show)

See Also:
Fixed In Version: libgphoto2-2.5.2-4.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-08-16 09:56:03 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2013-08-16 07:14:42 EDT
Description of problem:
I recently identified a flaw in libusb which was causing libgphoto to crash after dlclose() of the libusb.so library


While a workaround has been done in libusb to prevent the crash, this isn't an ideal solution. It would be better if libgphoto2 just used  libusbx instead, which has new APIs which allow it to avoid the problem scenario entirely.

It appears that libgphoto2 already has support for libusb1 / libusbx - all that is required is to update the BuildRequires in the specfile.

diff --git a/libgphoto2.spec b/libgphoto2.spec
index 241d49d..0d8109b 100644
--- a/libgphoto2.spec
+++ b/libgphoto2.spec
@@ -13,7 +13,7 @@ Patch1:         gphoto2-pkgcfg.patch
 Patch2:         gphoto2-storage.patch
 Patch3:         gphoto2-ixany.patch
 Patch4:         gphoto2-device-return.patch
-BuildRequires:  libusb1-devel, libusb-devel >= 0.1.5
+BuildRequires:  libusbx-devel
 BuildRequires:  lockdev-devel
 BuildRequires:  libexif-devel
 BuildRequires:  libjpeg-devel
@@ -35,7 +35,6 @@ however, such as gtkam for example.
 Summary:        Headers and links to compile against the libgphoto2 library
 Group:          Development/Libraries
 Requires:       %{name}%{?_isa} = %{version}-%{release}
-Requires:       libusb-devel >= 0.1.5, libexif-devel
 Obsoletes:      gphoto2-devel < 2.4.0-11
 Provides:       gphoto2-devel = %{version}-%{release}

Note the 'Requires' in the devel RPM here is not required. The header files in the libgphoto-devel RPM don't #include any libusb or libexif header files

$ rpm -ql libgphoto2-devel | grep include | xargs grep '#include' | grep -v '<gphoto2'
grep: /usr/include/gphoto2: Is a directory
/usr/include/gphoto2/gphoto2-context.h:#include <stdarg.h>
/usr/include/gphoto2/gphoto2-file.h:#include <time.h>
/usr/include/gphoto2/gphoto2-file.h:#include <stdint.h>
/usr/include/gphoto2/gphoto2-filesys.h:#include <time.h>
/usr/include/gphoto2/gphoto2-filesys.h:#include <stdint.h>
/usr/include/gphoto2/gphoto2-port-log.h:#include <stdarg.h>
/usr/include/gphoto2/gphoto2-port.h:#include <os2.h>

so I suggest dropping that Requires line from the devel package.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. N/a

Actual results:
/usr/lib/libgphoto2_port/0.10.0/usb.so  exists and dep on libusb RPM

Expected results:
Only /usr/lib/libgphoto2_port/0.10.0/usb1.so exists and no dep on libusb RPM

Additional info:
Comment 1 Tim Waugh 2013-08-16 09:56:03 EDT
Thanks. Fixed in:

Note You need to log in before you can comment on or make changes to this bug.