unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Meißner via Bug reports for GNU Guix" <bug-guix@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 56503@debbugs.gnu.org
Subject: bug#56503: Poor error message on missing file using substitute*
Date: Wed, 13 Jul 2022 12:23:31 +0200	[thread overview]
Message-ID: <8735f51fbw.fsf@ruhr-uni-bochum.de> (raw)
In-Reply-To: <87r12r9txi.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 11 Jul 2022 18:16:25 -0400")

Hi,

Maxim Cournoyer <maxim.cournoyer@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




  reply	other threads:[~2022-07-13 10:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 22:16 bug#56503: Poor error message on missing file using substitute* Maxim Cournoyer
2022-07-13 10:23 ` Daniel Meißner via Bug reports for GNU Guix [this message]
2022-07-13 19:46   ` Liliana Marie Prikler
2022-07-18 12:57   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735f51fbw.fsf@ruhr-uni-bochum.de \
    --to=bug-guix@gnu.org \
    --cc=56503@debbugs.gnu.org \
    --cc=daniel.meissner-i4k@ruhr-uni-bochum.de \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).