On Nov 18 2012, archlinux openntpd-3.9p1-20-i686 package install script had a syntax error. An empty bash function (it seems) caused upgrade abortion. I thought I could intercept package decompression so that I can correct the script but pacman is fine grained and clean everything as soon as it can. So I used that as an excuse to mess with it using gdb. I never ran a real program in gdb before, not even one without debugging symbols, so it wasn't a breeze. After 10 minutes of useless `continue` I tried to locate function calls of interest. Not knowing the linux C ecosystem I started with a guess `mkdir`, then saw `mkdtemp`. I was monitoring /tmp for new entries made by pacman. But by the time I see a .INSTALL it's already too late. After poking through pacman github's repo, I saw new names but these are non loaded shared libraries and I don't understand how to declare a breakpoint on these. Anyway the script execution is done in a forked process, so the .INSTALL file still exists at the time a `b fork` will pop, that's where vim comes into play for a little on-the-fly monkeypatch.
tl;dr: gdb breakpoints on mkdtemp and fork leaves an open window to edit pacman's .INSTALL script, and successfully install this package, one that people on #archlinux consider obsolete, too late, I'll brag anyway.
references:
https://projects.archlinux.org/pacman.git/tree/lib/libalpm/util.c
edit: few wordings, and forgot the end. * facepalm *
Aucun commentaire:
Enregistrer un commentaire