And this is the test file...

If you run this with the current parted it wont create a partition table on the 
file.

Comments greatly appreciated.

Joel Andres Granados wrote:
Hi list:

There is an issue with parted 1.8.1 in scripting mode.  It sometimes does not know that 
it should just continue and not ask the user about anything.  This patch addresses the 
creation of partitions when the command `parted -s  /dev/sdb "mklabel gpt mkpart 
primary ext3 1s -1s"`.  I'll send a test script that shows the misbehavior.

I think that there is two ways out of this: 1. To react according to the value 
of opt_script_mode before we through the exception and format the exception 
accordingly. or, 2. search for the value of opt_script_mode in the exception 
code (ped_exception_throw function) the and always return a yes for a yes_no 
exception question.

IMO we should go with the first.
This allows us to actually change the warning message and not print the "Is this 
still acceptable for you" message.  The message should include a question when in 
interactive mode, and should not include a question when in scripting mode.  This could 
also be done if we make the change in the exception code,  but we would have to change  
the ped_exception_throw function and the code that calls the function as well as we would 
have to anticipate ped_exception_throw behavior and change the message format accordingly.

I think that there might be a case where we need the ped_exception_throw 
function to stop when in opt_script_mode is set.  Like when a command is not 
really suppose to be scriptable.

The first option means of course that we need to look for all the places that 
we need to check the opt_script_mode variable and not wait for answers from the 
user, but I think community testing can take care of those :)

This is not the last draft of the patch, I post it to the list to get some 
feedback.
Comments on the patch are greatly appreciated.

--
Joel Andres Granados
Red Hat / Brno, Czech Republic
#!/bin/bash

dd if=/dev/zero of=testfile bs=512 count=100
parted -s  testfile "mklabel gpt mkpart primary ext3 1s -1s"
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to