find output is different from ls - what could be the reason for this?
2
votes
0
answers
70
views
On a MacBook, I tried to access one of the system apps,
Maps.app
which is normally a folder stored in /System/Applications
on a separate volume (here mounted as /System/Volumes/Data
). What I found odd is that ls
, cd
and stat
all seem to pretend the folder isn't there - however, find
happily finds it.
$ find /System/Volumes/Data -name 'Maps.app'
/System/Volumes/Data/System/Applications/Maps.app
# some access denied errors for other subfolders
$ stat /System/Volumes/Data/System/Applications/Maps.app
stat: /System/Volumes/Data/System/Applications/Maps.app: stat: No such file or directory
$ cd /System/Volumes/Data/System/Applications/Maps.app
cd: The directory '/System/Volumes/Data/System/Applications/Maps.app' does not exist
$ cd /System/Volumes/Data/System/Applications
cd: The directory '/System/Volumes/Data/System/Applications' does not exist
$ cd /System/Volumes/Data/System
# this worked
$ ls -la@O # pwd is /System/Volumes/Data/System
total 0
drwxr-xr-x@ 3 root wheel restricted 96 6 Mar 11:06 ./
com.apple.rootless 0
drwxr-xr-x@ 18 root wheel - 576 30 Mar 19:07 ../
purgeable-drecs-fixed 4
drwxr-xr-x 9 root wheel restricted 288 6 Mar 11:06 Library/
$ find . -name 'Maps.app'
# nothing found - only works on the parent folder
I'm aware that given this is happening on MacOS and that folder has special flags such as com.apple.rootless
and restricted
, but I'm curious about whether there's some mechanism in Unix that's used to produce this effect. Specifically, **what mechanism can be used to prevent a specific folder / tree from being visible and what does find
do differently from ls
** which allows it to bypass this?
Asked by fstanis
(121 rep)
Apr 1, 2025, 09:07 AM
Last activity: Apr 1, 2025, 09:53 AM
Last activity: Apr 1, 2025, 09:53 AM