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

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.

lundi, novembre 9 2009

Fuck you GNOME

I had to use GNOME today on a random computer. gnome-terminal was beeping all the time. I say no problem, I know how to disable this:

xset b off

It did not work... Hum. I go in the right menu and see a checkbox "Terminal bell". I click on it. All I got is all my terminal windows going away and:

gnome-terminal3557: segfault at 4 ip 0806f417 sp bf9fd000 error 4 in gnome-terminal8048000+3a000

No kidding. You don't want to use X standard ways and prefers to crash at my face. Fuck you.

lundi, octobre 19 2009

sysrqd 11

Just got a bug report (SIGPIPE when playing with nmap), so I released a 11th version of sysrqd.

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.

mardi, septembre 22 2009

Various news: what happend durring summer

It's been a while since I blogged about something. So here's a bunch of things I've done the last month.

Holidays

Well, I've been in holidays one week. :-P

awesome

There have been a huge number of changes between 3.3 (released in June) and 3.4 (almost relesed). I wrote a small but very useful object layer on top of Lua, which adds a class/object system a bit like gobject. I've also replaced all the hooks by per-class/object signals. Finally, the awesome Lua basement are cleaner than they were before, and the extendability is improved. How nice.

We're trying to release 3.4 (rc2 should be out soon), but the development pace is a bit slower than a year before. We're basically almost 2 months late on what was our previous release rate. Not a big deal however.

I've started working on 3.5 slowly. It gonna get amazing new features too. :-)

Google Summer Of Code 2009

I've mentored Mariusz Ceier on XCB GSoC. He worked on adding Xinput2 and XKB extensions. And he managed to do this. His work should be imported ASAP, the discussion has started on XCB maling list last week.

In exchange, Google offered me (and to every mentor) an awful blue t-shirt! Thanks Google! :-P

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.

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, octobre 3 2008

The eggtray problem

I still don't know why but many GTK+ applications use something called eggtrayicon. As far as I know, eggtrayicon.c is a file written in 2002 by Anders Carlsson which implements the Freedesktop.org system tray procotol for GTK+ applications.

Problem is that this C file is used in dozens of programs and maybe more, and is a bit bugged. I've already send patches for mail-notification and Audacious. pidgin is the first fixed implementation I found and works quite well. Many other applications are probably affected.

That seems to me like a real problem. Multiple copy of bad code instead of using native GTK+ system tray implementation.

So please stop using this bad implementation…

jeudi, septembre 18 2008

blah mail

Following my first idea of a blah script for irssi, I've wrote the same thing in Python for filtering some mail. IMHO, it's better than killfile.

  1 #!/usr/bin/python 
  2  
  3 import email, sys, re 
  4  
  5 def blaahw(match): 
  6     w = match.group(0) 
  7     l = len(w) 
  8     if l == 1: 
  9         return "o" 
 10     elif l == 2: 
 11         return "he" 
 12     elif l == 3: 
 13         return "lol" 
 14     a = "a" * (l - 3) 
 15     return re.sub("\w+", "bl%sh" % a, w) 
 16  
 17 def blaah(text): 
 18     rc = re.compile('\w+') 
 19     return rc.sub(blaahw, text) 
 20  
 21 mail = email.message_from_file(sys.stdin) 
 22  
 23 mail.replace_header("Subject", blaah(mail["Subject"])) 
 24  
 25 def blaah_payload(pl): 
 26     if type(pl) == list: 
 27         for i in range(len(pl)): 
 28             if pl[i].get_content_type() == "text/plain": 
 29                 pl[i].set_payload(blaah(pl[i].get_payload())) 
 30         return pl 
 31     elif type(pl) == str: 
 32         return blaah(pl) 
 33  
 34 mail.set_payload(blaah_payload(mail.get_payload())) 
 35 print(mail) 

Then can use a procmail rule like:

:0 fw
* ^From: asshole <asshole@asshole.com>
| $HOME/bin/blahmail.py

EDIT: I've updated it to a more robust version which support multipart messages.

mercredi, septembre 10 2008

Working on…

