Trash not emptied with folders from other partitions

Bug #686564 reported by Tsu Jan on 2010-12-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cairo-Dock Plug-ins
High
Fabounet

Bug Description

When a folder from a partition other than the home partition is put into the trash, the trash can't be emptied with middle-clicking on the dustbin applet. I get an error like this:

------------------
vfs.c:cairo_dock_gio_vfs_empty_trash:1624) [0m
gnome_integration : Error removing file: Directory not empty
GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Error removing file: No such file or directory
------------------

The GError part can be fixed by using "g_file_delete (file, NULL, NULL)" in that section of the function "cairo_dock_gio_vfs_empty_trash", which is related to the deletion of info files.

To fix "Error removing file: Directory not empty", in the same function, I added "G_FILE_ATTRIBUTE_STANDARD_TYPE" to "cAttributes" and set the following condition in a proper place:

if (iFileType == G_FILE_TYPE_DIRECTORY)

{

 cairo_dock_gio_vfs_empty_dir (sFileUri->str);

}

I've attached a patch.

Related branches

Tsu Jan (tsujan2000) wrote :

Thanks a lot for this clear patch !
I apply it immediately on my branch :-)

2010/12/7 Tsu Jan <email address hidden>

>
> ** Patch added: "cairo-dock-gio-vfs.c.diff"
>
> https://bugs.launchpad.net/bugs/686564/+attachment/1758453/+files/cairo-dock-gio-vfs.c.diff
>
> --
> You received this bug notification because you are a member of Cairo-
> Dock Team, which is subscribed to Cairo-Dock Plug-ins.
> https://bugs.launchpad.net/bugs/686564
>
> Title:
> Trash not emptied with folders from other partitions
>
> Status in Cairo-Dock : Plug-ins:
> New
>
> Bug description:
> When a folder from a partition other than the home partition is put into
> the trash, the trash can't be emptied with middle-clicking on the dustbin
> applet. I get an error like this:
>
> ------------------
> vfs.c:cairo_dock_gio_vfs_empty_trash:1624) [0m
> gnome_integration : Error removing file: Directory not empty
> GError set over the top of a previous GError or uninitialized memory.
> This indicates a bug in someone's code. You must ensure an error is NULL
> before it's set.
> The overwriting error message was: Error removing file: No such file or
> directory
> ------------------
>
> The GError part can be fixed by using "g_file_delete (file, NULL, NULL)" in
> that section of the function "cairo_dock_gio_vfs_empty_trash", which is
> related to the deletion of info files.
>
> To fix "Error removing file: Directory not empty", in the same function, I
> added "G_FILE_ATTRIBUTE_STANDARD_TYPE" to "cAttributes" and set the
> following condition in a proper place:
>
> if (iFileType == G_FILE_TYPE_DIRECTORY)
>
> {
>
> cairo_dock_gio_vfs_empty_dir (sFileUri->str);
>
> }
>
> I've attached a patch.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~cairo-dock-team<https://launchpad.net/%7Ecairo-dock-team>
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~cairo-dock-team<https://launchpad.net/%7Ecairo-dock-team>
> More help : https://help.launchpad.net/ListHelp
>

Fabounet (fabounet03) wrote :

forgot to mention that the patch has been included, thanks again for your help!

Changed in cairo-dock-plug-ins:
assignee: nobody → Fabounet (fabounet03)
importance: Undecided → High
status: New → Fix Committed
Tsu Jan (tsujan2000) wrote :

BTW, as you may know, Trash applet can't remove files with names containing "%". Do you think that there's a bug in g_file_delete()? Is there any workaround in that case?

I didn't know.
is there a difference if the file is in the home dir, or if it's on another
volume ?
the '%' char is used to escape characters, so maybe there is a conflict
here, but I don't know on which side.

2011/1/26 Tsu Jan <email address hidden>

> BTW, as you may know, Trash applet can't remove files with names
> containing "%". Do you think that there's a bug in g_file_delete()? Is
> there any workaround in that case?
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/686564
>
> Title:
> Trash not emptied with folders from other partitions
>
> Status in Cairo-Dock : Plug-ins:
> Fix Committed
>
> Bug description:
> When a folder from a partition other than the home partition is put
> into the trash, the trash can't be emptied with middle-clicking on the
> dustbin applet. I get an error like this:
>
> ------------------
> vfs.c:cairo_dock_gio_vfs_empty_trash:1624) [0m
> gnome_integration : Error removing file: Directory not empty
> GError set over the top of a previous GError or uninitialized memory.
> This indicates a bug in someone's code. You must ensure an error is NULL
> before it's set.
> The overwriting error message was: Error removing file: No such file or
> directory
> ------------------
>
> The GError part can be fixed by using "g_file_delete (file, NULL,
> NULL)" in that section of the function
> "cairo_dock_gio_vfs_empty_trash", which is related to the deletion of
> info files.
>
> To fix "Error removing file: Directory not empty", in the same
> function, I added "G_FILE_ATTRIBUTE_STANDARD_TYPE" to "cAttributes"
> and set the following condition in a proper place:
>
> if (iFileType == G_FILE_TYPE_DIRECTORY)
>
> {
>
> cairo_dock_gio_vfs_empty_dir (sFileUri->str);
>
> }
>
> I've attached a patch.
>
>
>

Tsu Jan (tsujan2000) wrote :

That only occurs for files in the home dir.

For a file "a%b" in other volumes, sFileUri in cairo-dock-gio-vfs.c is of the form ".../a%25b", while if the same file is in the home dir, sFileUri is ".../a%b".

Tsu Jan (tsujan2000) wrote :

I forgot to add that if the file "a%b" is inside a folder in the home dir Trash, the Trash will be emptied correctly!

Fabounet (fabounet03) wrote :

good job ! :-)
I can find a workaround, however your latest remark makes me feel like it's
a bug in gio/gvfs.

2011/1/26 Tsu Jan <email address hidden>

> I forgot to add that if the file "a%b" is inside a folder in the home
> dir Trash, the Trash will be emptied correctly!
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/686564
>
> Title:
> Trash not emptied with folders from other partitions
>
> Status in Cairo-Dock : Plug-ins:
> Fix Committed
>
> Bug description:
> When a folder from a partition other than the home partition is put
> into the trash, the trash can't be emptied with middle-clicking on the
> dustbin applet. I get an error like this:
>
> ------------------
> vfs.c:cairo_dock_gio_vfs_empty_trash:1624) [0m
> gnome_integration : Error removing file: Directory not empty
> GError set over the top of a previous GError or uninitialized memory.
> This indicates a bug in someone's code. You must ensure an error is NULL
> before it's set.
> The overwriting error message was: Error removing file: No such file or
> directory
> ------------------
>
> The GError part can be fixed by using "g_file_delete (file, NULL,
> NULL)" in that section of the function
> "cairo_dock_gio_vfs_empty_trash", which is related to the deletion of
> info files.
>
> To fix "Error removing file: Directory not empty", in the same
> function, I added "G_FILE_ATTRIBUTE_STANDARD_TYPE" to "cAttributes"
> and set the following condition in a proper place:
>
> if (iFileType == G_FILE_TYPE_DIRECTORY)
>
> {
>
> cairo_dock_gio_vfs_empty_dir (sFileUri->str);
>
> }
>
> I've attached a patch.
>
>
>

Tsu Jan (tsujan2000) wrote :

I'm afraid you've put the following line at a wrong position after "if (cFileName && *cFileName == '\\')" in cairo-dock-gio-vfs.c:

   g_file_delete (file, NULL, &erreur);

It should be below this conditional:

   if (iFileType == G_FILE_TYPE_DIRECTORY)
   {
    _cairo_dock_gio_vfs_empty_dir (sFileUri->str);
   }

Otherwise, only the contents of a (nonempty) folder -- and not the folder itself -- would be deleted on emptying the trash of another volume.

Fabounet (fabounet03) wrote :

you're perfectly right, thanks ! :-)
by the way I've commited a patch for the '%' problem too.

2011/1/27 Tsu Jan <email address hidden>

> I'm afraid you've put the following line at a wrong position after "if
> (cFileName && *cFileName == '\\')" in cairo-dock-gio-vfs.c:
>
> g_file_delete (file, NULL, &erreur);
>
> It should be below this conditional:
>
> if (iFileType == G_FILE_TYPE_DIRECTORY)
> {
> _cairo_dock_gio_vfs_empty_dir (sFileUri->str);
> }
>
> Otherwise, only the contents of a (nonempty) folder -- and not the
> folder itself -- would be deleted on emptying the trash of another
> volume.
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/686564
>
> Title:
> Trash not emptied with folders from other partitions
>
> Status in Cairo-Dock : Plug-ins:
> Fix Committed
>
> Bug description:
> When a folder from a partition other than the home partition is put
> into the trash, the trash can't be emptied with middle-clicking on the
> dustbin applet. I get an error like this:
>
> ------------------
> vfs.c:cairo_dock_gio_vfs_empty_trash:1624) [0m
> gnome_integration : Error removing file: Directory not empty
> GError set over the top of a previous GError or uninitialized memory.
> This indicates a bug in someone's code. You must ensure an error is NULL
> before it's set.
> The overwriting error message was: Error removing file: No such file or
> directory
> ------------------
>
> The GError part can be fixed by using "g_file_delete (file, NULL,
> NULL)" in that section of the function
> "cairo_dock_gio_vfs_empty_trash", which is related to the deletion of
> info files.
>
> To fix "Error removing file: Directory not empty", in the same
> function, I added "G_FILE_ATTRIBUTE_STANDARD_TYPE" to "cAttributes"
> and set the following condition in a proper place:
>
> if (iFileType == G_FILE_TYPE_DIRECTORY)
>
> {
>
> cairo_dock_gio_vfs_empty_dir (sFileUri->str);
>
> }
>
> I've attached a patch.
>
>
>

Tsu Jan (tsujan2000) wrote :

Thank you for that neat workaround! It fixed the problem.

Changed in cairo-dock-plug-ins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers