Bug 203554 - KConfig fails to sync on VFAT, CIFS, and EncFS (on top of Ext4) file systems
Summary: KConfig fails to sync on VFAT, CIFS, and EncFS (on top of Ext4) file systems
Status: CLOSED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdecore (show other bugs)
Version: SVN
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 216717 217173 239045 267466 275189 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-08-12 12:20 UTC by Pietro
Modified: 2011-08-31 15:13 UTC (History)
16 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pietro 2009-08-12 12:20:32 UTC
Version:            (using KDE 4.2.4)
OS:                Linux
Installed from:    Mandriva RPMs

I cannot create a new project in Kile, if I select new project what I can do is only to select an already existent project file. If I try to set a new name for the project it says that the file does not exist. (In the older version it creates that file)
Moreover, if I open an already created project (with older version of Kile), it opens it correctly but if I modify something (add files, remove files, modify options) it will not save them to the file causing also a crash of kile sometimes:

Application: Kile (kile), signal SIGABRT
[Current thread is 1 (Thread 0xb56198e0 (LWP 4477))]

Thread 2 (Thread 0xb2e24b90 (LWP 4480)):
#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb61f44c1 in select () from /lib/i686/libc.so.6
#2  0xb6e81d0c in ?? () from /usr/lib/libQtCore.so.4
#3  0xb6da92e3 in ?? () from /usr/lib/libQtCore.so.4
#4  0xb6d4c315 in start_thread () from /lib/i686/libpthread.so.0
#5  0xb61fc25e in clone () from /lib/i686/libc.so.6

Thread 1 (Thread 0xb56198e0 (LWP 4477)):
[KCrash Handler]
#6  0xffffe424 in __kernel_vsyscall ()
#7  0xb6149c00 in raise () from /lib/i686/libc.so.6
#8  0xb614b668 in abort () from /lib/i686/libc.so.6
#9  0xb6da0c45 in qt_message_output () from /usr/lib/libQtCore.so.4
#10 0xb6da0d3c in qFatal () from /usr/lib/libQtCore.so.4
#11 0xb6da0e35 in qt_assert () from /usr/lib/libQtCore.so.4
#12 0x080fb737 in ?? ()
#13 0x081b2f10 in ?? ()
#14 0x081b3414 in ?? ()
#15 0x081b442d in ?? ()
#16 0xb6ebb795 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#17 0xb6ebbbfb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#18 0xb647aa85 in QAction::triggered () from /usr/lib/libQtGui.so.4
#19 0xb647c0b7 in QAction::activate () from /usr/lib/libQtGui.so.4
#20 0xb68f23b7 in ?? () from /usr/lib/libQtGui.so.4
#21 0xb68f8e54 in ?? () from /usr/lib/libQtGui.so.4
#22 0xb68f99a4 in QMenu::mouseReleaseEvent () from /usr/lib/libQtGui.so.4
#23 0xb750caea in KMenu::mouseReleaseEvent () from /usr/lib/libkdeui.so.5
#24 0xb64da75d in QWidget::event () from /usr/lib/libQtGui.so.4
#25 0xb68fbc84 in QMenu::event () from /usr/lib/libQtGui.so.4
#26 0xb648139c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#27 0xb648a642 in QApplication::notify () from /usr/lib/libQtGui.so.4
#28 0xb7423d21 in KApplication::notify () from /usr/lib/libkdeui.so.5
#29 0xb6ea599e in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#30 0xb6489471 in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#31 0xb64fd39a in ?? () from /usr/lib/libQtGui.so.4
#32 0xb64fc5ca in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#33 0xb65269b4 in ?? () from /usr/lib/libQtGui.so.4
#34 0xb5945cea in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#35 0xb5949354 in ?? () from /usr/lib/libglib-2.0.so.0
#36 0xb59494df in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#37 0xb6ed25da in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#38 0xb652610a in ?? () from /usr/lib/libQtGui.so.4
#39 0xb6ea3f63 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#40 0xb6ea43bd in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#41 0xb6ea6916 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#42 0xb6481204 in QApplication::exec () from /usr/lib/libQtGui.so.4
#43 0x080ff34f in ?? ()
#44 0xb61366a5 in __libc_start_main () from /lib/i686/libc.so.6
#45 0x0806f941 in _start ()
Comment 1 Pietro 2009-08-12 12:31:01 UTC
I discovered that the bug is there if and only if I save the project on FAT32 filesystems.
If I move them to the home (ext4) I can manage project files. I tried with three different FAT32 systems and the bug is there.
Comment 2 Thomas Braun 2009-08-15 12:59:31 UTC
What kile version do you have? The full rpm package name might be best.
What QT Version?
Which mount options do you use for the FAT32 filesystems?

