Bug 177023 - Support for NFS mounts in kio_trash
Summary: Support for NFS mounts in kio_trash
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: trash (show other bugs)
Version: 4.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-05 23:29 UTC by John Beranek
Modified: 2015-09-16 22:17 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Beranek 2008-12-05 23:29:39 UTC
Version:            (using KDE 4.1.3)
OS:                Linux
Installed from:    SuSE RPMs

Dolphin doesn't implement the "top directory" section of the freedesktop.org trash specification <http://www.ramendik.ru/docs/trashspec.html> which specifies a cross-desktop way to safely trash files in an environment where some filesystems are local and some are not.

This can create large problems in environments where home directories are central NFS (or other network file system) provided. A user then deletes gigabytes of data from their local filesystem, and this data is all moved to the networked home directory, quite possibly taking said user over quota.

Konqueror supports this behaviour, so this is a loss of functionality for people that may swap to using Dolphin from Konqueror.
Comment 1 John Beranek 2008-12-05 23:33:52 UTC
Hmm, at least KDE 3 Konqueror supported this behaviour, but it seems KDE 4 Konqueror does _not_. Another bug...
Comment 2 Peter Penz 2008-12-06 16:48:12 UTC
@David: I reassigned this issue to you, the specification mentions your name :-)
Comment 3 David Faure 2008-12-24 20:06:10 UTC
This report doesn't make much sense to me.
KDE3 konqueror, KDE4 konqueror, and KDE4 dolphin, all share the same code for trashing files, called kio_trash. There is definitely no loss of behavior when switching between konqueror and dolphin, when it comes to trashing, the exact same code is being used. Where you simply confused by Del vs Shift+Del shortcuts maybe? Or maybe you're hitting Bug 178479 (seems $topdir doesn't always work, but in my tests it does, please see the infos in that bug). But there's no reason that bug would affect dolphin and not konqueror or vice-versa.
Comment 4 John Beranek 2008-12-25 23:35:00 UTC
Well, I wasn't suggesting KDE3 Konqueror on the same machine works, as Fedora don't offer a choice between KDE3 and KDE4 from Fedora 9 onwards. I only know with previous KDE 3 versions on earlier Fedora releases trashing to $topdirs worked correctly and now it does not.

Permissions should not be an issue:

$ ls -ld  /.Trash
drwxrwxrwt 3 root root 4.0K 2008-07-09 10:55 /.Trash/

$ ls -ld  /
drwxr-xr-x 32 root root 4.0K 2008-12-10 15:18 //

If I delete a file on the / partition, it is moved to $HOME/.local/share/Trash, which is an NFS mounted home directory.

Bug 178479 does look pertinent, maybe I'll post my details over there.
Comment 5 John Beranek 2008-12-25 23:52:12 UTC
However, on my openSUSE 11.1 box that does have both KDE3 and KDE4 konqueror, both konquerors do show the fault:

$ rpm -qf /opt/kde3/lib/kde3/kio_trash.so
kdebase3-runtime-3.5.10-17.4

$ rpm -qf /usr/lib/kde4/kio_trash.so
kdebase4-runtime-4.1.3-4.1

The kio_trash libraries look to be completely different...
Comment 6 John Beranek 2009-05-01 16:43:16 UTC
With the recent activity in this bug, it should be noted that Bug 178479 concluded that the remaining issue was in kio_trash's use of _HAL_, and that HAL doesn't handle LVM volumes.

