[parted-devel] Running parted-2.2 tests

Gilles Espinasse g.esp at free.fr
Wed Mar 10 08:29:58 UTC 2010


----- Original Message ----- 
From: "Jim Meyering" <jim at meyering.net>
To: "Gilles Espinasse" <g.esp at free.fr>
Cc: "Parted Devel" <parted-devel at lists.alioth.debian.org>
Sent: Tuesday, March 02, 2010 5:23 PM
Subject: Re: [parted-devel] Running parted-2.2 tests


> Gilles Espinasse wrote:
> ...
> >> > +++ dd if=loop-file bs=1 skip=1080 count=1
> >> > 1+0 records in
> >> > 1+0 records out
> >> > 1 byte (1 B) copied, 3.2736e-05 s, 30.5 kB/s
> >> > ++ local orig_pte_name_byte=
> >> > ++ local new_byte
> >>
> >> This may be due to a defective /bin/sh on your system.
> >> What version of which shell is that?
> >>
> >> On other systems (I've tried both debian unstable with bash-4.1.0
> >> and Fedora 12), we get this:
> >>
> >>     orig_pte_name_byte=s
> >>
I added this patch
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
index 5bf38f4..c206fd8 100755
--- a/tests/t0280-gpt-corrupt.sh
+++ b/tests/t0280-gpt-corrupt.sh
@@ -52,6 +52,7 @@ compare /dev/null empty || fail=1
 # We're going to change the name of the first partition,
 # thus invalidating the PartitionEntryArrayCRC32 checksum.
 orig_byte=$(gpt_corrupt_primary_table_ $dev $ss) || fail=1
+printf "orig_byte was %d\n" \'$orig_byte

 # printing the table must succeed, but with a scary diagnostic.
 parted -s $dev print > err 2>&1 || fail=1

and log show
+++ peek_ loop-file 1080
+++ case $# in
+++ case $2 in
+++ dd if=loop-file bs=1 skip=1080 count=1
1+0 records in
1+0 records out
1 byte (1 B) copied, 3.6317e-05 s, 27.5 kB/s
++ local orig_pte_name_byte=
++ local new_byte
++ test x = xA
++ new_byte=A
+++ gpt1_pte_name_offset_ 512
+++ local ss=512
+++ case $ss in
+++ expr 512 '*' 2 + 56
+++ return 0
++ poke_ loop-file 1080 A
++ case $# in
++ case $2 in
++ case $3 in
++ printf %s A
++ dd of=loop-file bs=1 seek=1080 count=1 conv=notrunc
1+0 records in
1+0 records out
1 byte (1 B) copied, 3.5408e-05 s, 28.2 kB/s
++ printf %s ''
++ return 0
+ orig_byte=
+ printf 'orig_byte was %d\n' ''\'''
orig_byte was 0

So it was chr0 and not 's'.
I could manually read the same with
rm -f loop-file
dd if=/dev/null of=loop-file bs=512 seek=5000
parted -s loop-file mklabel gpt
parted -m -s loop-file unit s print
parted -s loop-file mkpart sw linux-swap 2048s 4095s

it look to be a valid gtp partition
[chroot-i486]
root:/usr/src/parted-2.2/tests/pe-t0280-gpt-corrupt.sh.1ULW6aQOjW$ parted -s
loop-file print                    Model:  (file)
Disk /usr/src/parted-2.2/tests/pe-t0280-gpt-corrupt.sh.1ULW6aQOjW/loop-file:
2560kB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB

[chroot-i486]
root:/usr/src/parted-2.2/tests/pe-t0280-gpt-corrupt.sh.1ULW6aQOjW$
orig_byte=$(dd if=loop-file bs=1 skip=1080 count=1);printf "orig_byte=%d\n"
\'$orig_byte
1+0 records in
1+0 records out
1 byte (1 B) copied, 3.2178e-05 s, 31.1 kB/s
orig_byte=0

Gilles





More information about the parted-devel mailing list