Bug 485627 - libmtp 0.3.6-1.fc10 = segmentation fault + crash of Gnomad2, Amarok, etc.
libmtp 0.3.6-1.fc10 = segmentation fault + crash of Gnomad2, Amarok, etc.
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: libmtp (Show other bugs)
10
i686 Linux
low Severity high
: ---
: ---
Assigned To: Linus Walleij
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-15 09:51 EST by nicofo
Modified: 2009-03-08 09:32 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-03-08 09:32:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
gdb traces with gnomad2 => Shows the Segmentation Fault (7.91 KB, text/plain)
2009-02-18 17:03 EST, nicofo
no flags Details

  None (edit)
Description nicofo 2009-02-15 09:51:53 EST
Description of problem:

Hi, 

the last libmtp package for Fedora10 (libmtp-0.3.6-1.fc10.i386) causes every program that uses it to crash:

Ex1: gnomad2:
$ gnomad2 
usb_claim_interface(): Device or resource busy
LIBMTP PANIC: Unable to initialize device     
PDE device NULL.                              
PDE device NULL.                              
PTP_ERROR_IO: Trying again after re-initializing USB interface
Queried T10                                                   
Segmentation fault  

Result: gnomad crashes and closes

Ex2: rhythmbox: "Segmentation fault" as well: crashes and closes

Ex3: amarok: crashes and closes

These example are given when an mtp device is connected. Otherwise, these programs work well


Additional info: I've tried to downgrade libmtp to the version of the Fedora repository (libmtp-0.3.3-4.fc10.i386) ==> now everything is working well.


Remark: perhaps is it related to the bug #478774

Conclusion:
libmtp-0.3.3-4.fc10.i386  => OK
libmtp-0.3.6-1.fc10.i386  => KO
Comment 1 nicofo 2009-02-15 09:53:31 EST
(In reply to comment #0)

> Remark: perhaps is it related to the bug #478774
Sorry, I meant bug #478474
Comment 2 Linus Walleij 2009-02-17 18:09:34 EST
Can you produce a GDB backtrace? Like

> gdb gnomad2
> run

.... crash ...

> bt

So we can see something about where it gave up?

I have libmtp 0.3.6 running on this machine (x86_64 tho)
and no problem in running any of the apps so cannot reproduce
the problem :-/

[linus@fecusia ~]$ gnomad2
Queried Creative Zen Micro
[linus@fecusia ~]$ 
[no crash]

I wonder if it only occurs on the iRiver T10 and possibly other
iRivers and what may be causing that...
Comment 3 nicofo 2009-02-18 17:03:22 EST
Created attachment 332462 [details]
gdb traces with gnomad2 => Shows the Segmentation Fault

Hello,

here is your "gdb" traces. (I'm not used to using gdb => if it's not complete or if you want more info, just ask me)

Add. info: my T10 is a Samsung YP-T10 (not an iRiver)
Comment 4 Linus Walleij 2009-02-18 17:41:56 EST
Excellent! I think I can see the bug anyway. YP-T10 supports
Ogg files, so the bug should be here in libmtp.c:

    if (track->filetype == LIBMTP_FILETYPE_UNKNOWN &&
	(FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) ||
	 FLAG_OGG_IS_UNKNOWN(ptp_usb))) {
      // Repair forgotten OGG filetype
      char *ptype;
      
      ptype = strrchr(track->filename,'.')+1;
      if (ptype != NULL && !strcasecmp (ptype, "ogg")) {
	// Fix it.
	track->filetype = LIBMTP_FILETYPE_OGG;
      } else {
	// This was not an OGG file so discard it and continue
	LIBMTP_destroy_track_t(track);
	continue;
      }
    }


That strrchr() is not enough here, especially if
track->filename is NULL.

I think the reason to why you see this error is that you
have unknown files on the device with NULL names, which
are investigated to see if they are OGG files and then it
crashes.

Fixed like this:

    if (track->filetype == LIBMTP_FILETYPE_UNKNOWN &&
	track->filename != NULL &&
	(FLAG_IRIVER_OGG_ALZHEIMER(ptp_usb) ||
	 FLAG_OGG_IS_UNKNOWN(ptp_usb))) {
      // Repair forgotten OGG filetype
      int namelen = strlen(track->filename);

      if (namelen < 4)) {
	// Must be atleast 4 characters to end with ".ogg"
	LIBMTP_destroy_track_t(track);
	continue;
      }
      if (!strcasecmp(track->filename+namelen-4, ".ogg")) {
	// Fix the filetype
	track->filetype = LIBMTP_FILETYPE_OGG;
      } else {
	// This was not an OGG file so discard it and continue
	LIBMTP_destroy_track_t(track);
	continue;
      }
    }

Fixed in libmtp upstream, just need to get a fix out to
Bodhi, hold on.
Comment 5 nicofo 2009-02-22 10:12:49 EST
OK, thank you for your rapid reaction ! I'll wait for the update and keep you up to date.


In fact, concerning the ogg files, is it norwal that I don't see them in my device (they aren't not listed using libmtp) though they are well present on the device ? :

=> I can transfer ogg files from my computer to my Samsung YP-T10 without any problem using for instance amarok or gnomad2 (the ogg are well transfered on the device - I can listen to them: OK)

=> BUT amarok or gnomad2, ... don't show them: they only list the mp3 files that are on the device, not the ogg.


(Should I open another bug for this ?)
Comment 6 nicofo 2009-03-08 09:32:33 EDT
Hello,

I have tried the last version of libmtp (compiled from cvs today): OK, it works: thanks !


(concerning the problem of the ogg files not seen by libmtp (see previous comment), I have opened the bug #489176)

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