Bisecting Perl to find when something broke (or was fixed!)

bisect.pl - 2013-12-13

So, it's Christmas Eve and you've decided now's the time to update production to the latest and greatest version of Perl. But since you don't want to spend your holidays fixing production, you decide to build Perl on your dev machine and run your ample test suite against it first.

One of your tests looks like this: (Why it has your production code in it I have no idea):

Bisecting to the rescue!

Thankfully, with a clone of the Perl git repository, we can answer this question. So first we grab a copy:

$ git clone git://perl5.git.perl.org/perl.git perl

In Porting/ you'll find a tool called bisect.pl. This is a nice wrapper around git-bisect(1) that will build Perl for each revision being tested and run your tests, telling you when your test first broke.

However, this script cannot be run from the Perl repository it is testing, so first we must make a copy of a clean checkout of blead:

$ git clone perl perl-2

And now we can bisect Perl from 5.8.8 (when everything worked) to 5.18.1 (when our world collapsed) and wait a very long time to get our results:

Grab an eggnog, wrap some presents, write your memoirs, this will take awhile.

Optionally, we can make this go a little faster, because we have an awesome computer that we got last Christmas, and it can do many things in parallel. We just add a -j option which gets passed to make(1):