Bug 142937 - KMail crashes when attempting to create folder with slash in its name
Summary: KMail crashes when attempting to create folder with slash in its name
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: disconnected IMAP (show other bugs)
Version: 1.9.5
Platform: Debian testing Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 196767 199272 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-14 00:07 UTC by Andreas Veithen
Modified: 2010-01-03 23:07 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Veithen 2007-03-14 00:07:11 UTC
Version:           1.9.5 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

KMail 1.9.5 crashes when attempting to create folder with slash in its name (e.g. "crash/me"). It first displays the following message:

Error while creating file crash/me: No such file or directory

And then:

Error opening [...]/.INBOX.directory/crash/me; this folder is missing.

After this, KMail crashes with signal 11.

A very similar problem has already been reported in bugs 120448 and 125044. However this still happens with a disconnected IMAP account on a Cyrus IMAP server. Looking at the resolution of bug 120448 and the code in newfolderdialog.cpp, I think this has to do with the fact that Cyrus uses "." as a folder delimiter: With my configuration, KMail disallows dots in folder names, but allows slashes. The error messages shown above suggest that KMail then crashes because the caching code for disconnected IMAP has problems with slashes in folder names. Either KMail should always disallow slashes for disconnected IMAP folders, or the caching code needs to be corrected to handle slashes in folder names.
Comment 1 Thomas McGuire 2007-03-14 12:58:51 UTC
Can you please paste the backtrace of the crash here?
Comment 2 Andreas Veithen 2007-03-14 21:12:03 UTC
Backtrace:

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1517176608 (LWP 9682)]
[New Thread -1545770064 (LWP 9686)]
[New Thread -1537377360 (LWP 9685)]
[New Thread -1528984656 (LWP 9684)]
[New Thread -1520591952 (LWP 9683)]
[KCrash handler]
#6  0xa78e63eb in fseek () from /lib/tls/i686/cmov/libc.so.6
#7  0xa7e1ba18 in KMMsgDict::writeFolderIds (this=0x81a2c78, 
    storage=@0x847ace8) at kmmsgdict.cpp:519
#8  0xa7e1c75c in FolderStorage::invalidateFolder (this=0x847ace8)
    at folderstorage.cpp:942
#9  0xa7e1e204 in FolderStorage::readFolderIdsFile (this=0x847ace8)
    at folderstorage.cpp:929
#10 0xa7e1e231 in FolderStorage::registerWithMessageDict (this=0x847ace8)
    at folderstorage.cpp:916
#11 0xa7e5b0bc in KMFolder (this=0x847a8b8, aParent=0x81bcfe8, 
    aFolderName=@0xaffe7c38, aFolderType=KMFolderTypeCachedImap, 
    withIndex=true, exportedSernums=2) at kmfolder.cpp:136
#12 0xa7e5c306 in KMFolderDir::createFolder (this=0x81bcfe8, 
    aFolderName=@0xaffe7c38, aSysFldr=false, 
    aFolderType=KMFolderTypeCachedImap) at kmfolderdir.cpp:104
#13 0xa7d48fa9 in KMFolderMgr::createFolder (this=0x819f710, 
    fName=@0xaffe7c38, sysFldr=false, aFolderType=KMFolderTypeCachedImap, 
    aFolderDir=0x81bcfe8) at kmfoldermgr.cpp:180
#14 0xa7ea6b68 in KMail::NewFolderDialog::slotOk (this=0x853d3f0)
    at newfolderdialog.cpp:272
#15 0xa5fb2de9 in KDialogBase::qt_invoke (this=0x853d3f0, _id=74, 
    _o=0xaffe7d7c) at kdialogbase.moc:359
#16 0xa7c569f4 in KMail::NewFolderDialog::qt_invoke (this=0x853d3f0, _id=74, 
    _o=0xaffe7d7c) at newfolderdialog.moc:90
