Bug 311726 - TagLib crashes in TagLib::String::toCString when reading WavPack files with APE tags
Summary: TagLib crashes in TagLib::String::toCString when reading WavPack files with A...
Status: CONFIRMED
Alias: None
Product: taglib
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 1.8
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
: 313037 319941 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-12-15 10:47 UTC by enaut
Modified: 2021-03-09 10:19 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
two stacktraces + reports generated by abrt the Fedora reporting tool (860.00 KB, application/x-7z-compressed)
2012-12-15 11:21 UTC, enaut
Details
Output of amarok --debug --nofork 2>output.txt | xz (16.78 KB, application/x-xz)
2012-12-15 12:51 UTC, enaut
Details
amarokcollectionscanner-crashing.txt (48.81 KB, text/plain)
2012-12-15 14:51 UTC, Matěj Laitl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description enaut 2012-12-15 10:47:55 UTC
I'm trying to get my music into Amarok with Fedora 18 (I know its not released yet - but I'm testing)... Somehow I can't get amarok to add my music to the collection. The music plays just fine when I add it to a playlist using filesystemaccess but when I select the directory where the files are mounted as a collection source nothing happens... (it takes some while til the scan is over but not one single file is added to the collection).
The collection works fine if it is on the home directory (I copied a few Files to $HOME/Music which is a collection path too) but on my btrfs partition it does not work.

Reproducible: Always

Steps to Reproduce:
1. select the directory in the settingsdialog
2. hit full rescan
3. wait ~30 sec (which seems not enough for a month of music)
4. watch what is in the collection
Actual Results:  
Only the files copied to $HOME/Music are in the collection but not the ones on my "Music-partition"

Expected Results:  
Have all the Music in the collection

Amarok is not used within KDE but within Gnome 3.6.2

I tried different mounting options:
 * mounting with the nautilus GUI (I think its some kind of FUSER mount to /run/media/username/Music
 * mounting with fstab: LABEL="Musik" /media/Musik btrfs defaults,user 1 1

nothing seems to change.

I also tried different Versions of Amarok:
 * Amarok of the fedora repositories
 * Amarok compiled from source:  simply did git clone git://anongit.kde.org/amarok.git

nothing seems to change here either.

I would be greatfull for any hints on how to continue debugging this.
Comment 1 Matěj Laitl 2012-12-15 11:08:26 UTC
Hi enaut,
surely I'll provide hints, quite many! :-)

-2) I think best is to mount btrfs normally though fstab
-1) Please check that you have Amarok 2.7 Beta or later, use `git describe`
0) Attach full output of `solid-hardware list details`

1) Start Amarok as `amarok --debug --nofork 2>output.txt`
2) Perform Full Collection rescan (from the Config dialog)
3) Quit Amarok cleanly
4) Compress the output using `xz output.txt` and attach resulting output.txt.xz

5) Turn off dynamic collection feature [1]
6) Repeat steps 1-4, tell us whether tracks show up then, attach as output-dynamic-off.txt.xz

[1] http://amarok.community.kde.org/Dynamic_Collection#Disabling_Dynamic_Collection

Thanks!
Comment 2 enaut 2012-12-15 11:21:36 UTC
Created attachment 75843 [details]
two stacktraces + reports generated by abrt the Fedora reporting tool

With my selfcompiled version of Amarok the automagic generation fails with an error so I do not really know if everything is complete but I think the stacktraces looked ok. Furthermore there are a lot of files describing my system in detail so I hope those help too.

