jd:/dev/blog

Aller au contenu | Aller au menu | Aller à la recherche

vendredi, janvier 22 2010

On media players: 2 years after

Two years ago, I wrote about my switch from my beloved xmms to audacious.

During this 2 years with Audacious, I suffered a bit. It was working quite fine, but I saw no big progress around it. Life happened, and I had to use a network system to play music. I started to use PulseAudio over TCP, but it does not work well, and does not work at all with Audacious (and even if the plugin is provided by upstream). So I decided to dump it.

And some days ago I discovered Sonata, a MPD client. I never liked MPD so far because all clients I found were lame.

But I really like Sonata. It allows me to listen music the way I still want: load everything in one playlist, listen everything randomly or type a song/artist to jump to it directly in the current playlist. It even has some nice feature (lyrics, so I'll be able to song out loud, covers, tag editing…) and is written in Python and GTK+ (some days I may even hack it!).

You can rest in peace x11amp :-p

mardi, décembre 22 2009

Python cairo and XCB support

cairo has a Python binding (pycairo) since a long time, and some months ago a Python binding for XCB (xpyb) has been released.

Pycairo has no support for creating Xlib surfaces. You can get a Xlib surface from PyGTK and then use Pycairo to draw on it, but there's no way to create one directly.

What I've done is make Pycairo aware of xpyb so it can creates directly an XCB surface from a XCB connection and a drawable.

As said in my mail to the XCB list, I'm now waiting for a review before pushing this upstream. :-)

For the first time, I guess, XCB has beat Xlib support! ;-)

dimanche, décembre 20 2009

Teething troubles

It's not that often that I start something from scratch. It's an amazing feeling to start a new project, to start writing something new. I like that. It's creation, it's an artistic part of our computing stuff. I feel like a code artist.

And what I like even more is that little feeling that you are going in an unknown land. Some area in this tech world where nobody ever came before you, or only a few pioneers.

That the sensation I got starting to using Cython, Python 3 and various other tools. I just spent half of my time trying to fix problems, rather than working on *my* code. Problems in autoconf macro not knowing Python 2.6 or Python 3.1. Problems and limitations in Cython. And problem in Python.

That last one was a hard one. I'm still a beginner in the Python world: I barely know anything. And I was trying to use something nobody never did: building an embedded Python with a set of built-in modules.

I spent hours trying to find why one type of module importing was badly failing. I finally found the answer thanks to a guy. who has the same problem A guy ? No. A pioneer. What do I say? A hero. He's been my week-hero! Thank you Miguel Lobo because you found the bug I chased for hours and because you even reported it as issue 1644818, including a patch! How not damn wonderful is that?

I will not bore you with the technical details of that bug, since nobody cares. Nobody cares, even the Python guys, since that bug has been opened for 3 years, and nobody even reviewed in that time. I found an old thread about that bug where some guys were wanking about how they should do the review, because Miguel pushed for several weeks to have a review, back in 2007.

But that bug was in my way. I had to do something. So I prepared my mail reader, mounted my web browser and here I was for a uniq quest: getting a Python bug fixed.

At that point, if you did not stop reading earlier, you might get very excited. Don't be, spoiler, it's still not fixed. You'll have to wait the end of the season and see all the episodes I'll have to write to get the end of the story!

Let's continue.

I had to create an account on the Python bug tracking system. That was a trivial task for a man like me (you bet). Then, I launched a verbal attack, something you rarely see in a bug tracking system. Something I knew would awake any developer caring about their software.

Julien Danjou: Is there any chance to see this *bug* fixed someday?

I had the deep feeling that my quest was starting here. How many days would I have to wait until I get an answer? Time was passing. Minutes were ticking while I was waiting, sat in a comfortable sofa in a softly lighted room. It seemed like all my life was shorter than the delay I had to wait to get an answer.

After waiting for hours, suddenly, and only 15 minutes later, I got an answer:

Martin v. Löwis: Please ask on python-dev. I may be willing to revive my five-for-one offer.

Martin? Don't know that guy. Who is he? Who is he like? Will he fix that bug? What is this offer? So many question without an answer. But he asked to ask on python-dev, and I said: challenged accepted! I will write a mail to python-dev to get that bug fixed.

