develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #48885] perl-5.10 config failure: broken filexp

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
September 13, 2013 08:55
Subject:
Re: [perl #48885] perl-5.10 config failure: broken filexp
Message ID:
20130913085457.GG66035@plum.flirble.org
On Thu, Sep 12, 2013 at 05:54:00PM -0700, James E Keenan via RT wrote:
> On Mon May 07 17:29:02 2012, jkeenan wrote:
> > On Wed Dec 19 11:47:55 2007, doughera wrote:
> > > On Wed, 19 Dec 2007, l . mai @ web . de wrote:
> > > 
> > > > This is what happens when I run perl-5.10.0/Configure:
> > > > 
> > > > ...
> > > > Installation prefix to use? (~name ok) [/usr/local] ~/usr/local
> > > > filexp: can't locate home directory for: 
> > > > Directory ~/usr/local doesn't exist.  Use that name anyway? [n]  

> > > > The bash documentation says:
> > > > |                          Each PATTERN undergoes tilde expansion,
> > > > |  parameter expansion, command substitution, and arithmetic
> > > > |  expansion.
> > > > 
> > > > So C<case "$1" in ~/*|~)> never matches '~' because the ~ is expanded
> > > > by the case statement. The fix is to put \\ before each ~ in
> Configure,
> > > > which causes \~ to be written to filexp.
> > > 
> > > Excellent diagnosis.  Thank you.  The code in question was actually 
> > > written over 20 years ago (you'll find it in perl1) and was written
> to be 
> > > executed under /bin/sh, which did not expand ~ at the time, so this
> > wasn't 
> > > an issue.  The problem has remained hidden because most users who try
> > this 
> > > apparently have /bin/csh installed, so the  /bin/csh -f -c "glob \$1"
> > > command did the right thing.
> > > 
> > > Your suggestion makes a lot of sense; we'll have to try it on some old 
> > > Bourne shells and make sure they don't complain.

> Configure mavens:  Is there still work to be done in this ticket?

No. It turns out that I independently figured out the cause of this bug about
3 months later, and that it dated from Perl 1.

[I had encountered it both on my girlfriend's laptop and on a shell account
on a friend's machine earlier, but until then hadn't worked out why it was
only those two machines. CSH considered harmful, for hiding our bugs from us
:-)]

I can see from a git blame of Configure that I pushed the first half of the
fix suggested here as change 33318 (commit f16e9d76b4f2d50c), and Merijn
effectively applied the second as

commit 4137585d161068477223a004b005a7b78ff03d8e
Author: H.Merijn Brand <h.m.brand@xs4all.nl>
Date:   Fri Feb 15 16:41:12 2008 +0000

    Resync with metaconfig. Escape the last ~.
    
    p4raw-id: //depot/perl@33321



I didn't realise that proper old-fashioned Bourne shells didn't expand ~
(And I didn't realise that the rules had changed for ~. I know that ^ used
to be |) so I didn't consider it as something that needed testing.

The fix appears to have been merged to maint-5.10 before 5.10.1 shipped,
and we've had no feedback that we broke it for anyone.

So we actually fixed this a long time ago, but didn't realise that there was
an open ticket for it. Sorry about that lack of feedback.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About