bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm - bug or user error?


From: Eric Blake
Subject: Re: rm - bug or user error?
Date: Tue, 26 Jan 2010 19:20:20 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666

According to Jon Stanley on 1/26/2010 7:05 PM:
> On Tue, Jan 26, 2010 at 8:57 PM, Michael Webb <address@hidden> wrote:
> 
>> I'm running /bin/csh.  Don't know how to figure out the coreutil version,
>> however the rm man-page says 5.2.1.

Wow, that's old.  The latest stable version is 8.4, and includes several
fixes for rm (although I think we've already established that this was
your shell, and not rm).

> 
> Yeah, like Eric said, I think that this is a csh problem rather than a
> coreutils problem. I would even think that csh is behaving wrongly
> here - rather than refusing to run rm because the glob didn't match,
> it should pass the f* straight through to rm to deal with as it
> pleases, unless you explicitly told the shell to fail (as Eric did in
> his example). I don't have any standards to back that up though, Eric
> is the POSIX-citing guy around here :)

csh is not specified by any standards.  It's personal choice whether you
use it instead of sh (but personally, I _hate_ csh variants, because they
are so impossible to use for any decent scripting, and so woefully
under-specified).

My guess is that bash originally provided the failglob option to make it
easier for people switching from tcsh to bash to still keep the default
behavior of csh.  'man tcsh' states:

| It is an error for a glob‐pattern containing ‘*’, ‘?’, ‘[’ or ‘~’, with
| or without ‘^’, not to match any files.

It also looks like tcsh provides the nonomatch shell variable to make tcsh
take on the somewhat more POSIX-like behavior of passing unmatched globs
through.

> Any standards for that Eric?

Bash's '-s failglob' is an extension allowed by POSIX, but as an
extension, it is not standardized.  The moment you use an extension, then
the shell is within its right to use an alternate behavior (in this case,
failing when a glob doesn't expand, rather than calling the app with a
literal argument of "f*").  So I see nothing in the above example that
conflicts with the standards; although a strictly compliant app wouldn't
have been using either csh or failglob in the first place.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]