#17 0xa7148d4f in QObject::activate_signal (this=0x849e080, clist=0x849e058, 
    o=0xaffe7d7c) at kernel/qobject.cpp:2356
#18 0xa71497e0 in QObject::activate_signal (this=0x849e080, signal=4)
    at kernel/qobject.cpp:2325
#19 0xa74dade7 in QButton::clicked (this=0x849e080)
    at .moc/debug-shared-mt/moc_qbutton.cpp:152
#20 0xa71e5cf6 in QButton::mouseReleaseEvent (this=0x849e080, e=0xaffe81e4)
    at widgets/qbutton.cpp:836
#21 0xa717f6f0 in QWidget::event (this=0x849e080, e=0xaffe81e4)
    at kernel/qwidget.cpp:4702
#22 0xa70e0c26 in QApplication::internalNotify (this=0xaffe87a4, 
    receiver=0x849e080, e=0xaffe81e4) at kernel/qapplication.cpp:2635
#23 0xa70e2dc9 in QApplication::notify (this=0xaffe87a4, receiver=0x849e080, 
    e=0xaffe81e4) at kernel/qapplication.cpp:2421
#24 0xa7808e0e in KApplication::notify (this=0xaffe87a4, receiver=0x849e080, 
    event=0xaffe81e4) at kapplication.cpp:550
#25 0xa7074495 in QApplication::sendSpontaneousEvent (receiver=0x849e080, 
    event=0xaffe81e4) at qapplication.h:523
#26 0xa707312f in QETWidget::translateMouseEvent (this=0x849e080, 
    event=0xaffe8618) at kernel/qapplication_x11.cpp:4301
#27 0xa70716b0 in QApplication::x11ProcessEvent (this=0xaffe87a4, 
    event=0xaffe8618) at kernel/qapplication_x11.cpp:3478
#28 0xa7087d02 in QEventLoop::processEvents (this=0x808de60, flags=4)
    at kernel/qeventloop_x11.cpp:192
#29 0xa70fb179 in QEventLoop::enterLoop (this=0x808de60)
    at kernel/qeventloop.cpp:198
#30 0xa70faf9a in QEventLoop::exec (this=0x808de60)
    at kernel/qeventloop.cpp:145
#31 0xa70e27bf in QApplication::exec (this=0xaffe87a4)
    at kernel/qapplication.cpp:2758
#32 0x0804a094 in main (argc=)
    at /tmp/buildd/kdepim-3.5.5.dfsg.1/./kmail/main.cpp:110
#33 0xa789eea8 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#34 0x08049e11 in _start () at ../sysdeps/i386/elf/start.S:119
Comment 3 Bram Schoenmakers 2007-03-14 22:36:49 UTC

*** This bug has been marked as a duplicate of 120448 ***
Comment 4 Bram Schoenmakers 2007-03-14 22:40:06 UTC
You're sure about version 3.5.5? Because since KDE 3.5.5, KMail refuses to add folders with /, it gives a message box.
Comment 5 Andreas Veithen 2007-03-14 23:31:47 UTC
I think this bug is not a duplicate of 120448. In bug 120448 the problem appeared with local maildir folders. This problem is indeed corrected in 3.5.5: for this type of account KMail refuses to add folders with a slash (I just checked this). However as explained in my initial post, the problem still exists with a disconnected IMAP account on a Cyrus IMAP server. In this case KMail refuses to add folders with a dot (because this is the folder delimiter on Cyrus), but doesn't check for slashes. But the presence of a slash causes KMail to crash.
Comment 6 Andreas Veithen 2007-03-21 21:15:29 UTC
The following patch should solve the problem. It makes sure that for disconnected IMAP accounts, slashes in folder names are forbidden.