http://bugs.freedesktop.org/show_bug.cgi?id=6427
Comment 7 Maarten De Meyer 2012-06-10 19:34:13 UTC
(In reply to comment #6)
So this bug is fixed and can be closed now?
Comment 8 Jared B. 2012-06-10 19:48:02 UTC
No, it's not fixed.  Dolphin still (incorrectly) moves files deleted from a network share to ~/.local/share/.Trash rather than /path/to/share/.Trash-1000/.
Comment 9 David Faure 2012-12-14 15:57:48 UTC
There's definitely code for using such per-partition trash dirs, but I think the problem is that we use Solid to find the device associated with the partition (in order to use the device major+minor numbers as identifier for the partition), and this probably fails for NFS mounts. I'm not sure which identifier to use for those, though.

If anyone feels like writing a patch for this issue, see idForDevice() in kde-runtime/kioslave/trash/trashimpl.cpp, and the callers to that method (which use Solid::Device::listFromQuery). I *think* solid returns nfs mounts these days, but maybe not with the query used in this code, or if it does, then the issue is that idForDevice() returns -1 for NFS mounts.
Comment 10 David Faure 2013-04-22 09:31:49 UTC
Alex, this is the issue we discussed. Any numeric identifier we could use for a NFS mount?

Otherwise I guess we could generate them on demand and store them in a config file so that all instances of kio_trash share the same identifier for the nfs mount...
Comment 11 Alex Fiestas 2013-04-25 14:42:14 UTC
I don't have any nfs/samba share to test this right now, for those who have, can you execute:

solid-hardware list

then look at the returned list, when you see something that contains "fstab" execute:

solid-hardware details /fstab/....

That should show if we have any int we can use to identify the mount.

@david, do we have to use ints for this?
Comment 12 klangga 2013-08-21 23:21:03 UTC
*** This bug has been confirmed by popular vote. ***
Comment 13 klangga 2013-08-21 23:23:19 UTC
Here's mine. Hope this helps.

$ solid-hardware list
udi = '/org/kde/solid/udev/sys/devices/LNXSYSTM:00/LNXCPU:00'
udi = '/org/kde/solid/udev/sys/devices/LNXSYSTM:00/LNXCPU:01'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/hwC0D0'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0/net/eth0'
udi = '/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/net/wlan0'
udi = '/org/kde/solid/udev/sys/devices/platform/serial8250/tty/ttyS0'
udi = '/org/kde/solid/udev/sys/devices/platform/serial8250/tty/ttyS1'
udi = '/org/kde/solid/udev/sys/devices/platform/serial8250/tty/ttyS2'
udi = '/org/kde/solid/udev/sys/devices/platform/serial8250/tty/ttyS3'
udi = '/org/kde/solid/udev/sys/devices/virtual/net/lo'
udi = '/org/kde/solid/udev/sys/devices/virtual/sound/seq'
udi = '/org/kde/solid/udev/sys/devices/virtual/sound/timer'
udi = '/org/freedesktop/UDisks'
udi = '/org/freedesktop/UDisks/devices/sda'
udi = '/org/freedesktop/UDisks/devices/sdb'
udi = '/org/freedesktop/UDisks/devices/sda2'
udi = '/org/freedesktop/UDisks/devices/sda1'
udi = '/org/freedesktop/UDisks/devices/sda3'
udi = '/org/freedesktop/UPower'
udi = '/org/freedesktop/UPower/devices/line_power_ADP1'
udi = '/org/freedesktop/UPower/devices/battery_BAT1'
udi = '/org/kde/fstab'
udi = '/org/kde/fstab///ERDA/media'

$ solid-hardware details /org/kde/fstab
udi = '/org/kde/fstab'
  parent = ''  (string)
  vendor = 'KDE'  (string)
  product = 'Network Shares'  (string)
  description = 'NFS and SMB shares declared in your system'  (string)

$ solid-hardware details /org/kde/fstab///ERDA/media
udi = '/org/kde/fstab///ERDA/media'
  parent = '/org/kde/fstab'  (string)
  vendor = 'media'  (string)
  product = '//ERDA'  (string)
  description = 'media on //ERDA'  (string)
  StorageAccess.accessible = true  (bool)
  StorageAccess.filePath = '/storage/media'  (string)
  StorageAccess.ignored = false  (bool)
  NetworkShare.type = 'Cifs'  (0x2)  (enum)
  NetworkShare.url = 'smb://erda/media'  (string)
Comment 14 Valerii Malov 2014-01-05 10:55:34 UTC
This problem affects bind mounts as well. Maybe Solid is not the most suitable solution here?
Comment 15 Carl Gridley 2014-01-27 19:08:15 UTC
This affects my ZFS volume too. 

Took me a minute to figure out why deletes were so slow :-)
Comment 16 David Faure 2015-09-16 22:17:48 UTC
Git commit a7871885046394d577eeea8fa8991d30a046545f by David Faure, on behalf of Bartosz Sławianowski.
Committed on 16/09/2015 at 22:16.
Pushed by dfaure into branch 'master'.

Add support for network shares in kio_trash

kio_trash didn't support network shares, causing "trashed" files to be copied into user's home directory.

This patch adds support for them by assigning them persistent ID's (because
there is no device minor/major ID or any other integer we can use) which are
stored in trashrc config file - because we need to share them between
possible multiple kio_trash processes.

Network shares get ID's starting with 6000000 to avoid possible conflicts
with block devices.

NextID is also stored in trashrc file.
Change-Id: I5ad180d024fa61f026509435741d9967d97884c2
REVIEW: 125214
FIXED-IN: 5.15

M  +32   -2    src/ioslaves/trash/trashimpl.cpp
M  +7    -1    src/ioslaves/trash/trashimpl.h

http://commits.kde.org/kio/a7871885046394d577eeea8fa8991d30a046545f