Fernando J. Pereda’s blag

June 29, 2008

Mood change, I’m happy today

Filed under: blag — Tags: , — Fernando J. Pereda @ 7:18 pm

I’m quite happy today. Not because I had lots of fun at yesterday’s party, for which I’m completely dead after having danced salsa for more than 3 hours. I’m really happy because the Gentoo Infrastructure Team investigated what the Exherbo team reported (see details in my latest post).

This, incidentally, means that nobody can act like a sheriff with complete impunity. I won’t comment on the outcome of it, not because I dislike it, but because I think it wouldn’t be fair after all. If someone is interested, they can read the bug themselves.

Update: Alexander wrote a followup post about the whole thing: Follow-Up: Attack on Exherbo.org machine. I can’t do anything else than joining him in his thanks to the Gentoo Infrastructure Team.

— ferdy

PS: Some people have shown disagreement with the way I write stuff (not with what I write about). It seems I’m overly negative and bad publicity for Gentoo. If you feel that way, I apologise. My intention is to give information that I honestly think is relevant about both Gentoo and myself. I’ll try to be less negative in future, even though I’ll still post about what I think is relevant and/or important.

June 28, 2008


Filed under: blag — Tags: , , — Fernando J. Pereda @ 4:57 pm

I can’t find a different word to describe this situation. I’m usually very proud of being part of Gentoo, even if I don’t agree with every single thing Gentoo does (hey, unlike others, I’m able to live with people disagreeing). But what happened yesterday is really really sad and shameful.

The explanation is long but, fortunately, Alexander wrote a nice blag post explaining what happened:

Attack on Exherbo.org Machine

Do read it. It is important to know the kind of people you work with, and the kind of people you trust certain resources to. I hope Gentoo does something about this. It is of such a bad taste that I don’t want to get started… You can follow the process here: https://bugs.gentoo.org/229895 . I really do hope Gentoo does something.

— ferdy

June 27, 2008


Filed under: blag — Tags: , — Fernando J. Pereda @ 11:55 pm

Examples of poisonous people that only contribute to having a bad working environment includes:

* solar shitlists zlin ferdy peper on his ballot
<astinus> wolf31o2: agaffney: Seeing as there appears to be an arms
    race between $new_asshat_distribution developers who're still part of Gentoo and
    $non_asshats, consider yourself nominated for the non-asshats team on Gentoo Council

Fortunately, nobody cares about poisonous people, of course.

— ferdy

June 21, 2008

Sometimes, stuff goes wrong

Filed under: blag — Tags: , , — Fernando J. Pereda @ 4:55 pm

While doing some hacking on a virtual machine, VMWare decided to crash. After rebooting the computer (its kernel part was screwed up too) and restarting the virtual machine nothing seemed to work; rm, tr, sort and friends segfaulted.

The most interesting bit, however, was cat:

cat running parts of paludis?

Well, apparently paludis is to blame for this one too.

I ended up hardlinking lots of stuff to /bin/busybox and was able to rebuild paludis, coreutils and some other stuff. Everything seems to be working again. It is not the first time that an static build of busybox has saved me lots of pain.

— ferdy

June 11, 2008

How I migrated Paludis to Git

Filed under: blag — Tags: , , — Fernando J. Pereda @ 7:41 pm

Paludis has been using (and it currently still uses) Subversion to manage its source. We’ve been using git-svn for some months now and recently ciaranm agreed to fully migrate to Git.

To migrate the repository I used my old git-svn clone. This made some stuff a bit trickier, but it was both faster and nicer with pioto‘s server. Things that had to be done:

  • Remove ChangeLog and ChangeLog.old.bz2
  • Remove metadata added by git-svn
  • Rewrite authors and emails since I didn’t use an authors-file
  • Remove empty commits (these are commits that only touched ChangeLog or ChangeLog.old.bz2)

This looks like a good task for git-filter-branch. I probably could have done everything in one go, but I decided to do it one at a time.

Since filter-branch is mostly IO-bound, we’ll try to speed it up as much as possible:

$ sudo mount -t tmpfs -o size=100M none paludis/.git-rewrite
$ myrefs="0.4 0.6 0.8 0.20 0.24 0.26 ....."

The first task is easy:

$ git filter-branch -f --tree-filter 'git update-index --remove ChangeLog' $myrefs
$ git filter-branch -f --tree-filter 'git update-index --remove ChangeLog.old.bz2' $myrefs

To remove metadata created by git-svn I came up with:

tac | sed -n -e '1d' -e '/[^[:blank:]]/,$p' | tac

but dleverton came up with this perl one-liner, and I used it instead:

perl -ne 'print @blanks, $last and undef @blanks if defined $last; if (m/\S/) { $last = $_ } else { undef $last; push(@blanks, $_) }'

I put it in a file and ran:

git filter-branch -f --msg-filter ~/munge-commit-message $myrefs

Changing authors needed a script like the following (with proper mail-addresses):

