Bug 161457 - kmail crashes when creating maildir folder on cifs mounted filesystem
Summary: kmail crashes when creating maildir folder on cifs mounted filesystem
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.9.9
Platform: Ubuntu Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-30 11:06 UTC by Peter Parzer
Modified: 2010-01-05 11:49 UTC (History)
1 user (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 Peter Parzer 2008-04-30 11:06:41 UTC
Version:           1.9.9 (using KDE 3.5.9)
Installed from:    Ubuntu Packages
OS:                Linux

Looking at the strace it seems that kmail tries to rename a file to the name of an allready opened file. On the local file system this seem to work, but on an cifs mounted filesystem this doesn't. Kmail continues without checking for errors and crashes.

Here is my analysis of the strace:

# open .inbox.index (fd=13)

open("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 13
utime("/home/parzerpeter/.kde/share/apps/kmail/mail/inbox", NULL) = 0
utime("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index", NULL) = 0
utime("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index.ids", NULL) = -1 ENOENT (No such file or directory)
umask(022)                              = 077
fcntl64(13, F_SETFD, FD_CLOEXEC)        = 0
unlink("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index.temp") = -1 ENOENT (No such file or directory)
utime("/home/parzerpeter/.kde/share/apps/kmail/mail/inbox", NULL) = 0
umask(077)                              = 022

# open .inbox.index.temp (fd=14), .inbox.index is still open

open("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index.temp", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 14
umask(022)                              = 077
fstat64(14, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap2(NULL, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb550e000
write(14, "# KMail-Index V1506\n\0\10\0\0\0xV4\22\4\0\0"..., 33) = 33
_llseek(14, 0, [33], SEEK_CUR)          = 0
fsync(14)                               = 0

# close .inbox.index.temp

close(14)                               = 0
munmap(0xb550e000, 16384)               = 0

# rename .inbox.index.temp to .inbox.index, this fails since
# .inbox.index is still open

rename("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index.temp", "/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index") = -1 EINVAL (Invalid argument)

# rename fails, maybe because .inbox.index is open,
# finally close .inbox.index, could have done before 
# trying to rename .inbox.index.temp to .inbox.index

close(13)                               = 0
open("/home/parzerpeter/.kde/share/apps/kmail/mail/.inbox.index", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)

# open fails, because .inbox.index is vanished, this is a bug
# in cifs which is also involved here, ignore all return codes
# and continue

--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Comment 1 Bram Schoenmakers 2008-05-01 22:46:31 UTC
Can you also provide a backtrace please?
Comment 2 Peter Parzer 2008-05-05 08:54:03 UTC
[Thread debugging using libthread_db enabled]
[New Thread 0xb57996c0 (LWP 11412)]
[KCrash handler]
#6  0xb5848c61 in fileno_unlocked () from /lib/tls/i686/cmov/libc.so.6
#7  0xb7de9ac7 in KMFolderIndex::writeIndex (this=0x81701c0,
    createEmptyIndex=false)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfolderindex.cpp:202
#8  0xb7d29c1c in KMFolderMaildir::create (this=0x81701c0)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfoldermaildir.cpp:219
#9  0xb7c54021 in KMFolder (this=0x8177010, aParent=0x815f00c,
    aFolderName=@0xbf8d7a58, aFolderType=KMFolderTypeMaildir, withIndex=true,
    exportedSernums=<value optimized out>)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfolder.cpp:82
#10 0xb7c92971 in KMFolderDir::createFolder (this=0x815f00c,
    aFolderName=@0xbf8d7a58, aSysFldr=true, aFolderType=KMFolderTypeMaildir)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfolderdir.cpp:104
#11 0xb7c95fd4 in KMFolderMgr::createFolder (this=0x815efe0,
    fName=@0xbf8d7a58, sysFldr=<value optimized out>,
    aFolderType=KMFolderTypeMaildir, aFolderDir=0x0)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfoldermgr.cpp:207
#12 0xb7c963e5 in KMFolderMgr::findOrCreate (this=0x815efe0,
    aFolderName=@0xbf8d7a58, sysFldr=<value optimized out>, id=0)
    at /build/buildd/kdepim-3.5.9/./kmail/kmfoldermgr.cpp:327
#13 0xb7d40087 in KMKernel::initFolders (this=0xbf8d7b8c, cfg=0x8096688)
    at /build/buildd/kdepim-3.5.9/./kmail/kmkernel.cpp:1376
#14 0xb7d40f59 in KMKernel::init (this=0xbf8d7b8c)
    at /build/buildd/kdepim-3.5.9/./kmail/kmkernel.cpp:1489
#15 0x0804a591 in main (argc=1355164, argv=0xb59412a8)
    at /build/buildd/kdepim-3.5.9/./kmail/main.cpp:96


On Thursday 01 May 2008 22:46:32 Bram Schoenmakers wrote:
[bugs.kde.org quoted mail]
Comment 3 Thomas McGuire 2008-05-05 09:37:51 UTC

*** This bug has been marked as a duplicate of 140429 ***
Comment 4 Björn Ruberg 2010-01-03 00:31:54 UTC

*** This bug has been marked as a duplicate of bug 138445 ***
Comment 5 Peter Parzer 2010-01-05 09:41:32 UTC
I cannot see how this bug is a duplicate of bug 138445, since this bug is  actually related to the cifs bug 5431 "rename fails when newpath is open and deletes newpath". Anyway, I cannot reproduce it with KDE 4.3.2, maybe the cifs bus has been fixed meanwhile.
Comment 6 Björn Ruberg 2010-01-05 11:49:12 UTC
You are right. I mistaked cifs with an read-only flash file system. That's why I treated this as the read-only problem. But when you say that this is fixed, it is even better :)