Yet Another Linus Torvalds Interview
And a good one, at that. Honest, in-depth, provocative. No bullshit, like Linus, where is Linux headed in the next 2000 years.
And a good one, at that. Honest, in-depth, provocative. No bullshit, like Linus, where is Linux headed in the next 2000 years.
Antonio Radici, mutt’s Debian maintainer kindly replied and asked me to open a Debian bug for fixing the mailto-mutt vs MATE issue. I nearly did it, but decided to do some further testing before. I already had three virtual machines installed: Xubuntu, Linux Mint Maya Xfce and Linux Mint Maya KDE. It turned out that the simplistic mailto-mutt implementation worked perfectly on all.
The reason? Their native terminal emulator either passes the rest of the command line after “-e” to the command called (konsole) or, if not, they come with a wrapper that does just that (gnome-terminal.wrapper, xfce4-terminal.wrapper). The only one missing this wrapper was mate-terminal.
So I wrote another email to Antonio, calling off the new Debian bug, which restored his optimistic outlook on life, the universe and everything. And I set out to write the wrapper. My first shot was a shell script to replace “-e” with “-x”:
#!/bin/sh while [ "$1" ]; do param=$1 shift [ $param = '-e' ] && param='-x' args="$args $param" done exec mate-terminal $args
Seasoned Unix veterans have already noticed it. Noobs will immediately and enthusiastically learn it: This wrapper works beautifully. Until you pass a parameter that contains spaces, that is.
The shell is a cool programming language, but it has this sometimes irritating habit of messing with and interpreting your special characters, instead of leaving them alone. Fortunately the late Dennis Ritchie invented a language called C, which includes the brilliant concept of the zero-terminated C-strings. Many people hate them, others adore them. But no one can deny the fact that they don’t mess with special characters:
#include <unistd.h> #include <string.h> int main(int argc, char *argv[]) { int i; argv[0] = "/usr/bin/mate-terminal"; for (i = 1; i < argc; ++i) { if (strncmp(argv[i], "-e", 3) == 0) { argv[i] = "-x"; } } execv(argv[0], argv); return 1; /* if exec returns, it's an error, baby */ }
Finally, I submitted the code into a new issue on the github page of mate-terminal.
I tried Linux Mint Maya KDE over the weekend in a virtual machine. It came after a brief tour of the Xfce edition. The latter does not really let me set a small and tasty window title bar without editing pixmaps of the window decoration. KDE in general is extremely configurable, apart from the size and colour of the… yes, the window decoration theme. But it left a good impression. Except that some KDE apps look so cluttered and tasteless compared to their Gnome2 counterparts. Step forward Ktorrent.
Switching back to the real machine’s MATE was such a relief. So I decided to debug my main niggle with this half-baked DE: the disfunctional “Email Link…” in Firefox, which just brings up Mutt in normal mode, instead of composing a new mail in it. Same for clicking mailto links anywhere.
First configure Firefox mailto:
handling. Edit, Preferences, Applications, mailto. “Mutt (default)” does not work as intended. So I set it to the recommended /usr/lib/mutt/mailto-mutt
which is just a wrapper to start mutt in a new terminal:
exec x-terminal-emulator -e mutt "$@"
It did not work either. I just checked, x-terminal-emulator
is just a symlink to a symlink to /usr/bin/mate-terminal
.
Next step: check whether Firefox really sends the mailto parameters to mailto-mutt. So I replaced it with a one-liner to copy the argument list into a log file.
echo "$@" > ~/mailto.log
That worked fine, the proper mailto URI was copied to the log file.
So it must be either the mate-terminal or the mutt invocation. I tried it manually without a new terminal first:
mutt `cat mailto.log`
Everything fine, mutt starts in email-compose mode. So it’s the mate-terminal, then:
mate-terminal -e mutt `cat mailto.log`
There you go! The mailto URI from the log file was now ignored. It turns out the -e option ignores the rest of the command line, it just takes one argument. Should have used -x instead, or quote the whole thing. Not that mate-terminal has a manual page. I looked it up in that of gnome-terminal on Ubuntu 10.04. Anyway, here it is:
mate-terminal -e "mutt `cat mailto.log`"
works fine. So the fix to mailto-mutt is this, watch the opening quote:
exec x-terminal-emulator -e "mutt $@"
Then, even though I don’t believe society exists at all, I tried to do the civil thing towards the so-called community and tracked down the origins of the bug.
/usr/lib/mutt/mailto-mutt
is part of the mutt package, version 1.5.21-5ubuntu2.
The original Debian package 1.5.21-5 has an identical mailto-mutt.
The only Debian bug about mailto-mutt is #576313 which contains an interesting observation:
On top of that, mailto-mutt doesn't handle body specifications properly. /usr/lib/mutt/mailto-mutt 'mailto:test?body=test' doesn't do anything, but mutt 'mailto:test?body=test' works just fine.
The “upstream tarball” (mutt-1.5.21.orig.tar.gz) contains no mailto-mutt whatsoever. So it’s a Debian bug. I emailed the maintainer about the bug and the fix.
It seems few people have time to fix real usability bugs in these chaotic years of the Linux desktop. And why? Because the brilliant GNOME Usability people decided to discontinue Gnome 2, the best desktop environment ever. It’s so incredible that it hurts.