On Fri, Dec 20, 2013 at 6:25 PM, Phillip Susi <ps...@ubuntu.com> wrote: > gpt.c was simply truncating the UTF-16 characters stored > in the partition name field to 8 bits. This corrupted non > ascii characters which later resulted in parted crashing in > strlist.c trying to convert the now invalid multi byte > characters to wchar. > > gpt.c will now properly convert the UTF-16 to the current > locale encoding.
Thanks for adding the test. Please add something like this to NEWS, too: parted no longer crashes when processing non-ASCII partition names Please make the new t*.sh script executable. > libparted/labels/gpt.c | 60 > ++++++++++++++++++++++++++++++++++++++++------ > tests/Makefile.am | 1 + > tests/t0251-gpt-unicode.sh | 40 +++++++++++++++++++++++++++++++ > diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh > new file mode 100644 ... > +dev=loop-file > + > +# create zeroed device > +truncate -s 10m $dev || fail=1 > + > +# create gpt label with named partition > +parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 fooᴤ > empty > 2>&1 || fail=1 Please keep the contents of this test source file ASCII, e.g., part_name=$(printf 'foo\341\264\244') parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 fooᴤ > empty 2>&1 || fail=1 > +# ensure there was no output > +compare /dev/null empty || fail=1 > + > +# check for expected output > +dd if=$dev bs=1 skip=$((512+$sector_size_+58)) count=10 2>/dev/null | hd > + > out || fail=1 We have never used "hd" so far in these tests. Let's use "od" instead, e.g., $ printf 'foo\341\264\244\n'|od -An -tx1 66 6f 6f e1 b4 a4 0a > +cat <<EOF >> exp > +00000000 66 00 6f 00 6f 00 24 1d 00 00 |f.o.o.$...| > +0000000a > +EOF Then the above four lines can become one line: echo '...' > exp || framework_failure_ > +compare exp out || fail=1