Re: [Patch] gutenprint53+usb crashes with libusb-1.0.25

Zdenek Dohnal <[email protected]>
Newsgroups gmane.linux.printing.gimp-print.devel
Message-ID <[email protected]>
On 2/23/22 10:25, Benjamin Berg wrote:
> Hi,
>
> On Wed, 2022-02-23 at 09:34 +0100, Zdenek Dohnal wrote:
>> thank you for looking into the issue!
>>
>> On 2/22/22 19:00, Solomon Peachy wrote:
>>> On Tue, Feb 22, 2022 at 07:55:18AM +0100, Zdenek Dohnal wrote:
>>>> there were changes in libusb 1.0.25 which is in Fedora 36 - f.e. default USB
>>>> context is not initialized unless you specifically pass NULL into
>>>> `libusb_init()` - gutenprint53+usb backend actually depended on this hidden
>>>> behavior, because it passes its own context address into `libusb_init()`
>>>> instead of NULL. So the change causes the backend to crash if you run it:
>>> Yikes!
>>>
>>>> According libusb maintainer, Ben Berg, the backend can work with the default
>>>> USB context and he prepared the patch for it (the file is attached). I was
>>>> able to verify the patch fixes the crash, but I don't have a device
>>>> supported by gutenprint itself, so I couldn't do an additional sanity
>>>> testing. The patch looks good to me though.
>>> Will this work for multi-threaded stuff where there could conceivably be
>>> multiple contexts in use?  That's not being exercised in the current
>>> gutenprint code but some of the stuff I have cooking will change that.
>> Ben, would you mind looking into it? IMO we probably cannot use a
>> default USB context for multi-threading...
>>
>> In such case, IMO we can init the default context just for the
>> print_help() scope and close it after we're done with it.
>>
>> You can join us in discussion on the bug if you are able as well [1],
>> I've pinged Robert there as well, because I didn't know your email for
>> bugzilla...
> I am already subscribed to that bug. :)
I'm sorry for mystification... (that's what I got for adding text into 
email at last minute and don't read it as whole at the end) - I meant 
Solomon in the last paragraph :)
>
-- 
Zdenek Dohnal
Software Engineer
Red Hat, BRQ-TPBC
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.