Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: /proc slows % echo /**/*/etc/r*(/N)




On 2024-01-21 11:09, Bart Schaefer wrote:
Why /**/*/ rather than just /**/ ?  The extra /*/ there will expand
symbolic links, which are normally skipped by /**/.

I just now realized that.

... so by expanding that you're traversing the
whole filesystem again, which takes you back to /proc/ again, and so
on for every PID until zsh gives up (probably because it can't
allocate any more memory).

It had that looping feeling.  Didn't realize that it was crashing tho, I thought it was actually finishing.

I suspect previously you weren't adding that extra /*/.  What do you
mean for that to accomplish?

     % echo /**/*/etc/r*(/N) #BAD
     % echo /**/*etc/r*(/N)  #GOOD

... at some point the '/' got added, don't know. I just missed it. 
All good.  Man, what a strange adventure tho.  

> There's no glob qualifier for that, if that's what you mean.  As it
happens, those directories always appear to be empty, so you can find
them with /*(/L0) 

Ok I'll look at that.  Mind, the above has solved the problem.  Still one might save a millisecond avoiding searches of those virtual directories -- or not.

> Without trying it, which I'm not going to do, I think the answer to
your specific question might be:

echo /**/^(proc|sys)/etc/r*(N)

Hangs. Never mind!





Messages sorted by: Reverse Date, Date, Thread, Author