unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Michal Atlas <michal_atlas+gnu@posteo.net>
To: 68968@debbugs.gnu.org
Subject: bug#68968: system reconfigure ignores incorrect --on-error flag value
Date: Wed,  7 Feb 2024 11:48:25 +0000	[thread overview]
Message-ID: <fa140478-1bf0-1b32-2e56-063e56eb9d72@posteo.net> (raw)

In the guix/scripts/system.scm file we do not check the value while parsing the flag:

--8<---------------cut here---------------start------------->8---
(option '("on-error") #t #f
         (lambda (opt name arg result)
           (alist-cons 'on-error (string->symbol arg)
                       result)))
--8<---------------cut here---------------end--------------->8---

and then blindly pass it to load*:

--8<---------------cut here---------------start------------->8---
(load* file %user-module
        #:on-error (assoc-ref opts 'on-error))
--8<---------------cut here---------------end--------------->8---

and load* uses it in a case that only gets called when an actual error occurs and treats the correct symbols but has a default clause that silently ignores values other than debug and backtrace:

--8<---------------cut here---------------start------------->8---
(case on-error
   ((debug)
    ...)
   ((backtrace)
    ...)
   (else
    #t))
--8<---------------cut here---------------end--------------->8---

meaning that for example a typo such as `--on-error=stacktrace`, gets treated as if the flag was not passed at all.

Minimum replication:
--8<---------------cut here---------------start------------->8---
guix system build <(echo x) --on-error=stacktrace
guix system build <(echo x) --on-error=backtrace
--8<---------------cut here---------------end--------------->8---

I'm not sure where the check should be done, nor what would be an acceptable way to not duplicate the list of valid values between guix/ui.scm and guix/scripts/system.scm





                 reply	other threads:[~2024-02-07 11:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=fa140478-1bf0-1b32-2e56-063e56eb9d72@posteo.net \
    --to=michal_atlas+gnu@posteo.net \
    --cc=68968@debbugs.gnu.org \
    /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).