Archive for April, 2008

FISL

Friday, April 18th, 2008

O FISL tá como sempre, muito bom, muito animado, a cada dois passos um conhecido, um amigo querido que não vejo à muito tempo =). Eu estava no processo de mudança pra BH quando o call for papers foi fechado, então não propus palestra nenhuma, mas acabei ajudando cordenando três mesas (2 delas sobre Java, e uma sobre Mozilla, mas eu prometi que não ia dar minhas opiniões pessoais sobre tais tecnologias lol =D).

A partir de agora não tenho mais nada de obrigação no FISL, só ver palestras legais (estou ouvindo Theodore Tso falando sobre ndiswrapper nesse momento) e me divertir. Conheci mais gente que trabalha com o Yves no Google e todos são muito interessantes e divertidos! Vi muita gente do MDS, também, e alguns amigos queridos que deixei em Brasília. Reencontrar o pessoal do Debian Brasil foi muito bom, também… muito tempo sem vê-los!

Do ponto de vista da produtividade: como sempre, praticamente inexistente. Se eu tinha alguma pretensão de programar alguma coisa para WebKit, isso ficou pra trás tem tempo. Pelo menos consegui ler uns capitulozinhos do livro de C++/QT4 que eu coloquei na minha bookshelf do Safari. Comecei a ler porque decidi que preciso conhecer mais de C++ para realmente entender o que estou fazendo com WebKit, e escolhi um livro que citasse QT4 por uma quantidade de motivos diferentes… entre eles o fato de que é bom conhecer seus peers ;).

Tem dias em que eu sinto vergonha de ser brasileiro…

Monday, April 14th, 2008

Pois é… lá vai a merda da justiça brasileira de novo fazer cagada, e censurar um domínio inteiro por motivos arbitrários… http://naoaobloqueio.wordpress.com/. Não basta fazer censura, o que já seria ridículo por si só, tem de fazer burrada.

Obviamente o juiz que expediu essa ordem judicial não tem a menor noção de como funciona a Internet e de como um bloqueio desse tipo é feito. Até aqui tudo bem. A parte assustadora é que ele também nem tentou saber.

History meme

Friday, April 11th, 2008

The most recent meme in Planet GNOME is listing your most used commands using a clever command line hack. Here are mine, for my own user, and my root account:


$ history|awk '{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head
115 ls
64 cd
48 svn
27 git
22 screen
20 rgrep
19 find
16 sudo
11 rm
10 less


# history|awk '{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head
185 dzhandle
36 ls
32 aptitude
29 screen
22 dpkg
21 vim
17 cd
13 dd
13 apt-cache
11 iwlist

This definately shows that I’ve been hard at work on a Zope/Plone project =). More on that later!

PolicyKit rules, and, when error handling bites you

Friday, April 4th, 2008

PolicyKit, as I said before, is the authentication/authorization framework that will finally replace the gksu hack with a real solution. I am playing with some test code to be able to perhaps contribute with that goal. Everything was going forward pretty nicely in my tests when I hit a blocker. I spent like two hours trying to figure out the problem. Here’s the code:


sender = dbus_message_get_sender(message);
pk_caller = polkit_tracker_get_caller_from_dbus_name(pk_tracker,
sender,
&dbus_error);
if(dbus_error_is_set(&dbus_error))
{
g_error("Failed to get caller from dbus: %s: %s\n",
dbus_error.name, dbus_error.message);
return NULL;
}

When my mechanism goes to check if the caller is allowed to run the action, I first need to get the caller, of course. That code was always failing with this error message:


** ERROR **: Failed to get caller from dbus: org.freedesktop.DBus.GLib.UnmappedError.CkManagerError.Code0: Unable to lookup session information for process '25594'

It took me a long time, and a lot of code reading on PackageKit to realize the real simple problem with my code: I was assuming that the DBUS error would only be set if polkit_tracker_get_caller_from_dbus_name failed, which is just not the case. The DBUS error was set, but the function actually worked, most probably getting the information it needed from some other thing than ConsoleKit. So that brings us to something like this:


sender = dbus_message_get_sender(message);
pk_caller = polkit_tracker_get_caller_from_dbus_name(pk_tracker,
sender,
&dbus_error);
if(pk_caller == NULL)
{
if(dbus_error_is_set(&dbus_error))
{
g_error("Failed to get caller from dbus: %s: %s\n",
dbus_error.name, dbus_error.message);
return NULL;
}
}

And, voi lá!