all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: 57232@debbugs.gnu.org
Subject: bug#57232: [installer] ENTER in guided partitioner destroys partition table
Date: Tue, 16 Aug 2022 10:51:43 +0200	[thread overview]
Message-ID: <87y1voefkw.fsf@gnu.org> (raw)
In-Reply-To: <87zgg5f6el.fsf@nckx> (Tobias Geerinckx-Rice's message of "Tue, 16 Aug 2022 01:05:29 +0200")

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]


Hey Tobias,

> What that does is immediately and without confirmation wipe the on-disc
> partition table.  And its back-up.

Oops, glad you were able to recover, I was also bitten in the past. The
attached patch adds an extra confirmation page before wiping everything,
WDYT?

Mathieu

[-- Attachment #2: 0001-installer-partition-Add-a-confirmation-page-before-f.patch --]
[-- Type: text/x-patch, Size: 2111 bytes --]

From 4a9c1fb1fe7f9a65b2b7d1f9e4419b1d28a8082e Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Tue, 16 Aug 2022 10:49:07 +0200
Subject: [PATCH 1/1] installer: partition: Add a confirmation page before
 formatting.

Fixes: <https://issues.guix.gnu.org/57232>.

* gnu/installer/newt/partition.scm (run-label-confirmation-page): New
procedure.
(run-label-page): Call the above procedure before proceeding.
---
 gnu/installer/newt/partition.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index e7a97810ac..f11a644f92 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2018, 2019, 2022 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
@@ -92,6 +92,15 @@ (define (device-items)
          (device (car result)))
     device))
 
+(define (run-label-confirmation-page callback)
+  (lambda (item)
+    (and (run-confirmation-page
+          (format #f (G_ "This will create a new ~a partition table, \
+all data on disk will be lost, are you sure you want to proceed?") item)
+          (G_ "Format disk?")
+          #:exit-button-procedure callback)
+         item)))
+
 (define (run-label-page button-text button-callback)
   "Run a page asking the user to select a partition table label."
   ;; Force the GPT label if UEFI is supported.
@@ -103,6 +112,8 @@ (define (run-label-page button-text button-callback)
        #:title (G_ "Partition table")
        #:listbox-items '("msdos" "gpt")
        #:listbox-item->text identity
+       #:listbox-callback-procedure
+       (run-label-confirmation-page button-callback)
        #:button-text button-text
        #:button-callback-procedure button-callback)))
 
-- 
2.37.1


  reply	other threads:[~2022-08-16  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 23:05 bug#57232: [installer] ENTER in guided partitioner destroys partition table Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-08-16  8:51 ` Mathieu Othacehe [this message]
2022-08-16 16:55   ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-08-16 21:42     ` Mathieu Othacehe
2022-08-16 23:40       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2022-10-13  8:50   ` Mathieu Othacehe

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=87y1voefkw.fsf@gnu.org \
    --to=othacehe@gnu.org \
    --cc=57232@debbugs.gnu.org \
    --cc=me@tobias.gr \
    /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.