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

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



Any news on this?

On Wed, 30 May 2018 at 22:49 Bengt Brodersen <bengt.brodersen@xxxxxxxxx>
wrote:

> Just found a paragraph in stat(2) manpage on macos
>
> _DARWIN_FEATURE_64_BIT_INODE
>      In order to accommodate advanced capabilities of newer file systems,
> the struct stat, struct statfs, and struct dirent data structures were
> updated in Mac OSX 10.5.
>
>      The most obvious change is the increased size of ino_t from 32 bits
> to 64 bits.  As a consequence, storing an ino_t in an int is no longer
> safe, and file formats storing ino_t as 32-bit values may need to be
>      updated.  There are other changes as well, such as the widening of
> f_fstypename, f_mntonname, and f_mntfromname in struct statfs.  Please
> refer to stat(2) and dir(5) for more detail on the specific changes to
>      the other affected data structures.
>
>      On platforms that existed before these updates were available, ABI
> compatibility is achieved by providing two implementations for related
> functions: one using the legacy data structures and one using the
>      updated data structures.  Variants which make use of the newer
> structures have their symbols suffixed with $INODE64.  These $INODE64
> suffixes are automatically appended by the compiler tool-chain and should
>      not be used directly.
>
>      Platforms that were released after these updates only have the newer
> variants available to them.  These platforms have the macro
> _DARWIN_FEATURE_ONLY_64_BIT_INODE defined.
>
>      The _DARWIN_FEATURE_64_BIT_INODE macro should not be set directly.
> Instead, developers should make use of the _DARWIN_NO_64_BIT_INODE or
> _DARWIN_USE_64_BIT_INODE macros when the default variant is not
>      desired.  The following table details the effects of defining these
> macros for different deployment targets.
>
>
>             _DARWIN_FEATURE_ONLY_64_BIT_INODE not defined
>
>        -------------------------+-------------------------------
>
>                                 |       Deployment Target
>
>             user defines:       |   < 10.5       10.5    > 10.5
>
>        -------------------------+-------------------------------
>
>                 (none)          |   32-bit      32-bit   64-bit
>
>        _DARWIN_NO_64_BIT_INODE  |   32-bit      32-bit   32-bit
>
>        _DARWIN_USE_64_BIT_INODE |   32-bit      64-bit   64-bit
>
>        -------------------------+-------------------------------
>
>
>               _DARWIN_FEATURE_ONLY_64_BIT_INODE defined
>
>        -------------------------+-------------------------------
>
>             user defines:       | Any Deployment Target
>
>        -------------------------+-------------------------------
>
>                 (none)          | 64-bit-only
>
>        _DARWIN_NO_64_BIT_INODE  |   (error)
>
>        _DARWIN_USE_64_BIT_INODE | 64-bit-only
>
>        -------------------------+-------------------------------
>
>            32-bit       32-bit inode values are enabled, and the legacy
> structures involving the ino_t type are in use.  The macro
> _DARWIN_FEATURE_64_BIT_INODE is not defined.
>
>            64-bit       64-bit inode values are enabled, and the expanded
> structures involving the ino_t type are in use.  The macro
> _DARWIN_FEATURE_64_BIT_INODE is defined, and loader symbols will contain the
>                         $INODE64 suffix.
>
>            64-bit-only  Like 64-bit, except loader symbols do not have the
> $INODE64 suffix.
>
>            (error)      A compile time error is generated.
>
>      Due to the increased benefits of the larger structure, it is highly
> recommended that developers not define _DARWIN_NO_64_BIT_INODE and make use
> of _DARWIN_USE_64_BIT_INODE when targeting Mac OSX 10.5.
>
>      In addition to the $INODE64 suffixed symbols, variants suffixed with
> 64 are also available for related functions.  These functions were provided
> as a way for developers to use the updated structures in code
>      that also made use of the legacy structures.  The enlarged stat
> structures were also prefixed with 64 to distinguish them from their legacy
> variants.  These functions have been deprecated and should be
>      avoided.
>
> On Wed, 30 May 2018 at 22:44 Bengt Brodersen <bengt.brodersen@xxxxxxxxx>
> wrote:
>
>> If you google *mac stat64 deprecated* you will get a lot of results.
>> So maybe it caused by the depreciation on darwin os
>>
>> On Wed, 30 May 2018 at 22:24 Phil Pennock <
>> zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
>>
>>> 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