--- kmail/newfolderdialog.cpp.org       2007-03-21 20:12:49.657858562 +0100
+++ kmail/newfolderdialog.cpp   2007-03-21 20:13:53.386165175 +0100
@@ -194,6 +194,5 @@
   if ( fldName.find( '/' ) != -1 &&
        ( !mFolder ||
-         ( mFolder->folderType() != KMFolderTypeImap &&
-           mFolder->folderType() != KMFolderTypeCachedImap ) ) ) {
+         mFolder->folderType() != KMFolderTypeImap ) ) {
     KMessageBox::error( this, i18n( "Folder names cannot contain the / (slash) character; please choose another folder name." ) );
     return;
Comment 7 Allen Winter 2007-03-21 21:49:44 UTC
thanks for the patch Andreas.

But it doesn't look right.
'/' is allowed in a IMAP account, however dIMAP creates a local maildir copy and there '/' are not allowed..

Comment 8 Andreas Veithen 2007-03-21 22:16:30 UTC
I agree with you, but the other solution would be to make sure that the code that handles the local maildir copy for a dIMAP account supports slashes in folder names. In your opinion, is the fact that this code doesn't support slashes a bug or is it a design issue, i.e. is it supposed to handle slashes?
Comment 9 Eugeniu Plamadeala 2007-06-01 04:28:32 UTC
Just tried:
* Creating a maildir folder with name "test1/test2" fails with a message saying 
"Folder names cannot contain the / (slash) character; please choose another folder name."
* Creating a maildir folder with name "test1.test2" produces a folder with this exact name.


Debian testing. KDE 3.5.5 and Kmail 1.9.5
Comment 10 Andreas Veithen 2007-06-07 10:09:55 UTC
@Eugeniu: As indicated above the problem arises if (and only if) using a disconnected IMAP account with an IMAP server that uses '.' as a folder delimiter (such as Cyrus). You didn't specify what type of account and server you use. Could you provide this info?
Comment 11 Raúl 2008-11-07 12:41:33 UTC
Still alive in kmail 1.10.1 on kde 4.1.2. See attached freshen backtrace:

Application: KMail (kmail), signal SIGSEGV
[Thread debugging using libthread_db enabled]
[New Thread 0x7f0054edb6f0 (LWP 11076)]
[New Thread 0x41c2d950 (LWP 22331)]
[KCrash handler]
#5  0x00007f0051f48596 in fseek () from /lib/libc.so.6
#6  0x00007f00546a030d in KMMsgDict::writeFolderIds (
    this=<value optimized out>, storage=@0x51ed850)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmmsgdict.cpp:561
#7  0x00007f00546a6ab0 in FolderStorage::invalidateFolder (this=0x51ed850)
    at /tmp/buildd/kdepim-4.1.2/kmail/folderstorage.cpp:1014
#8  0x00007f00546a6b50 in FolderStorage::readFolderIdsFile (this=0x51ed850)
    at /tmp/buildd/kdepim-4.1.2/kmail/folderstorage.cpp:1001
#9  0x00007f005467e3e1 in KMFolder (this=0x382a720, aParent=0x29b8d70, 
    aFolderName=@0x7fff5d026f40, aFolderType=<value optimized out>, 
    withIndex=<value optimized out>, exportedSernums=<value optimized out>)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfolder.cpp:146
#10 0x00007f00546c7943 in KMFolderDir::createFolder (this=0x29b8d70, 
    aFolderName=@0x26dcf68, aSysFldr=false, 
    aFolderType=KMFolderTypeCachedImap)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfolderdir.cpp:106
#11 0x00007f0054775d55 in KMFolderCachedImap::createFoldersNewOnServerAndFinishListing (this=0x29a32b0, foldersNewOnServer=
        {{p = 0x7fff5d0273d0, d = 0x7fff5d0273d0}})
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfoldercachedimap.cpp:2183
#12 0x00007f005476d9c1 in KMFolderCachedImap::listDirectory2 (this=0x29a32b0)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfoldercachedimap.cpp:2173
#13 0x00007f00547707d9 in KMFolderCachedImap::serverSyncInternal (
    this=0x29a32b0)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfoldercachedimap.cpp:910
