From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gNElFTcVlWH/CQEAgWs5BA (envelope-from ) for ; Wed, 17 Nov 2021 15:44:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 6BPBEDcVlWG2JAAAbx9fmQ (envelope-from ) for ; Wed, 17 Nov 2021 14:44:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 18D4D28E0C for ; Wed, 17 Nov 2021 15:44:07 +0100 (CET) Received: from localhost ([::1]:50226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnMAP-0007Pf-Rk for larch@yhetil.org; Wed, 17 Nov 2021 09:44:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56622) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnMAM-0007PA-6D for guix-patches@gnu.org; Wed, 17 Nov 2021 09:44:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mnMAL-0000GB-TY for guix-patches@gnu.org; Wed, 17 Nov 2021 09:44:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mnMAL-0005Vx-Mf for guix-patches@gnu.org; Wed, 17 Nov 2021 09:44:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51878] [PATCH] installer: Rework installation device detection Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Nov 2021 14:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Josselin Poiret Cc: 51878@debbugs.gnu.org Received: via spool by 51878-submit@debbugs.gnu.org id=B51878.163716020221107 (code B ref 51878); Wed, 17 Nov 2021 14:44:01 +0000 Received: (at 51878) by debbugs.gnu.org; 17 Nov 2021 14:43:22 +0000 Received: from localhost ([127.0.0.1]:60578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnM9i-0005UN-Bn for submit@debbugs.gnu.org; Wed, 17 Nov 2021 09:43:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mnM9g-0005U8-QY for 51878@debbugs.gnu.org; Wed, 17 Nov 2021 09:43:21 -0500 Received: from [2001:470:142:3::e] (port=34192 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnM9b-00009L-J7; Wed, 17 Nov 2021 09:43:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=zDuTq1vza8HAiplrqNgitMTcpepRr6qsILzvb+XPpww=; b=C5+SYFjEjvy1mD/KoZ+N 5+lLQv3HVjhofsGUe/PpZJUlI2mEBhGkhJWOFNH+jXaAkStT0ZE6cDE1Pf9+sSoNRKO30ZV0hA6SP 4Wzxnwvln+gB1MzngLCIssWauGzOFJ37h68P5I6CDpBGRt0joDYSc/1x89EiKUiA+ilhl44bN06SK K+dg+iziRActhzmCaHHwMtXV3vFZJAi9/bCPVt0Cnyh2dblG90jQ5J63Um5UrhjipcogQG0H7SENJ lywzidI5cgUl3y2urXH+hSPqPBnrhD6s1NsYz6MToSMfsZaNsl8fToCLRYHfN9rBdgJztdMYmL0lI faoc3ePabX4rTg==; Received: from 2a01cb000492e90078753f5c96c7583f.ipv6.abo.wanadoo.fr ([2a01:cb00:492:e900:7875:3f5c:96c7:583f]:58194 helo=meije) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnM9b-0004J2-CS; Wed, 17 Nov 2021 09:43:15 -0500 From: Mathieu Othacehe References: <20211115210404.10680-1-dev@jpoiret.xyz> Date: Wed, 17 Nov 2021 14:43:11 +0000 In-Reply-To: <20211115210404.10680-1-dev@jpoiret.xyz> (Josselin Poiret's message of "Mon, 15 Nov 2021 21:04:04 +0000") Message-ID: <87lf1mhmgw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637160247; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=zDuTq1vza8HAiplrqNgitMTcpepRr6qsILzvb+XPpww=; b=fP1QAwWIL8+mESiV8RWkQTbadAOe1aBrlKmbVy0TS6GAsK/ermA0imYfzlbU8Q3oCmLrm7 YwnMv+mzUfBYA6xsMt704117Z4jzFlOxgNkwgc8cPwNmRWxsgSQgCr1oEMFZifsugHwKun 0nitDSRE28WMb4Ka1clc1Kw4WGM99TQ6hd5Pt6jlV7VosVM41bV9ahxf0DiyWefRpL9Pe2 zVbs04srX2L1kU20Aga1uTLWHNFQJ/Usk7Xw/CRFCNuz9zHrpzAuc5OP3kPaTwBWjpWML6 MHM+LXAspPgnu2STma1oy9UoIhKUvqc1B6XfWUTb3OV6n6oZqI7D4urhr2Elig== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637160247; a=rsa-sha256; cv=none; b=GvrtnmkML6sZLu31i3DWJZJLYYcA+amdqMOAU//3ipLxD9lo7jhTX8LW2cfZOIV17/jxwY DWQAyR/h1VkMUvRFy0ZiNelxe6gdtlFrvLLFc6s4rk6l/DPt880Jz1IFQON0IeGPeqfk48 rRmeGIgV0Y6NLiyoLlf7QTNQmrMa6Oeh8YjPSw0Qrc0rr+LKyJ3fFCvqtOziMcYvsZeJH4 vAbWdPdmMVsGTcZnSrsM9Wk5QNrmJG0qVfVGs29Gy6uiG/550VNwPyxHtvfX2nG/EknJ4b tWxeU1hieunhfOgRAlfaTZS9X9tp0iWKh/RkklhPQjslv5t9cVvck/TgmH6L4Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=C5+SYFjE; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.05 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=C5+SYFjE; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 18D4D28E0C X-Spam-Score: -2.05 X-Migadu-Scanner: scn0.migadu.com X-TUID: 329RGBunDCcW Hello Josselin, > properly detect the device as it was comparing a disk block device path (eg > `/dev/sda`) with a partition block device path (`/dev/sda2`). Instead, this When using an ISO installer image, > - (or (read-only? device) > - (and install-device > - (string=? file-name install-device))))) > - (devices)))) file-name and install-device both equal "/dev/sr0" for the cdrom device, which means it will be correctly filtered out. Is it handled correctly with your patch? When using a raw disk image, we may indeed compare devices and partitions currently. > + > + (define the-intaller-root-partition-path > + (installer-root-partition-path)) > + > + ;; Read partition table of device and compare each path to the one > + ;; we're booting from to determine if it is the installation > + ;; device. > + (define (installation-device? device) > + (let ((disk (disk-new device))) > + (and disk > + (let loop ((partition #f)) > + (let ((next-partition (disk-next-partition disk > + #:partition > + partition))) > + (and next-partition > + (or (string=? the-installer-root-partition-path > + (partition-get-path > + next-partition)) > + (loop next-partition)))))))) Filtering the "(devices)" list can cause extra iterations compared to your implementation, but is easier to read I think. Thanks, Mathieu