GNU bug report logs - #24215
command=`rm`: how to script responses?

Previous Next

Package: parted;

Reported by: bug-parted <at> gnu.org, Tom Roche <Tom_Roche <at> pobox.com>

Date: Fri, 12 Aug 2016 23:22:02 UTC

Severity: normal

Tags: patch

Merged with 22167

Full log


View this message in rfc822 format

From: Phil Susi <psusi <at> ubuntu.com>
To: Tom Roche <Tom_Roche <at> pobox.com>, 24215 <at> debbugs.gnu.org
Subject: bug#24215: command=`rm`: how to script responses?
Date: Wed, 31 Aug 2016 17:07:46 -0400
On 8/12/2016 7:21 PM, Tom Roche wrote:
> $ sudo parted ${DRIVE_DEV} --script -- rm 1
>> Warning: Partition /dev/sdb1 is being used. Are you sure you want to continue?
> 
> This seems wrong to me, in 2 ways:
> 
> 1. The manual[2] says quite clearly
>> ‘-s’
>> ‘--script’
>> never prompt the user

That is correct; it does not prompt the user.  You do still get the
warning that something is wrong though, and then parted exits with an error.

> So ISTM[3] either something is wrong with the code or with the manual. Am I missing something? 
> 
> 2. I can't find a way to script a response to the prompt. I have tried various permutations of
> 
>     echo 'yes' | sudo parted ${DRIVE_DEV} --script -- rm 1
>     yes | sudo parted ${DRIVE_DEV} --script -- rm 1
>     yes Y | sudo parted ${DRIVE_DEV} --script -- rm 1
>     sudo sh -c "yes yes | sudo parted ${DRIVE_DEV} --script -- rm 1"

Leave off the --script so that it prompts for a response, and then you
can give it the yes response on the command line, probably followed by
the ignore response to the error that is going to follow.

I've know about this class of problem for some time now but can't come
up with a satisfactory way to deal with it.  Something along the lines
of --yes-i-know-it-is-in-use to automatically answer that particular
response with a yes, if and only if it comes up would be ideal, but due
to the way the libparted api is designed, implementing such a thing is
difficult.





This bug report was last modified 5 years and 162 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.