bug-bash
[Top][All Lists]
Advanced

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

Re: dot gob+extglob bug


From: Ian Kelling
Subject: Re: dot gob+extglob bug
Date: Thu, 19 Jun 2014 15:47:38 -0700
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux)

Chet Ramey <chet.ramey@case.edu> writes:
> On 6/9/14, 3:42 PM, Ian Kelling wrote:
> Yes, it's an interesting question: what exactly does pattern negation
> include?  You can match all filenames beginning with a `.' by using `.'
> as the first character of the pattern, so should a negated pattern
> beginning with a `.' match all filenames beginning with a `.' that don't
> match that particular pattern?  The bash-4.3 implementation says yes.
> (FWIW, ksh93 disagrees.)

Yes, now I understand. I agree with this bash 4.3 behavior.

As you pointed out, some of my comments about past bash were
wrong. Thank you. Now I think I have I have explored properly the latest
version and found some problems I did not fully see before:

The doc says "When matching a pathname, the slash character
must always be matched explicitly."  Shortly thereafter, in the next
paragraph of the same section, GLOBIGNORE is described, which does not
treat / as special, but this is not mentioned, and is very unexpected to
me. Closer inspection, I see same language "filenames matching a
pattern" is used in both paragraphs, so I think some clarification is
needed.

# example: / matters to GLOBIGNORE 
~/opt/bash (master) $ ./bash --norc
bash-4.3$ cd $(mktemp -d)
bash-4.3$ touch a
bash-4.3$ GLOBIGNORE=a
bash-4.3$ echo *
*
bash-4.3$ echo ./*
./a
# another example of the same phenomenon
bash-4.3$ GLOBIGNORE='*a'
bash-4.3$ echo ./*
./*

And then, this definitely seems like a bug: * matches / in
GLOGIGNORE, and so does [/], but ? does not match /

# example: ? does not match "/"
bash-4.3$ GLOBIGNORE=.?a
bash-4.3$ echo ./*
./a
# example: ? does match "x"
bash-4.3$ touch .xa
bash-4.3$ echo .x*
.x*
# example: [/] matches "/"
bash-4.3$ GLOBIGNORE=.[/]a
bash-4.3$ echo ./*
./.xa

And then, another bug or doc clarification. The various [:class:] forms
don't seem to work at all in GLOBIGNORE.


Side note, I've added to my bashrc:
GLOBIGNORE=*/.:*/.. 



reply via email to

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