You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐞 A host directory's digest depends on a symlink's permission bits, so macOS and Linux clients disagree #15167
The digest of a host directory depends on the permission bits of the symlinks in it. Those bits are a property of the client's host, not of the tree:
On macOS a symlink has permission bits of its own, taken from the umask it was created under (lrwxr-xr-x under the usual 022).
On Linux a symlink is always lrwxrwxrwx.
So the same tree, for example one git checkout with a symlink in it, has one digest when a macOS client imports it and another when a Linux client does. On macOS alone, the digest changes with the umask the link was made under.
I expected one digest: the engine's copy of the link is the same in every case, because Linux has no permission bits to set on a symlink.
Reading the source, the cause looks like this:
normalizeLocalImportStat (engine/client/filesync.go) clears uid, gid and xattrs before the client sends a stat, and sends the mode as the host reports it.
statHash (engine/filesync/hash.go) hashes the mode it was sent.
localFS.Symlink (engine/filesync/localfs.go) creates the link in the mirror, and rewriteMetadata skips chmod for symlinks.
This seems to be the same kind of case #13389 fixed for host xattrs: metadata that cannot round-trip through the Linux mirror ends up in the import's identity.
I have a fix with tests and will open a pull request for it.
Activity
filesync: keep a symlink's permission bits out of a host directory's …