[-- 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 --]
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.
[-- 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 --]
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.
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
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.
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