From fda598cfdd83a3617f1d554fc9bb720d1d079dff Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Sat, 11 Mar 2023 21:38:44 +0400 Subject: [PATCH] Make tar invocation portable, fix OpenBSD build/test At least on OpenBSD, tar(1) reads from /dev/rst0 not stdin by default options must specififed consistently with or without dashes, not mixed. Specify standard input explicitly to not rely on implementation details. Use either option style consistently. --- src/libexpr/primops/fetchGit.cc | 2 +- tests/tarball.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc index d866647f0..ca5af7492 100644 --- a/src/libexpr/primops/fetchGit.cc +++ b/src/libexpr/primops/fetchGit.cc @@ -174,7 +174,7 @@ GitInfo exportGit(ref store, const std::string & uri, Path tmpDir = createTempDir(); AutoDelete delTmpDir(tmpDir, true); - runProgram("tar", true, { "x", "-C", tmpDir }, tar); + runProgram("tar", true, { "-x", "-f", "-", "-C", tmpDir }, tar); gitInfo.storePath = store->addToStore(name, tmpDir); diff --git a/tests/tarball.sh b/tests/tarball.sh index ba534c626..b2acb9eb9 100644 --- a/tests/tarball.sh +++ b/tests/tarball.sh @@ -11,7 +11,7 @@ cp dependencies.nix $tarroot/default.nix cp config.nix dependencies.builder*.sh $tarroot/ tarball=$TEST_ROOT/tarball.tar.xz -(cd $TEST_ROOT && tar c tarball) | xz > $tarball +(cd $TEST_ROOT && tar cf - tarball) | xz > $tarball nix-env -f file://$tarball -qa --out-path | grep -q dependencies