develooper Front page | perl.perl5.porters | Postings from June 2016

Re: [perl #128295] Strange bug with -Dprefix=/usr and -Dversiononly

Thread Previous | Thread Next
Andy Dougherty
June 2, 2016 03:47
Re: [perl #128295] Strange bug with -Dprefix=/usr and -Dversiononly
Message ID:
On Tue, May 31, 2016 at 09:04:32PM +0100, Aaron Crane wrote:
> Father Chrysostomos via RT <> wrote:
> > On Mon May 30 17:19:13 2016, tonyc wrote:
> >> On Mon May 30 14:30:17 2016, sprout wrote:
> >> > I have tried installing perl 5.24.0 on an old PPC machine, with the
> >> > configuration below, but it installed the perl binary and the scripts
> >> > in /bin, even though I specified a prefix of /usr.
> >> >
> >> > I don’t know exactly which option is responsible for the bug, but I
> >> > do
> >> > find it really strange.
> >>
> >> I think it's caused by the hints on darwin, from hints/
> >>
> >> case "$prefix" in
> >> ...
> >> '/usr') # We are building/replacing the built-in perl
> >>         prefix='/';
> >>         installprefix='/';  # used to set installbin
> >>         bin='/usr/bin';
> >>         siteprefix='/usr/local';
> >> ...
> This looks like a Very Bad Idea, imho.

Yes, I agree.  If the user specified -Dprefix=/usr, changing it to /
seems wrong.  A better way to do this sort of thing is to do something
like openbsd does, which is to use a specific flag

     ./Configure -des -Dopenbsd_distribution

> AFAICT, hints/ has overridden the user's configured paths
> "forever", modulo some back-and-forth in summer 2003. But the
> impression I get from the Git history is that this has been done to
> make life easier for Apple building the perl installation that they
> actually supply as part of Mac OS. This strikes me as the epitome of a
> special-purpose requirement; we should not make all users building a
> Perl explicitly unpick path mangling that's needed only by Apple
> engineers.

> > In any case, I’m *not* trying to replace the system perl here (-Dversiononly), and I’ve used this incantation before.
> At the very least, hints/ must avoid overriding the user's
> chosen prefix under -Dversiononly.
> But I honestly can't see a good argument against simply jettisoning
> the path mangling in the "/usr" case in hints/ And I think
> this is a good time to do it: we've got a large fraction of a year to
> shake out any Mac OS build problems before the 5.26 freeze.
> If I don't hear a counterargument, I'll make that change in the next few days.

I agree with the sentiment, but I'd suggest wrapping it up in an
apple_distribution variable instead.

> > $ ../perl.git/porting/ -Dprefix=/usr --target --end v5.24.0 --match installbin=\'/usr
> > ...
> > 41d73075f0801c26794dadb1ff690f305d7e53a7 is the first bad commit
> > commit 41d73075f0801c26794dadb1ff690f305d7e53a7
> > Author: Ivan Pozdeev <>
> > Date:   Wed Aug 12 20:33:12 2015 +0300
> >
> >     Make -O behaviour the default
> >
> > I can’t see how that commit causes that.
> I share your puzzlement; I see signs of the same brokenness under
> 5.22, even when running Configure with the -O option. Though
> admittedly this is based on looking at the generated by
> Configure, rather than by building and installing.

What happened is that Father C specified -Dprefix=/usr, the hints
file changed both prefix and installprefix to '/', but then the -O
option re-instated the origin prefix=/usr setting. was then
left in the confused state where prefix='/usr' and installprefix='/'.
Obviously, that doesn't work well.  Prior to that patch, the -O option
didn't reinstate the command-line version of prefix, so both prefix and
installprefix were set to '/', which is at least consistent.

Having the -O switch as the default also makes Configure behave
differently if you specify -Dprefix on the command line versus specifying
it interactively at the Configure prompt.

I'm now wondering what else -O might break.

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About