#14 0x00007f0054771598 in KMFolderCachedImap::slotRescueDone (this=0x29a32b0, 
    command=<value optimized out>)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfoldercachedimap.cpp:3067
#15 0x00007f0054771aa2 in KMFolderCachedImap::slotListResult (this=0x29a32b0, 
    folderNames=<value optimized out>, folderPaths=@0x3008e60, 
    folderMimeTypes=@0x291b168, folderAttributes=@0x3008e70, 
    jobData=@0x311afd8)
    at /tmp/buildd/kdepim-4.1.2/kmail/kmfoldercachedimap.cpp:2028
#16 0x00007f005477c684 in KMFolderCachedImap::qt_metacall (this=0x29a32b0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fff5d028050)
    at /tmp/buildd/kdepim-4.1.2/obj-x86_64-linux-gnu/kmail/kmfoldercachedimap.moc:220
#17 0x00007f005340c6d4 in QMetaObject::activate (sender=0x3008df0, 
    from_signal_index=<value optimized out>, to_signal_index=12, 
    argv=0x39c3a30) at kernel/qobject.cpp:3031
#18 0x00007f005463a062 in KMail::ListJob::receivedFolders (this=0x3008df0, 
    _t1=<value optimized out>, _t2=<value optimized out>, _t3=@0x3008e68, 
    _t4=@0x34c7e90, _t5=@0x0)
    at /tmp/buildd/kdepim-4.1.2/obj-x86_64-linux-gnu/kmail/listjob.moc:89
#19 0x00007f005463b0db in KMail::ListJob::slotListResult (this=0x3008df0, 
    job=0x5303dd0) at /tmp/buildd/kdepim-4.1.2/kmail/listjob.cpp:181
#20 0x00007f005463c747 in KMail::ListJob::qt_metacall (this=0x3008df0, 
    _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff5d028310)
    at /tmp/buildd/kdepim-4.1.2/obj-x86_64-linux-gnu/kmail/listjob.moc:76
#21 0x00007f005340c6d4 in QMetaObject::activate (sender=0x5303dd0, 
    from_signal_index=<value optimized out>, to_signal_index=7, 
    argv=0x39c3a30) at kernel/qobject.cpp:3031
#22 0x00007f00537d4a72 in KJob::result (this=0x800000001, _t1=0x5303dd0)
    at /tmp/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kdecore/kjob.moc:186
#23 0x00007f00537d4e37 in KJob::emitResult (this=0x5303dd0)
    at /tmp/buildd/kde4libs-4.1.2/kdecore/jobs/kjob.cpp:290
#24 0x00007f004e59e1f0 in KIO::SimpleJob::slotFinished (this=0x5303dd0)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/job.cpp:498
#25 0x00007f004e59e325 in KIO::ListJob::slotFinished (this=0x5303dd0)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/job.cpp:2393
#26 0x00007f004e5a4f1d in KIO::ListJob::qt_metacall (this=0x5303dd0, 
    _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, 
    _a=0x7fff5d028650)
    at /tmp/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/jobclasses.moc:747
#27 0x00007f005340c6d4 in QMetaObject::activate (sender=0x3427bf0, 
    from_signal_index=<value optimized out>, to_signal_index=8, 
    argv=0x39c3a30) at kernel/qobject.cpp:3031
#28 0x00007f004e65a9f1 in KIO::SlaveInterface::dispatch (this=0x3427bf0, 
    _cmd=104, rawdata=<value optimized out>)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:175
#29 0x00007f004e657852 in KIO::SlaveInterface::dispatch (this=0x3427bf0)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/slaveinterface.cpp:90
#30 0x00007f004e6488b3 in KIO::Slave::gotInput (this=0x3427bf0)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/slave.cpp:322
#31 0x00007f004e64afd8 in KIO::Slave::qt_metacall (this=0x3427bf0, 
    _c=QMetaObject::InvokeMetaMethod, _id=86829360, _a=0x7fff5d028a70)
    at /tmp/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/slave.moc:75
