[parted-devel] Scripting miss behavior from parted
Joel Andres Granados
jgranado at redhat.com
Wed Jun 18 11:26:56 UTC 2008
Hi list:
I apologize if I double posted or posted some gibberish or didn't post at all....I had a little configuration problem with git. I hope everything is ok :) Resending in case this did not reach the 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 are 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) and always return a yes for a yes_no exception question if we find the opt_script_mode to be true.
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, which is nonsense in when scripting. 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.
Moreover 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 and somehow it ends up being called as such.
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.
More information about the parted-devel
mailing list