Skip to content
Snippets Groups Projects
Commit b02d065a authored by Will Chandler's avatar Will Chandler
Browse files

repository: Suppress macOS metadata in tar archive

By default macOS's `bsdtar(1)` will include `._` resource fork files[0]
in the archive, unless the `--no-mac-metadata` flag is passed on
archive creation. These files are suppressed during extraction by default,
but in several tests we are directly reading the archive and finding
files we won't see in a Linux environment.

Specifically, tests like `TestCreateRepositoryFromSnapshot_success` and
`TestBackupCustomHooks_symlink` are running into this scenario and
will fail with errors like:

  file "._." not unpacked

and:

  []string{"custom_hooks/pre-commit.sample"} does not contain "._custom_hooks"

To resolve this, pass the `--no-mac-metadata` flag to `tar` in
`BackupCustomHooks` and `generateTarFile` to ensure we get clean
archives.

Note: the man page[1] for BSD tar states the `--no-mac-metadata` flag is
specific to `x` mode, but testing shows that it works in `c` mode as
well.

[0] https://en.wikipedia.org/wiki/Resource_fork#Compatibility_problems
[1] https://www.freebsd.org/cgi/man.cgi?query=tar&sektion=&n=1
parent 65f4af76
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment