1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 06:31:00 +01:00

Merge pull request #64 from DeterminateSystems/better-truncated-tar-error

Improve 'cannot read file from tarball' error
This commit is contained in:
Graham Christensen 2025-05-12 21:05:45 +00:00 committed by GitHub
commit cf3671a815
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,7 +219,7 @@ time_t unpackTarfileToSink(TarArchive & archive, ExtendedFileSystemObjectSink &
std::vector<unsigned char> buf(128 * 1024); std::vector<unsigned char> buf(128 * 1024);
auto n = archive_read_data(archive.archive, buf.data(), buf.size()); auto n = archive_read_data(archive.archive, buf.data(), buf.size());
if (n < 0) if (n < 0)
throw Error("cannot read file '%s' from tarball", path); checkLibArchive(archive.archive, n, "cannot read file from tarball: %s");
if (n == 0) if (n == 0)
break; break;
crf(std::string_view{ crf(std::string_view{