https://bugs.kde.org/show_bug.cgi?id=76380

Daniel <danlemn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |danlemn...@gmail.com

--- Comment #62 from Daniel <danlemn...@gmail.com> ---
I took a look at the Freedestop specifications. I'm sorry David (Faure), but
there's something in KDE code that isn't right.

To quote the freedesktop specifications for Trash, regarding the .Trash-userid
folder:
https://specifications.freedesktop.org/trash-spec/trashspec-latest.html


"(2) If an $topdir/.Trash directory is absent, an $topdir/.Trash-$uid directory
is to be used as the user's trash directory for this device/partition. $uid is
the user's numeric identifier.

The following paragraph applies ONLY to the case when the implementation
supports trashing in the top directory, and a $topdir/.Trash does not exist or
has not passed the checks:

When trashing a file, if an $topdir/.Trash-$uid directory does not exist, the
implementation MUST immediately create it, without any warnings or delays for
the user.

When trashing a file, if this directory does not exist for the current user,
the implementation MUST immediately create it, without any warnings or delays
for the user."



There is no requirement there about certain restrictive folder permissions when
it comes to .Trash-uid folders (unlike the .Trash), there is only an
underlining of the immediacy of creating the necessary folder. Other DEs simply
ensure that the folder will be fit to write into. That's it.

Your implementation is just stricter than necessary. I did a comparison with
Gnome's approach. 

See Gnome's relevant code here:
https://gitlab.gnome.org/GNOME/glib/blob/glib-2-56/gio/glocalfile.c#L2083

And here's KDE's (thanks Fikri Muhammad Iqbal):
https://code.woboq.org/qt5/kf5/kio/src/ioslaves/trash/trashimpl.cpp.html#1190

While Gnome does try to make the folder 0700, they will still use it as long as
the uid is correct as they will be able to write into the folder, being aware
that for a FAT partition for example, permissions will not work. Even if you
are particularly sensitive about the security implications of such a trash
folder, you must admit that no major issue has arisen in more than 10 years
since other DEs have implemented it.

I think this really should be moving forward after 10 years. If one searches
online, there are many instances of users complaining about this issue, and
trying to find some kind of workaround. Some use /etc/fstab, others stick to a
straight delete policy (no moving to trash), which obviously is not ideal.

Keep in mind that most USB sticks and external HDDs, and even internal data
disks/partitions will use windows compatible file systems by default. And many
users will keep them that way because they dual boot or also use them with
Windows systems. Copying every deleted file from "data" to their /home Trash is
just the wrong approach, of which the freedesktop specifications seem well
aware. Many will have hundreds of GBs of data, but limited size SSDs for their
OS. An eventual HDD cleanup of old data will burn through their SSD writes,
take ages to complete, and eventually result in "/" being filled, with possible
stability consequences, because not everybody uses a separate /home partition.



In the mean time, for anyone bumping into this bug report, some workaround
tips, based on what was said by others above (the instructions do assume you're
using a Debian/Ubuntu based distro, unfortunately):

I. Using the terminal:

sudo nano /etc/fstab

Then add something like this to the file (edited of course to fit your
particular system, so you will need the Label or the UUID of your partition)

LABEL=LG /mnt/LG auto
nosuid,nodev,nofail,x-gvfs-show,uid=1000,gid=1000,umask=077,noauto 0 0

or 

UUID=cea8b9a9-9fd9-4e38-842c-57b9bdbdffdc /mnt/LG auto
nosuid,nodev,nofail,x-gvfs-show,uid=1000,gid=1000,umask=077,noauto 0 0

Then press

Ctrl-o - to save the file
Enter - to confirm the file name
Ctrl-x - to exit the editing session

For those not familiar with the terminal, there's GNOME Disks. 

sudo apt install gnome-disk-utility

Once installed, look for the "Disks" app. Find the partition you need to
operate on, click on the button that says "Additional Partition Options" when
you hover over it, disable "User Session defaults" then add
"uid=1000,gid=1000,umask=077,noauto" to the mount options.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to