From patchwork Thu Jan 6 22:47:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 36053 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D078127BBE9; Thu, 6 Jan 2022 22:49:15 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 488F227BBEA for ; Thu, 6 Jan 2022 22:49:15 +0000 (GMT) Received: from localhost ([::1]:43926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5bZK-0007R4-Ek for patchwork@mira.cbaines.net; Thu, 06 Jan 2022 17:49:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bZ8-0007P1-Px for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5bZ8-00074Q-GO for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5bZ8-00004u-Fq for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH wip-harden-installer 01/14] installer: Use define instead of let at top-level. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 Jan 2022 22:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53063 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53063@debbugs.gnu.org Cc: Josselin Poiret Received: via spool by 53063-submit@debbugs.gnu.org id=B53063.164150931632569 (code B ref 53063); Thu, 06 Jan 2022 22:49:02 +0000 Received: (at 53063) by debbugs.gnu.org; 6 Jan 2022 22:48:36 +0000 Received: from localhost ([127.0.0.1]:42576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYh-0008T8-OX for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:36 -0500 Received: from jpoiret.xyz ([206.189.101.64]:35884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYg-0008Sz-MI for 53063@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:35 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id C7518184D98; Thu, 6 Jan 2022 22:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1641509314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AYAELU2YYSxP6xZiza7ofFvxFOT2oqZL5X+TXp7zLvg=; b=tHjU7Ove1ede1OZBIF+opNUgkRUgtaW6kImHVBa/PQSXmbORCucHJjEEC7wGer7tDYuCHl cXbPiARbTktRDVZ50Eauswmb8taIb7YNGaocCFfqxK+MDV8/V4CjBWBosveAEWo4DYGdZa PgOMmPWJ/S+xGRYwyvKH/rawUDFkKCEbgOaCK1CfKPF/bFY0zANNVeVfjlo9iGaI9KgLcZ 1YCY9QnbDFzTBda3krblkvhhCzn9icx0NxeEbe2pzQoXUBFEOm6rfbaIvo8NC5WLIdjFKu JzckvK54xfdBgZUqBB7ycF+PSszp+TyuPi1CXCbey3W4Dk338Z6EuVZFzlqCNw== Date: Thu, 6 Jan 2022 23:47:59 +0100 Message-Id: <5eec8987674e650ca14b1b1b3e8a211d10e772fd.1641507696.git.dev@jpoiret.xyz> In-Reply-To: References: MIME-Version: 1.0 X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Josselin Poiret X-ACL-Warn: , Josselin Poiret via Guix-patches X-Patchwork-Original-From: Josselin Poiret via Guix-patches via From: Josselin Poiret X-getmail-retrieved-from-mailbox: Patches * gnu/installer.scm (installer-program): Improve readability by using define at top-level. --- gnu/installer.scm | 88 +++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/gnu/installer.scm b/gnu/installer.scm index d57b1d673a..134fa2faaf 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -412,50 +412,50 @@ (define installer-builder ;; verbose. (terminal-width 200) - (let* ((current-installer newt-installer) - (steps (#$steps current-installer))) - ((installer-init current-installer)) - - (catch #t - (lambda () - (define results - (run-installer-steps - #:rewind-strategy 'menu - #:menu-proc (installer-menu-page current-installer) - #:steps steps)) - - (match (result-step results 'final) - ('success - ;; We did it! Let's reboot! - (sync) - (stop-service 'root)) - (_ - ;; The installation failed, exit so that it is restarted - ;; by login. - #f))) - (const #f) - (lambda (key . args) - (syslog "crashing due to uncaught exception: ~s ~s~%" - key args) - (let ((error-file "/tmp/last-installer-error") - (dump-archive "/tmp/dump.tgz")) - (call-with-output-file error-file - (lambda (port) - (display-backtrace (make-stack #t) port) - (print-exception port - (stack-ref (make-stack #t) 1) - key args))) - (make-dump dump-archive - #:result %current-result - #:backtrace error-file) - (let ((report - ((installer-dump-page current-installer) - dump-archive))) - ((installer-exit-error current-installer) - error-file report key args))) - (primitive-exit 1))) - - ((installer-exit current-installer))))))) + (define current-installer newt-installer) + (define steps (#$steps current-installer)) + ((installer-init current-installer)) + + (catch #t + (lambda () + (define results + (run-installer-steps + #:rewind-strategy 'menu + #:menu-proc (installer-menu-page current-installer) + #:steps steps)) + + (match (result-step results 'final) + ('success + ;; We did it! Let's reboot! + (sync) + (stop-service 'root)) + (_ + ;; The installation failed, exit so that it is restarted + ;; by login. + #f))) + (const #f) + (lambda (key . args) + (syslog "crashing due to uncaught exception: ~s ~s~%" + key args) + (let ((error-file "/tmp/last-installer-error") + (dump-archive "/tmp/dump.tgz")) + (call-with-output-file error-file + (lambda (port) + (display-backtrace (make-stack #t) port) + (print-exception port + (stack-ref (make-stack #t) 1) + key args))) + (make-dump dump-archive + #:result %current-result + #:backtrace error-file) + (let ((report + ((installer-dump-page current-installer) + dump-archive))) + ((installer-exit-error current-installer) + error-file report key args))) + (primitive-exit 1))) + + ((installer-exit current-installer)))))) (program-file "installer"