[parted-devel] [PATCH] [RFC] Do not automatically update GPT label in interactive mode
Jim Meyering
jim at meyering.net
Mon Feb 16 18:27:18 UTC 2009
Petr Uzel <petr.uzel at suse.cz> wrote:
> Here is a simple shell script that illustrates the incorrect behavior.
> The patch I've sent before fixes the issue (at least for me ;) ).
>
> ============================
> I'd like to transform it to the form of parted-testsuite, but it will
> take me some time as I'm not familiar much with it - any hints would
> be highly appreciated ;)
Great.
Thanks for the example.
Here's how I'd do it, using only a backing file.
No need for lvm.
First I do it at the shell/command-line level:
dev=file
dd if=/dev/null of=$dev bs=1 seek=30M
./parted -s $dev mklabel gpt
dd if=$dev of=before bs=512 count=1 skip=1 2>/dev/null
./parted -m -s $dev p
# make the backing file larger. one byte is enough
printf x >> $dev
./parted -m -s $dev p
Error: The backup GPT table is not at the end of the disk, as it should be...
...
dd if=$dev of=after bs=512 count=1 skip=1 2>/dev/null
cmp before after
before after differ: byte 17, line 1
[Exit 1]
Then I made that into a test like any of the others:
[I chose a low numbered name for the new file, because this is a
very fundamental property of partition tables (no file system
aspects involved) ]
In the process, I discovered a GPT-related bug that
would provoke a failed assertion. So I fixed that. Patch below.
Would you like to write the test case for *it*?
If so, please name it t0201-gpt.sh, since it'll be
very similar to the one below (which has a FIXME
comment I plan to address before pushing).
My plan for tomorrow:
- apply your patch, and test a little
- address FIXME comment in the test script below
- ensure that the test passes
- push your patch and the test-adding one
If you write the test to exercise my patch,
(or tell me you'd rather not, in which case I'll do it),
I'll push those two change sets, too.
More information about the parted-devel
mailing list