From: "Ludovic Courtès" <ludo@gnu.org>
To: 75402@debbugs.gnu.org
Cc: "Luis Guilherme Coelho" <lgcoelho@disroot.org>,
"Ludovic Courtès" <ludo@gnu.org>,
"Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#75402] [PATCH 3/3] reconfigure: Make ‘load-system-for-kexec’ errors non-fatal.
Date: Mon, 6 Jan 2025 13:58:37 +0100 [thread overview]
Message-ID: <7b6998df5bf49154493079c304e2362eb102b57c.1736168031.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1736168030.git.ludo@gnu.org>
Partially fixes <https://issues.guix.gnu.org/75215>.
* guix/scripts/system/reconfigure.scm (load-system-for-kexec): Catch
exceptions in the gexp. Report them outside.
Reported-by: Luis Guilherme Coelho <lgcoelho@disroot.org>
Change-Id: Iebcdc92e29b8623a55967d58a4f353abab01631a
---
guix/scripts/system/reconfigure.scm | 33 +++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/system/reconfigure.scm b/guix/scripts/system/reconfigure.scm
index 96e5bff351..d35980590d 100644
--- a/guix/scripts/system/reconfigure.scm
+++ b/guix/scripts/system/reconfigure.scm
@@ -230,10 +230,35 @@ (define* (upgrade-shepherd-services eval os)
to-restart)))))))
(define (load-system-for-kexec eval os)
- "Load OS so that it can be rebooted into via kexec, if supported. Return
-true on success."
- (eval #~(and (string-contains %host-type "-linux")
- (primitive-load #$(kexec-loading-program os)))))
+ "Load OS so that it can be rebooted into via kexec, if supported. Print a
+warning in case of failure."
+ (mlet %store-monad
+ ((result (eval
+ #~(and (string-contains %host-type "-linux")
+ (with-exception-handler
+ (lambda (c)
+ (define kind-and-args?
+ (exception-predicate &exception-with-kind-and-args))
+
+ (list 'exception
+ (if (kind-and-args? c)
+ (call-with-output-string
+ (lambda (port)
+ (print-exception port #f
+ (exception-kind c)
+ (exception-args c))))
+ (object->string c))))
+ (lambda ()
+ (primitive-load #$(kexec-loading-program os))
+ 'success)
+ #:unwind? #t)))))
+ (match result
+ ('success
+ (return #t))
+ (('exception message)
+ (warning (G_ "failed to load operating system for kexec: ~a~%")
+ message)
+ (return #f)))))
\f
;;;
--
2.47.1
next prev parent reply other threads:[~2025-01-06 13:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 12:57 [bug#75402] [PATCH 0/3] Assorted kexec fixes Ludovic Courtès
2025-01-06 12:58 ` [bug#75402] [PATCH 1/3] reconfigure: Do not pass KEXEC_FILE_DEBUG Ludovic Courtès
2025-01-06 12:58 ` [bug#75402] [PATCH 2/3] syscalls: Remove wrong syscall ID for ‘kexec_load_file’ on i686 Ludovic Courtès
2025-01-06 12:58 ` Ludovic Courtès [this message]
2025-01-07 10:41 ` [bug#75402] [PATCH 0/3] Assorted kexec fixes Tomas Volf
2025-01-07 10:48 ` Ludovic Courtès
2025-01-07 10:58 ` Tomas Volf
2025-01-07 18:12 ` Ludovic Courtès
2025-01-07 18:08 ` bug#75402: " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b6998df5bf49154493079c304e2362eb102b57c.1736168031.git.ludo@gnu.org \
--to=ludo@gnu.org \
--cc=75402@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=lgcoelho@disroot.org \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.