Files in the root of a folder on another partition symlinked to user's home cannot be moved to trash because of a patch in this package

Bug #1638245 reported by Sadi Yumuşak
86
This bug affects 36 people
Affects Status Importance Assigned to Milestone
glib2.0 (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
Fix Released
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned

Bug Description

[ Description ]

Can't trash files if the directory they are in is a symlink to another device

[ QA ]

Steps:
1. Install system and partition disk into root and data partitions
2. create ~/Data folder, and mount data partition on it
3. create symlinks for ~/whatever/ to ~/Data/something/
4. delete files directly inside ~/whatever/

What happen:
Then Nautilus says: "File can't be put in the trash. Do you want to delete it immediately?".

What should happen:
The files moved into Trash.

[ Regression potential ]

The proposed fix uses g_stat instead of g_stat to follow symlinks, so we know where to place the trash (you can't rename() across filesystems). If that is wrong, then it could regress trashing other kinds of files.

[ Original ]

I'm on Ubuntu 16.10 64-bit with libglib2.0-0 version 2.50.0-1.

I've reported this bug (or marked as "it affects me") in a couple of other places before I've finally discovered that this is the package that's causing this problem, which unfortunately has been around for a couple of years now.

This bug has been reported upstream as well, but it's just taking very very long to arrive at a decision and take action it seems.

Apparently one of the patches (https://sources.debian.net/patches/glib2.0/2.50.1-1/0001-Fix-trashing-on-overlayfs.patch/) which is here (https://launchpad.net/ubuntu/+archive/primary/+files/glib2.0_2.50.0-1.debian.tar.xz) to the original package which is here (https://launchpad.net/ubuntu/+archive/primary/+files/glib2.0_2.50.0.orig.tar.xz) is the root cause of this annoying problem.

As I prefer keeping one patition for the root filesystem (/), one partition for user settings (/home) and one partition for user data (Documents, Downloads, Drive, Music, Pictures, Public, Videos) which are simply symlinked to my home folder for ease of use, I cannot move any file to the trash in the root of these folders when I access them from my home folder or nautilus sidebar.

This problem doesn't affect folders at all, nor any other files in subfolders, etc.

So I was wondering if Ubuntu devs can leave out that particular patch when building this package for Ubuntu - if it doesn't cause more harm, which I doubt.

Otherwise, I would appreciate if I could learn how to do it myself: how can I (as an end-user) compile the contents of "glib2.0_2.50.0.orig.tar.xz" with all the patches, etc. in "glib2.0_2.50.0-1.debian.tar.xz" except "0001-Fix-trashing-on-overlayfs.patch"?

Revision history for this message
Iain Lane (laney) wrote : Re: [Bug 1638245] [NEW] Files in the root of a folder on another partition symlinked to user's home cannot be moved to trash because of a patch in this package

On Tue, Nov 01, 2016 at 10:48:08AM -0000, Launchpad Bug Tracker wrote:
> So I was wondering if Ubuntu devs can leave out that particular patch
> when building this package for Ubuntu - if it doesn't cause more harm,
> which I doubt.

The patch is there for a reason - otherwise you can't delete on
overlayfs.

I have asked in a few places for specific steps I can follow from a
clean install in a VM to reproduce this problem so that I can try to fix
it. Nobody has yet given me them.

Can you provide that?

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

Thanks, I will try that. Maybe tomorrow, but you might be able to reproduce
this by creating a symlink in user home to a directory in another partition
(ext 4 or ntsf) and secondly going into that dir by clicking the symlink,
and thirdly trying to delete any file there (no subfolder).
On Tue, 1 Nov 2016 at 14:01, Iain Lane <email address hidden> wrote:

> On Tue, Nov 01, 2016 at 10:48:08AM -0000, Launchpad Bug Tracker wrote:
> > So I was wondering if Ubuntu devs can leave out that particular patch
> > when building this package for Ubuntu - if it doesn't cause more harm,
> > which I doubt.
>
> The patch is there for a reason - otherwise you can't delete on
> overlayfs.
>
> I have asked in a few places for specific steps I can follow from a
> clean install in a VM to reproduce this problem so that I can try to fix
> it. Nobody has yet given me them.
>
> Can you provide that?
>
> --
> Iain Lane [ <email address hidden> ]
> Debian Developer [ <email address hidden> ]
> Ubuntu Developer [ <email address hidden> ]
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1638245
>
> Title:
> Files in the root of a folder on another partition symlinked to user's
> home cannot be moved to trash because of a patch in this package
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/1638245/+subscriptions
>
--

Sent from a mobile device

Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

UPDATE:
1) The symlink can be created on the desktop as well (as long as it sits directly/really in the same partition as user home and not in another partition)
2) The symlink doesn't have to be pointing to a directory in the root of the other partition (on the internal HDD), it can be any directory or subdirectory in that partition; files in that target directory cannot be moved to trash while any of its subdirectories and/or subdirectory contents can...

I hope all this helps, otherwise I will be available this whole afternoon and evening (GMT+3) to further help reproduce it ( in realtime ;-)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glib2.0 (Ubuntu):
status: New → Confirmed
Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

Dear Iain,
Maybe the fix suggested here is all we need???
https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/1495781/comments/6
Thanks...

Revision history for this message
Iain Lane (laney) wrote :

That disables the patch?

Please please could you give me very very simple steps that will let me reproduce the problem in a VM. Explain what happens that is wrong and what should happen instead.

Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

Sorry I'm just a user, I don't know much about these source codes, I thought it was a fix, but if it simply forces skipping the patch, it's no good for you, of course ;-)

To reproduce the problem you need another partition other than the one where the user home directory is, and follow these simple steps:

1) Go to Desktop.
2) Create a symbolic link to any folder in another partition (or disk) in your computer (i.e. not removable media)
3) Click that symlink on your desktop to access that folder.
4) Create a new document there - any type of file, even empty, will do.
5) Press the Delete key to move that file to trash: you should see that message telling you it can't be done (although you can safely move any subfolder or any file in subfolders to trash, and although you can do it if you access that folder directly instead of going via that symlink on your home partition).

