develooper Front page | perl.perl5.porters | Postings from May 2012

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

Thread Next
From:
James E Keenan via RT
Date:
May 7, 2012 17:29
Subject:
[perl #48885] perl-5.10 config failure: broken filexp
Message ID:
rt-3.6.HEAD-4610-1336436941-1752.48885-15-0@perl.org
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


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

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