Sorry for 7z format but tar.gz was too big
Comment 3 Matěj Laitl 2012-12-15 11:47:25 UTC
(In reply to comment #2)
> Created attachment 75843 [details]
> two stacktraces + reports generated by abrt the Fedora reporting tool

Oh, so your amarokcollectionscanner crashed!

> With my selfcompiled version of Amarok the automagic generation fails with
> an error so I do not really know if everything is complete but I think the
> stacktraces looked ok. Furthermore there are a lot of files describing my
> system in detail so I hope those help too.

I was able to gather some information from it, but please don't attach abrt reports in future, these are not human-readable.

> Sorry for 7z format but tar.gz was too big

That's why I instructed you to use xz. Do you read my comments carefully?

Now please (follow these exactly, plaese don't invent your own interpretation any more):
1) Install debugging symbols of the taglib, qt-core, qt-gui, and kdelibs packages. Uninstall distro Amarok package and then install Amarok from source with CMAKE_BUILD_TYPE set to Debug. (You can use `ccmake .` to set it before compiling)
2) Go through steps -2) to 4) of comment 1. Exactly. Please.
3) run amarokcollectionscanner manually from command line through gdb:
   `gdb --ex run --args amarokcollectionscanner -r /path/to/your/Music-partition`
   # wait for it to crash, then paste (not attach) full output of:
   (gdb) set height 0
   (gdb) thread apply all bt
Comment 4 enaut 2012-12-15 12:51:10 UTC
Created attachment 75846 [details]
Output of amarok --debug --nofork 2>output.txt | xz

Hi again... Sorry about the last file I uploaded it was only after I uploaded it that I saw your comment.

going through your instructions:
The partition is mounted using fstab.
I installed the debugging symbols (sudo debuginfo-install taglib qt-core qt-gui kdelibs) aswell as some aditional debuginfos.
and uninstalled amarok using: sudo yum remove amarok-libs amarok-utils amarok amarok-doc

my amarok version is most recent git:
$ git describe
v2.6.90-2-gc7c688c

I configure with: cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debug
and build with: make -j9 (for faster compiling)
and install with: sudo make install

Now execute the commands from comment 1 (With Dynamic on):
$ amarok --debug --nofork 2> output2.txt
--> see attached file... note however that there are still a lot of backtraces print on the commandline that do not occur in the file.

If you still need the one without Dynamic collection I'll post that too...

Now for the GDB part:

I run: gdb --ex run --args amarokcollectionscanner -r /media/Musik/Sortiert

The first run displays a lot of xml formatted tags... so actually it seems to work and just choke on some files... in the end it says

Program received signal SIGSEGV, Segmentation fault.
TagLib::String::String (this=0x7fffffffd140, s=...) at /usr/src/debug/taglib-1.8/taglib/toolkit/tstring.cpp:86
86	  d->ref();
Missing separate debuginfos, use: debuginfo-install dbus-libs-1.6.8-2.fc18.x86_64 glib2-2.34.2-1.fc18.x86_64 keyutils-libs-1.5.5-3.fc18.x86_64 libicu-49.1.1-5.fc18.x86_64 libselinux-2.1.12-7.fc18.x86_64 openssl-libs-1.0.1c-7.fc18.x86_64 taglib-extras-1.0.1-4.fc18.x86_64

So I seem to have missed some Debuginfos... I installed them with the command suggested and restarted from now for the GDB part:
Here is the output of the gdb commands:

(gdb) set height 0
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fcd800 (LWP 30407)):
#0  0x00000030d6c35ba5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:63
#1  0x00000030d6c37358 in __GI_abort () at abort.c:90
#2  0x00000030d6c7559b in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x30d6d79b88 "*** glibc detected *** %s: %s: 0x%s ***\n") at ../sysdeps/unix/sysv/linux/libc_fatal.c:197
#3  0x00000030d6c7ca8e in malloc_printerr (ptr=0x6b8170, str=0x30d6d779f9 "free(): invalid size", action=3) at malloc.c:4969
#4  _int_free (av=0x30d6fb1740 <main_arena>, p=0x6b8160, have_lock=0) at malloc.c:3826
#5  0x00000030f7275a5d in TagLib::String::toCString (this=0x7fffffffd130, unicode=true) at /usr/src/debug/taglib-1.8/taglib/toolkit/tstring.cpp:259
#6  0x0000000000433b05 in Meta::Tag::TStringToQString (str=...) at /home/enaut/Source/amarok/shared/tag_helpers/StringHelper.cpp:45
#7  0x000000000042b5e5 in Meta::Tag::APETagHelper::tags (this=0x69aa60) at /home/enaut/Source/amarok/shared/tag_helpers/APETagHelper.cpp:55
#8  0x0000000000419de8 in Meta::Tag::readTags (path=...) at /home/enaut/Source/amarok/shared/MetaTagLib.cpp:251
#9  0x0000000000423544 in CollectionScanner::Track::Track (this=0x6854a0, path=..., directory=<optimized out>) at /home/enaut/Source/amarok/shared/collectionscanner/Track.cpp:77
#10 0x000000000041ebbf in CollectionScanner::Directory::Directory (this=0x7fffffffdb80, path=..., state=0x7fffffffe0d0, skip=<optimized out>)
    at /home/enaut/Source/amarok/shared/collectionscanner/Directory.cpp:115
#11 0x0000000000415b12 in CollectionScanner::Scanner::doJob (this=0x7fffffffe090) at /home/enaut/Source/amarok/utilities/collectionscanner/CollectionScanner.cpp:212
#12 0x00000030e218c39e in QObject::event (this=0x7fffffffe090, e=<optimized out>) at kernel/qobject.cpp:1194
#13 0x00000030e2177a8e in QCoreApplication::notifyInternal (this=0x7fffffffe090, receiver=receiver@entry=0x7fffffffe090, event=event@entry=0x675460) at kernel/qcoreapplication.cpp:946
#14 0x00000030e217b541 in sendEvent (event=0x675460, receiver=0x7fffffffe090) at kernel/qcoreapplication.h:231
#15 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x64e210) at kernel/qcoreapplication.cpp:1570
#16 0x00000030e21a5f43 in sendPostedEvents () at kernel/qcoreapplication.h:236
#17 postEventSourceDispatch (s=s@entry=0x65ea20) at kernel/qeventdispatcher_glib.cpp:279
#18 0x00000030d6847a75 in g_main_dispatch (context=0x65d900) at gmain.c:2715
#19 g_main_context_dispatch (context=context@entry=0x65d900) at gmain.c:3219
#20 0x00000030d6847da8 in g_main_context_iterate (context=context@entry=0x65d900, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3290
#21 0x00000030d6847e64 in g_main_context_iteration (context=0x65d900, may_block=1) at gmain.c:3351
#22 0x00000030e21a60d6 in QEventDispatcherGlib::processEvents (this=0x64faf0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#23 0x00000030e21767df in QEventLoop::processEvents (this=this@entry=0x7fffffffe050, flags=...) at kernel/qeventloop.cpp:149
#24 0x00000030e2176a68 in QEventLoop::exec (this=0x7fffffffe050, flags=...) at kernel/qeventloop.cpp:204
#25 0x00000030e217b858 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#26 0x0000000000414740 in main (argc=3, argv=<optimized out>) at /home/enaut/Source/amarok/utilities/collectionscanner/CollectionScanner.cpp:71
(gdb) 

