zsh-workers
 help / color / mirror / code / Atom feed
* [bug] Globbing fails with execute-only directory in path
@ 2018-03-28 13:35 Tatsuyuki Ishi
  2018-03-28 16:54 ` Mikael Magnusson
  0 siblings, 1 reply; 6+ messages in thread
From: Tatsuyuki Ishi @ 2018-03-28 13:35 UTC (permalink / raw)
  To: zsh-workers

Globs fail to work when one of the directory component is execute-only
(not readable). This is the case on Android (/data/data/ is execute
only so each app can be isolated).

Reproduction steps:

mkdir -p data/app
chmod 111 data
touch data/app/{a,b}
ls data/app/*

Actual results (zsh 5.4.2):

zsh: no matches found: data/app/*

Expected results (bash):

data/app/a  data/app/b


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

* Re: [bug] Globbing fails with execute-only directory in path
  2018-03-28 13:35 [bug] Globbing fails with execute-only directory in path Tatsuyuki Ishi
@ 2018-03-28 16:54 ` Mikael Magnusson
  2018-03-28 17:00   ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2018-03-28 16:54 UTC (permalink / raw)
  To: Tatsuyuki Ishi; +Cc: zsh workers

On Wed, Mar 28, 2018 at 3:35 PM, Tatsuyuki Ishi <ishitatsuyuki@gmail.com> wrote:
> Globs fail to work when one of the directory component is execute-only
> (not readable). This is the case on Android (/data/data/ is execute
> only so each app can be isolated).
>
> Reproduction steps:
>
> mkdir -p data/app
> chmod 111 data
> touch data/app/{a,b}
> ls data/app/*
>
> Actual results (zsh 5.4.2):
>
> zsh: no matches found: data/app/*
>
> Expected results (bash):
>
> data/app/a  data/app/b

Can't reproduce here. I've used this method for a few years to protect
some directories against accidental rm -rf so i know it works with
older zsh versions than mine too.

-- 
Mikael Magnusson


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

* Re: [bug] Globbing fails with execute-only directory in path
  2018-03-28 16:54 ` Mikael Magnusson
@ 2018-03-28 17:00   ` Bart Schaefer
  2018-03-29  0:00     ` Tatsuyuki Ishi
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2018-03-28 17:00 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Tatsuyuki Ishi, Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

On Wed, Mar 28, 2018, 9:54 AM Mikael Magnusson <mikachu@gmail.com> wrote:

> On Wed, Mar 28, 2018 at 3:35 PM, Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
> wrote:
> >
> > Reproduction steps:
> >
> > mkdir -p data/app
> > chmod 111 data
> > touch data/app/{a,b}
> > ls data/app/*
> >
> > Actual results (zsh 5.4.2):
> >
> > zsh: no matches found: data/app/*
> >
> > Expected results (bash):
> >
> > data/app/a  data/app/b
>
> Can't reproduce here.


I can't reproduce this either.

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

* Re: [bug] Globbing fails with execute-only directory in path
  2018-03-28 17:00   ` Bart Schaefer
@ 2018-03-29  0:00     ` Tatsuyuki Ishi
  2018-03-29  6:37       ` Stephane Chazelas
  0 siblings, 1 reply; 6+ messages in thread
From: Tatsuyuki Ishi @ 2018-03-29  0:00 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Mikael Magnusson, Zsh hackers list

I've found a setting difference for this: nocaseglob needs to be set
to reproduce. Tried on bash too and it still works with nocaseglob.

2018-03-29 2:00 GMT+09:00 Bart Schaefer <schaefer@brasslantern.com>:
> On Wed, Mar 28, 2018, 9:54 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>>
>> On Wed, Mar 28, 2018 at 3:35 PM, Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
>> wrote:
>> >
>> > Reproduction steps:
>> >
>> > mkdir -p data/app
>> > chmod 111 data
>> > touch data/app/{a,b}
>> > ls data/app/*
>> >
>> > Actual results (zsh 5.4.2):
>> >
>> > zsh: no matches found: data/app/*
>> >
>> > Expected results (bash):
>> >
>> > data/app/a  data/app/b
>>
>> Can't reproduce here.
>
>
> I can't reproduce this either.


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

* Re: [bug] Globbing fails with execute-only directory in path
  2018-03-29  0:00     ` Tatsuyuki Ishi
@ 2018-03-29  6:37       ` Stephane Chazelas
  2018-03-29 10:23         ` Stephane Chazelas
  0 siblings, 1 reply; 6+ messages in thread
From: Stephane Chazelas @ 2018-03-29  6:37 UTC (permalink / raw)
  To: Tatsuyuki Ishi; +Cc: Bart Schaefer, Mikael Magnusson, Zsh hackers list

2018-03-29 09:00:27 +0900, Tatsuyuki Ishi:
> I've found a setting difference for this: nocaseglob needs to be set
> to reproduce. Tried on bash too and it still works with nocaseglob.
[...]

That reveals another difference between zsh and bash here (or
more like between bash and other shells):

$ mkdir -p a/b/cd
$ zsh -o nocaseglob -c 'echo a/B/c*'
a/b/cd
$ yash -o nocaseglob -c 'echo a/b/C*'
a/b/cd
$ ksh93 -c 'echo ~(i)a/b/C*'
a/b/cd
$ bash -O nocaseglob -c 'echo a/B/c*'
a/B/c*

yash manages to find a/b/cd here after I remove search
permission to "a":

$ chmod 111 a
$ ksh93 -c 'echo ~(i)a/b/C*'
~(i)a/b/C*
$ yash -o nocaseglob -c 'echo a/b/C*'
a/b/cd

-- 
Stephane


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

* Re: [bug] Globbing fails with execute-only directory in path
  2018-03-29  6:37       ` Stephane Chazelas
@ 2018-03-29 10:23         ` Stephane Chazelas
  0 siblings, 0 replies; 6+ messages in thread
From: Stephane Chazelas @ 2018-03-29 10:23 UTC (permalink / raw)
  To: Tatsuyuki Ishi, Bart Schaefer, Mikael Magnusson, Zsh hackers list

2018-03-29 07:37:07 +0100, Stephane Chazelas:
[...]
> That reveals another difference between zsh and bash here (or
> more like between bash and other shells):
> 
> $ mkdir -p a/b/cd
> $ zsh -o nocaseglob -c 'echo a/B/c*'
> a/b/cd
> $ yash -o nocaseglob -c 'echo a/b/C*'
> a/b/cd
> $ ksh93 -c 'echo ~(i)a/b/C*'
> a/b/cd
> $ bash -O nocaseglob -c 'echo a/B/c*'
> a/B/c*
> 
> yash manages to find a/b/cd here after I remove search
                                                  read
> permission to "a":
> 
> $ chmod 111 a
> $ ksh93 -c 'echo ~(i)a/b/C*'
> ~(i)a/b/C*
> $ yash -o nocaseglob -c 'echo a/b/C*'
> a/b/cd
[...]

Sorry, my bad, I hadn't realised that was the wrong test case
for yash. yash does behave like bash here:

$ yash -o nocaseglob -c 'echo a/b/C*'
a/b/cd
$ yash -o nocaseglob -c 'echo a/B/C*'
a/B/C*
$ zsh -o nocaseglob -c 'echo a/B/C*'
a/b/cd

So it works for the chmod 111 case for the same reason as it works in bash:
it's doesn't need to list directory at every path components to find matching
files.

In effect, in zsh

echo a/b/c*

is like:

echo [aA]/[bB]/[cC]*

And that command fails to match in every shell when "a" is not readable.

-- 
Stephane


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

end of thread, other threads:[~2018-03-29 10:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 13:35 [bug] Globbing fails with execute-only directory in path Tatsuyuki Ishi
2018-03-28 16:54 ` Mikael Magnusson
2018-03-28 17:00   ` Bart Schaefer
2018-03-29  0:00     ` Tatsuyuki Ishi
2018-03-29  6:37       ` Stephane Chazelas
2018-03-29 10:23         ` 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).