zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] don't treat alone grouping pattern as glob qualifier
@ 2013-11-17  5:24 Han Pingtian
  2013-11-17 18:40 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Han Pingtian @ 2013-11-17  5:24 UTC (permalink / raw)
  To: zsh-workers

Hello,

I think this is a minor bug:

% ls
a  sym1  sym2  sym3  sym4  testfile
% print (s*)
zsh: no match
%

Looks like the alone grouping pattern (s*) is treated as qualifier.

And I have figured out a patch which looks like fixes the issue. Please 
have a look. 

Thanks.

---
 Src/glob.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Src/glob.c b/Src/glob.c
index e0d0cf6..385b9e6 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -1171,7 +1171,7 @@ zglob(LinkList list, LinkNode np, int nountok)
 		break;
 	    }
 	}
-	if (*s != Inpar)
+	if (*s != Inpar || s == str)
 	    break;
 	if (isset(EXTENDEDGLOB) && !zpc_disables[ZPC_HASH] && s[1] == Pound) {
 	    if (s[2] == 'q') {
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] don't treat alone grouping pattern as glob qualifier
  2013-11-17  5:24 [PATCH] don't treat alone grouping pattern as glob qualifier Han Pingtian
@ 2013-11-17 18:40 ` Bart Schaefer
  2013-11-18  0:30   ` Han Pingtian
  2013-11-18 10:31   ` Peter Stephenson
  0 siblings, 2 replies; 6+ messages in thread
From: Bart Schaefer @ 2013-11-17 18:40 UTC (permalink / raw)
  To: zsh-workers

On Nov 17,  1:24pm, Han Pingtian wrote:
}
} Looks like the alone grouping pattern (s*) is treated as qualifier.

That would be correct according to the documentation ... anything in
parens that can't be distinguished from a qualifier, is a qualifier,
unless you unsetopt BARE_GLOB_QUAL.

"A glob subexpression that would normally be taken as glob qualifiers,
for example `(^x)', can be forced to be treated as part of the glob
pattern by doubling the parentheses, in this case producing `((^x))'."

However, I can't immediately think of any reason why a paren should be
considered part of a "trailing set" when nothing precedes it ...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] don't treat alone grouping pattern as glob qualifier
  2013-11-17 18:40 ` Bart Schaefer
@ 2013-11-18  0:30   ` Han Pingtian
  2013-11-18  3:42     ` Bart Schaefer
  2013-11-18 10:31   ` Peter Stephenson
  1 sibling, 1 reply; 6+ messages in thread
From: Han Pingtian @ 2013-11-18  0:30 UTC (permalink / raw)
  To: zsh-workers

On Sun, Nov 17, 2013 at 10:40:41AM -0800, Bart Schaefer wrote:
> On Nov 17,  1:24pm, Han Pingtian wrote:
> }
> } Looks like the alone grouping pattern (s*) is treated as qualifier.
> 
> That would be correct according to the documentation ... anything in
> parens that can't be distinguished from a qualifier, is a qualifier,
> unless you unsetopt BARE_GLOB_QUAL.
> 
> "A glob subexpression that would normally be taken as glob qualifiers,
> for example `(^x)', can be forced to be treated as part of the glob
> pattern by doubling the parentheses, in this case producing `((^x))'."
> 

Thanks.

> However, I can't immediately think of any reason why a paren should be
> considered part of a "trailing set" when nothing precedes it ...

Yes, because there is nothing before (s*), it wouldn't be treated as
qualifiers, I think.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] don't treat alone grouping pattern as glob qualifier
  2013-11-18  0:30   ` Han Pingtian
@ 2013-11-18  3:42     ` Bart Schaefer
  2013-11-18 10:42       ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2013-11-18  3:42 UTC (permalink / raw)
  To: zsh-workers

On Nov 18,  8:30am, Han Pingtian wrote:
} Subject: Re: [PATCH] don't treat alone grouping pattern as glob qualifier
}
} On Sun, Nov 17, 2013 at 10:40:41AM -0800, Bart Schaefer wrote:
} > However, I can't immediately think of any reason why a paren should be
} > considered part of a "trailing set" when nothing precedes it ...
} 
} Yes, because there is nothing before (s*), it wouldn't be treated as
} qualifiers, I think.

Anybody else going to chime in on this?  Are there other cases where
the (s == str) test in the patch could be true but the paren really
should be treated as introducing a qualifier?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] don't treat alone grouping pattern as glob qualifier
  2013-11-17 18:40 ` Bart Schaefer
  2013-11-18  0:30   ` Han Pingtian
@ 2013-11-18 10:31   ` Peter Stephenson
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2013-11-18 10:31 UTC (permalink / raw)
  To: zsh-workers

On Sun, 17 Nov 2013 10:40:41 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Nov 17,  1:24pm, Han Pingtian wrote:
> }
> } Looks like the alone grouping pattern (s*) is treated as qualifier.
> 
> That would be correct according to the documentation ... anything in
> parens that can't be distinguished from a qualifier, is a qualifier,
> unless you unsetopt BARE_GLOB_QUAL.
> 
> "A glob subexpression that would normally be taken as glob qualifiers,
> for example `(^x)', can be forced to be treated as part of the glob
> pattern by doubling the parentheses, in this case producing `((^x))'."
> 
> However, I can't immediately think of any reason why a paren should be
> considered part of a "trailing set" when nothing precedes it ...

No, and that quote says "*part* of the glob pattern".  I think the patch
is probably the right way to go.

pws


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] don't treat alone grouping pattern as glob qualifier
  2013-11-18  3:42     ` Bart Schaefer
@ 2013-11-18 10:42       ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2013-11-18 10:42 UTC (permalink / raw)
  To: zsh-workers

On Sun, 17 Nov 2013 19:42:26 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Nov 18,  8:30am, Han Pingtian wrote:
> } Subject: Re: [PATCH] don't treat alone grouping pattern as glob qualifier
> }
> } On Sun, Nov 17, 2013 at 10:40:41AM -0800, Bart Schaefer wrote:
> } > However, I can't immediately think of any reason why a paren should be
> } > considered part of a "trailing set" when nothing precedes it ...
> } 
> } Yes, because there is nothing before (s*), it wouldn't be treated as
> } qualifiers, I think.
> 
> Anybody else going to chime in on this?  Are there other cases where
> the (s == str) test in the patch could be true but the paren really
> should be treated as introducing a qualifier?

Another relevant factor leading me to suppose this is probably OK is
that we don't apply glob qualifiers unless there are files that match,
and a file can't match the empty string.  So for example (in the Src
directory, with NO_NOMATCH, and before the patch although it doesn't
affect this):

% print signames.c(:t)
signames.c
% print signames(:t)
signames(:t)

So I contend there is no case that worked before the patch that fails
afterwards.

pws


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-18 10:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-17  5:24 [PATCH] don't treat alone grouping pattern as glob qualifier Han Pingtian
2013-11-17 18:40 ` Bart Schaefer
2013-11-18  0:30   ` Han Pingtian
2013-11-18  3:42     ` Bart Schaefer
2013-11-18 10:42       ` Peter Stephenson
2013-11-18 10:31   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).