On Thursday 30 September 2010 23:29, Rob Landley wrote:
> > > (Making {file,file} curly bracket support work would be darn nice too,
> > > that's the biggest thing I miss.  You can't even follow the Linux From
> > > Scratch build instructions without that...)
> >
> > This is not easy. Consider three commands:
> >
> > v='/bin/*'; echo $v
> > v='/bin/{a,b}*'; echo $v
> > echo /bin/{a,b}*
> >
> > In the first case, unquoted $v is globbed *after* $v value is substituted,
> > and echo prints long list of filenames in /bin.
> >
> > In the second case, echo prints just "/bin/{a,b}*"
> >
> > In the third case, echo prints all filenames in /bin which start from a and
> > b.
> 
> That's messed up, and it really sounds like the second case is a bug.
> 
> I just fired up an Aboriginal system image with bash 2.05b (the much less 
> bloated version), and under that the third case _also_ prints "/bin/{a,b}*", 
> so the behavior of this corner case changed between bash versions.  Most 
> likely somebody reported the third case as a bug and they fixed the one 
> defect 
> report without fixing the general case, because they're the FSF and 
> everything 
> is a special case to them.
> 
> The _important_ test is just:
> 
>   v='/bin/*'; echo $v
> 
> Which answers the simple question of glob precedence: does it happen before 
> or 
> after the variable substitution?  And if the answer is "after" (which it is), 
> then that's what we should do.  Perform globbing after substituting 
> variables.  
> {a,b} is part of globbing the same way * and ? and [x-y] and such are.
> 
> The fact that bash is a buggy pile of crap that can't even consistently 
> implement its own extensions is not our problem.  We should do the simple 
> thing and wait for the FSF to catch up.  (Specifically, wait for somebody 
> replying on this _obvious_bug_ to complain, and then tell them to complain to 
> the bash guys and make sure they don't _fix_ their inconsistency first.)

We can't do this.

Regardless of what is correct or not (and in this case,
it is debatable - it can easily be argued that brace expansion
and glob expansion are two different things), if we want to have
more users, we should be compatible with bash (latest one, if older ones
are different).

Users don't care that much which way is "more correct";
but they do care a lot about having their scripts run correctly
even in corner cases when they migrate from bash to, say, hush.

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to