case ${GIT_AUTHOR_NAME} in
        ciaranm)   n="Ciaran McCreesh"      ; m="foo@bar.com" ;;
        spb)       n="Stephen P. Bennett"   ; m="foo@bar.com" ;;
        halcyon)   n="Mark Loeser"          ; m="foo@bar.com" ;;
        allanonjl) n="John N. Laliberte"    ; m="foo@bar.com" ;;
        steev)     n="Stephen Klimaszewski" ; m="foo@bar.com" ;;
        kugelfang) n="Danny van Dyk"        ; m="foo@bar.com" ;;
        ferdy)     n="Fernando J. Pereda"   ; m="foo@bar.com" ;;
        arachnist) n="Robert S. Gerus"      ; m="foo@bar.com" ;;
        drizzt)    n="Timothy Redaelli"     ; m="foo@bar.com" ;;
        djm)       n="David Morgan"         ; m="foo@bar.com" ;;
        pioto)     n="Mike Kelly"           ; m="foo@bar.com" ;;
        piotr)     n="Piotr Rak"            ; m="foo@bar.com" ;;
        rbrown)    n="Richard Brown"        ; m="foo@bar.com" ;;
        baptux)    n="Baptiste Daroussin"   ; m="foo@bar.com" ;;
        eroyf)     n="Alexander Færøy"      ; m="foo@bar.com" ;;
        compnerd)  n="Saleem Abdulrasool"   ; m="foo@bar.com" ;;
        omp)       n="David Shakaryan"      ; m="foo@bar.com" ;;
        dleverton) n="David Leverton"       ; m="foo@bar.com" ;;
        peper)     n="Piotr Jaroszyński"    ; m="foo@bar.com" ;;
        dev-zero)  n="Tiziano Müller"       ; m="foo@bar.com" ;;
        zlin)      n="Bo Ørsted Andresen"   ; m="foo@bar.com" ;;
        buildtest) n="Nightly Buildtest"    ; m="foo@bar.com" ;;
        flameeyes) n="Diego Pettenò"        ; m="foo@bar.com" ;;
        iluxa)     n="Ilya Volynets"        ; m="foo@bar.com" ;;
        dercorny)  n="Stefan Cornelius"     ; m="foo@bar.com" ;;


git commit-tree "$@"

and ran:

$ git filter-branch -f --commit-filter ~/rewrite-authors $myrefs

Removing empty commits requires a bit more foo:

        while [[ -n $1 ]] ; do
                map "$1"

our_parent_tree=$(map $3)

if [[ -z ${our_parent_tree} ]] || [[ -n $(git diff-tree ${our_tree} ${our_parent_tree}:) ]] ; then
        git commit-tree "$@"
        skip_commit "$@"

This one could have just tested whether the current tree is the same as our parent’s tree (that is, no changes were made by this commit):

[[ ${our_tree} == $(git rev-parse $(map $3):) ]]

But it wouldn’t have made a big difference and I noticed it while filter branch was already running something like:

$ git filter-branch -f --commit-filter '. ~/empty-commits.bash' $myrefs

There’s still stuff to do like tags and adding scratch and probably converting the overlay; but the big thing is done. I think that history is stable already, that is, I won’t have to rewrite it again.

It is sitting in my home in bach and will be published soon.

Update: Re-tagging every paludis was the last step. I thought it was going to be cumbersome and boring, however, git makes this kind of stuff pretty easy. Since ciaranm should sign the tags himself, I did:

$ git log --pretty=oneline origin/releases |
> sed -n -e '/^\([0-9a-f]\{40\}\) Tag\( release\)\? \(.*\)/s--\3|\1|Tag release \3-p' \
> > ~/paludis-git-tags

After some hand editing of the file, creating the tags can be done with something like:

$ while read name msg head ; do
> git tag -m "${msg}" ${name} ${head} ;
> done < paludis-git-tags

To checkout an exact version (assuming ~/git/paludis is your repo, doesn’t have to be a local repo):

$ cd somewhere
$ git archive --format=tar --remote=~/git/paludis --prefix=paludis- 0.4.0 0.4.0 | tar xf -

— ferdy

June 9, 2008

Getting rid of ChangeLog files

Filed under: blag — Tags: , — Fernando J. Pereda @ 10:34 pm

There’s been some discussion on exherbo’s development list about getting rid of ChangeLog files. With the move of our repositories to git this would be easy.

This doesn’t mean users won’t see ChangeLog files, it means we won’t have to manually generate them. It has some improvements:

  • Maintaining ChangeLog files by hand is a PITA
  • People can’t void ChangeLog files, if you commit, it automagically goes to the ChangeLog.
  • We can easily link ChangeLog entries with Git history (by including commit hashes)
  • Cross-package/category commits become less annoying (because of the two bullets above)
  • The repository size doesn’t increase stupidly

Generatiing ChangeLog files is quite easy using Git, and can be done incrementally.

The cons…. I really don’t know whether those exist in this particular case :) If you can think of any, I’m all ears (or eyes in this case).

— ferdy

June 1, 2008

Security trivia III

Filed under: blag — Tags: , — Fernando J. Pereda @ 6:03 pm

People seem to like this kind of stuff, so here it goes. Take a look at this code:

#define MAX(a, b) ((a) > (b) ? (a) : (b))

struct st *dst, *src;
int size /* = some number of bytes you can control so that size >= 0 */;

/* Some code that sets up src and dst to valid buffers.
 * Everything but the last structure of src fits into dst. */

memcpy(dst, src, MAX(0, size - sizeof(struct st)));


  • What’s wrong with this code?
  • What environment do you need to exploit it?
  • Given such an environment, how can you exploit it?
  • How would you fix the code?

Remember, someone might have solved it in the comments. That could spoil the fun. You have been warned.

— ferdy

Blog at WordPress.com.