Revision history for this message
CzBiX (gliuwr) wrote :

Steps:
1. Install system and partition disk into root and data partitions
2. create ~/Data folder, and mount data partition on it
3. create symlinks for ~/whatever/ to ~/Data/something/
4. delete files directly inside ~/whatever/

What happen:
Then Nautilus says: "File can't be put in the trash. Do you want to delete it immediately?".

What should happen:
The files moved into Trash.

What I think:
The issue here is glib use parent dir(on another partition) to find Trash location, and move files from partition A(~/Data/something/xxx) to partition B(~/.local/share/Trash) failed by crossed device.

Revision history for this message
Iain Lane (laney) wrote : Re: [Bug 1638245] Re: Files in the root of a folder on another partition symlinked to user's home cannot be moved to trash because of a patch in this package

On Fri, Nov 11, 2016 at 11:01:57AM -0000, Sadi Yumuşak wrote:
> Sorry I'm just a user, I don't know much about these source codes, I
> thought it was a fix, but if it simply forces skipping the patch, it's
> no good for you, of course ;-)
>
> To reproduce the problem you need another partition other than the one
> where the user home directory is, and follow these simple steps:
>
> 1) Go to Desktop.
> 2) Create a symbolic link to any folder in another partition (or disk) in your computer (i.e. not removable media)
> 3) Click that symlink on your desktop to access that folder.
> 4) Create a new document there - any type of file, even empty, will do.
> 5) Press the Delete key to move that file to trash: you should see that message telling you it can't be done (although you can safely move any subfolder or any file in subfolders to trash, and although you can do it if you access that folder directly instead of going via that symlink on your home partition).

Ok, thanks, that sounds like something to try. I'll have a go next week.

--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]

Revision history for this message
Iain Lane (laney) wrote :

Please try ppa:laney/1638245 once the packages in there have built and let me know how it goes.

If still broken I would like specific, exact and simple steps to make the breakage happen, preferably in a clean VM or live session.

Cheers.

Revision history for this message
Iain Lane (laney) wrote :

