zsh-workers
 help / color / Atom feed
* lstat(2) upon e and + globbing qualifiers
@ 2012-11-09 12:12 Stephane Chazelas
  2020-02-21 19:45 ` Stephane Chazelas
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Chazelas @ 2012-11-09 12:12 UTC (permalink / raw)
  To: zsh-workers

Hiya.

Adding a "e" or "+" qualifier to a globbing pattern seems to
cause zsh to call an unnecessary lstat(2) for each file. No big
deal, just potential performance improvement here.

There's a side effect though when you have read but not search
permission on a directory:

$ strace -fe lstat zsh -c 'echo 2/*'
2/bar 2/foo
$ strace -fe lstat zsh -c 'echo 2/*(e::)'
lstat("2/foo", 0x7fff95492110)          = -1 EACCES (Permission denied)
lstat("2/bar", 0x7fff95492110)          = -1 EACCES (Permission denied)
zsh:1: no matches found: 2/*(e::)

(reproduced with 5.0 on debian)

-- 
Stephane


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

* Re: lstat(2) upon e and + globbing qualifiers
  2012-11-09 12:12 lstat(2) upon e and + globbing qualifiers Stephane Chazelas
@ 2020-02-21 19:45 ` Stephane Chazelas
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane Chazelas @ 2020-02-21 19:45 UTC (permalink / raw)
  To: zsh-workers

Ping:

2012-11-09 12:12:37 +0000, Stephane Chazelas:
Adding a "e" or "+" qualifier to a globbing pattern seems to
cause zsh to call an unnecessary lstat(2) for each file. No big
deal, just potential performance improvement here.

There's a side effect though when you have read but not search
permission on a directory:

$ strace -fe lstat zsh -c 'echo 2/*'
2/bar 2/foo
$ strace -fe lstat zsh -c 'echo 2/*(e::)'
lstat("2/foo", 0x7fff95492110)          = -1 EACCES (Permission denied)
lstat("2/bar", 0x7fff95492110)          = -1 EACCES (Permission denied)
zsh:1: no matches found: 2/*(e::)

(reproduced with 5.0 on debian)

-- 
Stephane

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-09 12:12 lstat(2) upon e and + globbing qualifiers Stephane Chazelas
2020-02-21 19:45 ` Stephane Chazelas

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git