Bug 87491 - Crash on adding new folder
Summary: Crash on adding new folder
Status: RESOLVED FIXED
Alias: None
Product: juk
Classification: Applications
Component: general (show other bugs)
Version: 2.1
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Scott Wheeler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-19 11:10 UTC by Michael Schuerig
Modified: 2005-02-19 16:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
C Program to try calling opendir(), and report the success/failure. (732 bytes, text/plain)
2004-08-23 00:40 UTC, Michael Pyne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schuerig 2004-08-19 11:10:26 UTC
Version:           2.1 (using KDE 3.3.0,  (3.1))
Compiler:          gcc version 3.3.4 (Debian 1:3.3.4-7)
OS:                Linux (i686) release 2.6.7

After installing the Debian/unstable packages for KDE pre-3.3.0, I noticed, that JuK no longer recognized it when new files were added to my music folder. In order to rebuild its cache, I removed ~/.kde/share/apps/juk and after launching JuK added my music folder. After clicking OK in the folder list this immediately crashes JuK.

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 1073893376 (LWP 4108)]
[KCrash handler]
#4  0x47aa037b in readdir () from /lib/tls/i686/cmov/libc.so.6
#5  0xbfffe590 in ?? ()
#6  0xbfffe570 in ?? ()
#7  0x080d62e9 in typeinfo name for Qt ()
#8  0xbfffe538 in ?? ()
#9  0x08092dde in QValueListPrivate<KURL>::QValueListPrivate ()

The crash is in playlist.cpp line 1445.

Michael
Comment 1 Michael Pyne 2004-08-22 01:35:15 UTC
Hmm, it seems that opendir() can fail for some reason, and then readdir() crashes on the null pointer.  I'm investigating how Qt could betray us so. ;-)
Comment 2 Michael Pyne 2004-08-22 02:26:25 UTC
CVS commit by mpyne: 

Commit bugfix for crash bug #87491.

Reporter: please test if this fixes your problem.  You may also want to check
your directory permissions, the only way I could reproduce this was to remove
access permissions for my test directory.

CCMAIL:87491@bugs.kde.org


  M +15 -6     playlist.cpp   1.243.2.1


--- kdemultimedia/juk/playlist.cpp  #1.243:1.243.2.1
@@ -1441,4 +1441,6 @@ PlaylistItem *Playlist::addFile(const QS
 
         DIR *dir = ::opendir(QFile::encodeName(fileInfo.filePath()));
+
+        if(dir) {
         struct dirent *dirEntry;
 
@@ -1450,4 +1452,11 @@ PlaylistItem *Playlist::addFile(const QS
         ::closedir(dir);
     }
+        else
+        {
+            kdWarning(65432) << "Unable to open directory "
+                             << fileInfo.filePath()
+                             << ", make sure it is readable.\n";
+        }
+    }
 
     return after;


Comment 3 Michael Pyne 2004-08-22 02:28:10 UTC
CVS commit by mpyne: 

Forward porting bugfix for crash bug #87491.

CCMAIL:87491-done@bugs.kde.org


  M +15 -6     playlist.cpp   1.246


--- kdemultimedia/juk/playlist.cpp  #1.245:1.246
@@ -1352,4 +1352,6 @@ PlaylistItem *Playlist::addFile(const QS
 
         DIR *dir = ::opendir(QFile::encodeName(fileInfo.filePath()));
+
+        if(dir) {
         struct dirent *dirEntry;
 
@@ -1361,4 +1363,11 @@ PlaylistItem *Playlist::addFile(const QS
         ::closedir(dir);
     }
+        else
+        {
+            kdWarning(65432) << "Unable to open directory "
+                             << fileInfo.filePath()
+                             << ", make sure it is readable.\n";
+        }
+    }
 
     return after;


Comment 4 Michael Schuerig 2004-08-22 02:57:54 UTC
Hm, that's not a fix, it only circumvents the crash, but doesn't solve the problem.

I don't quite understand what and why is happening, but what seems to be causing the problem is that I'm trying to add a folder where a partition is mounted. When I add a folder below that topmost folder, it works.

Presumably your /tmp is on its own partition. As a test try to add it as a folder to JuK. When I do this on my system, JuK crashes immediately. Yes, /tmp is readable...

Michael
Comment 5 Michael Pyne 2004-08-23 00:37:33 UTC
Well I've tried opening up my partition mount point with JuK with no problems.

So, there's other things we can try I guess.

1) Does running JuK from the Konsole result in any error output after trying to open the folder?

2) Are any other programs able to open the folder?  Konqueror would be the easiest example.

3) Are any other multimedia programs able to open it, especially ones that also scan folders recursively?  Amarok is the best-known example, but I think there is a playlist plugin for Noatun that could work for testing as well.

I'll be attaching a short C snippet that will try calling readdir() and report the output, I'd appreciate it if you could compile it and try running it on the folder that crashes JuK.
Comment 6 Michael Pyne 2004-08-23 00:40:00 UTC
Created attachment 7225 [details]
C Program to try calling opendir(), and report the success/failure.
Comment 7 Michael Schuerig 2004-08-23 03:10:00 UTC
The test program works just fine. I've rebuild the JuK Debian package with debug info and it still crashes at the same point.

In a chrooted environment I have an up to date CVS version of KDE. I simply copied JuK from over there to my normal environment -- and it works. No crash, it reads my music folder just fine. But there's a hitch: It does not import playlists.

Michael
Comment 8 Michael Pyne 2004-08-24 01:29:55 UTC
Well that's very odd.  Perhaps the Debian package for JuK contains a patch which is causing the problem?

I assume when you mention that importing playlists doesn't work that the Import Playlist checkbox in File -> Add Folder is actually checked?
Comment 9 Michael Schuerig 2004-08-24 01:50:51 UTC
I've looked at the sources for the debian package and there is not specific patch for JuK. I'll ask on the debian-kde ML, if anyone beside me is experiencing this problem.

Yes, Import Playlists is checked and it is set in jukrc:
ImportPlaylists=true

To rule out any lingering inconsistencies, I've force-fsck'ed my music partition (ext3).

Michael
Comment 10 Jacob Hinkle 2004-08-31 02:13:50 UTC
Hello, I just had this problem after reinstalling and keeping my music partition. One thing to check is that the permissions and ownership of the directories are correct. If you have forinstance a "files" group be sure it exists and that you are in it. perhaps other permissions things were your problem.  I still think this is a bug since you should get an error message when there is any problem opening the directory.
Comment 11 Scott Wheeler 2005-02-19 16:41:07 UTC
Hmm, doing a little cleaning at the moment.  It seems that this one morphed from being a crash for one thing into JuK not being able to read playlists.  If you still are having problems with the playlists in CVS please open a new bug report related to that.