GNU bug report logs - #68968
system reconfigure ignores incorrect --on-error flag value

Previous Next

Package: guix;

Reported by: Michal Atlas <michal_atlas+gnu <at> posteo.net>

Date: Wed, 7 Feb 2024 11:59:01 UTC

Severity: normal

To reply to this bug, email your comments to 68968 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#68968; Package guix. (Wed, 07 Feb 2024 11:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michal Atlas <michal_atlas+gnu <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 07 Feb 2024 11:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michal Atlas <michal_atlas+gnu <at> posteo.net>
To: bug-guix <at> gnu.org
Subject: system reconfigure ignores incorrect --on-error flag value
Date: Wed,  7 Feb 2024 11:48:25 +0000
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





This bug report was last modified 87 days ago.

Previous Next


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