When I list a mounted directory that contains symbolic links on macOS, I get Stale NFS file handle errors. Bellow, *.app are symbolic links to directories using their absolute paths.
pedro@Pedros-MacBook-Pro ~ % ls -@Oahl ~/Applications
total 2924
dr-xr-xr-x@ 5 root wheel - 160B 31 Dec 1969 .
com.apple.FinderInfo 32B
drwxr-x---+ 103 pedro staff - 3.2K 30 Dec 21:02 ..
-rw-rw-rw- 1 root wheel - 1.4M 30 Dec 21:35 .VolumeIcon.icns
-rw-rw-rw- 1 root wheel - 406B 30 Dec 21:35 ._.
ls: /Users/pedro/Applications/IntelliJ IDEA CE.app: Stale NFS file handle
lrwxr-xr-x 1 root wheel - 116B 31 Dec 1969 IntelliJ IDEA CE.app
ls: /Users/pedro/Applications/Sublime Text.app: Stale NFS file handle
lrwxr-xr-x 1 root wheel - 91B 31 Dec 1969 Sublime Text.app
ls: /Users/pedro/Applications/Visual Studio Code.app: Stale NFS file handle
lrwxr-xr-x 1 root wheel - 105B 31 Dec 1969 Visual Studio Code.app
pedro@Pedros-MacBook-Pro ~ % ls -@Oahl ~/Applications
ls: IntelliJ IDEA CE.app: Stale NFS file handle
ls: Sublime Text.app: Stale NFS file handle
ls: Visual Studio Code.app: Stale NFS file handle
total 2921
dr-xr-xr-x@ 5 root wheel - 160B 31 Dec 1969 .
com.apple.FinderInfo 32B
drwxr-x---+ 103 pedro staff - 3.2K 30 Dec 21:02 ..
-rw-rw-rw- 1 root wheel - 1.4M 30 Dec 21:38 .VolumeIcon.icns
-rw-rw-rw- 1 root wheel - 406B 30 Dec 21:38 ._.
ls: fts_read: Stale NFS file handle
I'm also getting this error message from the NFS client: nfs loadattrcache vnode changed type, was 5 now 2. Meaning that the vnode type was VLNK and now is VDIR.
I've added some logging, and my FS implementation is indeed returning different vnode types for those files. But that's because the NFS library is calling billy.Filesystem#ReadDir, that "If the entry denotes a symbolic link, Info reports the information about the link itself, not the link's target.", and then it calls billy.Filesystem#Stat instead of billy.Filesystem#Lstat. So the vnode type will always change.
But I'm not sure if changing the implementation of tryStat to always use billy.Filesystem#Lstat is something we can do. I think we need a tryLstat and move to this new function on a case-by-case basis.
When I list a mounted directory that contains symbolic links on macOS, I get
Stale NFS file handle
errors. Bellow,*.app
are symbolic links to directories using their absolute paths.I'm also getting this error message from the NFS client:
nfs loadattrcache vnode changed type, was 5 now 2
. Meaning that the vnode type wasVLNK
and now isVDIR
.I've added some logging, and my FS implementation is indeed returning different vnode types for those files. But that's because the NFS library is calling
billy.Filesystem#ReadDir
, that "If the entry denotes a symbolic link, Info reports the information about the link itself, not the link's target.", and then it callsbilly.Filesystem#Stat
instead ofbilly.Filesystem#Lstat
. So the vnode type will always change.This patch addressed my problem: https://github.com/t0rr3sp3dr0/go-nfs/commit/7d4f8290f183abd44a6211fe9e6980a6f2583863
But I'm not sure if changing the implementation of
tryStat
to always usebilly.Filesystem#Lstat
is something we can do. I think we need atryLstat
and move to this new function on a case-by-case basis.