develooper Front page | | Postings from April 2007

Re: _detildefy -- r9408

Thread Next
Eric Wilhelm
April 28, 2007 19:52
Re: _detildefy -- r9408
Message ID:
# from Eric Wilhelm on Monday 16 April 2007 11:10 pm:

># from Ken Williams on Monday 16 April 2007 08:06 pm:
>>Yup, that's right.  Unfortunately this patch won't deal with the  
>>~user/blah/blah case, though.
>Actually, I think it does.

Oh, *now* I get it.  Sorry to be dense.  I had never used that 
shell-expansion behavior before.  That certainly throws a wrench in the 
works.  A strace on perl -e 'glob("~foo")' shows that /etc/passwd is 
being consulted.  Neat :-/

Also note that it seems to not do that on windows, though it will give 
you ~/ if $ENV{HOME} is set.

So, do we protect the spaces, juggle backslashes (on windows) and use 
glob() or try to do things ourselves?  We're certainly at risk of 
surprising someone if we throw the whole thing into glob() since the 
reason we're doing this is that the bash shell doesn't expand 
*anything* mid-word (such as --foo=* or --foo=[a-z].)

Maybe we do "s/(~\w*(?:/|$))//" and then "glob($1) . $_" ?  Does that 
cover everything?  (Well, everything except the backslash duality issue 
on windows.)  If people want "~my user name is cool/" to work, I don't 
think I can bring myself to think about it.

The first rule about Debian is you don't talk about Debian

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