I've been quite busy last weeks, between real life and awesome stuff.

awesome 3.0 final release is getting closer. No more release candidate version should be expected since there's only 9 small patches into master from rc6. Final release should be out real soon now, before the end of the month. Also, the next branch already contains already nice stuff for the upcoming 3.1 version.

I've done some grunt work on XCB also, pushing other patches and fixing padding stuff in XML protocol description. This was very boring, but well, had to be done, so… I did it.

That's all for now. Stay tuned.

lundi, août 18 2008

Unexpected VARMon new release

This has been 4 years since I released a new upstream release of VARMon, the DAC960 administration tool.

There was a bug first discovered in #401236. It has been fixed in Debian with an ugly fix, which did not work finally for a long time. Recently #491505 got opened too, which was the same as the previous one. But this time I got access to hardware, thanks to Christoph! And I finally fixed the bug. I've even be able to test the fixes I wrote years ago for all of the compilation warnings.

That's a shame that the problem was caused by dead code from the previous upstream, and that I did not realize that sooner. Kids, do not let dead debug code in your program at home.

So I've finally been able to release a new 1.2.1 version which maybe the last release for the next decade! ;-)

mardi, août 12 2008

xulrunner hacking

I've discovered a tiny bug in Iceweasel yesterday, and I decided to fix it myself. So I'm proud to have opened bug #494694 against xulrunner with a patch!

That bring me to the tip of the day: if you are bored, I suggest you compile xulrunner and keep looking at the build log while it's building. There's so much gcc warnings that you'll get enthousiastic thinking:

« Argh, it'll fail… Oh no! That was just a bunch of warnings! Ahah this time it'll fail! Shit, just 764 warnings again in a row. Not so bad… ».

vendredi, août 1 2008

Releasing xcb-util 0.2.1

This morning I put on my Freedesktop hat and go ahead for a minor release of xcb-util.

This is the third release ever made of xcb-util, 2 years after the first one… It really needed some love.

lundi, mai 19 2008

Upgrading MediaWiki from PostgreSQL 8.2 to 8.3

With my server migration I switched from PostgreSQL 8.2 to 8.3. However, I've installed MediaWiki for the awesome wiki on 8.2, but dumping from 8.2 and restoring to 8.3 just failed because of the tsearch2 extension, which is now part of PostgreSQL 8.3.

With the help of my friend Dimitri, the pgloader author, I managed to migrate the database from PostgreSQL 8.2 to 8.3. Here is how I did.

This was done with MediaWiki 1.12, and I doubt that older version supports PostgreSQL 8.3.

Dump the database schema

First, you need to dump the database schema, and then, the database data. We need to do it in two steps because we need to change the schema a bit. I assume that MediaWiki is installed in the mediawiki schema:

% pg_dump -s -n mediawiki wikidb > wikidb-schema.sql

Convert the schema

Then, edit your wikidb-schema.sql. When you installed tsearch2, you probably did it in the public schema like I did. So it created two or three data types used by MediaWiki wich are named public.datatype. These tsearch2 datatypes are now part of PostgreSQL, so they're in the pg_catalog schema. You just need to replace a few lines with public.datatype with pg_catalog.datatype. For example public.tsvector is now pg_catalog.tsvector. For your information gin_tsvector_ops is now pg_catalog.tsvector_ops.

Finished? Good, but that's not all. You need to split up the file in two parts: one with the tables creation, and another one with the constraints creation. Why? Because otherwise the data insertion will fail because of these constraints. That's not so hard, just split your files in wikidb-schema.sql with all CREATE TABLE and so one, and then you see that the SQL file begins to do some ADD CONSTRAINTS, just put this in another file, named wikidb-constraints-schema.sql. You'll also need to set the namespace before executing command in your second file, so do not forget to add a SET search_path = mediawiki, pg_catalog; line at the beginning.

Dump the database data

That's easy:

% pg_dump -a -n mediawiki wikidb > wikidb-data.sql

Create your new database

That's easy too:

% createuser -S -D -R -P -E wikiuser #(then enter the password)
% createdb -O wikiuser wikidb
% createlang plpgsql wikidb

