From unknown Thu Aug 14 22:21:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71790: parted -s emits a warning when shrinking a partition Resent-From: Sean Warner Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 27 Jun 2024 04:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71790 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 71790@debbugs.gnu.org X-Debbugs-Original-To: bug-parted@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171946256314475 (code B ref -1); Thu, 27 Jun 2024 04:30:03 +0000 Received: (at submit) by debbugs.gnu.org; 27 Jun 2024 04:29:23 +0000 Received: from localhost ([127.0.0.1]:40744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMgl8-0003lK-Jk for submit@debbugs.gnu.org; Thu, 27 Jun 2024 00:29:23 -0400 Received: from lists.gnu.org ([209.51.188.17]:60970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMbUR-0003sO-9T for submit@debbugs.gnu.org; Wed, 26 Jun 2024 18:51:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMbUO-0007en-F0 for bug-parted@gnu.org; Wed, 26 Jun 2024 18:51:44 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMbUM-00032T-Je for bug-parted@gnu.org; Wed, 26 Jun 2024 18:51:44 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-366df217347so4150200f8f.0 for ; Wed, 26 Jun 2024 15:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719442300; x=1720047100; darn=gnu.org; h=mime-version:user-agent:date:to:from:subject:message-id:from:to:cc :subject:date:message-id:reply-to; bh=y4Lhc/3Z+5SBhPu/n/Jsl1U2529/JRwEu6U6LjRNzIE=; b=VZ11lbZ1DVfBN9aY2zcGyy5UhBCVmXwa4IInXj6FJXNM1WXIrtzo/OBqZLpbcdZOXl d5bAl1PqTY8CYM/p2sNWs4edEZG3bZr2BzFqOZsmVqxnPc0rH7qgVihMclZx3KDCefS5 SDLceV2o6yIecJvlp6kt9eozkRI6OL8S3GxfySOeoGOpRt0Jlc3cyRX0LNOAyK8CNRZW u6krJwLXoFWCc+BY01RkdnYnablesVAetjaayAkly8BChQGLX7PiG1B3h2O/aMsZdL1r wioM3xncryzDptbyjOIOcoKnSvCnC96tIx725p08wotDlWmJOzto0rfTV1hxcaQSpx14 NV6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719442300; x=1720047100; h=mime-version:user-agent:date:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y4Lhc/3Z+5SBhPu/n/Jsl1U2529/JRwEu6U6LjRNzIE=; b=i9uX7G0vLXHvSgKUL7kRxJouGNEPJe29jMWTrilfrwq85Qqv/uBv9uXPpkQ8QFdFEa wcxQr3jo7Y01/BFAXAt1vW+tySeqCmKVDiI2cDpAEmzerUUYOb5OKNEPmpVOGBA/jk6O oHF4zxR8ydRo3BJlNixhSICZlEi4tyo9JsZ+yl9pDWGbAOvjy2tAsnh99SNJOdtlBYSf yHg/SYk5lIqtiKLK5RAXbB7Wg8lPjdf34oQaFZpMlZ5anwxfQkLc4638jRzqER7Qc5tN VbFlwcLafojcLQx7c+IlAXjRnLUPDKi8GaJAAv/dBaulYND4WA1B8ueGBz6wR1Vo/Rmj +xxQ== X-Gm-Message-State: AOJu0Yy5yxVb9EMTL5VHooWW3osLAfpJXHT0tYg3AHjGMQfMwhYsOI2s C0Zp7RVZWQ9egpv0ER88GpKWCHozm6XIuo21fIgB61k8i6MQlzrXfZS/8Q== X-Google-Smtp-Source: AGHT+IGhzpsQCqTmsgrFgOI0x7/kPzii0AccHt/qHMCZOb7vT5wr26jFsks5YsVhOtzjbP1iw+7o5Q== X-Received: by 2002:adf:fd85:0:b0:360:9180:760f with SMTP id ffacd0b85a97d-366e962ff92mr7024702f8f.66.1719442300435; Wed, 26 Jun 2024 15:51:40 -0700 (PDT) Received: from [192.168.1.1] (95-45-113-217-dynamic.agg2.ome.mvw-sla.eircom.net. [95.45.113.217]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3674357c0dbsm98954f8f.12.2024.06.26.15.51.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 15:51:39 -0700 (PDT) Message-ID: <79ff238c357d949911800b22872623f76e47379d.camel@gmail.com> From: Sean Warner Date: Wed, 26 Jun 2024 23:51:38 +0100 Content-Type: multipart/alternative; boundary="=-hxiPDR//ZKkisTxcIxzU" User-Agent: Evolution 3.52.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=plica2006@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Mailman-Approved-At: Thu, 27 Jun 2024 00:29:17 -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.1 (--) --=-hxiPDR//ZKkisTxcIxzU Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I am also having this bug reported in 2017: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D879555 $ parted -v parted (GNU parted) 3.6 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+ Written by . $=C2=A0cat /etc/lsb-release=C2=A0 DISTRIB_ID=3D"ManjaroLinux" DISTRIB_RELEASE=3D"24.0.2" DISTRIB_CODENAME=3D"Wynsdey" -- If increasing the size of a partition the following command works but if shrinking a partition it=C2=A0gives a warning "Warning: Shrinking a partition can cause data loss, are you sure you want to continue?" and the command just exits back to the command prompt and no changes are made to the partition. sudo parted -s /dev/loop0 resizepart 1 46280703s I assumed that parted -s would automatically supply a default value of 'Yes' in this instance? According to the Parted Man page: -s, --script never prompts for user intervention Is this a bug or am I misunderstanding something? >From researching the interweb this might be a bug that for many years has never been addressed. Previous parted versions apparently allowed for something like: sudo parted -s /dev/loop0 resizepart 1 yes 46280703s or sudo parted -s /dev/loop0 resizepart 1 46280703s yes But in parted 3.6 there appears to be no way to make this work with parted -s. The only option is to resort to the undocumented ---pretend- input-tty <-- But is this safe to keep using if not documented? Any plans to make ---pretend-input-tty an official "thing" in Parted? Example that will work whether increasing or reducing the partition size: echo -e "resizepart 1 46280703s\nyes\nunit s\nprint\nquit" | sudo parted /dev/loop0 ---pretend-input-tty Any help much appreciated, Flex --=-hxiPDR//ZKkisTxcIxzU Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
I am also having this bug reported in 2017:
=
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D879555

$ parted -v
parted (GNU parted) 3.6<= /div>
Copyright (C) 2023 Free Software Foundation, Inc.
Licen= se GPLv3+

c= at /etc/lsb-release 
DISTRIB_ID=3D"ManjaroLinux"
DISTRIB_RELEASE=3D"24.0.2"
D= ISTRIB_CODENAME=3D"Wynsdey"

-- If= increasing the size of a partition the following command works but if shri= nking a partition it gives a warning "Warning: Shrinking a partition c= an cause data loss, are you sure you want to continue?" and the command jus= t exits back to the command prompt and no changes are made to the partition= .

sudo parted -s /dev/loop0 resizepart 1 46280703s=

I assumed that parted -s would automatically= supply a default value of 'Yes' in this instance?

According to the Parted Man page:
-s, --script
n= ever prompts for user intervention

Is this a bug o= r am I misunderstanding something?

From researchin= g the interweb this might be a bug that for many years has never been addre= ssed.

Previous parted versions apparently allowed = for something like:

sudo parted -s /dev/loop0= resizepart 1 yes 46280703s
or
sudo parted -= s /dev/loop0 resizepart 1 46280703s yes

But = in parted 3.6 there appears to be no way to make this work with parted -s. = The only option is to resort to the undocumented ---pretend-input-tty <-= - But is this safe to keep using if not documented? Any plans to make ---pr= etend-input-tty an official "thing" in Parted?

Exa= mple that will work whether increasing or reducing the partition size:

echo -e "resizepart 1 46280703s\nyes\nunit s\nprint\nq= uit" | sudo parted /dev/loop0 ---pretend-input-tty

Any help much appreciated,

Flex
<= /span>
--=-hxiPDR//ZKkisTxcIxzU-- From unknown Thu Aug 14 22:21:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71790: parted -s emits a warning when shrinking a partition Resent-From: "Brian C. Lane" Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 27 Jun 2024 15:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71790 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Sean Warner Cc: 71790@debbugs.gnu.org Received: via spool by 71790-submit@debbugs.gnu.org id=B71790.17195021477394 (code B ref 71790); Thu, 27 Jun 2024 15:30:02 +0000 Received: (at 71790) by debbugs.gnu.org; 27 Jun 2024 15:29:07 +0000 Received: from localhost ([127.0.0.1]:43180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMr3a-0001vC-VB for submit@debbugs.gnu.org; Thu, 27 Jun 2024 11:29:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMr3Y-0001v3-LX for 71790@debbugs.gnu.org; Thu, 27 Jun 2024 11:29:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719502141; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oU7VNeEiErQ5bOoObRFS719Yy2akX8pA2lbk/pgCvI0=; b=YM2BXU4ptDoa96FDNmIp0oMg0vGwGum9ZVKebmvYXV02EKTxEa/AwmbOPxnPQi9y2Lws9w 9V2rXa91olCQg/WPTHDej2ncsAbUjKk8cCGGzt/nhflLxU7v0VsACx8kF1k2vGS9I8Pe8j IcvCrmKAjY6LOd6Z/3KrWgYCEOaWUx8= Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-R_GD7e3xO3uGZiEVjQ5ZeA-1; Thu, 27 Jun 2024 11:28:59 -0400 X-MC-Unique: R_GD7e3xO3uGZiEVjQ5ZeA-1 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-2547e18cb07so13020333fac.2 for <71790@debbugs.gnu.org>; Thu, 27 Jun 2024 08:28:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719502138; x=1720106938; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oU7VNeEiErQ5bOoObRFS719Yy2akX8pA2lbk/pgCvI0=; b=u3UmrDD5lLB5FxI63S+cZaPXVCeHo1HS5gMgrF6JAddU1XWv7xBkcONydV2TiUIq5X MPPIBqI6sFqpMEoYAwtowSKoozCahTOQH+rTs8esmfJRZOKRw6Z2SgOtOH03hst9ZRjP 5oflcDIeVB4MJ41zzUsp6I4cXahxFzWo9cqWO+XR04RhXBRuP7IeeR6+0lCM+p4ogOsC nOlnRT+QRrmTcrn6sEDxJl0VH+mlzbby3s+sUDtC9qkn+mXGM2cVIjdwtko9k2LS5QTA 1SktN939OLE+HRmG1nSES9CsmG/n+Ej8VtyR3j5ThZb4Sf0t9/YLCYw8tnbTzDbxJW7q O1sQ== X-Gm-Message-State: AOJu0Yz5Dyk5+ca0jtn/afEbpbolXwSYNTiVPxE92mY8/X5qxKXi4kKX et7Q/tSTUrUX2pAnldHGlEbf/HUeqyneuysedSvaH/ulZ/HLia4TWnhT2qi/zS61ShTvv34SU0a /09ztG3yofJ2pvulMfPmlOyf3GKTZcIFMM/tunVd+8FRdvyHK2EI2 X-Received: by 2002:a05:6870:d623:b0:25d:1c0:803e with SMTP id 586e51a60fabf-25d01c080aemr14251857fac.7.1719502138221; Thu, 27 Jun 2024 08:28:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5DWE95dq27e5Yr4hLvl97hnG/+nyv2yLvf4ZKTgoIWrmDG/TKrwIbA/AUDzb1DshNL25xWQ== X-Received: by 2002:a05:6870:d623:b0:25d:1c0:803e with SMTP id 586e51a60fabf-25d01c080aemr14251847fac.7.1719502137874; Thu, 27 Jun 2024 08:28:57 -0700 (PDT) Received: from ohop.brianlane.com (c-24-16-250-154.hsd1.wa.comcast.net. [24.16.250.154]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-706b4a34ce6sm1494722b3a.162.2024.06.27.08.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 08:28:57 -0700 (PDT) Date: Thu, 27 Jun 2024 08:28:55 -0700 From: "Brian C. Lane" Message-ID: References: <79ff238c357d949911800b22872623f76e47379d.camel@gmail.com> MIME-Version: 1.0 In-Reply-To: <79ff238c357d949911800b22872623f76e47379d.camel@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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, Jun 26, 2024 at 11:51:38PM +0100, Sean Warner wrote: > I am also having this bug reported in 2017: > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=879555 > > $ parted -v > parted (GNU parted) 3.6 > Copyright (C) 2023 Free Software Foundation, Inc. > License GPLv3+ > Written by > . > > $ cat /etc/lsb-release  > DISTRIB_ID="ManjaroLinux" > DISTRIB_RELEASE="24.0.2" > DISTRIB_CODENAME="Wynsdey" > > -- If increasing the size of a partition the following command works > but if shrinking a partition it gives a warning "Warning: Shrinking a > partition can cause data loss, are you sure you want to continue?" and > the command just exits back to the command prompt and no changes are > made to the partition. > > sudo parted -s /dev/loop0 resizepart 1 46280703s > > I assumed that parted -s would automatically supply a default value of > 'Yes' in this instance? No, in script mode parted defaults to the safe option. Automatically saying yes will lead to data loss so it defaults to know. I admit the message is misleading, this is because of how parted handles warnings like this and it could use some improvement. I don't really have any suggestion for working around this other than doing it in interactive mode. > input-tty <-- But is this safe to keep using if not documented? Any > plans to make ---pretend-input-tty an official "thing" in Parted? No, it's there for the tests. But there's no plan to remove it since the tests depend on it. But I really don't recommend automating things that could lose data. Brian -- Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart From unknown Thu Aug 14 22:21:02 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71790: parted -s emits a warning when shrinking a partition Resent-From: Sean Warner Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 27 Jun 2024 21:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71790 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 71790@debbugs.gnu.org Received: via spool by 71790-submit@debbugs.gnu.org id=B71790.171952532222438 (code B ref 71790); Thu, 27 Jun 2024 21:56:02 +0000 Received: (at 71790) by debbugs.gnu.org; 27 Jun 2024 21:55:22 +0000 Received: from localhost ([127.0.0.1]:43549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMx5N-0005pp-NT for submit@debbugs.gnu.org; Thu, 27 Jun 2024 17:55:22 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:57471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMx5L-0005pa-N8 for 71790@debbugs.gnu.org; Thu, 27 Jun 2024 17:55:20 -0400 Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-36742cc9c12so971838f8f.2 for <71790@debbugs.gnu.org>; Thu, 27 Jun 2024 14:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719525250; x=1720130050; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:date:to:from:subject :message-id:from:to:cc:subject:date:message-id:reply-to; bh=Y5v04JaIaaVbFem9KVsR1M0RlYplO6/HEByT35f+4Co=; b=aAhlqg17NZ1LIUaiME+Z9ei9Pn2n5ctbHnrht95uWEDeh8E7YwO1BBJ8Wze8dnTkOb IFeyPVxazHVTVAitJ1i9rTxAGopXtia9UI2mqzKuVpY9asiFsnm27V0wNEVabol+Te7y NLlOs9mZxHazNfStV0zUUCMq2F+cMlFqyO7mGUnh05v7irNSWZ/0NYE84tNLRyAKVr0O oZU5YFHXYG/yayvqg2ARhx5uZMROcu7Tl/NCbgkkqwgjmGvaPMKhz6NoBvjEX+nuCuhj kl0BgOhFn0KBRSva+svNdW1zetHnXaNTE0+fTsJipE6UoGct8wJkySi0DakDyB8Kl41n RVxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719525250; x=1720130050; h=mime-version:user-agent:references:in-reply-to:date:to:from:subject :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y5v04JaIaaVbFem9KVsR1M0RlYplO6/HEByT35f+4Co=; b=Fc6N83wgOh8UYhB1E7EdMV8tCd/RHfoP485r2PiHq+VyOThU6UTNsKfO4vWbLfagRr LYv/BaaRyX5GN/0K0/lQ6g6dXgW2iWN7JprSoI2W4v/TZ0N+caT1zlISsnQ7UI7Riwpe /eef084KM2Pm6oqyxeFuMYLyBIF6xjvfRoECLhsCYkH5etB/qeFwruC4VBcZs1X9m/4A jscVvXweYPawGk1lbSy8CfTAhumlh8lI1UfBWrTZl2AHvBjekV/Vmjs28hsJpFxkR5dZ Nvv6E1PJO3uKQlEjg9ICLSaL9MO9aBUsYAk1rbNpNBtFuvcWH32yd1QhOyR7GV2DUIUd xiTw== X-Gm-Message-State: AOJu0Yy/uezjASX4rjE7e7dPNKck55LKz7x1FYZnpk7EWdJFJ/y2+wO7 HwGclcmPJIVzYUsgFTWnPpKKNXkrlkFPqfBUKpZv0aPjEIXna7R0VrN+GQ== X-Google-Smtp-Source: AGHT+IGQoH6c289X1mqWEPwbMKcUEGtWtdR4YqevqhWqSFs2xjsXvxgG3bqM7m8oL3HhwtsZKxDpSQ== X-Received: by 2002:a05:6000:18a1:b0:366:eeda:c32a with SMTP id ffacd0b85a97d-366eedac3eamr10690907f8f.7.1719525250348; Thu, 27 Jun 2024 14:54:10 -0700 (PDT) Received: from [192.168.1.1] (95-45-113-217-dynamic.agg2.ome.mvw-sla.eircom.net. [95.45.113.217]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3675a0fc41esm386178f8f.78.2024.06.27.14.54.09 for <71790@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jun 2024 14:54:09 -0700 (PDT) Message-ID: From: Sean Warner Date: Thu, 27 Jun 2024 22:54:08 +0100 In-Reply-To: References: <79ff238c357d949911800b22872623f76e47379d.camel@gmail.com> Content-Type: multipart/alternative; boundary="=-IYIVgAHG8uq2uwZw5b6N" User-Agent: Evolution 3.52.2 MIME-Version: 1.0 X-Spam-Score: 0.2 (/) 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: -0.8 (/) --=-IYIVgAHG8uq2uwZw5b6N Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Brian, Thank you for your helpful reply. There are many threads on various sites where people, like me, have incorrectly assumed that parted -s will let you do whatever you want and are left confused. It makes sense to apply the philosophy of do-no- harm with the parted --script option but perhaps the man page needs to clarify the intended behavior. Currently it simply says: "-s --script never prompts for user intervention" instead maybe something like: "Will default safe answers to user prompts such as 'No' when parted checks if it is OK to shrink a partition." OK that sounds wordy but I think better to have verbose man pages that don't leave any doubt as to what the intended functionality is. This bug report=C2=A0https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27204=C2=A0(Nor= man Shulman) proposes a patch to really make parted -s "never prompt for user intervention" even if shrinking a partition. I tried it out and it works, at least I have the option now! --- a/parted/parted.c 2014-06-15 15:16:33.000000000 -0400 +++ b/parted/parted.c 2017-05-24 17:27:02.093371079 -0400 @@ -1551,7 +1551,7 @@ do_resizepart (PedDevice** dev, PedDisk* start, end)) goto error_destroy_constraint; /* warn when shrinking partition - might lose data */ - if (part->geom.end < oldend) + if (part->geom.end < oldend && !opt_script_mode) if (ped_exception_throw ( PED_EXCEPTION_WARNING, PED_EXCEPTION_YES_NO, Cheers, Sean=C2=A0 -----Original Message----- From: Brian C. Lane To: Sean Warner Cc: 71790@debbugs.gnu.org Subject: Re: bug#71790: parted -s emits a warning when shrinking a partition Date: 27/06/24 16:28:55 On Wed, Jun 26, 2024 at 11:51:38PM +0100, Sean Warner wrote: > I am also having this bug reported in 2017: > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D879555 >=20 > $ parted -v > parted (GNU parted) 3.6 > Copyright (C) 2023 Free Software Foundation, Inc. > License GPLv3+ > Written by > = . >=20 > $=C2=A0cat /etc/lsb-release=C2=A0 > DISTRIB_ID=3D"ManjaroLinux" > DISTRIB_RELEASE=3D"24.0.2" > DISTRIB_CODENAME=3D"Wynsdey" >=20 > -- If increasing the size of a partition the following command works > but if shrinking a partition it=C2=A0gives a warning "Warning: Shrinking = a > partition can cause data loss, are you sure you want to continue?" > and > the command just exits back to the command prompt and no changes are > made to the partition. >=20 > sudo parted -s /dev/loop0 resizepart 1 46280703s >=20 > I assumed that parted -s would automatically supply a default value > of > 'Yes' in this instance? No, in script mode parted defaults to the safe option. Automatically saying yes will lead to data loss so it defaults to know. I admit the message is misleading, this is because of how parted handles warnings like this and it could use some improvement. I don't really have any suggestion for working around this other than doing it in interactive mode. > input-tty <-- But is this safe to keep using if not documented? Any > plans to make ---pretend-input-tty an official "thing" in Parted? No, it's there for the tests. But there's no plan to remove it since the tests depend on it. But I really don't recommend automating things that could lose data. Brian --=-IYIVgAHG8uq2uwZw5b6N Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hello Brian,

Thank you f= or your helpful reply.

There are many threads on v= arious sites where people, like me, have incorrectly assumed that parted -s= will let you do whatever you want and are left confused. It makes sense to= apply the philosophy of do-no-harm with the parted --script option but per= haps the man page needs to clarify the intended behavior.

Currently it simply says: "-s --script never prompts for user in= tervention" instead maybe something like: "Will default safe answers to= user prompts such as 'No' when parted checks if it is OK to shrink a parti= tion." OK that sounds wordy but I think better to have verbose man pages th= at don't leave any doubt as to what the intended functionality is.

This bug report https://debbugs.gnu.org/cgi/bugreport.cgi?bug= =3D27204 (Norman Shulman) proposes a patch to really make parted -= s "never prompt for user intervention" even if shrinking a partition. I tri= ed it out and it works, at least I have the option now!

--- a/par=
ted/parted.c	2014-06-15 15:16:33.000000000 -0400
+++ b/parted/parted.c	2017-05-24 17:27:02.093371079 -0400
@@ -1551,7 +1551,7 @@ do_resizepart (PedDevice** dev, PedDisk*
                                           start, end))
                 goto error_destroy_constraint;
         /* warn when shrinking partition - might lose data */
-        if (part->geom.end < oldend)
+        if (part->geom.end < oldend && !opt_script_mode)
                 if (ped_exception_throw (
                             PED_EXCEPTION_WARNING,
                             PED_EXCEPTION_YES_NO,

Cheers,

Sean 

-----= Original Message-----
From: Brian C. Lane <bcl@redhat.com>= ;
To: Sean Warner <plica2006@gmail.com>
Cc: <= a href=3D"mailto:71790@debbugs.gnu.org">71790@debbugs.gnu.org
Subject: Re: bug#71790: parted -s emits a warning when shrinking a = partition
Date: 27/06/24 16:28:55

On Wed, Jun 26, 2024 at 11:51:38PM +0100, Sean Warner wrote:
I am also having this bug reported in 2017:
=
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D879555

$ parted -v
parted (GNU parted) 3.6
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+
Written by

$ cat /etc/lsb-release 
DISTRIB_ID=3D"ManjaroLinux"
DISTRIB_RELEASE=3D"24.0.2"
<= /div>
DISTRIB_CODENAME=3D"Wynsdey"

-- If i= ncreasing the size of a partition the following command works
but if shrinking a partition it gives a warning "Warning: Shrinking a=
partition can cause data loss, are you sure you want to cont= inue?" and
the command just exits back to the command prompt = and no changes are
made to the partition.

<= /div>
sudo parted -s /dev/loop0 resizepart 1 46280703s
I assumed that parted -s would automatically supply a default = value of
'Yes' in this instance?
<= br>
No, in script mode parted defaults to the safe option. Automa= tically
saying yes will lead to data loss so it defaults to k= now. I admit the
message is misleading, this is because of ho= w parted handles warnings
like this and it could use some imp= rovement.

I don't really have any suggestion f= or working around this other than
doing it in interactive mod= e.

input-tty <--= But is this safe to keep using if not documented? Any
plans = to make ---pretend-input-tty an official "thing" in Parted?

No, it's there for the tests. But there's no pla= n to remove it since the
tests depend on it. But I really don= 't recommend automating things that
could lose data.

Brian

--=-IYIVgAHG8uq2uwZw5b6N--