Which I did. I sent a short (but well written you know, I made efforts) "WTF?" to pyhon-dev.

And then the guy asked me to review 5 bugs so he will review and fix this one. And this is how I said that he was pissing me off for blackmailing me to fix a bug that was its "duty".

Therefore, this is the end of the story so far. Will that bug be fixed some day? There's a hope, because another guy jumped in and took the bug assignment.

To be continued.

My conclusion about all that story: that is a little rude to start something new, with new tools, and get quickly into teething troubles. It's even more harsh to enter a community because you just found bugs, and be not very well received when you ask to apply a 10 lines long fix somebody wrote 3 years ago to fix it.

I'll probably still use Python :-), but I get a darker image of its community now.

vendredi, octobre 2 2009

Courier to dovecot migration

This week, I've managed to migrate from courier-imap to dovecot at work. I always had a good experience with dovecot, and I still have one.

Dovecot performances are very good in comparison with courier. With that switch, we dropped the CPU usage of the server from 25 % to 10 %, and it's damn faster now. I have no idea why, but I think that it's better written looking at the code, and also that its usage of index files helps a lot.

We got no problem getting things work with public folders either, so the switch was almost painless.

The only problem we had is that Dovecot is too smart for some MUA. Consequently, we hit an 8 years old Mutt bug #969, which I also reported to the Debian BTS as #549204 with a not-well-tested-but-seems-to-work patch.

Thanks to Claws mail, we also found a bug in dovecot 1.2.5, which should be fixed soon. Dovecot upstream is very responsive and that's always something nice to know when you use a free software.

jeudi, juillet 9 2009

Upgrading to dovecot 1.2: hello Sieve!

Last year, I told you I wanted to use Sieve to filter my mail. I did not switch, because of the lacking implementation of some Sieve features inside Dovecot, my preferred IMAP server.

After that disapointement, I kept my 8 years old mail setup, being fetchmail running on my workstation and throwing the mails in procmail, then using mutt locally to read the maildirs. But that's over.

As I told you yesterday, I got a laptop to replace my workstation. It was not possible to continue using such a mail setup, since my laptop can be offline, and so would be my mails.

So I decided to upgrade Dovecot to 1.2. I used the dovecot-1.2-work Subversion branch of our lovely Debian maintainers, and built a Debian package for Lenny. The upgrade from 1.1 was almost painless, since the configuration file did not change heavily.

Then I started to write my little Sieve script. Sieve is a very nice language. Almost user friendly. So in 20 lines I rewrote all my procmail stuff, matching things like List-Id with regex to put the mails automagically in the right folder. I reconfigured mutt to use IMAP, and it works fine. I even reimported my old Maildir via IMAP using mutt too.

I am now a happy IMAP user.

For people wondering why I wanted to switch away from procmail to Sieve: the reason is that Sieve script can be uploaded remotely via managesieve. This means you do not need FTP/SSH/whatever access to put your script. You can, for example, use connect-sieve or the Sieve plugin for Thunderbird/Icedove.

samedi, avril 4 2009

Still working!

Well, I'm not dead buddies. I was overbooked.

Last weeks have been a bit busy for me. I've also been on holidays, so I gave up on computers stuff a bit.

awesome

Big news: awesome 3.2 has been released some weeks ago, and seems to be a success so far. We're working on the new 3.3 release, which will have some new sexy feature you'll love. More on that later.

Debian

I've uploaded a new awesome-extra package with third party modules such as shifty or wicked.

startup-notification

I just managed to be added in the startup-notification group at Freedesktop. I moved the CVS repository to git and merged my set of XCB patches.

jeudi, février 12 2009

sysrqd 10

I've just released sysrqd 10. I've rewritten big chunks of code, mostly because my C skills have quite improved between now and 4 years ago, and because I've blindly merged contributors patches which were crap.

mercredi, février 11 2009

OpenOffice is better as a pager than as a text processor

Since several month, awesome users have reported a bug with OpenOffice.org. When using OOo and clicking on a menu, or using the mouse wheel to read a document, the currently selected tag (desktop) will change automagically to another one.

