diff options
author | Phillip Susi <psusi@ubuntu.com> | 2013-12-22 22:13:12 -0500 |
---|---|---|
committer | Phillip Susi <psusi@ubuntu.com> | 2013-12-23 10:18:34 -0500 |
commit | cf16ea884fc72aa99b49f721fc186429cec9fa87 (patch) | |
tree | 496404d3c46169ce7c44d02ae5d08d7a2b550165 /tests/t0251-gpt-unicode.sh | |
parent | 01900e056ec250836d15b5f5c3f59a8e1454b781 (diff) | |
download | parted-cf16ea884fc72aa99b49f721fc186429cec9fa87.tar.gz |
bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly
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.
Diffstat (limited to 'tests/t0251-gpt-unicode.sh')
-rwxr-xr-x | tests/t0251-gpt-unicode.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh new file mode 100755 index 0000000..36a4c26 --- /dev/null +++ b/tests/t0251-gpt-unicode.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Test unicode partition names +# Copyright (C) 2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. "${srcdir=.}/init.sh"; path_prepend_ ../parted + +dev=loop-file + +# create zeroed device +truncate -s 10m $dev || fail=1 + +export LC_ALL=en_US.UTF-8 +# create gpt label with named partition +part_name=$(printf 'foo\341\264\244') +parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > 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=$(($sector_size_+$sector_size_+58)) count=10 2>/dev/null | od -An -tx1 > out || fail=1 +echo ' 66 00 6f 00 6f 00 24 1d 00 00' >> exp +compare exp out || fail=1 + +Exit $fail |