Bug 997880

Summary: RFE: Switch to use libusbx instead of libusb
Product: [Fedora] Fedora Reporter: Daniel BerrangĂ© <berrange>
Component: libgphoto2Assignee: Tim Waugh <twaugh>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: hdegoede, rhbugs, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libgphoto2-2.5.2-4.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-16 13:56:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Berrangé 2013-08-16 11:14:42 UTC
Description of problem:
I recently identified a flaw in libusb which was causing libgphoto to crash after dlclose() of the libusb.so library

  https://bugzilla.redhat.com/show_bug.cgi?id=996760

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):
libgphoto2-2.5.2-1.fc19

How reproducible:
N/a

Steps to Reproduce:
1. N/a
2.
3.

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 13:56:03 UTC
Thanks. Fixed in:
  libgphoto2-2.5.2-4.fc19
  libgphoto2-2.5.2-4.fc20