zsh-users
 help / color / mirror / code / Atom feed
* Is this a bug?
@ 2022-04-19  2:02 Perry Smith
  2022-04-19  3:05 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Perry Smith @ 2022-04-19  2:02 UTC (permalink / raw)
  To: zsh-users

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

I’m on macOS 12.3.1.  I’m using zsh 5.8.1 from Home-brew.  I do `sudo -s` and now it seems I’m using the native macOS 5.8 version of zsh.

The command `print -l /System/Volumes/Data/**/*(D)` gets about 20 errors such as:

zsh: operation not permitted: com.apple.LaunchServices.dv

And then appears to hang.  ^C doesn’t stop it.  ^Z does not suspend it.  ^\ kills the sudo and I get back to my user prompt.

The “operation not permitted” doesn’t bother me… that is the new Mac non-sense where root isn’t root.  But the apparent hang seems rather ugly.  Can others reproduce this?

Thank you,
Perry


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Is this a bug?
  2022-04-19  2:02 Is this a bug? Perry Smith
@ 2022-04-19  3:05 ` Bart Schaefer
  2022-04-19 12:33   ` Perry Smith
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2022-04-19  3:05 UTC (permalink / raw)
  To: Perry Smith; +Cc: Zsh Users

On Mon, Apr 18, 2022 at 7:02 PM Perry Smith <pedz@easesoftware.com> wrote:
>
> I’m on macOS 12.3.1.  I’m using zsh 5.8.1 from Home-brew.  I do `sudo -s` and now it seems I’m using the native macOS 5.8 version of zsh.

That's not a bug.  It should work to do `sudo -s $SHELL` if you want
to keep using the same shell version.

> The command `print -l /System/Volumes/Data/**/*(D)` [...]  appears to hang.  ^C doesn’t stop it.  ^Z does not suspend it.  ^\ kills the sudo and I get back to my user prompt.

This isn't entirely surprising ... those signals might fail because
your user doesn't have privilege to signal the root shell.

> But the apparent hang seems rather ugly.  Can others reproduce this?

Does there happen to be a Time Machine backup under
/System/Volumes/Data/ ?  Time Machine plays some tricks with making
hard links to directories (normally not allowed) for reasons of space
savings, but that could put **/ into an infinite loop.


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

* Re: Is this a bug?
  2022-04-19  3:05 ` Bart Schaefer
@ 2022-04-19 12:33   ` Perry Smith
  2022-04-19 16:53     ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Perry Smith @ 2022-04-19 12:33 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users


