Thursday, July 5, 2007

Firefox and dark color schemes

So I changed my desktop color scheme to a dark theme. The only problem is, firefox takes from that color scheme when displaying websites, causing the websites to display incorrectly. In the Neutronium theme pack (found at gnome-look.org) it includes instructions on how to modify firefox to fix this issue. I just turned those instructions into a patch.

~Russ

P. S. Please note that this patch applies to the source, not to an install of firefox. In order to get it to apply to an install of firefox, change the lines starting at line two to
--- res/forms.css 2007-05-10 14:28:20.000000000 -0400
+++ res/forms.css 2007-05-10 14:30:18.000000000 -0400
and around line 105 to
--- res/html.css 2007-05-10 14:28:20.000000000 -0400
+++ res/html.css 2007-05-10 14:30:39.000000000 -0400

Patch - mozilla-firefox-dark-color.patch

Edit: The latest version of Neutronium includes a different, user specific, way of fixing this which you only need to put one file in your ~/.mozilla directory. This method is much cleaner and should be used instead. For information on it, download the Neutronium Unity theme pack and read the Instructions

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