Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday July 30, 2009
05:46 AM

How To Downgrade Perl on Ubuntu

[ #39375 ]

Ubuntu has recently offered a Perl upgrade to 5.10 and I accidentally accepted the upgrade. Unfortunately, since our development Perl is 5.8.8, I've encountered a few annoying problems. Since many people are confused about how to do this, I decided to slog through and figure it out. Not fun. The answers to the various problems are scattered hither and yon, making this a very unpleasant process.

First, you need to get Perl and apply a regex patch which closes a security hole (many thanks to Rufus Cable for alerting me to the patch):

wget http://www.cpan.org/src/perl-5.8.8.tar.gz
wget ftp://ftp.cpan.org/pub/CPAN/authors/id/N/NW/NWCLARK/regexp-5.8.8.patch
tar xzf perl-5.8.8.tar.gz
cd perl-5.8.8
patch -p1 < ../regexp-5.8.8.patch
rm -f {config,Policy}.sh
sh Configure -de

Be sure to read the INSTALL file for more information about the Configure options.

At this point, everything should be fine, but you can't run make yet. Actually, you can run make, but it will likely fail. Fortunately, you can keep fixing errors and rerunning make until all errors go away.

The first problem is a strange "You haven't done a make depend yet" error. As it turns out, this is because Ubuntu has decided to link /bin/sh to /bin/dash instead of /bin/bash. It's a faster shell, but not only does it not support everything bash does, it also is less tolerant of errors. The makedepend file has an unterminated quote string, so doing this gets you over the first hurdle:

sudo ln -s /bin/bash /bin/sh

Be sure to change the symlink back after you're done if you want dash instead of bash (note that using a correct shebang line at the top of your bash scripts makes this a non-issue for you).

If you've already tried to run make, you might see this error:

makedepend: Already running, exiting

That's because it previously exited abnormally (anyone remember "abend"?) and left a .depending directory lying around. Simply remove this directory and rerun.

If you run make now, you might hit the second error:

No rule to make target `<command-line>', needed by `miniperlmain.o'.

Apparently, we filter out some of the gcc output, but it's changed over time and we missed this. The following fixes it:

perl -i~ -nle 'print unless /<command-line>/' makefile x2p/makefile

That command tells perl to edit those files in place, reprinting all lines except those containing the string <command-line>. If for some bizarre reason you don't yet have Perl installed (or if it's broken), you can edit those files manually, but it's tedious and error prone.

You can rerun make and it might be fine, but you might hit this error:

SysV.xs:7:25: error: asm/page.h: No such file or directory

Arg! I don't know what this is, but apparently it's related to the linux headers. What I don't understand is that I have them installed (sudo apt-get install linux-headers-$(uname -r)), but page.h is not symlinked in /usr/include/asm/. A locate '/page.h' | grep asm returned many candidates, but the most likely fix seemed like this:

sudo ln -s /usr/src/linux-headers-2.6.28-13/arch/x86/include/asm/page.h /usr/include/asm/page.h

Obviously, the exact page.h you're linking to will vary depending on your architecture.

Assuming all is well and make completes successfully, you can now run make test && make install and you'll have successfully downgraded perl (I would recommend you set your prefix when you run Configure to ensure that you don't overwrite the system perl. You can always set up a symlink to ensure you have the proper Perl running).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I would slap them upside the head just for that!

    • It'd be more useful too slap the people specifying /bin/sh in their shell scripts that rely on features of bash.
  • on a Debian based system line Ubuntu it should also be possible to revert the upgrade to bin/perl itself, reinstalling the older 5.8
    8 as bin/perl with the Debs, and pinning that version. this may rollback and block an expanding number of dependant upgrades, however.

    as is stated elsewhere, having app prod perl be OS bin/perl is dangerous, best to have your own.

    --
    Bill
    # I had a sig when sigs were cool
    use Sig;
    • as is stated elsewhere, having app prod perl be OS bin/perl is dangerous, best to have your own.

      Every time I think about this I am torn. I'm sure most people know the pros and cons of relying on the OS perl install. The big problem that I see is that my operating system provides me with an excellent package manager. A package manager that I have to use anyway, too.

      I've always thought it would be useful to have some standardized disto packages that provide an alternate Perl install.

      Debian and Ubuntu already have a pretty large percentage of the CPAN modules I need rolled up into packages. However,

  • Note to kids finding this on google: don't follow any of these instructions unless you like hosing your system.
    • Can you please be more specific? I do state that people should be setting PREFIX to avoid overwriting the system perl. Should that be highlighted sooner, I suppose. Are there other issues that users should be aware of?

    • Note to kids finding this on google: since this person never came back and bothered to offer any evidence to support their claim, you can probably ignore it. Personally, if there is a problem here, I'd love to know about it, but frankly, my Ubuntu system has been fine since I've done this.

      • Slashdot syndrome: he read the title but not the article. The title makes it sound like you're trying to literally downgrade the system perl, but you of course understand how to use PREFIX to install alternative perls.

        Thanks for writing this up, by the way: I've been trying to build an old perl, and I had pretty much blundered my way through to just before the last fix you have here-- and I was glad to see that you didn't understand where the problem came from either.

  • Hello, I have 64 bit Ubuntu 10.04 LTS. I want to downgrade it from 5.10.1 to 5.8.8. So is it safe to use this method? Thanks.