(You'll need to restart after upgrading to the PPA)

Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

My problem disappeared after these upgrades, thanks a lot Iain!

Iain Lane (laney)
Changed in glib2.0 (Ubuntu Yakkety):
status: New → In Progress
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glib2.0 - 2.51.0-2

---------------
glib2.0 (2.51.0-2) experimental; urgency=medium

  * Merge changes from 2.50.2-2:
    + debian/rules: disable libmount on !linux (Closes: #844052)
    + debian/patches/0001-Fix-trashing-on-overlayfs.patch: Update with new
      version from the upstream report to hopefully fix trashing of files in
      directories which are symlinks to different devices. (Closes: #800047)
      (LP: #1638245)

 -- Iain Lane <email address hidden> Wed, 23 Nov 2016 17:36:07 +0000

Changed in glib2.0 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Sadi, or anyone else affected,

Accepted glib2.0 into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/glib2.0/2.50.2-2ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in glib2.0 (Ubuntu Yakkety):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

Thanks a million ! :-)

I selected libglib2.0-0 to be upgraded to the new yakkety-proposed version 2.50.2-2ubuntu1.
It automatically required also upgrading the existing libglib2.0-bin and libglib2.0-dev, and everything went OK.

Now I can trash files in the root of other symlinked partitions as well!

The only issue perhaps is that upgrading libglib2.0-0 to the new yakkety-proposed version 2.50.2-2ubuntu1 did not require upgrading libglib2.0-data as well.

Perhaps I didn't experience any problems only because I've already got it upgraded to a compatible version created by Iain (ppa) for testing purposes.

Changed in glib2.0 (Ubuntu Xenial):
status: New → Confirmed
tags: added: verification-done
removed: verification-needed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

I tested this in an Ubuntu GNOME 16.10 GNOME 3.20 64-bit VM and found that with the new update the issue goes away and the problem here is fixed. Although it should be noted that after updating to the new version it shows any mounted partitions with a long gobbledygook name in the sidebar when running Nautilus as root.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :
Revision history for this message
Sadi Yumuşak (sa-yu) wrote :

Hi Nikita, what you call gobbledygook is partition UUID it seems, which is strange. Could it be because those partitions have no label?

I see only partition labels as expected (for both internal and external, mounted and unmounted, drives) under Ubuntu 16.10 64-bit ( I tend to make sure that everyone is labelled properly ;-)

Revision history for this message
Svivi (svivi) wrote :

Hi,

Does anybody know when will be the updated glib2.0 included in xenial(-proposed)?

Thanks in advance!

Revision history for this message
Felipe Castillo (fcastillo.ec) wrote :

Is it safe to use the patched glib version from Ian ppa? I'm using Xenial and I really need this patch

Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Sadi, or anyone else affected,

Accepted glib2.0 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/glib2.0/2.48.2-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in glib2.0 (Ubuntu Xenial):
status: Confirmed → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
Revision history for this message
Svivi (svivi) wrote :

Hi Brian,

I tested the new package in Xenial from -proposed and it fixed the problem for me.

The glib version: 2.48.2-0ubuntu1

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glib2.0 - 2.50.2-2ubuntu1

---------------
glib2.0 (2.50.2-2ubuntu1) yakkety; urgency=medium

  * No-change backport of this stable release from unstable to 16.04 (LP:
    #1644320)
  * Should fix trashing of files in symlinked directories (LP: #1638245)
  * Should fix display of trash on external drives (LP: #1633824)

glib2.0 (2.50.2-2) unstable; urgency=medium

  * debian/rules: disable libmount on !linux (Closes: #844052)
  * debian/patches/0001-Fix-trashing-on-overlayfs.patch: Update with new
    version from the upsstream report to hopefully fix trashing of files in
    directories which are symlinks to different devices. (Closes: #800047)

glib2.0 (2.50.2-1) unstable; urgency=medium

  * New upstream release.
  * Track stable releases in debian/watch.

glib2.0 (2.50.1-1) unstable; urgency=medium

  [ Jason Crain ]
  * libglib2.0-bin: includes a new 'gio' commandline tool (Closes: #840164)

  [ Andreas Henriksson ]
  * New upstream release.

glib2.0 (2.50.0-2) unstable; urgency=medium

  [ Simon McVittie ]
  * Build-depend on tzdata, which is no longer transitively Essential.
    One test needs it. (Closes: #839487)

  [ Michael Biebl ]
  * Fix Vcs-* to point to unstable.
  * Mark dependencies which are required to run the test-suite with
    <!nocheck>.
  * Add explicit Build-Depends on xsltproc, docbook-xml and docbook-xsl.
    Besides libxml2-utils, those are needed for building the man pages.
  * Drop Build-Depends on dbus-x11. The test-suite uses a mock version of
    dbus-launch nowadays, so this dependency is no longer needed.
    (Closes: #835884)
  * Use dh-exec to substitute ${DEB_HOST_MULTIARCH} in .install, .links and
    .dirs files.

 -- Iain Lane <email address hidden> Wed, 23 Nov 2016 17:44:33 +0000

Changed in glib2.0 (Ubuntu Yakkety):
status: Fix Committed → Fix Released
Revision history for this message
Steve Langasek (vorlon) wrote : Update Released

The verification of the Stable Release Update for glib2.0 has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glib2.0 - 2.48.2-0ubuntu1

---------------
glib2.0 (2.48.2-0ubuntu1) xenial; urgency=medium

  * New upstream release (LP: #1637731)
  * debian/patches/0001-Fix-trashing-on-overlayfs.patch: Update with new
    version from the upsstream report to hopefully fix trashing of files in
    directories which are symlinks to different devices. (Closes: #800047)
    (LP: #1638245)

 -- Iain Lane <email address hidden> Thu, 24 Nov 2016 17:39:06 +0000

Changed in glib2.0 (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Aravind R (araviaravi) wrote :

My Current system is ubuntu 17.10. If I delete file under home it moves to trash. But if I delete file in other location. It dont go to trash

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.