Exact preservation of com.apple.provenance when copying files on macOS

On a Mac reporting macOS 27.0, build 26A428, copying a small regular file with an existing 11-byte com.apple.provenance value into a new private directory consistently produces a different 11-byte value. fcopyfile(COPYFILE_ALL), forced copyfile cloning with exclusive/no-follow flags, fclonefileat with ACL/no-follow flags, and ditto with resource-fork, extended-attribute, ACL and quarantine preservation all return success. Both default fsetxattr and XATTR_REPLACE, supplied the unchanged opaque source value, also return success without exact readback equality. The source is left unchanged, values are not decoded, and no private flags, elevated privilege or security-setting changes are used. The same outcome occurs when the Python probe is launched from Terminal.

Is there a supported public method and documented postcondition for preserving this attribute byte-for-byte on a recoverable copy, including after changing the copy's data fork and atomically replacing an artificial destination? If this is not a supported invariant for this OS-managed attribute, please clarify the public contract. We need guidance on supported preservation, not a private value format or a way to disable protection.

Answered by DTS Engineer in 919817022

See my reply on this thread. It’s about a different extended attribute but my answer there is quite general.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

See my reply on this thread. It’s about a different extended attribute but my answer there is quite general.

Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"