Skip to content

Commit

Permalink
fix(libutil/tarfile): add option to libarchive so it behaves correctl…
Browse files Browse the repository at this point in the history
…y with AppleDouble files

AppleDouble files were extracted differently on macOS machines than on other
UNIX's.
Setting `archive_read_set_format_option(this->archive, NULL ,"mac-ext",NULL)`
fixes this problem, since it just ignores the AppleDouble filel and treats it as
a normal one.
This was a problem since it caused source archives to be different between macOS
and Linux.

Ref: NixOS#9290
  • Loading branch information
bryanhonof committed Dec 7, 2023
1 parent 458e511 commit 717347b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/libutil/tarfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ TarArchive::TarArchive(Source & source, bool raw) : buffer(65536)
archive_read_support_format_raw(archive);
archive_read_support_format_empty(archive);
}
archive_read_set_option(archive, NULL, "mac-ext", NULL);
check(archive_read_open(archive, (void *)this, callback_open, callback_read, callback_close), "Failed to open archive (%s)");
}

Expand All @@ -63,6 +64,7 @@ TarArchive::TarArchive(const Path & path)

archive_read_support_filter_all(archive);
archive_read_support_format_all(archive);
archive_read_set_option(archive, NULL, "mac-ext", NULL);
check(archive_read_open_filename(archive, path.c_str(), 16384), "failed to open archive: %s");
}

Expand Down

0 comments on commit 717347b

Please sign in to comment.