#32 0x00007f005340c6d4 in QMetaObject::activate (sender=0x26c4860, 
    from_signal_index=<value optimized out>, to_signal_index=4, 
    argv=0x39c3a30) at kernel/qobject.cpp:3031
#33 0x00007f004e56b970 in KIO::ConnectionPrivate::dequeue (this=0x35a1aa0)
    at /tmp/buildd/kde4libs-4.1.2/kio/kio/connection.cpp:82
#34 0x00007f004e56baaa in KIO::Connection::qt_metacall (this=0x26c4860, 
    _c=QMetaObject::InvokeMetaMethod, _id=86829360, _a=0x47546b0)
    at /tmp/buildd/kde4libs-4.1.2/obj-x86_64-linux-gnu/kio/connection.moc:72
#35 0x00007f0053407345 in QObject::event (this=0x26c4860, e=0x327b670)
    at kernel/qobject.cpp:1155
#36 0x00007f005291ca5d in QApplicationPrivate::notify_helper (this=0x25cf6d0, 
    receiver=0x26c4860, e=0x327b670) at kernel/qapplication.cpp:3803
#37 0x00007f00529247da in QApplication::notify (this=0x7fff5d0295e0, 
    receiver=0x26c4860, e=0x327b670) at kernel/qapplication.cpp:3768
#38 0x00007f0053d5240b in KApplication::notify (this=0x7fff5d0295e0, 
    receiver=0x26c4860, event=0x327b670)
    at /tmp/buildd/kde4libs-4.1.2/kdeui/kernel/kapplication.cpp:311
#39 0x00007f00533f8381 in QCoreApplication::notifyInternal (
    this=0x7fff5d0295e0, receiver=0x26c4860, event=0x327b670)
    at kernel/qcoreapplication.cpp:587
#40 0x00007f00533f901a in QCoreApplicationPrivate::sendPostedEvents (
    receiver=0x0, event_type=0, data=0x25aa340)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:209
#41 0x00007f0053420a83 in postEventSourceDispatch (s=<value optimized out>)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:214
#42 0x00007f004ab4c78b in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#43 0x00007f004ab4ff5d in ?? () from /usr/lib/libglib-2.0.so.0
#44 0x00007f004ab5011b in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#45 0x00007f005342070f in QEventDispatcherGlib::processEvents (
    this=0x25c2090, flags=<value optimized out>)
    at kernel/qeventdispatcher_glib.cpp:319
#46 0x00007f00529ae44f in QGuiEventDispatcherGlib::processEvents (
    this=0x800000001, flags=<value optimized out>)
    at kernel/qguieventdispatcher_glib.cpp:198
#47 0x00007f00533f6ca2 in QEventLoop::processEvents (
    this=<value optimized out>, flags={i = 1560450032})
    at kernel/qeventloop.cpp:143
#48 0x00007f00533f6e2d in QEventLoop::exec (this=0x7fff5d029430, flags=
      {i = 1560450112}) at kernel/qeventloop.cpp:194
#49 0x00007f00533f92dd in QCoreApplication::exec ()
    at kernel/qcoreapplication.cpp:845
#50 0x0000000000402f8b in main (argc=<value optimized out>, 
    argv=<value optimized out>) at /tmp/buildd/kdepim-4.1.2/kmail/main.cpp:146
#0  0x00007f0051f79ff1 in nanosleep () from /lib/libc.so.6
Comment 12 Christophe Giboudeaux 2009-07-06 20:56:47 UTC
*** Bug 196767 has been marked as a duplicate of this bug. ***
Comment 13 Dario Andres 2009-07-07 17:03:42 UTC
*** Bug 199272 has been marked as a duplicate of this bug. ***
Comment 14 Björn Ruberg 2010-01-03 23:07:41 UTC
When I try to create a dIMAP folder with / in its name, kmail refuses with a warning. So this is fixed, I think