2006-10-31

userspace filesystems

Once a year I do a "filemanager" poll: I check on the status of two-pane file managers, looking for something that resembles Total Commander, only in Unix.

This year I ran into gnome-commander while looking for a file-manager that would support libgnomevfs (with its exotic sshfs, smbfs and so on).

It strikes me odd, the fact that there is so much code duplication between user-space filesystem projects. There are three levels of userspace filesystem implementations on Linux software right now:
  • Virtual filesystems implemented within the file-manager (such as a virtual filesystem for tar.gz contents)
  • Userspace filesystems exported via libraries (and object broker services), to applications (such as gnomevfs sshfs module, or samba kio-slave)
  • Kernel-assisted userspace filesystems, accessible by all applications, but requiring manual setup (see FUSE-related projects)
Is there a way to unite these projects so that people don't have to write the same code over and over again? Shouldn't a newly mounted userspace filesystem, be available to all applications and not just the one that generated it?

More on this later.

2006-10-29

Eternity and a Day



This is Theo Angelopoulos' view on the crossing to the Other side. The frame says it all.

2006-10-24

for Badi

I love Badi Assad's music.

It is sincere, sweet and meticulously played.

Badi herself is a wonderful person. I had the chance of enjoying
one of her shows here in Athens last year. I hope she
visits us again soon..

This is her home on the web.

Her album Verde has a version of Bjork's Bachelorette
that still haunts me..

"if you forget my name..you will go astray..."

2006-10-23

Rebuilding freetype on Debian

My rather slow desktop (450mhz) is becoming more and more sluggish.

A friend insisted that I should try compiling [1] libfreetype for my machine. Debian uses "-g -O2" for the official libfreetype6 package, which I turned to "-O3 -march=k6-2" in debian/rules.

apt-get build-dep libfreetype6
apt-get source libfreetype6
cd freetype-2.2.1
vi debian/rules
dpkg-buildpackage -b -nc -rfakeroot
dpkg -i ../libfreetype*.deb


The optimisation flags helped a lot. Firefox seems a bit more lightweight now, gimp does font-kerning in 'no time' and gnome-commander displays directory entries much much faster.

I should note here that according to the info pages of gcc [2] -mmmx and -m3dnow do not add any optimisations to the source code. They simply enable the corresponding cpu operations in the form of builtin functions, such as:

v8qi __builtin_ia32_paddb (v8qi, v8qi)


kudos to vvas
[1] apt-build automates package building/upgrading on Debian
[2] pinfo is a nice browser for info pages btw..

2006-10-15

Catharsis (flushgmail)

When I got my gmail account I read the ad saying "this is a fantastic spot to subscribe to all your favourite mailing lists and never delete any email EVER". Saw I said, "ok, let's do that". I started subscribing to a few mailing lists (with lots and lots of traffic) and what do you know? 22k email messages on the first month. So I said "my bad, let's delete all these messages and I'll just read my news from tin as usual". But I found no way of doing this.

Months and years passed and not a single time did I use this account. Why? Because it was muffled with all these garbage messages. "Time to change this", Yoda said. So I looked at fetchmail's manpage to see if I could get rid of all messages in a POP3 mailbox (yes gmail now gives you POP3-SSL access). Guess what? You can't do this without retrieving part of the messages. I resorted to something like this:

fetchmail -v -a --ssl -p POP3 -u account@gmail.com pop.gmail.com --bsmtp /dev/null


"Oh, such inefficiency!" cried the young padowan and ran towards the masters.

I say, since we're still on Catharsis weekend, let's do a proper flush for gmail :)


flushgmail.pl
---------------------------------------------------------------
#!/usr/bin/perl -w

use Term::ReadPassword;
use Mail::Transport::POP3;

my $gmail_server = "pop.gmail.com:995";
my $stunnel_pid_file = "/tmp/flushgmail_stunnel4.pid";

die "usage: flushgmail.pl <localport>\n" unless(@ARGV == 1);

my $localport = shift @ARGV;

print "Enter gmail username: ";
my $username = <>;
die "error: no username provided!\n" unless defined $username;
chomp($username);