I hope that I have everything covered... now I guess from the results of the backtrace this is rather a taglib bug?
Comment 5 Matěj Laitl 2012-12-15 14:11:57 UTC
(In reply to comment #4)
> Hi again... Sorry about the last file I uploaded it was only after I
> uploaded it that I saw your comment.

Ah, that explains it, sorry for me being a bit impolite.

> going through your instructions:
> The partition is mounted using fstab.
> I installed the debugging symbols (sudo debuginfo-install taglib qt-core
> qt-gui kdelibs) aswell as some aditional debuginfos.
> and uninstalled amarok using: sudo yum remove amarok-libs amarok-utils
> amarok amarok-doc
> 
> my amarok version is most recent git:
> $ git describe
> v2.6.90-2-gc7c688c
> 
> I configure with: cmake .. -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`
> -DCMAKE_BUILD_TYPE=debug
> and build with: make -j9 (for faster compiling)
> and install with: sudo make install
> 
> Now execute the commands from comment 1 (With Dynamic on):
> $ amarok --debug --nofork 2> output2.txt
> --> see attached file... note however that there are still a lot of
> backtraces print on the commandline that do not occur in the file.

Thanks for that the precise info, if only every reporter would be this accurate... My command was not perfect (`amarok --debug --nofork 2> output2.txt 2>&1` would redirect everything), but no need to repost, we know the problem now.I

> If you still need the one without Dynamic collection I'll post that too...

No need, thanks, the culprit is amarokcollectionscanner crashing.

> Now for the GDB part:
> 
> I run: gdb --ex run --args amarokcollectionscanner -r /media/Musik/Sortiert
> 
> The first run displays a lot of xml formatted tags... so actually it seems
> to work and just choke on some files... in the end it says
> 
> Program received signal SIGSEGV, Segmentation fault.
> TagLib::String::String (this=0x7fffffffd140, s=...) at
> /usr/src/debug/taglib-1.8/taglib/toolkit/tstring.cpp:86
> 86	  d->ref();
> Missing separate debuginfos, use: debuginfo-install
> dbus-libs-1.6.8-2.fc18.x86_64 glib2-2.34.2-1.fc18.x86_64
> keyutils-libs-1.5.5-3.fc18.x86_64 libicu-49.1.1-5.fc18.x86_64
> libselinux-2.1.12-7.fc18.x86_64 openssl-libs-1.0.1c-7.fc18.x86_64
> taglib-extras-1.0.1-4.fc18.x86_64
> 
> So I seem to have missed some Debuginfos... I installed them with the
> command suggested and restarted from now for the GDB part:
> Here is the output of the gdb commands:
> 
> (gdb) set height 0
> (gdb) thread apply all bt
> 
> Thread 1 (Thread 0x7ffff7fcd800 (LWP 30407)):
> #0  0x00000030d6c35ba5 in __GI_raise (sig=sig@entry=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:63
> #1  0x00000030d6c37358 in __GI_abort () at abort.c:90
> #2  0x00000030d6c7559b in __libc_message (do_abort=do_abort@entry=2,
> fmt=fmt@entry=0x30d6d79b88 "*** glibc detected *** %s: %s: 0x%s ***\n") at
> ../sysdeps/unix/sysv/linux/libc_fatal.c:197
> #3  0x00000030d6c7ca8e in malloc_printerr (ptr=0x6b8170, str=0x30d6d779f9
> "free(): invalid size", action=3) at malloc.c:4969
> #4  _int_free (av=0x30d6fb1740 <main_arena>, p=0x6b8160, have_lock=0) at
> malloc.c:3826
> #5  0x00000030f7275a5d in TagLib::String::toCString (this=0x7fffffffd130,
> unicode=true) at /usr/src/debug/taglib-1.8/taglib/toolkit/tstring.cpp:259
> #6  0x0000000000433b05 in Meta::Tag::TStringToQString (str=...) at
> /home/enaut/Source/amarok/shared/tag_helpers/StringHelper.cpp:45
> #7  0x000000000042b5e5 in Meta::Tag::APETagHelper::tags (this=0x69aa60) at
> /home/enaut/Source/amarok/shared/tag_helpers/APETagHelper.cpp:55
> #8  0x0000000000419de8 in Meta::Tag::readTags (path=...) at
> /home/enaut/Source/amarok/shared/MetaTagLib.cpp:251
> #9  0x0000000000423544 in CollectionScanner::Track::Track (this=0x6854a0,
> path=..., directory=<optimized out>) at
> /home/enaut/Source/amarok/shared/collectionscanner/Track.cpp:77
> #10 0x000000000041ebbf in CollectionScanner::Directory::Directory
> (this=0x7fffffffdb80, path=..., state=0x7fffffffe0d0, skip=<optimized out>)
>     at /home/enaut/Source/amarok/shared/collectionscanner/Directory.cpp:115
> #11 0x0000000000415b12 in CollectionScanner::Scanner::doJob
> (this=0x7fffffffe090) at
> /home/enaut/Source/amarok/utilities/collectionscanner/CollectionScanner.cpp:
> 212
> #12 0x00000030e218c39e in QObject::event (this=0x7fffffffe090, e=<optimized
> out>) at kernel/qobject.cpp:1194
> #13 0x00000030e2177a8e in QCoreApplication::notifyInternal
> (this=0x7fffffffe090, receiver=receiver@entry=0x7fffffffe090,
> event=event@entry=0x675460) at kernel/qcoreapplication.cpp:946
> #14 0x00000030e217b541 in sendEvent (event=0x675460,
> receiver=0x7fffffffe090) at kernel/qcoreapplication.h:231
> #15 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0,
> data=0x64e210) at kernel/qcoreapplication.cpp:1570
> #16 0x00000030e21a5f43 in sendPostedEvents () at
> kernel/qcoreapplication.h:236
> #17 postEventSourceDispatch (s=s@entry=0x65ea20) at
> kernel/qeventdispatcher_glib.cpp:279
> #18 0x00000030d6847a75 in g_main_dispatch (context=0x65d900) at gmain.c:2715
> #19 g_main_context_dispatch (context=context@entry=0x65d900) at gmain.c:3219
> #20 0x00000030d6847da8 in g_main_context_iterate
> (context=context@entry=0x65d900, block=block@entry=1,
> dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3290
> #21 0x00000030d6847e64 in g_main_context_iteration (context=0x65d900,
> may_block=1) at gmain.c:3351
> #22 0x00000030e21a60d6 in QEventDispatcherGlib::processEvents
> (this=0x64faf0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
> #23 0x00000030e21767df in QEventLoop::processEvents
> (this=this@entry=0x7fffffffe050, flags=...) at kernel/qeventloop.cpp:149
> #24 0x00000030e2176a68 in QEventLoop::exec (this=0x7fffffffe050, flags=...)
> at kernel/qeventloop.cpp:204
> #25 0x00000030e217b858 in QCoreApplication::exec () at
> kernel/qcoreapplication.cpp:1218
> #26 0x0000000000414740 in main (argc=3, argv=<optimized out>) at
> /home/enaut/Source/amarok/utilities/collectionscanner/CollectionScanner.cpp:
> 71
> (gdb) 
> 
> I hope that I have everything covered... now I guess from the results of the
> backtrace this is rather a taglib bug?

Yes, but we can cope with taglib crashes in collectionscanner. We'll resolve the Amarok problem first and then the taglib bug second.
Comment 6 Matěj Laitl 2012-12-15 14:51:43 UTC
Created attachment 75848 [details]
amarokcollectionscanner-crashing.txt

Just to make this linkable from code.
Comment 7 Matěj Laitl 2012-12-15 16:24:16 UTC
Reassigning to TagLib. It is still possible this is an Amarok bug, but then I don't know where. Lukáši, the backtrace is in comment 4. I can reproduce too with TagLib 1.8 and enaut can provide a file that triggers the crash.

APETagHelper.cpp:
      (...) m_tag is TagLib::APE::Tag *, asserted to be non-null.
51    TagLib::APE::ItemListMap map =  m_tag->itemListMap();
52    for( TagLib::APE::ItemListMap::ConstIterator it = map.begin(); it != map.end(); ++it )
53    {
54        qint64 field;
55        QString value = TStringToQString( it->second.toString() );

StringHelper.cpp:
42 QString
43 Meta::Tag::TStringToQString( const TagLib::String &str )
44 {
45     return s_codec->toUnicode( str.toCString( true ) ).trimmed();
46 }

Sometimes it also crashes here for me:
[KCrash Handler]
#6  ref (this=0x15) at /var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/taglib/toolkit/taglib.h:116
#7  TagLib::String::String (this=0x7fff8fed3d90, s=...) at /var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/taglib/toolkit/tstring.cpp:86
#8  0x00007fe2e4f14d5f in TagLib::APE::Item::toString (this=0x5613060) at /var/tmp/portage/media-libs/taglib-1.8/work/taglib-1.8/taglib/ape/apeitem.cpp:203
#9  0x00007fe2ed99162a in Meta::Tag::APETagHelper::tags (this=0x5610da0) at /home/strohel/projekty/amarok/shared/tag_helpers/APETagHelper.cpp:56
Comment 8 Myriam Schweingruber 2013-01-10 21:29:21 UTC
*** Bug 313037 has been marked as a duplicate of this bug. ***
Comment 9 Rex Dieter 2013-05-17 15:33:20 UTC
*** Bug 319941 has been marked as a duplicate of this bug. ***
Comment 10 Justin Zobel 2021-03-09 07:25:41 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 11 enaut 2021-03-09 10:19:45 UTC
I created this bug however I do not use amarok anymore and neither do I know on which files it failed... so as far as I'm concerned close this bug. - The issue might still persist though.