GNU bug report logs - #56503
Poor error message on missing file using substitute*

Previous Next

Package: guix;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 11 Jul 2022 22:17:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Daniel Meißner <daniel.meissner-i4k <at> ruhr-uni-bochum.de>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: 56503 <at> debbugs.gnu.org
Subject: bug#56503: Poor error message on missing file using substitute*
Date: Wed, 13 Jul 2022 12:23:31 +0200
Hi,

Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:

> When substitute* encounters a nonexistent file, the error is reported
> to the guix CLI like so:
>
> [...]
>
> The main error message, "system-error "mkstemp" "~A" ("No such file or
> directory") (2)" is malformed and doesn't report the actual file which
> is missing; one must decipher the backtrace for clues as to which file
> caused the error.
>
> We should improve it :-).

I am Guix and Guile newbie but looking at the definition of the
procedure ‘with-atomic-file-replacement’ I think we have to catch the
(possible) exception of the call to ‘mkstemp!’ and provide a custom
error message.

This is because the exception thrown by ‘mkstemp!’ does not contain any
information about which file was tried.  Try this snippet in a Guile
REPL:

--8<---------------cut here---------------start------------->8---
(with-exception-handler (lambda (x) (write x) (newline))
  (lambda ()
    (mkstemp! "/non/existing/path/foo.XXXXXX")))
--8<---------------cut here---------------end--------------->8---

It prints:

--8<---------------cut here---------------start------------->8---
#<&compound-exception components: (#<&external-error> #<&origin origin: "mkstemp"> #<&message message: "~A"> #<&irritants irritants: ("Datei oder Verzeichnis nicht gefunden")> #<&exception-with-kind-and-args kind: system-error args: ("mkstemp" "~A" ("Datei oder Verzeichnis nicht gefunden") (2))>)>
--8<---------------cut here---------------end--------------->8---

So maybe this is a bug in Guile? Shouldn’t ‘mkstemp!’ list the path in
the irritants?

Best

-- 
Daniel




This bug report was last modified 2 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.