[-- Attachment #1.1: Type: text/plain, Size: 1579 bytes --]



> On Apr 18, 2022, at 22:05, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> On Mon, Apr 18, 2022 at 7:02 PM Perry Smith <pedz@easesoftware.com> wrote:
> 
>> But the apparent hang seems rather ugly.  Can others reproduce this?
> 
> Does there happen to be a Time Machine backup under
> /System/Volumes/Data/ ?  Time Machine plays some tricks with making
> hard links to directories (normally not allowed) for reasons of space
> savings, but that could put **/ into an infinite loop.

pedz@Peace Data % ls /System/Volumes/Data/Volumes
.timemachine	Macintosh HD
pedz@Peace Data % ls /System/Volumes/Data/Volumes/Macintosh\ HD
.VolumeIcon.icns	Users			opt
.file			Volumes			private
.vol			bin			sbin
AppleInternal		cores			tmp
Applications		dev			usr
Library			etc			var
System			home
pedz@Peace Data % ls /System/Volumes/Data/Volumes/Macintosh\ HD/Volumes
.timemachine	Macintosh HD
pedz@Peace Data % ls /System/Volumes/Data/Volumes/Macintosh\ HD/Volumes/Macintosh\ HD
.VolumeIcon.icns	Users			opt
.file			Volumes			private
.vol			bin			sbin
AppleInternal		cores			tmp
Applications		dev			usr
Library			etc			var
System			home


My bad… I knew /Volumes/… would show the repeated mount but I thought somehow
magically /System/Volumes/Data/Volumes would not.  That’s one of the reasons I was
using it as my starting point.  Indeed, I wasn’t aware that /System/Volumes/Data had
Volumes in it.

Now I need to go read zshall and find out how to do “all except ‘Volumes’”

“find” must have something to detect loops?

[-- Attachment #1.2: Type: text/html, Size: 4476 bytes --]

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Is this a bug?
  2022-04-19 12:33   ` Perry Smith
@ 2022-04-19 16:53     ` Bart Schaefer
  2022-04-19 17:13       ` Mikael Magnusson
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2022-04-19 16:53 UTC (permalink / raw)
  To: Perry Smith; +Cc: Zsh Users

On Tue, Apr 19, 2022 at 5:34 AM Perry Smith <pedz@easesoftware.com> wrote:
>
> Now I need to go read zshall and find out how to do “all except ‘Volumes’”

I don't think it's possible in any straightforward way.
((^Volumes)/)# can match the empty string, so you just end up
searching into Data//Volumes (note doubled slash) instead.  And
**/*~Volumes(D) doesn't filter until after the recursion.


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

* Re: Is this a bug?
  2022-04-19 16:53     ` Bart Schaefer
@ 2022-04-19 17:13       ` Mikael Magnusson
  2022-04-19 21:06         ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Mikael Magnusson @ 2022-04-19 17:13 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Perry Smith, Zsh Users

On 4/19/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, Apr 19, 2022 at 5:34 AM Perry Smith <pedz@easesoftware.com> wrote:
>>
>> Now I need to go read zshall and find out how to do “all except
>> ‘Volumes’”
>
> I don't think it's possible in any straightforward way.
> ((^Volumes)/)# can match the empty string, so you just end up
> searching into Data//Volumes (note doubled slash) instead.  And
> **/*~Volumes(D) doesn't filter until after the recursion.

Hmm?
% mkdir -p {a,Volumes}/{b,Volumes}/{c,Volumes}
% print -l ((^Volumes)/)#
a/
a/b/
a/b/c/


-- 
Mikael Magnusson


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

* Re: Is this a bug?
  2022-04-19 17:13       ` Mikael Magnusson
@ 2022-04-19 21:06         ` Bart Schaefer
  2022-04-19 21:53           ` Mikael Magnusson
  0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2022-04-19 21:06 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Perry Smith, Zsh Users

On Tue, Apr 19, 2022 at 10:13 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> Hmm?
> % mkdir -p {a,Volumes}/{b,Volumes}/{c,Volumes}
> % print -l ((^Volumes)/)#
> a/
> a/b/
> a/b/c/

Sure, but try ((^Volumes)/)#/ and suddenly you're recursing from the root.

For Perry's specific use case, ./((^Volumes)/)#/ is OK, because he
only cares about directories, bad things can happen if you end that
with another glob.  I discounted ./((^Volumes)/)#/(^Volumes) but
that's because it runs afoul of bare_glob_qual, it works if you unset
that or append some other qualifier to force (^...) to be taken as a
pattern.


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

* Re: Is this a bug?
  2022-04-19 21:06         ` Bart Schaefer
@ 2022-04-19 21:53           ` Mikael Magnusson
  0 siblings, 0 replies; 7+ messages in thread
From: Mikael Magnusson @ 2022-04-19 21:53 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Perry Smith, Zsh Users

On 4/19/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, Apr 19, 2022 at 10:13 AM Mikael Magnusson <mikachu@gmail.com>
> wrote:
>>
>> Hmm?
>> % mkdir -p {a,Volumes}/{b,Volumes}/{c,Volumes}
>> % print -l ((^Volumes)/)#
>> a/
>> a/b/
>> a/b/c/
>
> Sure, but try ((^Volumes)/)#/ and suddenly you're recursing from the root.

There's no reason to append this extra slash, (foo/)#hello works fine
to match bar/hello (but not /hello).

% touch a/b/c/hello
% print -l ((^Volumes)/)#hello
a/b/c/hello


> For Perry's specific use case, ./((^Volumes)/)#/ is OK, because he
> only cares about directories, bad things can happen if you end that
> with another glob.  I discounted ./((^Volumes)/)#/(^Volumes) but
> that's because it runs afoul of bare_glob_qual, it works if you unset
> that or append some other qualifier to force (^...) to be taken as a
> pattern.

Afaict, ((^Volumes)/)#^Volumes should work fine there.

% touch **/*(/e*'REPLY+=/bar'*)
% print -l ((^Volumes)/)#^Volumes
a
a/b
a/b/bar
a/b/c
a/b/c/bar
a/b/c/hello
a/bar


-- 
Mikael Magnusson


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

end of thread, other threads:[~2022-04-19 21:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19  2:02 Is this a bug? Perry Smith
2022-04-19  3:05 ` Bart Schaefer
2022-04-19 12:33   ` Perry Smith
2022-04-19 16:53     ` Bart Schaefer
2022-04-19 17:13       ` Mikael Magnusson
2022-04-19 21:06         ` Bart Schaefer
2022-04-19 21:53           ` Mikael Magnusson

Code repositories for project(s) associated with this 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).