[parted-devel] Running parted-2.2 tests
Jim Meyering
jim at meyering.net
Tue Mar 2 16:23:01 UTC 2010
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
>>
>> That your shell assigns the empty string there is very suspicious.
>>
> bash was to patch 33, I upgraded to 37 with no changes
>
> [chroot-i486] root:/$ ls -l /bin/sh
> lrwxrwxrwx 1 root root 4 Feb 26 22:20 /bin/sh -> bash
> [chroot-i486] root:/$ bash --version
> GNU bash, version 4.0.37(1)-release (i686-pc-linux-gnu)
>
>
>> FYI, in case you can investigate, the code in question is in
> tests/t-local.sh:
>>
>> # Change the name of the first partition in the primary GPT table,
>> # thus invalidating the PartitionEntryArrayCRC32 checksum.
>> gpt_corrupt_primary_table_()
>> {
>> case $# in 2) ;; *) echo "$0: expected 2 args, got $#" >&2; return 1;;
> esac
>> local dev=$1
>> local ss=$2
>> case $ss in *[^0-9]*) echo "$0: invalid sector size: $ss">&2; return 1;;
> esac
>>
>> # get the first byte of the name
>> local orig_pte_name_byte=$(peek_ $dev $(gpt1_pte_name_offset_ $ss)) ||
> return 1
>>
> I don't think I have peek_ and poke_ (the other reason for the failure in
> 5000)
> Where should they come from?
They're defined just above that function, in tests/t-local.sh.
peek_()
{
case $# in 2) ;; *) echo "usage: peek_ FILE 0_BASED_OFFSET" >&2; exit 1;; esac
case $2 in *[^0-9]*) echo "peek_: invalid offset: $2" >&2; exit 1 ;; esac
dd if="$1" bs=1 skip="$2" count=1
}
poke_()
{
case $# in 3) ;; *) echo "usage: poke_ FILE 0_BASED_OFFSET BYTE" >&2; exit 1;;
esac
case $2 in *[^0-9]*) echo "poke_: invalid offset: $2" >&2; exit 1 ;; esac
case $3 in ?) ;; *) echo "poke_: invalid byte: '$3'" >&2; exit 1 ;; esac
printf %s "$3" | dd of="$1" bs=1 seek="$2" count=1 conv=notrunc
}
More information about the parted-devel
mailing list