Bug 349610 - Cannot save files
Summary: Cannot save files
Status: RESOLVED FIXED
Alias: None
Product: libkeduvocdocument
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Kubuntu Linux
: NOR major
Target Milestone: ---
Assignee: Jeremy Whiting
URL:
Keywords:
: 360940 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-06-26 03:51 UTC by Leon Maurer
Modified: 2016-03-24 19:22 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Versions of qt5 and kf5 related packages (output of: rpm -qa kf5* qt5* | sort >kf5-qt5-versions.txt) (3.73 KB, text/plain)
2015-10-31 18:07 UTC, Damian Wrobel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leon Maurer 2015-06-26 03:51:15 UTC
If I try to save-as, I enter a filename and hit save, and then I get a popup error saying "File is not writeable." The file is not saved. However, if I try to save-as again with the same filename, I instead get the error "The file is locked by another process." -- even though the file does not seem to exist.

Reproducible: Always
Comment 1 Damian Wrobel 2015-10-31 17:57:35 UTC
I'm observing the same on the latest available version in Fedora 22:

$ rpm -qv kwordquiz
kwordquiz-15.04.0-1.fc22.x86_64

Steps to reproduce:
1. launch kwordquiz
2. Enter "foo" in Column 1
3. Enter "bar" in Column 2
4. Save as into ~/kwordquiz-test

Result: "File is not writable"

Reproducibility: 100%

It's not the filesystem issue:
$ ls -ls ~/kwordquiz-test*
$ ls: cannot access /home/dawid/kwordquiz-test*: No such file or directory
$ echo foo > ~/kwordquiz-test.kvtml
$ ls -ls ~/kwordquiz-test*
4 -rw-rw-r-- 1 dawid dawid 4 paź 31 18:55 /home/dawid/kwordquiz-test.kvtml
Comment 2 Damian Wrobel 2015-10-31 18:05:55 UTC
However the problem seems to be more generic becuase "parley" is also affected by the same issue and reports: Writing file "Untitled" resulted in an error: File is not writeable.
Comment 3 Damian Wrobel 2015-10-31 18:07:48 UTC
Created attachment 95239 [details]
Versions of qt5 and kf5 related packages (output of: rpm -qa kf5* qt5* | sort  >kf5-qt5-versions.txt)
Comment 4 Damian Wrobel 2015-10-31 18:14:05 UTC
stracing the kwordquiz during the attempt of saving a file gives the following output:

stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec2107f0) = -1 ENOENT (No such file or directory)
lstat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210700) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210780) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210700) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210560) = -1 ENOENT (No such file or directory)
stat("/home/dawid/kwordquiz-test.kvtml", 0x7fffec2105b0) = -1 ENOENT (No such file or directory)
lstat("/home/dawid/kwordquiz-test.kvtml", 0x7fffec210720) = -1 ENOENT (No such file or directory)
open("/home/dawid/kwordquiz-test.kvtml", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop.lock", O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0644) = 19
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210470) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210670) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210580) = -1 ENOENT (No such file or directory)
stat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210580) = -1 ENOENT (No such file or directory)
lstat("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0x7fffec210570) = -1 ENOENT (No such file or directory)
open("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop.h25416", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 20
rename("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop.h25416", "/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop") = 0
chmod("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop", 0600) = 0
unlink("/home/dawid/.local/share/RecentDocuments/kwordquiz-test.kvtml.desktop.lock") = 0
open("/home/dawid/.local/share/stalefiles/kwordquiz/kwordquiz-test.kvtmlfile_file%3A%2F%2F%2Fhome%2FdawidX.d25015.kalock", O_RDONLY|O_CLOEXEC) = 19

It looks that there is no single attempt to really create the "/home/dawid/kwordquiz-test.kvtml" file.
Comment 5 Christof Hanke 2015-12-01 12:50:51 UTC
I can comfirm this.
The problem is in libkeduvocdocument.

The saveAS()-method of the KEduVocDocument-class creates an QUrl from another url, but it should do it from the QString Path of the local file.
Otherwise it tries to store files like "file:///blah.bla" on the local filesystem.
This usually fails, since the directory "file:" is not existant in the CWD.

 
The patch which works for me is :

libkeduvocdocument/libkeduvocdocument-15.08.3/keduvocdocument> diff -u keduvocdocument.cpp.orig keduvocdocument.cpp
--- keduvocdocument.cpp.orig    2015-03-19 16:35:18.000000000 +0100
+++ keduvocdocument.cpp 2015-12-01 13:45:16.618816540 +0100
@@ -317,7 +317,7 @@
         return FileIsReadOnly;
     }
 
-    QUrl tmp( url );
+    QUrl tmp( url.toLocalFile() );
 
     if ( ft == Automatic ) {
         if ( tmp.path().right( strlen( "." KVTML_EXT ) ) == "." KVTML_EXT )



DISCLAIMER:
I have _no_ experience in debugging KDE-apps. I am just interested in parley.
Comment 6 Vladimir Lopatin 2015-12-27 15:43:22 UTC
It looks like the problem is solved, by cleaning stalefiles:

rm -rf .kde4/data/stalefiles/*
rm -rf .local/share/stalefiles/*
Comment 7 Joel Koreth 2016-01-16 03:21:14 UTC
Problem has not been resolved by deleting the listed directories here.
Comment 9 Rex Dieter 2016-02-15 19:19:23 UTC
I can confirm the small patch in comment #5 works as advertised (tested with kwordquiz successfully saving now)
Comment 10 Rex Dieter 2016-02-15 19:26:16 UTC
fix from bug #356233 works too, but it was committed only to master/ branch
Comment 11 Rex Dieter 2016-02-15 19:27:14 UTC
triaging to libkeduvocdocument
Comment 12 Jeremy Whiting 2016-02-15 21:02:52 UTC
Ok, cherry-picked 0cb9b9aea2264fc66d25fb6d93adc32c75dfef97 from master to Applications/15.12 branch, so it will be in Applications 15.12.3 release next month.
Comment 13 Christoph Feck 2016-03-24 19:22:11 UTC
*** Bug 360940 has been marked as a duplicate of this bug. ***