my $password = read_password(' gmail password: ');
die "error: no password provided!\n" unless defined $password;

sub report {
my $msg = shift;
print "flushgmail: $msg\n";
}

sub stunnel_shutdown {
my $msg = shift;
report($msg);
if (-r $stunnel_pid_file){
kill('TERM',`cat $stunnel_pid_file`);
}
}

sub sig_int_catcher {
stunnel_shutdown("stunnel emergency shutdown");
die "flushgmail: caught SIG_INT!\n";
}

$SIG{INT} = \&sig_int_catcher;

stunnel_shutdown("destroying old stunnel instances");

report("spawning new stunnel");
open(STUNNEL, "|stunnel4 -fd 0");
print STUNNEL << "STUNNEL_END_CONFIG";
pid = $stunnel_pid_file
[gmail]
accept = $localport
client = yes
connect = $gmail_server
STUNNEL_END_CONFIG

close(STUNNEL);

my $total_deleted_msgs = 0;
my $run = 1;
while(1){
my $pop3_conn = Mail::Transport::POP3->new(
port => $localport,
hostname => 'localhost',
username => $username,
password => $password);

unless (defined($pop3_conn)){
stunnel_shutdown("emergency stunnel shutdown");
die "error: could not connect to stunnel\n";
}

my $msg_cnt = $pop3_conn->messages;
last if ($msg_cnt == 0);
report("run #$run found $msg_cnt messages");

my @ids = $pop3_conn->ids;
$pop3_conn->deleted(TRUE, @ids);
$pop3_conn->disconnect;
$total_deleted_msgs += $msg_cnt;
++$run;
}

stunnel_shutdown("shutting down stunnel");
report("deleted $total_deleted_msgs messages");


To use the script you'll need Perl modules Mail::Box and Term::ReadPassword, as well as stunnel4 (cause Mail::Box doesn't support SSL natively yet).

If you're wondering why there's a loop around the POP3 connection.. I noticed that each time I connected to gmail, the pop3 server provided me with just a subset of my mailbox (ranging from 500 to 1200 messages) instead of the whole thing. Maybe this is the way gmail organises their mbox'es, in volumes of a certain size..

Catharsis

I'm going through some kind of catharsis weekend.

On Friday night, I watched "Empire of the Senses" a film about sexual obsession, at a film festival in Athens. This was followed by a Pilali/Poulikakos show (a blend of greek rock and rempetiko-blues) at RODEO club. The place had poor air conditioning, but the show was excellent. You don't get to see people dancing on tables in rock concerts and this was a first ("Τη μπετονιέρα μη τη κατηγοράς, αυτή σου δίνει για να φάς"). We took a cab to Psyrri square, to find our friends at Aspro. The groove penetrates your head cleansing the day's worries.

Woke up late on Saturday. Had to review the case of a defaced site, where the owner sued a big corp. Had a coffee with a colleague and went through the facts of the case. Admins are poorly paid in this country and are usually pressed to wear more than one hats (computer support technician, technical advisor, security officer etc.). Companies don't take administration seriously and security is something of an added-value service (usually provided by 3rd-parties). I don't want to
sound mean, but at some point there should be some sort of regulation for poorly maintained internet hosts.

Saturday evening found me at Theseum Theatre. Watched Superlux with a friend. Fantastic show. From what I hear, they'll be touring Europe soon :)

There was something bogging me all afternoon. I had to pop the Question.

[Mind you, the universe has no problem with you coming up with Questions, just as long as you don't require an Answer. If you _are_ looking for one, it will conspire in all its quantum glory and provide you with the shortest one.]

The Answer was "I don't know".

A glass of Drambuie, a couple of friends, Tapas coldcuts and a manic taxi driver made sure there were no more Questions before bedtime.

Today (Sunday) is election day. Met an old friend from school at the voting center (he still reminds me of Cartman :). Came back and continued working on my gmail flusher. Hmmm, haven't told you anything about it, have I? Check the next blog entry..

I'm off to pick up a friend from Larissis Station. The weekend is not over yet.