From patchwork Thu Jan 6 22:48:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josselin Poiret X-Patchwork-Id: 36061 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 6CD4327BBEB; Thu, 6 Jan 2022 22:52:00 +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 18BD527BBEA for ; Thu, 6 Jan 2022 22:52:00 +0000 (GMT) Received: from localhost ([::1]:49408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5bbz-0003KO-8u for patchwork@mira.cbaines.net; Thu, 06 Jan 2022 17:51:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5bZB-0007W2-U9 for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49731) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5bZB-00075Z-KH for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n5bZB-000063-K1 for guix-patches@gnu.org; Thu, 06 Jan 2022 17:49:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53063] [PATCH wip-harden-installer 10/14] installer: Raise condition when mklabel fails. Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 06 Jan 2022 22:49:05 +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.164150932532701 (code B ref 53063); Thu, 06 Jan 2022 22:49:05 +0000 Received: (at 53063) by debbugs.gnu.org; 6 Jan 2022 22:48:45 +0000 Received: from localhost ([127.0.0.1]:42616 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYq-0008VG-Fq for submit@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:44 -0500 Received: from jpoiret.xyz ([206.189.101.64]:36368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5bYm-0008Tv-Ic for 53063@debbugs.gnu.org; Thu, 06 Jan 2022 17:48:40 -0500 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 23E62184D98; Thu, 6 Jan 2022 22:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1641509320; 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=j1+E8H+8d39neV6FFL1ihLD+RKMyC2d6miPvlu5wODs=; b=Jf5hjKM/j4x7CIw3yDm3jGTNkhM8gF+kLnqdw0d4Qh0uRf+2/zXVEZXtWZFFpM3kSm7pDU IyffsvaJ7iAxz/WSlFGmI3q7tSW+DaGkA9CRqtysKjwtMIfSns5bmtiKqvXGo4ZH+RFUhb GFtBnJSU0XynJtbBlVRyrjJGxuONe/iokjgyyIbFCJK2ngzW8UKCF5fgYdKxZCPovV48Bd k5ZdI1F1pDTFkqAaHXxXG+Ls3e0IyVrW9nasF3TtehKylkUmBXhdxK3pTP3PZ6PUfthxPK 4OLeU8VArC2kqNgVdWAq2KoGrjeD8r5dYv0v/k7kgildrbKUxRTcPRL31C6lSg== Date: Thu, 6 Jan 2022 23:48:08 +0100 Message-Id: <6155fe6216aadb42c2f7f67274fb4eb888cb7b4c.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/parted.scm (mklabel): Do it. --- gnu/installer/parted.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm index c8bb73ee64..e33ef5f8fd 100644 --- a/gnu/installer/parted.scm +++ b/gnu/installer/parted.scm @@ -635,8 +635,14 @@ (define (user-partition-description user-partition) (define (mklabel device type-name) "Create a partition table on DEVICE. TYPE-NAME is the type of the partition table, \"msdos\" or \"gpt\"." - (let ((type (disk-type-get type-name))) - (disk-new-fresh device type))) + (let* ((type (disk-type-get type-name)) + (disk (disk-new-fresh device type))) + (or disk + (raise + (condition + (&error) + (&message (message (format #f "Cannot create partition table of type +~a on device ~a." type-name (device-path device))))))))) ;;