system reconfigure ignores incorrect --on-error flag value

  • Open
  • quality assurance status badge
Details
One participant
  • Michal Atlas
Owner
unassigned
Submitted by
Michal Atlas
Severity
normal
M
M
Michal Atlas wrote on 7 Feb 12:48 +0100
(address . bug-guix@gnu.org)
fa140478-1bf0-1b32-2e56-063e56eb9d72@posteo.net
In the guix/scripts/system.scm file we do not check the value while parsing the flag:

Toggle snippet (6 lines)
(option '("on-error") #t #f
        (lambda (opt name arg result)
          (alist-cons 'on-error (string->symbol arg)
                      result)))

and then blindly pass it to load*:

Toggle snippet (4 lines)
(load* file %user-module
#:on-error (assoc-ref opts 'on-error))

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:

Toggle snippet (9 lines)
(case on-error
((debug)
...)
((backtrace)
...)
(else
#t))

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

Minimum replication:
Toggle snippet (4 lines)
guix system build <(echo x) --on-error=stacktrace
guix system build <(echo x) --on-error=backtrace

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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 68968@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68968
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch