Wednesday, March 29, 2006

Fixing GNOME's trash under NetBSD

For a very long long time (probably since forever), the trash icon in GNOME has not worked in NetBSD. You'd drag files onto it and they were appropriately deleted but, unfortunately, the trash did not update its status to reflect the removed files. If you opened the folder, it appeared empty despite ~/.Trash contained the deleted files. As you can image this was very annoying as it made the trash near to useless.

However, and by pure luck, some days ago I noticed that the trash icon showed some files on my machine. For a moment I thought that the problem had been fixed with GNOME 2.14.0. But I was wrong: ~/.Trash didn't contain the files shown in the trash window; the files were really stored in /vol/data/.Trash-jmmv. So why was it picking up the files from one directory but not from the other one?

I started by looking for the .Trash string in gnome-vfs which led me to a piece of code that returns the trash directory for a given volume. I first thought that there could be a problem detecting the home directory so I added some debugging messages there; everything looked correctly.

After digging some more and thanks to the test/test-volume test utility, I ended up in the libgnomevfs/gnome-vfs-filesystem-type.c file. This contains a table called fs_data that maps each file system name to a description and to a boolean. The boolean indicates whether the file system is supposed to hold a trash or not. As you can imagine, ffs was not part of this list, so the code felt back to the default values that specify that there was no trash.

Solving the issue was trivial. I just had to add the appropriate file system names to the table, rebuild gnome-vfs and experience the trash icon to its full power :-) The issue is reported in bug #336533 and is already commited to pkgsrc. Therefore, it will be part of the forthcoming pkgsrc-2006Q1 stable branch.

4 comments:

ghen said...

Haha, good job, Julio!

I found another issue with gnomevfs-on-NetBSD which works correctly on Linux: sftp:// URLS. I never seem to be able to get a connection to the ssh server, whereas this works fine with a Gnome/Linux live-CD, on the same machine, to the same host.

(sorry, don't ask me what exactly happens, it's been a while since I've used Gnome, but it happened every time I tried it.)

Julio M. Merino Vidal said...

It used to work for me, but that was around 2.6 or 2.8 if I recall correctly. I haven't tried with later versions, but will try it once I've reinstalled 2.14 from scratch (it's building now).

Were you using a ssh key? Did you have ssh-agent running? Did you ssh-add your key to the agent before trying?

You may want to file a PR so that this is not forgotten.

carney1979 said...

Thanks for the tip.

Using Gnome on Ubuntu Linux for AMD64.

Many are having the problem you reported here.

I have added your comments to the open bug report for this.

Again, thanks!

David

Julio M. Merino Vidal said...

carney1979: But the file systems used by Ubuntu under AMD64 are the same as those used in i386, aren't they?

If that's the case, I don't think this is related because the Trash icon works fine in an (my) Ubuntu/i386 install (using reiserfs). Maybe you are using some other file system, unknown to gnome-vfs?