1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 10:21:47 +02:00

* NAR archives: handle files larger than 2^32 bytes. Previously it

would just silently store only (fileSize % 2^32) bytes.
* Use posix_fallocate if available when unpacking archives.
* Provide a better error message when trying to unpack something that
  isn't a NAR archive.
This commit is contained in:
Eelco Dolstra 2009-03-22 17:36:43 +00:00
parent 7e05b8b75e
commit 77d272623f
7 changed files with 48 additions and 17 deletions

View file

@ -617,16 +617,19 @@ static void opExport(Strings opFlags, Strings opArgs)
static void opImport(Strings opFlags, Strings opArgs)
{
bool requireSignature = false;
for (Strings::iterator i = opFlags.begin();
i != opFlags.end(); ++i)
foreach (Strings::iterator, i, opFlags)
if (*i == "--require-signature") requireSignature = true;
else throw UsageError(format("unknown flag `%1%'") % *i);
if (!opArgs.empty()) throw UsageError("no arguments expected");
FdSource source(STDIN_FILENO);
while (readInt(source) == 1)
while (true) {
int n = readInt(source);
if (n == 0) break;
if (n != 1) throw Error("input doesn't look like something created by `nix-store --export'");
cout << format("%1%\n") % store->importPath(requireSignature, source) << std::flush;
}
}