Tar files made in macOS generate "xattr" errors when expanded in Linux
27 points by heresie-dabord 4 days ago | 14 comments
pier25 2 hours ago
I use these settings when creating a tar file for deploy:
reply tar --no-xattrs --no-mac-metadata -czfchmaynard 23 minutes ago
Homebrew installs GNU tar as "gtar". On my M4 MacBook:
reply $ which gtar
gtar is /opt/homebrew/bin/gtarangry_octet 35 minutes ago
We might also ask, why doesn't Linux also track such meta-data? Are Linux users not also subject to drive-by downloads impersonating valid files? Should we be one chmod a+x away from compromise?
replydanielheath 26 minutes ago
Yes, we should be.
replyMy computer should run programs when I tell it to run them.
Don’t blunt _every_ tool just to make them harder to cut yourself on.
firesteelrain 59 minutes ago
You can either send stderr to /dev/null or use --warning=no-unknown-keyword to suppress them cleanly.
replyBut still interesting nonetheless why they are added
Apple treats tar less like “portable Unix interchange” and more like “archive this filesystem object faithfully.” That is very Apple, and very libarchive. ;-)
This is probably going to get worse (as Apple continues to add macOS-specific metadata), so your workaround is very helpful.
I haven't tested it in a while, but at one point, setting the COPYFILE_DISABLE=1 env variable would disable the inclusion of macOS-specific metadata.
If I point "tape archive" at a file system, I want that file system archived to tape. And so, tar does.
If I don't, well, that's a fine option, and there's a fine option for that.
So it's less of a "workaround" or something that "gets worse", than, "No, I don't really want a tape archive of this filesystem, only of some of it." And that's supported.
That said, never seeing another .DS_Store should be a system-wide option!
Principle of least surprise is good engineering practice. The question is always whose surprise. Someone who expects tar to behave like other UNIX systems is going to be surprised by this. Someone who expects tar on Apple to have perfect fidelity would be surprised by not-this.
I increasingly feel like build systems should never be relying on any "native" utilities from the host system, and should instead be bringing them in via dependencies. You can't have this problem if your packaging system pulls in a specific portable `tar` library.
Yes please.
These can all die in a fire too, as far as I am concerned. macOS loves to treat the user's filesystem as its own personal garbage dump.
filesystem attributes are for decorating files with meaning. Anything else that attempts to use filesystems in "interesting" ways is silly.
Apple and MS really ought to consider why they do this sort of fragile, idiosyncratic nonsense.