From unknown Sat Aug 16 18:43:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43993: parted in script mode still needs "yes/no" as input in "are you sure" questions Resent-From: Michael Kopp Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Wed, 14 Oct 2020 20:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43993 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 43993@debbugs.gnu.org X-Debbugs-Original-To: bug-parted@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160270706428677 (code B ref -1); Wed, 14 Oct 2020 20:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Oct 2020 20:24:24 +0000 Received: from localhost ([127.0.0.1]:53092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSnJv-0007SR-1B for submit@debbugs.gnu.org; Wed, 14 Oct 2020 16:24:24 -0400 Received: from lists.gnu.org ([209.51.188.17]:38626) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSlwN-0003DV-2k for submit@debbugs.gnu.org; Wed, 14 Oct 2020 14:55:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSlwM-0004WC-Qo for bug-parted@gnu.org; Wed, 14 Oct 2020 14:55:58 -0400 Received: from sonic312-26.consmr.mail.ir2.yahoo.com ([77.238.178.97]:34828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSlwJ-0006mH-LC for bug-parted@gnu.org; Wed, 14 Oct 2020 14:55:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1602701751; bh=xZafcCqjQQkkhIkNLPGdLoB6NhmC4mbXvOkThBx5S6k=; h=To:From:Subject:Date:References:From:Subject; b=lHyBH51BspjxS3bi7P8+Lo1YFYy/zRIOKrgN2JYIG3oz10mb/f/9Mf8BSlcOZ0iMkZzAC+4veI4yhz/3ymtgopsq2iMthWl+Bwyiq+6dLzu9qeMO6xStjH6B2tFXeY1g4hUuoWSmM4hXRA90l4BRlYpfR6XKwO4HaTWbnBoOcQKn8NcI7ooPYlZYIvL08OXgVsGW9k4e7KFTE9s/GloWlc3iYCBMGVmS9Yf5kAeOKduPx4VyvoybMxqQeZBt+bUZW02wahPsxadCMfxY4yoDU2BRbU1tGRisE2PpS9XZFb1W7zhR6BaTTI0dyRaij0qprr3mz56ULyjB4B06o0rKMA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1602701751; bh=dTLnNf1fBvHCbBZfCbeTBU1TK1rVNkmboiRvPZNDqC2=; h=To:From:Subject:Date; b=lTpLXLIBdLO9ImnYY8J/Ih+EZHVhW97VPa6QChgYKpgDV80r6Au1HpEaMlAznfTMSe6GjkGfdFCCk22rwErpYISK0vdxjF5A4gnqiHggo0aU4Ie4HLm1QLcSq7MoPMLX/QrjGAMYV7EhHHdf+E2IY4IKXhtD37upA90JuWSzHrUUYSH//n9cch5fsDWjftbrnsSQvoRXU8TyjJLxkE8NE8bfBDSnq67itwcK6WFF2t0RNwdlh61m8VSSmST2y+K6edOYKeocul1ly9Qq1Yp3DasSaeL18GYRiGa3hLd5wj/N1WWalFZ2r0BGe7MbOvMRYpV+Vg0j8JylvXP7U1dcxw== X-YMail-OSG: RJ1Qd3QVM1n2mL6maNjnzhK.4qXfgV9uwUPdIJ6K6g7OLdh_pL3RLkPs8KsNgze va8XETa7KdZEstfcp4oTfuVxezrg.iCDWkeDjMSFDP4emSXW1bcjDlwQNDdtXp6Y_6Aq2TV7VI9i 3PJjyvpav.ln_lKEggW4bIa2bLyg_mC.gDTabPZ85YehYPr7cIsXrr5rddI7YFwPrBymzmyUE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Pgt60.4gnhGbv4LyQipHfQxBBgjEW61hL5J5BdYgq7u3kkXxVcCTUainAH dW35dHPXE9NBthEmvW_xRA5rN7R4vJfe1gJHiPgXlODQ8gy4qMnp_1q0ntjH4svWwpF5N_2p2vNc TSSgK_osAHt8A2Xds19yRtr9IN8LaYWpdVHMbGu.ciN4Y4B6zoCfWnghchYHHxVM28bHHCvRgnew AIpnexYxzPq6kD0yR.NJMEpVjfq_tSncyr9SRRctdRRqecQfe Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Wed, 14 Oct 2020 18:55:51 +0000 Received: by smtp413.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 8f40666acac7bff7c5647ae1b5debef9; Wed, 14 Oct 2020 18:55:46 +0000 (UTC) From: Michael Kopp Message-ID: Date: Wed, 14 Oct 2020 20:55:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit References: X-Mailer: WebService/1.1.16863 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) Content-Length: 2877 Received-SPF: pass client-ip=77.238.178.97; envelope-from=kopp.michael@yahoo.de; helo=sonic312-26.consmr.mail.ir2.yahoo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/14 14:31:01 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Mailman-Approved-At: Wed, 14 Oct 2020 16:24:21 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hi, I wanted to use parted in a script and used the `--script` option. Unfortunately, I wanted to do something risky (resizing the partition that is still mounted -- in my defense: It's only in a virtual machine), and then the script will not continue but die with Warning: partition /dev/sda2 is being used. Are you sure you want to continue? The program does not run through and the size is not changed. Even using something like `yes | parted --script ...` does not fix the issue. This does sound like kind of a bug to me. I would propose to add something like an `--assume-yes` option, which will answer to the messages in some way to make the script continue (or only to yes/no questions?). I took a look at the code, how one could add something like this but I'm not fluent in this kind of C programming. The little thingy I could produce was the following patch. What do you think about the behavior and the proposal? Cheers, Michael ``` diff --git a/parted/parted.c b/parted/parted.c index dbd38d0..58b0621 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -115,6 +115,7 @@ static struct option const options[] = { {"list", 0, NULL, 'l'}, {"machine", 0, NULL, 'm'}, {"script", 0, NULL, 's'}, + {"assume-yes", 0, NULL, 'y'}, {"version", 0, NULL, 'v'}, {"align", required_argument, NULL, 'a'}, {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY}, @@ -126,12 +127,14 @@ static const char *const options_help [][2] = { {"list", N_("lists partition layout on all block devices")}, {"machine", N_("displays machine parseable output")}, {"script", N_("never prompts for user intervention")}, + {"assume-yes", N_("Assume yes to all answers (useful in script mode)")}, {"version", N_("displays the version")}, {"align=[none|cyl|min|opt]", N_("alignment for new partitions")}, {NULL, NULL} }; int opt_script_mode = 0; +int opt_assume_yes = 0; int pretend_input_tty = 0; int opt_machine_mode = 0; int disk_is_modified = 0; @@ -225,6 +228,14 @@ _partition_warn_busy (PedPartition* part) if (ped_partition_is_busy (part)) { path = ped_partition_get_path (part); + if (opt_assume_yes) + { + printf(_("Partition %s is being used, but " + "assume-yes mode is on, so we will go ahead."), + path); + free (path); + return 1; + } if (ped_exception_throw ( PED_EXCEPTION_WARNING, PED_EXCEPTION_YES_NO, ``` -- Michael Kopp From unknown Sat Aug 16 18:43:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43993: parted in script mode still needs "yes/no" as input in "are you sure" questions Resent-From: "Brian C. Lane" Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Wed, 14 Oct 2020 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43993 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Michael Kopp Cc: 43993@debbugs.gnu.org Received: via spool by 43993-submit@debbugs.gnu.org id=B43993.160270753829535 (code B ref 43993); Wed, 14 Oct 2020 20:33:02 +0000 Received: (at 43993) by debbugs.gnu.org; 14 Oct 2020 20:32:18 +0000 Received: from localhost ([127.0.0.1]:53114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSnRZ-0007gI-Lv for submit@debbugs.gnu.org; Wed, 14 Oct 2020 16:32:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21811) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSnRW-0007g9-LK for 43993@debbugs.gnu.org; Wed, 14 Oct 2020 16:32:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602707534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9MMs/DFOevP0S9G5JlPuQ293MTQw93iATZpeM0OLLFA=; b=VjJ/yRiO6WZN27cjxPfE1vwYBuc4MiA1A3rReDHXcaRy4c4tXnRg5UIdzv+/tK7nDhtrY2 qLd9MMXwblKgIXqQy+1TIwKec1SuFRn+eJ+SfhGnC7WDyI6zMce1mH0a4myjCFX//vdigH XrH+TAmUmuwH01H5ykGB5Pjrg4/P61w= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-KfeOh3RaPfC1jL7qM52pdg-1; Wed, 14 Oct 2020 16:32:11 -0400 X-MC-Unique: KfeOh3RaPfC1jL7qM52pdg-1 Received: by mail-pf1-f200.google.com with SMTP id y7so255020pff.20 for <43993@debbugs.gnu.org>; Wed, 14 Oct 2020 13:32:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9MMs/DFOevP0S9G5JlPuQ293MTQw93iATZpeM0OLLFA=; b=EusGcLzYV9W9Fa1LuhPQUsUSrmlPT67j+czyiQR6dw812BvCCwKpXxbycDD804x1Eb aiERGbqtoc2H0WbFuwzapU1Tf1BfUyMHoqBVWxxqPok+IauAKLX5k5iioaXkKbvqWF2Z T+tNUtEN/Aqpcx202X+jg79+Elz2uyN01BJAd2Q9d8oSloshrwfVo3CeVv7eTXOxRMBL NdzrbeZtPEuO7gkeU8FJ+kxIQzo+1l6zi5dPiEUCDwRhEa2QkqFDwAlvSgqwHVv6+s6Q o9XKavX9mS+Pr940Ahbq7dZBifWakeoybfKOt3c9OAmNqnikre3voUIPQX47wctMqC64 MixA== X-Gm-Message-State: AOAM5329uNSHYuc9YjBnm2xwozEDtBoClkY1BE+DqEavwM8Xp9qtbCSD GfytR4Cl0FncVG8V8Z8ueIgudH8jTkJy+kykLbf66NfXishYWF1p1voz/6Ieqx839OxtJ4aarOJ qpbouQNprl1nPaR0= X-Received: by 2002:a62:1c8f:0:b029:156:6ebd:3361 with SMTP id c137-20020a621c8f0000b02901566ebd3361mr1014771pfc.42.1602707530898; Wed, 14 Oct 2020 13:32:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmIWBoD5GgzZtXe0+G5n2MwKASvYXKt9ih/yYLrD3qWeoaBbY/dKPYWMBUw0QibCBt6qgqjw== X-Received: by 2002:a62:1c8f:0:b029:156:6ebd:3361 with SMTP id c137-20020a621c8f0000b02901566ebd3361mr1014680pfc.42.1602707529663; Wed, 14 Oct 2020 13:32:09 -0700 (PDT) Received: from ohop.brianlane.com (c-73-157-81-114.hsd1.wa.comcast.net. [73.157.81.114]) by smtp.gmail.com with ESMTPSA id x16sm509780pff.14.2020.10.14.13.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 13:32:09 -0700 (PDT) Date: Wed, 14 Oct 2020 13:32:07 -0700 From: "Brian C. Lane" Message-ID: <20201014203207.GB1730@ohop.brianlane.com> References: MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bcl@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, Oct 14, 2020 at 08:55:45PM +0200, Michael Kopp via Bug reports for the GNU Parted disk partition editor wrote: > Hi, > > I wanted to use parted in a script and used the `--script` option. > Unfortunately, I wanted to do something risky (resizing the partition > that is still mounted -- in my defense: It's only in a virtual machine), > and then the script will not continue but die with > > Warning: partition /dev/sda2 is being used. Are you sure > you want to continue? I'm reluctant to add something like this because of the potential for data loss when things go wrong. The script mode defaults to 'safe' for all of the prompts like this to avoid unexpected surprises. Brian -- Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart