zsh-workers
 help / color / mirror / code / 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, other threads:[~2020-02-21 19:46 UTC | newest]

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

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).