I've digged into awesome and found that awesome received a _NET_CURRENT_DESKTOP request. As defined by EWMH, this kind of request are sent by a pager to change the active desktop.

That was weird. Nobody is using a pager here. So, I just kicked my gdb out, attached it to OOo, breaking on XSendEvent call. And I got it:

Breakpoint 1, XSendEvent (dpy=0x1a00080, w=483, propagate=0, event_mask=1572864, event=0x7fff1fd70d70)
   at ../../src/SendEvent.c:46
(gdb) bt
#0  XSendEvent (dpy=0x1a00080, w=483, propagate=0, event_mask=1572864, event=0x7fff1fd70d70)
   at ../../src/SendEvent.c:46
#1  0x00007f8c0ab4193f in vcl_sal::WMAdaptor::switchToWorkArea ()
  from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#2  0x00007f8c0aafdbd8 in X11SalFrame::Show ()
  from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#3  0x00007f8c1378623c in Window::Show ()
  from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#4  0x00007f8c13785f40 in Window::Show ()
  from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#5  0x00007f8c1372cb54 in FloatingWindow::StartPopupMode ()
  from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#6  0x00007f8c1373c877 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#7  0x00007f8c1373ccf2 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#8  0x00007f8c1373ce84 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#9  0x00007f8c13795e7f in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#10 0x00007f8c13797e74 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#11 0x00007f8c13796748 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#12 0x00007f8c0aafe6f8 in X11SalFrame::HandleMouseEvent ()
  from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#13 0x00007f8c0ab040c2 in X11SalFrame::Dispatch ()
  from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#14 0x00007f8c0ab31625 in SalX11Display::Yield ()
  from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#15 0x00007f8c0ab356f3 in ?? () from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#16 0x00007f8c0ab2df1f in SalXLib::Yield () from /usr/lib/openoffice/basis3.0/program/libvclplug_genlx.so
#17 0x00007f8c135b050e in Application::Yield ()
  from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#18 0x00007f8c135b0587 in Application::Execute ()
  from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#19 0x00007f8c17517e80 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libsofficeapp.so
#20 0x00007f8c135b4b24 in ?? () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#21 0x00007f8c135b4bc5 in SVMain () from /usr/lib/openoffice/program/../basis-link/program/libvcllx.so
#22 0x00007f8c1754ca6c in soffice_main ()
  from /usr/lib/openoffice/program/../basis-link/program/libsofficeapp.so
#23 0x000000000040105b in main ()

I started digging more into the code, and this is what I finally found in salframe.cxx:

       // #i45160# switch to desktop where a dialog with parent will appear 
       if( mpParent && mpParent->m_nWorkArea != m_nWorkArea ) 
           GetDisplay()->getWMAdaptor()->switchToWorkArea( mpParent->m_nWorkArea );

Beautiful! It even has a comment with a IssueZilla bug number. Let's go and see where it comes from.

After 10 minutes of research to find that fucking IZ, I finally found the link to the issue #45160. The bug is IMHO not related to OOo but to a window manager doing poor job.

I've found that an awesome user already reported an bug… err, wait, I mean an issue as issue #96684 (remember there's no bug in OOo, only issues) and I commented about it.

UPDATE: It seems OOo developers have agreed to fix that bug eventually.

jeudi, janvier 29 2009

What's new in awesome 3.2

We're working since several month on awesome 3.2, and here is what you'll get soon:

  • By wibox X cursor;
  • New mousegrabber infrastructure;
  • Client move with mouse is now in Lua;
  • New D-Bus hooks; you can also watch D-Bus events to get information like the song played in Audacious, or things like that;
  • naughty (notification library) now supports notification via D-Bus, following standard notification protocol;
  • Layout code moved to Lua;
  • Client gets a new mouse_leave hook;
  • Floating state is now handled on Lua side;
  • Windows groups are handled and exported to Lua API;
  • Various awesome markups have been removed in favor of widgets properties (simpler);
  • Shadow support has been removed (too buggy);
  • Add new telak module (draw image from the Web on your root window);
  • Add mouse move code for wiboxes;
  • Add functions to move clients with mouse to tags via the taglist;
  • Add support for key release events in keybindings;
  • Add support for input faking into client via XTest extension;
  • Add support for X selection retrieval (clipboard);
  • Add support for real transparency attribute on wiboxes;
  • Replace tile layout by a new layout (originally called 'vile') which supports resizing of slaves clients.