So you have no problems at all on ext4?
Comment 3 Pietro 2009-08-23 10:20:38 UTC
I used kile version: kile-2.1-0.924057.3mdv2009.1.i586 (MDV 2009.1 official), I tried also to update to kile-2.1-0.b1.1mdv2009.1 (testing version) but it's the same.
QT: libqtcore4-4.5.2-1.3mdv2009.1
and for one of the FAT32 filesystem the options are:
/dev/sda5 /mnt/data vfat umask=000,iocharset=utf8 0 0
the other is mounted by truecrypt and the output of `mount` is:
truecrypt on /tmp/.truecrypt_aux_mnt1 type fuse.truecrypt (rw,nosuid,nodev,allow_other)
/dev/mapper/truecrypt1 on /mnt/crypto type vfat (rw,uid=500,gid=500,umask=077)

I do not have any problem on ext4 and reiserfs.
Thanks.
Comment 4 Michel Ludwig 2009-11-28 15:33:15 UTC
This seems to a bug in KConfig::sync. The locking of the file seems to fail as it prints "couldn't lock local file" and returns from the 'sync' method.
Comment 5 Michel Ludwig 2009-12-03 21:27:42 UTC
*** Bug 217173 has been marked as a duplicate of this bug. ***
Comment 6 Michel Ludwig 2010-01-04 13:28:53 UTC
*** Bug 216717 has been marked as a duplicate of this bug. ***
Comment 7 Oswald Buddenhagen 2010-03-07 16:56:44 UTC
the bug is actually in KLockFile which does hardlinking tricks in an attempt at being NFS2-safe. of course this must utterly fail on fat. a solution would be falling back to regular posix file locks. in fact, one might ditch this nfs2-safety at all ... who still uses this crap nowadays?
Comment 8 Ian Wood 2010-05-06 09:39:37 UTC
An easy workaround is to store project files on the home ext3 file system.
(trivial, I know, but sometimes the trivial is hard to see :)
Comment 9 Pietro 2010-05-06 10:15:04 UTC
I already wrote that in second comment, but this is not a solution since I wanted to share project files with other operating system (such as Win) so a FAT must be used. OK, now also NTFS can be used but I didn't try what happens on that filesystem.
However, kile was used to handle files in FAT and should do the same now.
If the problem is in the backend it should be solved since I think other applications use that backend.
Comment 10 Oswald Buddenhagen 2010-05-29 10:32:50 UTC
*** Bug 239045 has been marked as a duplicate of this bug. ***
Comment 11 K. Pauli 2010-05-29 12:15:58 UTC
Thanks, Oswald, for managing Bug 239045. As described KDE config isn't saved in a encrypted (encfs) home directory. 
@Ian: I did a similar workaround as you proposed. But in the .kde directory are personal data I don't want to be stored unencrypted on my harddisk.
Sadly I'm not familiar with C++ and KDE programming so I'm not able to submit a patch.
Comment 12 Dror Atariah 2010-08-03 10:20:49 UTC
I can confirm this issue. I tried moving the .kliper to my home dir, but then KILE couldn't open the files in the project since they were still stored on the FAT32 partition.
Comment 13 Sandro Mathys 2010-10-06 13:55:31 UTC
I think I can reproduce the same on Fedora 13 with a mounted CIFS user-home (without posix extensions). With kile, I get the "can't lock local file" messages (hundreds of them) and kile's configuration isn't kept at all.

Is anyone actually working on a fix for this issue?
Comment 14 Michel Ludwig 2011-03-02 22:10:17 UTC
*** Bug 267466 has been marked as a duplicate of this bug. ***
Comment 15 Marcus 2011-03-08 11:01:02 UTC
It's definitly related to the way links are created:

15319 13:46:44.680463 write(10, "15319\n", 6) = 6 <0.001848>
15319 13:46:44.682429 write(10, "systemsettings\n", 15) = 15 <0.001075>
15319 13:46:44.683647 write(10, "moellema.ethz.ch\n", 17) = 17 <0.001376>
15319 13:46:44.685182 link("/home/moellema/.kde/share/config/kdebugrc.lock.T15319", "/home/moellema/.kde/share/config/kdebugrc.lock") = -1 EOPNOTSUPP (Operation not supported) <0.001892>
15319 13:46:44.687389 _llseek(10, 0, [0], SEEK_SET) = 0 <0.000048>
15319 13:46:44.687555 close(10)         = 0 <0.002003>

