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

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

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 13, 2013 00:54
Subject:
[perl #48885] perl-5.10 config failure: broken filexp
Message ID:
rt-3.6.HEAD-1873-1379033640-1577.48885-15-0@perl.org
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]  
> > > 
> > > Here's why it happens:
> > > filexp is generated by Configure line 3589:
> > > cat >filexp <<EOSS
> > > $startsh
> > > : expand filename
> > > case "\$1" in
> > >  ~/*|~)
> > >     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
> > >     ;;
> > >  ~*)
> > >     if $test -f /bin/csh; then
> > >         /bin/csh -f -c "glob \$1"
> > >         failed=\$?
> > >         echo ""
> > >         exit \$failed
> > >     else
> > >         name=\`$expr x\$1 : '..\([^/]*\)'\`
> > >         dir=\`$sed -n -e
"/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:
> > > \([^:]*\).*"'\$'"/
> > > \1/" -e p -e q -e '}' </etc/passwd\`
> > >         if $test ! -d "\$dir"; then
> > >             me=\`basename \$0\`
> > >             echo "\$me: can't locate home directory for: \$name" >&2
> > >             exit 1
> > >         fi
> > 
> > > 
> > > 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.
> > 
> 
> Andy D:
> 
> Are there still issues we need to follow up on here?
> 
> Thank you very much.
> Jim Keenan

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

Thank you very much.
Jim Keenan


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=48885

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