We've done a nice job. :-) Thanks to all contributors! See you soon for the first release candidate version…

startup-notification port to XCB

Since Tuesday, I've begun to work on XCB portage of the startup-notification library.

I've just completed the job, and send a bunch of patches to the XDG mailing list. My work is available in my startup-notification git repository.

If the patches are merged, which I don't doubt, I'll be able to use this lib into awesome, which would be nice step to the Freedesktop standard compliance I like to make.

mercredi, janvier 7 2009

The ignorance test

This is one of the most stupid test I ever encountered. It seems this sort of things happens when you have no clue about the technology you are talking about.

Just imagine the famous Road Runner. This benchmark is about measuring how fast is the animal below:

Meep meep!

Yeah, indeed, this is not a Road Runner.

mardi, décembre 30 2008

Rants about Lua

I've started using Lua some months ago, while looking for a more powerful way to configure awesome. At this time, around March 2008, Lua seemed to be the best language to integrate inside the core system of awesome.

I still think that Lua was a good choice, but after 8 months, it shows some important drawbacks.

I'll try to keep my explanation simple and to make you understand everything, even if you do not know Lua.

I refer here to Lua 5.1

Design flaws

Length operator

Lua has a length operator on its objects, known as #. It can be used to get the size of various objects.

return #"lol" 3

This operator works for table, string, etc… It's possible to define this operator by setting a __len meta-method on a userdata value.

The problem is that you cannot redefine it on string or table objects, see:

> a = { "hello", "world" }
> return #a
2
> setmetatable(a, { __len = function () return 18 end })
> return #a
2

Indeed, looking at the Lua core code:

     case OP_LEN: { 
       const TValue *rb = RB(i); 
       switch (ttype(rb)) { 
         case LUA_TTABLE: { 
           setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); 
           break; 
         }   
         case LUA_TSTRING: { 
           setnvalue(ra, cast_num(tsvalue(rb)->len)); 
           break; 
         }   
         default: {  /* try metamethod */ 
           Protect( 
             if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) 
               luaG_typeerror(L, rb, "get length of"); 
           )   
         }   
       }   
       continue; 
     }

You clearly see that tables and strings always use the internal length operator, never the __len meta-method.

That's for me a design problem, which will cause more trouble. We'll see later.

__index and __newindex metamethods

Lua defines two useful metamethods, which are __index and __newindex. Both can be set on a table or any other object. __index will be called upon each read access to an undefined key on an object, and __newindex upon each write access.

Example

> a = {}
> setmetatable(a, { __index = myindexfunction, __newindex = mynewindexfunction }) -- function are not defined, this is just an example
> a[1] = "hello" -- This will call __newindex metamethod
> return a[2] -- This will call __index metamethods
> return a[1] -- This will NOT call __index

The last line does not call __index meta-method because a[1] does exists. This is a problem when you want to use table as object, because sometimes you want to monitor access to the table elements.

This can be easily worked around using a proxy system: you don't store things in the table you manipulate, but in another table.

> a = {}
> realtable = {}
> setmetatable(a, { __index = myindexfunction, __newindex = mynewindexfunction }) -- function are not defined, this is just an example

Where meta-methods are something like:

function myindexfunction(table, key)
   return realtable[key]
end
function mynewindexfunction(table, key, value)
   realtable[key] = value
end

This way, our a table will always be empty, and realtable will have the data. At every read or write access to a, the meta-methods will be called. This is very convenient and widely used hack.

