Cyril Brulebois: Fixing synaptics on powerpc
(It s a new day, it s a new bug )
A regression appeared in the
synaptics input driver, between the
1.4.1 and the 1.5.0 release, as reported in Debian
#649002 by many users. Basically, no
more touchpad on PowerPC (hi, iBook G4 users!). :-(
What follows is how I tracked it down. The upstream bug report is
fdo#43728. Anyone could have
done so, there s no black magic involved. A little hint maybe: git bisect
is really easy on X drivers, since one can build and test
without the Debian packaging bits.
1st step: Getting started
You need sources and build dependencies, nothing fancy. Since packages
might be named a bit differently, there s a reference to the relevant
upstream repositories in debian/watch for X packages.
# You need git here:
debcheckout xserver-xorg-input-synaptics synaptics.git
cd synaptics.git
# Let s get the upstream tags and branches:
cat debian/watch
git remote add upstream git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
git fetch --all
# Let s install build dependencies:
sudo apt-get build-dep xserver-xorg-input-synaptics
2nd step: Reproducing
It was said 1.5.0 was the first known buggy version, so let s make
sure:
# Get the appropriate tag:
git checkout xf86-input-synaptics-1.5.0
# Prepare the build system:
autoreconf -vfi
# X finds its modules under /usr, not /usr/local:
./configure --prefix=/usr
# Build and install:
make && sudo make install
Now time to restart the display manager, and confirm that the pointer
is not moving bug reproduced.
Now let s check the 1.4.1 release isn t affected:
# Clean everything:
git clean -xdf
git checkout xf86-input-synaptics-1.4.1
autoreconf -vfi
./configure --prefix=/usr
make && sudo make install
And after a display manager restart, the pointer is moving again,
good! For reference, the log has very different lines about
appletouch, so it can be used to programmatically learn about the
status (good or bad).
3rd step: Narrowing it down
So, we have a known good version and a known bad version. Time for a
binary search to find the guilty commit which introduced that
regression!
git bisect start
git bisect good xf86-input-synaptics-1.4.1
git bisect bad xf86-input-synaptics-1.5.0
You don t even need to know that 1.4.x and 1.5.x live in different
branches, git figures that out for you:
Bisecting: a merge base must be tested
[de0dfb76444ad4160468d00515876c91a9fa20bf] synaptics 1.4.0
It s just a matter of running autoreconf && ./configure && make && sudo make install && sudo /etc/init.d/xdm restart
every step of the way, so it s pretty easy.
No wonder, 1.4.0 was working OK, so it can be recorded as such through
git bisect good, and the binary search goes between that commit and
1.5.0. After a few iterations of git bisect good and git bisect bad,
we get to the commit reported on the upstream bug.
As an extra bonus, mentioning the upstream bug number/URL in the
Debian bug means it can be marked as forwarded there and we ll
receive automatic notifications when its status changes, thanks to
bts-link.
Now, if you want to provide a patch for this bug, you may want to try
and revert this commit.
4th step: Providing a patch
Let s go back to the affected release and try to revert the guilty
commit:
git checkout xf86-input-synaptics-1.5.0
git revert 13543b156d78bc4d01a19844a5ee8f283269621b
Unfortunately, some later commits modified the affected areas so we re
running into conflicts:
error: could not revert 13543b1... eventcomm: replace synaptics-custom TEST_BIT with server's BitIsOn.
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
Let s try to understand what the
offending commit
did: it replaced a set of macros with a single one, taken from the
server. Both the old TEST_BIT() and the new BitIsOn() take 2
arguments, but the order is reversed. Reverting it should only be a
matter of introducing the TEST_BIT() macro again (along with the two
other ones it needs), and using it.
The problem is replacing all BitIsOn(foo,bar) with
TEST_BIT(bar,foo): foo and bar might not be trivial, they could
be complex C expressions, and a replacement in your favourite editor
might not get all occurrences right.
Thankfully, there s a nice tool to handle such things, called
coccinelle. I won t go into details,
just show how it can help here. Basically you just need to craft a
tiny patch, called a semantic patch, which describes what I wrote in
the previous paragraph. You only need to declare two expressions, say
a and b, and declare that all BitIsOn(a,b) must be replaced with
TEST_BIT(b,a). Here s the syntax:
@@
expression a,b;
@@
-BitIsOn(a,b)
+TEST_BIT(b,a)
Save it under testbit.cocci and apply it through spatch (from the
coccinelle package), asking it to perform in-place replacement
(we re in a git checkout copy, remember):
# Apply:
spatch -sp_file testbit.cocci -in_place .
# Profit:
git diff
Then you can run git commit -s, write a nice commit message, send it
upstream, and enjoy the rest of the night.
Coming soon to a mirror near you:
fixing commit.
As mentioned on the upstream bug report, I got the Debian reference
wrong in the commit message, I really meant
#649002.
I left you 2.5 months ago with the last question asked by my
applicaiton manager, Martin Michlmayr : "Please tell me about about yourself and what
you intend to do for Debian".
Interesting question to revisit now, indeed. Here is what I answered:
About myself first.
I'm a 40 year old project manager and system administrator working in French
National Aerospace Research Center. My best definition of my skills in
computing is "Know more or less about a Lot of Things and be a Specialist of
Nothing"...:-). I'm definitely not a programmer, nor a real system
administrator, nor a RDBMS administrator, nor a personal workstation
designer, though I do all of these daily. I think I'm perfect for finding
the good person for having a defined job done.
Besides this, I'm a genealogist for several years now. This is what finally
decided me to apply for becoming a package maintainer : there are some quite
good free genealogy software for Unix, though for various reasons they are
not used very widely, even Unix geeks (my main software for genealogy still
runs on Another Operatin System and is evertythig but free).I think that I
can bring something here to the Free Software World, by helping some of
these good programs in getting into the best Linux distribution I know....
For me, this is a mean for giving back to the free software movement what I
gives to me since I discovered Linux 6-7 years ago.
My very first intention as soon as I get my way into the Debian Developers
Heaven is adopting the Geneweb package currently maintained by Brent
Flugham. I'm in close contact with the author (who happens to be french,
which helps) as well as a daily user of it. The current package which is in
the distribution is already my work for a great part. I gave it to Brent,
the current maintainer and we both agreed that it would be better for me to
apply to becoming anofficial maintainer.
I also contributed to the package for lifelines, another genealogy software.
The last version of the package is also 80% my work, acknowledged by Javier,
the official maintainer. Concerning that package, I do not have "plans" for
adopting it (we didn't discussed of this with Javier, and I'm not sure I
could bring him that much things).
I came to Linux thanks to a great friend of mine, Ren Cougnenc. Ren opened
my eyes to the free software world when I still thought that it was only a
variant of free beers.
I got really involved into Linux when I forced me to remove any other
Operating System from my computer at work and tried to do my daily job with
Linux.
I have now succeeded at ONERA in getting free software to be accepted as a
credible alternative for important projects. At this time, especially for
server and network-related projects.
I absolutely cannot tell why and how I came to be a Debian user. I simply
don't remember. But I know why I am still a Debian user : this is a
distribution which is controlled by only one organisation--->its users. And
I want to be part of it.
Finally, I did not mention above the somewhat "political" nature of my
personal involvment into free software. Except for the physical appearence,
I think I mimic RMS on several points (though he probably speaks better
french than I try to speak english....which does not help for expressing
complex ideas like the ones above!).
As anyone can see, I was already very verbose when writing, sorry for
this. Funnily Martin summed this up in one paragraph when he posted
his AM report about my application. From what I see, also, my English
didn't improve that much since then. It seems this is a
desperatecause, I'm afraid.
Anyway, all this was apparently OK for Martin and, on July 21st 2001,
he wrote and posted his AM report and, on July 30th 2001, I got a mail
by James Troup:
An account has been created for you on developer-accessible machines
with username 'bubulle'.
bubulle@debian.org was born. Now I can more easily destro^W contribute
to my favourite Linux distro.
Indeed, I don't remember that much about the 2001-2003 years. I was
probably not that active in Debian. Mostly, I was maintaining geneweb,
for which I polished the package to have it reach a quite decent
state, with elaborated debconf configuration. Indeed, at that time, I
was still also deeply involved in genealogy research and still
contributing to several mutual help groups for this. This is about the
time where I did setup 
It has been a while since I blogged but I've been very busy, with my new job and this new blog!
New job!
I quitted my job last September, and found another one that I started in
October. I'm now the lead developer of
On Sunday, I 
When someone wants to package a piece of software for Debian, he has to file
an Intent to Package, by filing a special bug report against the
pseudo-package
Today I was idly performing some maintainence upon one of my hosts, and it crossed my mind to look beneath /etc in there I found:
Yesterday the Bug Squashing Party in Hildesheim, Germany started. I think
it's going well, according to the statistics of the #debian-bugs
channel, we solved 11 bugs with direct uploads, 2 with uploads to delayed,
5 via package removals and opened/upgraded only one. So we are still
fixing more than we break ;)
I'm especially pleased that some of the above was done by
This is my monthly summary of my Debian related activities. If you re among the people who
Dpkg: Multi-Arch Saga
I know lots of people are waiting the landing of multiarch in Debian unstable, and so am I. Things are progressing, though not as quickly as I hoped. Guillem merged about half of the branch between the 24th October and the 6th of November. After that most of the work happened on his personal repository in his 
I've released version 0.23 of

alt="imagine an xkcd-style infographic here"
0 seconds
