summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-01-30 11:33:18 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-01-30 12:39:40 +0200
commit4cf1acc7f3033b50b0bf19e02c9f522d522d338c (patch)
tree9fd64956ee60304c15387eb394cd649e49f01467 /nix
parentedb8c09addd186d9538d43b12af74d6c7aeea082 (diff)
parent595b53b74e3ef57a1c0c96108ba86d38a170a241 (diff)
Merge remote-tracking branch 'origin/master' into core-updates
Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm
Diffstat (limited to 'nix')
-rw-r--r--nix/libstore/build.cc2
-rw-r--r--nix/libutil/hash.cc9
-rw-r--r--nix/libutil/util.cc4
3 files changed, 9 insertions, 6 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 10a6093bd5..c5383bc756 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2576,7 +2576,7 @@ Path DerivationGoal::openLogFile()
closeOnExec(fd);
if (!(fLogFile = fdopen(fd.borrow(), "w")))
- throw SysError(format("opening file `%1%'") % logFileName);
+ throw SysError(format("opening log file `%1%'") % logFileName);
int err;
if (!(bzLogFile = BZ2_bzWriteOpen(&err, fLogFile, 9, 0, 0)))
diff --git a/nix/libutil/hash.cc b/nix/libutil/hash.cc
index 7853acdd49..9b83ffcdd9 100644
--- a/nix/libutil/hash.cc
+++ b/nix/libutil/hash.cc
@@ -76,8 +76,11 @@ string printHash(const Hash & hash)
Hash parseHash(HashType ht, const string & s)
{
Hash hash(ht);
- if (s.length() != hash.hashSize * 2)
- throw Error(format("invalid hash `%1%'") % s);
+ if (s.length() != hash.hashSize * 2) {
+ string algo = gcry_md_algo_name(ht);
+ throw Error(format("invalid %1% hash '%2%' (%3% bytes but expected %4%)")
+ % algo % s % (s.length() / 2) % hash.hashSize);
+ }
for (unsigned int i = 0; i < hash.hashSize; i++) {
string s2(s, i * 2, 2);
if (!isxdigit(s2[0]) || !isxdigit(s2[1]))
@@ -244,7 +247,7 @@ Hash hashFile(HashType ht, const Path & path)
start(ht, ctx);
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
- if (fd == -1) throw SysError(format("opening file `%1%'") % path);
+ if (fd == -1) throw SysError(format("computing hash of file `%1%'") % path);
unsigned char buf[8192];
ssize_t n;
diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc
index 4d3780e3c2..82eac72120 100644
--- a/nix/libutil/util.cc
+++ b/nix/libutil/util.cc
@@ -264,7 +264,7 @@ string readFile(const Path & path, bool drain)
{
AutoCloseFD fd = open(path.c_str(), O_RDONLY);
if (fd == -1)
- throw SysError(format("opening file `%1%'") % path);
+ throw SysError(format("reading file `%1%'") % path);
return drain ? drainFD(fd) : readFile(fd);
}
@@ -273,7 +273,7 @@ void writeFile(const Path & path, const string & s)
{
AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT, 0666);
if (fd == -1)
- throw SysError(format("opening file '%1%'") % path);
+ throw SysError(format("writing file '%1%'") % path);
writeFull(fd, s);
}