From the above output, link is used to create a hardlink which is not supported on that kind of shares.

A solution could be to use soft links instead.
Comment 16 David Faure 2011-05-27 00:04:08 UTC
I'm looking into a O_EXCL implementation on non-nfs filesystems.
Comment 17 David Faure 2011-06-03 11:48:26 UTC
Git commit 3f0ce125052b9ef9c1f02733871ca88b64a68d90 by David Faure.
Committed on 03/06/2011 at 10:41.
Pushed by dfaure into branch 'master'.

Implement locking on non-NFS systems using O_EXCL

Fixes locking on VFAT and CIFS etc.

BUG: 203554

M  +227  -69   kdecore/io/klockfile_unix.cpp     
M  +2    -0    kdecore/io/kmountpoint.cpp     
M  +1    -0    kdecore/tests/CMakeLists.txt     
A  +44   -0    kdecore/tests/klockfile_testlock.cpp         [License: LGPL (v2+)]
M  +26   -5    kdecore/tests/klockfiletest.cpp     

http://commits.kde.org/kdelibs/3f0ce125052b9ef9c1f02733871ca88b64a68d90
Comment 18 David Faure 2011-06-03 16:27:05 UTC
Git commit 12484b1abfe57abfe45df4d9d0a5f652e4d6ec02 by David Faure.
Committed on 03/06/2011 at 16:19.
Pushed by dfaure into branch 'master'.

Revert "Implement locking on non-NFS systems using O_EXCL"

This reverts commit 3f0ce125052b9ef9c1f02733871ca88b64a68d90.
I didn't mean to commit it yet (it needs cleanups, at least), and it
breaks compilation for someone.
CCBUG: 203554

M  +69   -227  kdecore/io/klockfile_unix.cpp     
M  +0    -2    kdecore/io/kmountpoint.cpp     
M  +0    -1    kdecore/tests/CMakeLists.txt     
D  +0    -44   kdecore/tests/klockfile_testlock.cpp     
M  +5    -26   kdecore/tests/klockfiletest.cpp     

http://commits.kde.org/kdelibs/12484b1abfe57abfe45df4d9d0a5f652e4d6ec02
Comment 19 Michel Ludwig 2011-06-11 09:57:50 UTC
*** Bug 275189 has been marked as a duplicate of this bug. ***
Comment 20 Sandro Mathys 2011-06-23 14:53:48 UTC
Can confirm that the patchset doesn't compile on Fedora 15 x86_64:

/usr/bin/cmake -E cmake_progress_report /builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu/CMakeFiles 
[ 17%] Building CXX object kdecore/CMakeFiles/kdecore.dir/io/klockfile_unix.o
cd /builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu/kdecore && /usr/lib64/ccache/c++   -DMAKE_KDECORE_LIB -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS -
DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=21 -DQT_NO_CAST_FROM_ASCII -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-alig
n -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common -Werror=return-type -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -
O2 -DNDEBUG -DQT_NO_DEBUG -fPIC -I/builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu/kdecore -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore -I/builddir/build/BUILD/kdelibs-4.6.4 -I/builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-l
inux-gnu -I/builddir/build/BUILD/kdelibs-4.6.4/interfaces -I/builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu/kdecore/network -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/sonnet -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/auth
 -I/builddir/build/BUILD/kdelibs-4.6.4/kjs -I/builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu/kjs -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/compression -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/config -I/builddir/build/B
UILD/kdelibs-4.6.4/kdecore/date -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/io -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/jobs -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/kernel -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/network 
-I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/services -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/localization -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/sycoca -I/builddir/build/BUILD/kdelibs-4.6.4/kdecore/text -I/builddir/build/BUI
LD/kdelibs-4.6.4/kdecore/util -I/usr/include/QtCrypto -I/usr/include/polkit-qt-1 -I/usr/include/phonon -I/usr/include/QtXmlPatterns -I/usr/include/QtXml -I/usr/include/QtWebKit -I/usr/include/QtUiTools -I/usr/include/QtTest -I/usr/include/
QtSvg -I/usr/include/QtSql -I/usr/include/QtScriptTools -I/usr/include/QtScript -I/usr/include/QtOpenGL -I/usr/include/QtNetwork -I/usr/include/QtMultimedia -I/usr/include/QtHelp -I/usr/include/QtDesigner -I/usr/include/QtDeclarative -I/us
r/include/QtDBus -I/usr/include/Qt3Support -I/usr/include/QtGui -I/usr/include/QtCore -I/usr/include/Qt -I/usr/lib64/qt4/mkspecs/default   -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -o CMakeFiles/kdecore.dir/io/klockfile_unix.o -c /builddir/build
/BUILD/kdelibs-4.6.4/kdecore/io/klockfile_unix.cpp
In file included from /usr/include/fcntl.h:267:0,
                 from /builddir/build/BUILD/kdelibs-4.6.4/kdecore/util/kde_file.h:33,
                 from /builddir/build/BUILD/kdelibs-4.6.4/kdecore/io/klockfile_unix.cpp:46:
In function 'int open(const char*, int, ...)',
    inlined from 'KLockFile::LockResult KLockFile::Private::lockFileOExcl(stat&)' at /builddir/build/BUILD/kdelibs-4.6.4/kdecore/io/klockfile_unix.cpp:284:63:
/usr/include/bits/fcntl2.h:51:26: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [kdecore/CMakeFiles/kdecore.dir/io/klockfile_unix.o] Error 1
make[2]: Leaving directory `/builddir/build/BUILD/kdelibs-4.6.4/x86_64-redhat-linux-gnu'
make[1]: *** [kdecore/CMakeFiles/kdecore.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Is there a new patchset available to test?
Comment 21 Raphael Kubo da Costa 2011-06-23 15:59:42 UTC
I think dfaure forgot to reopen the bug after reverting his commit (comment #17). Doing that now.
Comment 22 David Faure 2011-08-06 16:31:13 UTC
Git commit 10ca4ddc8cca49103c2d605a64468788605f3010 by David Faure.
Committed on 06/08/2011 at 14:53.
Pushed by dfaure into branch 'KDE/4.7'.

Implement locking on non-NFS systems using O_EXCL

Fixes locking on VFAT and CIFS etc.

The unit-test only tests local files automatically, but explains
how to set up test environments to test it on a FAT filesystem and on a NFS mount.

BUG: 203554

M  +182  -72   kdecore/io/klockfile_unix.cpp
M  +1    -0    kdecore/tests/CMakeLists.txt
M  +39   -5    kdecore/tests/klockfiletest.cpp

http://commits.kde.org/kdelibs/10ca4ddc8cca49103c2d605a64468788605f3010
Comment 23 David Faure 2011-08-06 16:33:18 UTC
Git commit 63b8ad8b7c6cc9845f11e5fbacf1a8cc9c977859 by David Faure.
Committed on 06/08/2011 at 14:53.
Pushed by dfaure into branch 'frameworks'.

Implement locking on non-NFS systems using O_EXCL

Fixes locking on VFAT and CIFS etc.

The unit-test only tests local files automatically, but explains
how to set up test environments to test it on a FAT filesystem and on a NFS mount.

BUG: 203554
(cherry picked from commit 10ca4ddc8cca49103c2d605a64468788605f3010)

M  +182  -72   kdecore/io/klockfile_unix.cpp
M  +1    -0    kdecore/tests/CMakeLists.txt
M  +39   -5    kdecore/tests/klockfiletest.cpp

http://commits.kde.org/kdelibs/63b8ad8b7c6cc9845f11e5fbacf1a8cc9c977859
Comment 24 Marcus 2011-08-08 14:01:25 UTC
Still get:

couldn't lock local file

on CIFS mounted share (whithout unix extensions, but mfsymlink support).

Greets
Marcus
Comment 25 Marcus 2011-08-08 14:33:14 UTC
Hmm, seems that the patch did not apply correctly.

CMake Error at cmake/modules/KDE4Macros.cmake:984 (add_executable):
  Cannot find source file:
    klockfile_testlock.cpp

I am now trying to build without the tests
Comment 26 Sandro Mathys 2011-08-08 20:16:50 UTC
Only builds if you additionally cherry pick klockfile_testlock.cpp from the commit in comment #17.
Comment 27 David Faure 2011-08-09 00:40:25 UTC
Missing test file added in commit f529824 in 4.7 branch, sorry.
Should all be ok now ;)
Comment 28 Bernhard E. Reiter 2011-08-11 09:12:55 UTC
Okay, we still need verification for CIFIS.
Comment 29 Sandro Mathys 2011-08-11 10:22:53 UTC
Works with CIFS user homes. Login to KDE desktop, changing system settings, open applications and change their settings all worked. Settings were still there after closing apps, logout-login, rebooting or on other systems with the same mounted home.

Tested with KDE 4.6.5 on Fedora 15 x86_64.
Comment 30 Bernhard E. Reiter 2011-08-31 15:13:25 UTC
This defect was fixed by KDAB and Intevation and 
the fix was funded by the IT Services of ETH Zurich.