Bug 480644 - SFTP: when saving a file in a folder, that does not have write permission, the file is saved as empty
Summary: SFTP: when saving a file in a folder, that does not have write permission, th...
Status: RESOLVED WORKSFORME
Alias: None
Product: kiofuse
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: a.saoutkin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-31 23:32 UTC by andriy.parhomenko
Modified: 2024-03-02 03:46 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andriy.parhomenko 2024-01-31 23:32:09 UTC
SUMMARY
As the title says, when saving a file in a folder without write permission (provided the file itself has this permission) results in empty file 

STEPS TO REPRODUCE
1. Mount a sftp location via kiofuse.
2. Open a text file in a Sublime Text, for example. The file must have write permission set for the user, but not the folder it is in.
3. Make changes to the file and try to save it.

OBSERVED RESULT
The file on the server is empty after saving.

EXPECTED RESULT
The file is saved (it has the write permission), or at least it is not corrupted and the proper error message is displayed.

ADDITIONAL INFORMATION
Maybe, this happens because of the bug, mentioned in TODO:
"Bugfixes:
- Check whether write access works before writing into the cache:
  Currently write access it not explicitly checked at all, possibly leading to data loss"
Comment 1 Harald Sitter 2024-02-01 07:05:08 UTC
Doesn't seem to happen with kwrite. Are you sure this isn't simply caused by sublime text?
Comment 2 andriy.parhomenko 2024-02-01 07:17:03 UTC
KWrite does not use kio-fuse, it uses kio, as far as I know. The problem is with non-kde software, which would use gvfs normally. Sublime Text works perfectly in Gnome.
Comment 3 Harald Sitter 2024-02-01 07:27:11 UTC
I obviously routed kwrite through fuse :)

gedit also works fine.
Comment 4 Fabian Vogt 2024-02-01 10:27:03 UTC
> Maybe, this happens because of the bug, mentioned in TODO:
> "Bugfixes:
> - Check whether write access works before writing into the cache:
>   Currently write access it not explicitly checked at all, possibly leading to data loss"

That shouldn't happen with sftp, which supports direct read/write and thus the file based cache isn't used.

That the folder needs write permissions implies that it wants to create a new file, probably for the create, write, rename dance. Creation and rename do perform proper access checks though in any case, as would f(data)sync.

Please try with "kio-fuse -d" (you might have to kill the running one first) and maybe even strace on sublime text.

My guess is that the create/write/rename dance is used, but the write for some reason doesn't happen successfully. That requires that creation was successful though, which contradicts missing write permissions on the containing folder.
Comment 5 Bug Janitor Service 2024-02-16 03:45:55 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2024-03-02 03:46:58 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!