But this has serious drawbacks: as we saw before, the length operator (#) cannot be redefined on a table. That means #a will always be 0, and you cannot get the table length anymore, except by defining another method or a special attribute.

Also, Lua has several functions in the table library that are used to manipulate table in a easy way. The problem is that standard functions like table.insert or table.remove do raw accesses to the table. Meaning that if you do table.insert(a, 1, 1) it will insert the value 1 at the key 1 into a, without calling the __newindex meta-methods, breaking all your beautiful object-oriented model.

Another solution is to use a userdata object, like done in the Lua newproxy function (which is under-documented).

The problem is that it breaks all the other functions that are waiting for a table as argument, because they see a userdata, not a table. So this time table.insert is now more usable, which somehow fixes the problem, but not in the right way IMHO. However, this allows to use the __len meta-method.

Development model

The development model of Lua is, from my point of view, non-existent.

There is no public version control system repository available, so there's no chance to really contribute to Lua. It seems only a defined set of people work on it and therefore, the development system is very closed to my eyes, in comparison of usual projects.

Conclusion

I still think Lua is a good choice, because it is very easy to integrate into any C program, and to expand to fulfill your needs. However, some bad design choices were made, and the poor and closed development model chosen does not allow to have a good overview of the future of Lua.

This has been well stated by the authors themselves.

vendredi, décembre 12 2008

Using a Bluetooth headset under Linux

… is a no.

It just does not work. I mean, it does work if you want to listen to music using mplayer in 8 KHz quality, but don't even think to use it to phone using SIP.

I've first tested with bluez 3 which is part of Debian. It roughly work, but sometimes it stops working and you have to restart hcid, or to clean its cache. Not very stable.

I've then tried using bluez 4, compiled from scratch. It works much better, i.e. I can run mplayer a thousand of times without having it stopping to work, but I'm totally unable to use it with twinkle or ekiga.

And I don't even talk about ekiga still unable to set a custom ALSA output. I even try to hack it via gconf-editor!

That's really a shame.

samedi, novembre 22 2008

Security bug found in Imlib2

Yeah, I'm the proud discover of CVE-2008-5187.

It's my first time, it does mean something to me. ;-)

vendredi, août 15 2008

Documentation usefulness

I had this books since 2 years under my screens to raise them at work. Never though of opening them, I just realized what they are some days ago.

xlib-prog-man.jpg

That's probably why I became awesome without even knowing it. The truth is out there.

lundi, février 11 2008

Holidays and projects

Long story short: I'm busy.

These days are quite busy. I'm working (you know, I need to eat so I've a job), to the point that I have many vacation days to take. So I'll be in holidays and offline from friday for 10 days.

I'm still working on awesome developement. Code base is quite good now, so I don't do 30 commits/day anymore, and update are less frequent. It's very nice that the users base is increasing every day, without polluting the mailing list and the BTS with bug reports and request for documentation. That means we at least achieve to do a not-so-bad code with a not-so-bad documentation. The feature requests list is still a bit long, but I think it will decrease in the next weeks.

On a human side, that's the biggest project I ever managed and it's very pleasant to have so many users and contributors.

I've some more project I'd like to work too. I plan to write a small git stats generator in Python when I'll have some more spare time. I'd also like to do some developement work around LDAP and Python for my servers, but I did not find the courage to do it neither the good library to handle LDAP object correctly (a DB_Object way would be good).

I'm always following Debian developement with one eye, so I'm not totally out. I really hope I could to some bug squashing like I did with several Debian buddies 2 years ago for the etch release.

Stay tuned.

dimanche, décembre 17 2006

Easter-eggs sur Demain

Durant tout le mois de décembre, la chaîne Demain diffuse dans le cadre de l'émission Label entreprise une interview du gérant d'Easter-eggs, Pierre-Yves Dillard.

Et comme c'est là que je travaille, et que c'est intéressant de découvrir le fonctionnement un peu particulier de la SSLL Easter-eggs, j'ai mis la vidéo à disposition ici.

lundi, juillet 3 2006

You gotta work to feed the soul

After 5 years of holidays, studying computer science (mostly), I got a real job and began to work... 3 hours ago.

I finally accepted the offer that Easter-eggs made me at the end of my 4 months training. My work will mainly consists in doing sysadmin stuff, on servers running... Debian!

dimanche, avril 9 2006

Time Management for System Administrators

I just found this book.

Amazingly enough, if you read this book, your entire life will be transformed instantly and all of your problems will be fixed. You'll be better looking, too!

I should read it...

lundi, janvier 30 2006

Stage

EEVoilà, je viens de commencer mon stage aujourd'hui chez Easter-eggs, et cela s'annonce plutôt bien.

- page 1 de 2