Thursday, July 5, 2007

Getting involved with gmailfs

Seeing that a package maintainer has finally taken the gmailfs ebuild in gentoo, it can finally get included in portage! As a result, I decided to try to fix all the brokenness of the current gmailfs ebuild. After some *cough cough* "work" and other miscellaneous black magic, I created a couple of patches, and added a new feature!

Apparently, gentoo has a patch which changes the gmailfs log file from ~/.gmailfs.log to /var/log/gmailfs.log and it's config file from /etc/gmailfs.conf to ~/.gmailfs. Well this makes sense since gmailfs is a FUSE filesystem, and so is supposed to work for the unprivileged user. In their patch however, they forgot that python needs to call a helper function in order to interpret paths using the ~. My first patch fixes this (and a bug with how it detected failures to read the file).

My second patch addresses gmailfs' support for encfs. It seems that (at least with encfs-1.3.2.1) encfs needs absolute paths in order to mount in daemon mode (which gmailfs uses). Gmailfs does not cover this, and so my patch just expands the path you give it to an absolute path for encfs' sake.

In my final patch, I added the ability to have a global and a local config file. The files are /etc/gmailfs.conf and ~/.gmailfs with the latter overriding the values in the former. I then went and took the username/password/logfile settings out of the global file and placed them in the local. Please note that this patch requires that my first patch has been applied because it changes code created by that patch.

There are a number of things that bug me about gmailfs, but the largest one is that it seems that gmailfs was not designed with !root users in mind, and also does not work like a normal FUSE filesystem (it has a mount.gmailfs instead of using mount.fuse) so out of the box will not work for !root. I have contacted Richard Jones, the author of gmailfs, with my patches and the !root issue, and he has been responsive and helpful. The next release of gmailfs will include my patches, and through my discussions with him, he may change gmailfs' behavior to that of a normal fuse filesystem (I may try to help that along by fixing any bugs that pop up by making the change). This patch turned out to be much easier than I thought it would be.

Lastly, I have patched the gentoo ebuild to allow for !root use. It only symlinks /sbin/mount.gmailfs to /usr/bin, but it works. As I said above, I'm working on getting this done correctly, but it works for now. Look at the gmailfs bug in gentoo's bugzilla (link below) to get the ebuild.

In the end, I spent lots more time debugging and trying to understand gmailfs' strange code than I did coding.

~Russ

P. S. It seems that Richard is planning on setting up a project on sourceforge for gmailfs. Lets hope he gets that done soon =)

gmailfs bug in gentoo - sys-fs/gmailfs-0.2.ebuild (New Package)
Patch 1 - gmailfs-log-path.patch
Patch 2 - gmailfs-encfs-mount.patch
Patch 3 - gmailfs-multi-config.patch

4 comments:

Anonymous said...

I’d sweetie to ascertain that too!

Anonymous said...

Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also...

rH3uYcBX

Anonymous said...

I congratulate, your idea is very good

Anonymous said...

As a Newbie, I am always searching online for articles that can help me. Thank you

rH3uYcBX