Bug 441567 - Dolphin seems to allow rename for files owned by other users in directories with the sticky bit set
Summary: Dolphin seems to allow rename for files owned by other users in directories w...
Status: CONFIRMED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 21.08.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-26 12:04 UTC by 2wxsy58236r3
Modified: 2021-08-27 08:53 UTC (History)
2 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 2wxsy58236r3 2021-08-26 12:04:40 UTC
SUMMARY

Even though the user does not have write permission to a file, the rename option is still available and a new name can be entered. Then Dolphin silently fails to rename the file due to insufficient permission.

STEPS TO REPRODUCE

1. `sudo touch test.txt` to create a file owned by root with mode 644.
2. As a non-root user, rename the file via right-click menu or F2.

OBSERVED RESULT

File rename dialog pops up and the user can submit a new name.

The file will not be renamed because the user does not have write permission. However, Dolphin will not give any error message.

EXPECTED RESULT

Dolphin should disable the rename option if the user does not have enough permission, or at least output an error message that the rename operation failed.

SOFTWARE/OS VERSIONS

KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Comment 1 Paul Worrall 2021-08-26 18:04:14 UTC
The lack of write permission to a file does not prevent a user from renaming it (try it on the command line), and for me Dolphin can rename it as expected.

If the file is in a directory that the user has no write access to then the user can't rename it and the rename option is disabled in Dolphin.

So I cannot reproduce the bug as described. Please add more detail if there is a specific use case that shows the bug.

I'm using Dolphin 21.04.1
Comment 2 2wxsy58236r3 2021-08-27 03:53:47 UTC
After more testing, if I do it in /tmp (drwxrwxrwt root root) and have test.txt (-rw-r--r-- root root), the Dolphin bug can be reproduced. (`mv test.txt test2.txt` will fail)

If I create a directory in /tmp, e.g. testdir (drwxr-xr-x user users) and have test.txt (-rw-r--r-- root root), then `mv test.txt test2.txt` is OK.

So in the case of /tmp, I think there may be a bug in Dolphin.
Comment 3 Paul Worrall 2021-08-27 08:48:40 UTC
That's useful info.  I can reproduce an issue in this area:

For files *not* owned by the current user that are in a directory with the sticky bit set, e.g. /tmp, which prevents other users renaming files not owned by themself:

1. The "Rename" command is not greyed-out

2. Using the Rename command produces an "Access denied" message, which is good, but then appears to proceed to rename the file.  The user has to refresh the display to show the rename has failed.

3. If the user does not refresh the display but tries the Rename command again on the same file, nothing happens.

This is the behavior I see on Dolphin 21.08.0

EXPECTED RESULT
As the bug reporter suggests, if a user has no access to rename a file due to it being owned by another user in a sticky bit folder, the rename option should be greyed-out in a similar way to files that are in a folder which the user does not have write access.