Restore the database

That's even easier, but you need to respect this order, otherwise it will fail:

# Restore schema first
% psql wikidb < wikidb-schema.sql
# Then restore dat
% psql wikidb < wikidb-data.sql
# Then restore constraints
% psql wikidb < wikidb-constraints-schema.sql

Run update.php

Just go the the maintenance directory. Then you can try to run update.php, but it'll fail.

% php update.php
[...]
Could not open "/var/www/awesome.naquadah.org/wiki/maintenance/postgres/archives/patch-tsearch2funcs.sql".

Well it seems that MediaWiki people just forgot this file in the 1.12 archive.. You can grab it on the SVN repository here. When you've put it in the good directory, really run:

% php update.php
[...]

You should see no error. And now it works.

Give us some kudos

This is the last and hardest part of this tutorial. Since everything works, you should give kudos to Dimitri and me. :-)

dimanche, mai 4 2008

OpenArena, comment que ca m'éclate

C'est à dire que j'avais un peu oublié Quake 3 Arena, tout ca, c'était du passé vous voyez. Et puis voilà que je tombe sur OpenArena, le jeu qu'il est forké de Quake 3 et qu'il est bien.

Alors OpenArena, c'est quoi ? C'est simple, ca ressemble à Quake 3, ca sent comme Quake 3, mais... c'est Quake 3 !@!#!

Alors évidemment, les puristes diront sûrement que non, mais en fait si. La seule différence, c'est que tous les graphismes, les joueurs, les objets, les cartes, ont été refaits à la main par les auteurs, étant donné que tout ceci n'a pas été liberé par ID Software.

Conclusion ? Ca fait juste un Quake 3 en beaucoup plus moche. Certains objects sont três bien fait (le Quad, le shotgun, le mega-health, les drapeaux, …), mais le reste est globalement vraiment pas beau. Les cartes ne sont pas sublimes non plus, ca manque de textures, de détails, etc.

Ceci dit, à part ca, ca reste du bon gros Quake, donc j'aime. Allez, je me suis même fait plaisir, j'ai jouer en tant que C4 pour défendre l'honneur, tout en mettant une claque aux gentils admins de TuxFamily qui ont leurs propres serveurs où vous pourrez peut-être me croiser quand je me détends !

jd on OpenArena

vendredi, avril 18 2008

Updating my .plan

I've been on holidays for one week now, breaking my usual workflow. Well, that allowed me to rest and to think about what I'd like to do and things I need to handle during next weeks.

The urgent things this next days will be my primary server replacement. It is currently dying, and I already had to change its power supply twice in a month. Unfortunately, I'm now at a point where I do not have any spare piece so if things go wrong again, I'm screwed. I need to collect some money and buy a new server, or maybe get a server if someone have an old or spare one to give me, I do not know yet.

On the awesome front, I'm about to release awesome 2.3, which will be the final minor release of the major branch 2. This will lead me to work on awesome 3 at a slower rate and a cooler pace.

Then, the thing I do not have to hurry for is awesome 3. There's no big problems in awesome 2, and the xcb-util stuff are not stabilized yet. After my gentle yelling on XCB mailing list, it seems that things will move but will slowly. So I do have time to make things right and do what I want on that branch, making bugfix release on awesome 2 if needed. You can read more about futur on my last post about awesome.

All this should give me some more spare time to work on the upcoming Debian release, lenny, which I'd like to work on. Two years ago (my god, time flies), we've done good work with the french cabal squashing critical bugs and I'd like to go back on this and squash asses again.

samedi, janvier 26 2008

Moving old projects to git

I finally did it.

Most of my small and personal projects (telak, sysrqd and mod_defensible) were maintained in my home-svn-repository. This had the side effect that I did not have a good overview of the current status of the project, and that I never though about tagging releases.

I used git-svnimport to move this stuff to git, with great success. Now, I see that only one release on three is tagged correctly, bad me. They are now on my git server.

But with a better tool like git I'm sure I will be more precise when I will work on that source code, so it was time to switch. And now my source code is public, which is far better than before.

- page 1 de 5