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

Re: [Bug] Strange Globing Behaviour when used with sudo



On 2018-05-30 at 19:15 +0000, Daniel Shahaf wrote:
> > On Wed, May 30, 2018 at 10:11 AM, Bengt Brodersen
> > > sudo zsh -c 'echo ./*/'
> > >>> ./file/ ./folder/

> - macOS 10.13.4 (17E202)
> - zsh 5.5.1 (x86_64-apple-darwin17.5.0)
> 
> and that the issue still occurred under -fc.

This appears to be macOS returning different results for stat64() for
root vs non-root.  Using dtruss:

non-root:
open_nocancel("./\0", 0x1100004, 0x10040A3F8)		 = 3 0
fstatfs64(0x3, 0x7FFF5F8A1338, 0x10040A3F8)		 = 0 0
getdirentries64(0x3, 0x7FA30F805E00, 0x1000)		 = 112 0
getdirentries64(0x3, 0x7FA30F805E00, 0x1000)		 = 0 0
close_nocancel(0x3)		 = 0 0
stat64("./dummy/.\0", 0x7FFF5F8A1948, 0x1000)		 = -1 Err#20
stat64("./folder/.\0", 0x7FFF5F8A1948, 0x1000)		 = 0 0

root:
open_nocancel("./\0", 0x1100004, 0x10B5F8B28)		 = 3 0
fstatfs64(0x3, 0x7FFF547471B8, 0x10B5F8B28)		 = 0 0
getdirentries64(0x3, 0x7FAFD9821400, 0x1000)		 = 112 0
getdirentries64(0x3, 0x7FAFD9821400, 0x1000)		 = 0 0
close_nocancel(0x3)		 = 0 0
stat64("./dummy/.\0", 0x7FFF547477C8, 0x1000)		 = 0 0
stat64("./folder/.\0", 0x7FFF547477C8, 0x1000)		 = 0 0

<sys/errno.h> defines ENOTDIR as 20.

-Phil



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