After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 512144 - symlinks to folders are deleted recursively
symlinks to folders are deleted recursively
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: trash backend
0.1.x
Other All
: Immediate critical
: ---
Assigned To: Allison Karlitskaya (desrt)
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2008-01-25 23:03 UTC by Stefan Friesel
Modified: 2009-01-30 22:38 UTC
See Also:
GNOME target: ---
GNOME version: 2.25/2.26


Attachments
don't attempt to enumerate symlinks, even with no-follow set (1.15 KB, patch)
2009-01-30 21:01 UTC, Allison Karlitskaya (desrt)
none Details | Review

Description Stefan Friesel 2008-01-25 23:03:45 UTC
Please describe the problem:
When finally deleting a symlink to a folder, the contents of the folder are being deleted too.

Steps to reproduce:
1. Move a link to a folder to trash
2. Empty the trash
3. Data in the linked folder is gone


Actual results:
All files within the linked directory are being deleted

Expected results:
only the symlink is deleted, no other files

Does this happen every time?
yes

Other information:
Comment 1 Cosimo Cecchi 2008-01-26 12:24:41 UTC
Can't reproduce this bug with 2.21.6.
Which version of Nautilus and gvfs you have?
Comment 2 Stefan Friesel 2008-01-27 17:46:23 UTC
Nautilus version is a 2.21.6 too, gvfs 0.1.4-0
However, as i see now it doesn't happen with usual directories. the case for which the bug was filed was my ~/Music and ~/Pictures directories (unfortunately...), being both xdg-user-dirs and living on another partition. so one of those two might be the reason for the different behaviour. here are the commands which should reproduce the bug (with some partition mounted @ /mnt/data):

#as root (probably doesn't matter):
cd /mnt/data
mkdir Pictures
chown some_user_name Pictures

#as normal user
cd /mnt/data/Pictures
touch a
touch b
touch c
ln -s /mnt/data/Pictures/ ~/Pictures
#now go into nautilus, move the symlink to trash and empty it
ls
#the files a, b and c are gone
Comment 3 Alexander Larsson 2008-02-05 11:08:41 UTC
2008-02-04  Alexander Larsson  <alexl@redhat.com>

        * libnautilus-private/nautilus-file-operations.c:
	Don't follow symlinks when emptying trash (#513912)

Comment 4 Pedro Villavicencio 2009-01-30 20:01:23 UTC
seems to be an issue with nautilus 2.25.3 and gvfs 1.1.4 these steps reproduce the issue:

* create a folder on the desktop, create some documents inside.
* right click on the folder and select create a link
* move the link to the trash
* empty the trash
* go to the folder previously created on the desktop, folder is empty

However cannot reproduce the bug if i create a symlink with ln. Thanks.
Comment 5 Pedro Villavicencio 2009-01-30 20:02:13 UTC
there's also an Ubuntu report about it here: https://bugs.edge.launchpad.net/nautilus/+bug/323321
Comment 6 Allison Karlitskaya (desrt) 2009-01-30 20:54:23 UTC
the delete code in the trash says:

  enumerator = g_file_enumerate_children (directory,
                                          G_FILE_ATTRIBUTE_STANDARD_NAME,
                                          G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
                                          NULL, NULL);

let me guess: NOFOLLOW_SYMLINKS doesn't mean what i think it means here... (ie: a symlink to a directory is still followed and the directory contents are still enumerated...)
Comment 7 Allison Karlitskaya (desrt) 2009-01-30 21:01:49 UTC
Created attachment 127586 [details] [review]
don't attempt to enumerate symlinks, even with no-follow set
Comment 8 Allison Karlitskaya (desrt) 2009-01-30 21:03:41 UTC
completely untested patch
Comment 9 Allison Karlitskaya (desrt) 2009-01-30 21:20:26 UTC
Seb and I tested to confirm the patch fixes the bug.

Sorry about that, everyone. *covers face with bag*

Committed revision 2187.