Skip to content

🐞 A host directory's digest depends on a symlink's permission bits, so macOS and Linux clients disagree #15167

Closed

Description

@dshaw

What is the issue?

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.

Dagger version

dagger v1.0.0-beta.27 (image://registry.dagger.io/engine:v1.0.0-beta.27) darwin/arm64/v8

Steps to reproduce

On macOS, with only the CLI:

dir=$(mktemp -d) && mkdir "$dir/tree" && printf 'hello\n' > "$dir/tree/notes.md"
chmod 0644 "$dir/tree/notes.md" && chmod 0755 "$dir/tree"
for mask in 022 077 000; do
  rm -f "$dir/tree/latest.md"
  (umask "$mask" && ln -s notes.md "$dir/tree/latest.md")
  ls -l "$dir/tree/latest.md" | cut -c1-10
  dagger -s -m core api call host directory --path "$dir/tree" digest; echo
done

Run the same lines from a Linux client against the same engine to compare.

Log output

macOS client (the same digests on v1.0.0-beta.25 and v1.0.0-beta.27):

lrwxr-xr-x
sha256:523803c60cb8901facae3403e1ee65710e315844a184924338b167822bf7cb0d
lrwx------
sha256:4e830ea5782c3d95ea6ff697f3aadc3ccd2674b3a081442444e45bf80c37628f
lrwxrwxrwx
sha256:e1ee8b8ac2b9f38cb4c86044a5f5b1be6668c06e6ad4a27b222656447f5857c4

Linux client (a container), same engine:

lrwxrwxrwx
sha256:e1ee8b8ac2b9f38cb4c86044a5f5b1be6668c06e6ad4a27b222656447f5857c4
lrwxrwxrwx
sha256:e1ee8b8ac2b9f38cb4c86044a5f5b1be6668c06e6ad4a27b222656447f5857c4
lrwxrwxrwx
sha256:e1ee8b8ac2b9f38cb4c86044a5f5b1be6668c06e6ad4a27b222656447f5857c4

Activity

  1. added a commit that references this issue on Nov 18, 2026
    d55538f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions