From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: gpt mishandles non ascii partition names Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 11 Oct 2013 19:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org X-Debbugs-Original-To: "bug-parted@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.138151795817301 (code B ref -1); Fri, 11 Oct 2013 19:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Oct 2013 18:59:18 +0000 Received: from localhost ([127.0.0.1]:43625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUhvh-0004Uy-SR for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44749) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUhvg-0004Ur-0T for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUhvZ-0003Uz-TI for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvZ-0003Uu-Pr for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvU-0002SG-9z for bug-parted@gnu.org; Fri, 11 Oct 2013 14:59:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUhvO-0003SX-Kz for bug-parted@gnu.org; Fri, 11 Oct 2013 14:59:04 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:61084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvO-0003SR-Gy for bug-parted@gnu.org; Fri, 11 Oct 2013 14:58:58 -0400 X-Authority-Analysis: v=2.0 cv=auQw+FlV c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=Qsx_du5GiBkA:10 a=sCfsyOEanakA:10 a=CaGQTAwTuEkA:10 a=S1A5HrydsesA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=jI-KHgsGx_YA:10 a=danhDmx_AAAA:8 a=QfKxxUxMAAAA:8 a=QU5NSF2I7XW8Q_w3pIkA:9 a=wPNLvfGTeEIA:10 a=0B7kyOrQLHoA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:52261] helo=[10.1.1.236]) by cdptpa-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 11/C6-01471-17A48525; Fri, 11 Oct 2013 18:58:57 +0000 Message-ID: <52584A71.2080301@ubuntu.com> Date: Fri, 11 Oct 2013 14:58:57 -0400 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Original bug report: https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1238446 The gpt partition table has 16 bit characters for the name, which I assume are supposed to be UTF-16, but the bloody uefi standard is moot on the subject. Currently parted simply decimates the characters, throwing out the upper 8 bits. This corrupts characters that aren't simple ascii, and at some later point, strlist.c calls mbstrtowcs(), which chokes on the corrupt name causing parted to bail out with "Error during translation". I think that gpt.c needs to translate the UTF-16 to the native multibyte encoding, but I have no idea how to do that. The C standard conversion functions all seem to use the current locale and don't have a way to override it if you know this string is in UTF-16 ( and maybe the current locale is UTF-8 ). -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSWEpxAAoJEJrBOlT6nu75YYYH+gOqxQdKmRmPFfSAFbkOnXzf 9SqhaamWXNmqWLCaKHb4COO0S/Wg5Uu5Kzw0chqFbty0+S+Wa13/SM97S25SxUmh q3sVnWbVwbOW5D2NAGhC7jjGwpZ9F4k45xE4DaHntSD1lsoYfq5+D25+4h7GTNqL vliuuFhzUs5dQke/ONFnRfDb202ZC4j+HE7nBRwRm7VsUswsiiPVV8dz5iSQhkD1 /tx3N63A9aViBpFLlgGZu8XSaBHoE+4ZZ/COEGPzga372GDXyccODe0QfmErqWKI 3s0juqk5uOhUWvrWfzaYDtFEG+3AXuIXm8OT/SEQ4uKlqpCBKsFoBQLRGvoEPOE= =0KW9 -----END PGP SIGNATURE----- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 14 13:50:42 2013 Received: (at control) by debbugs.gnu.org; 14 Oct 2013 17:50:42 +0000 Received: from localhost ([127.0.0.1]:49231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVmHy-0000p2-2M for submit@debbugs.gnu.org; Mon, 14 Oct 2013 13:50:42 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:39155) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVmHq-0000ok-NS for control@debbugs.gnu.org; Mon, 14 Oct 2013 13:50:39 -0400 X-Authority-Analysis: v=2.0 cv=N/mr5hBB c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=Qsx_du5GiBkA:10 a=sCfsyOEanakA:10 a=4xGza5WrNBEA:10 a=S1A5HrydsesA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=IbrB8of2KH0A:10 a=eAW4V0x159Bbr_Oqom4A:9 a=wPNLvfGTeEIA:10 a=5ffwx4AglO4A:10 a=pFslaYIHIiIA:10 a=B9cvR--qHFsA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:55349] helo=[10.1.1.236]) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 74/7C-06764-8EE2C525; Mon, 14 Oct 2013 17:50:33 +0000 Message-ID: <525C2EE8.1010209@ubuntu.com> Date: Mon, 14 Oct 2013 13:50:32 -0400 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: Re: bug#15597: bug-parted Digest, Vol 131, Issue 9 References: <525979C8.7030106@rodsbooks.com> In-Reply-To: <525979C8.7030106@rodsbooks.com> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) merge 15597 15591 thanks From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly References: <52584A71.2080301@ubuntu.com> In-Reply-To: <52584A71.2080301@ubuntu.com> Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 19 Dec 2013 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138748836113240 (code B ref 15591); Thu, 19 Dec 2013 21:26:01 +0000 Received: (at 15591) by debbugs.gnu.org; 19 Dec 2013 21:26:01 +0000 Received: from localhost ([127.0.0.1]:59069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtl6W-0003RR-32 for submit@debbugs.gnu.org; Thu, 19 Dec 2013 16:26:00 -0500 Received: from rrcs-67-78-168-186.se.biz.rr.com ([67.78.168.186]:42922 helo=iriserv.iradimed.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtl6T-0003RF-Hs for 15591@debbugs.gnu.org; Thu, 19 Dec 2013 16:25:58 -0500 Received: by iriserv.iradimed.com (Postfix, from userid 1000) id 5F4AC47E58; Thu, 19 Dec 2013 16:25:56 -0500 (EST) From: Phillip Susi Date: Thu, 19 Dec 2013 16:25:56 -0500 Message-Id: <1387488356-9975-1-git-send-email-psusi@ubuntu.com> X-Mailer: git-send-email 1.8.3.2 X-Spam-Score: 0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) 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. --- libparted/labels/gpt.c | 60 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 490de70..73109f4 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "xalloc.h" #include "verify.h" @@ -192,7 +194,7 @@ struct __attribute__ ((packed)) _GuidPartitionEntry_t uint64_t StartingLBA; uint64_t EndingLBA; GuidPartitionEntryAttributes_t Attributes; - efi_char16_t PartitionName[72 / sizeof (efi_char16_t)]; + efi_char16_t PartitionName[36]; }; #define GPT_PMBR_LBA 0 @@ -276,7 +278,8 @@ typedef struct _GPTPartitionData { efi_guid_t type; efi_guid_t uuid; - char name[37]; + efi_char16_t name[37]; + char *translated_name; int lvm; int raid; int boot; @@ -785,10 +788,11 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) gpt_part_data = part->disk_specific; gpt_part_data->type = pte->PartitionTypeGuid; gpt_part_data->uuid = pte->UniquePartitionGuid; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) gpt_part_data->name[i] = (efi_char16_t) PED_LE16_TO_CPU ((uint16_t) pte->PartitionName[i]); gpt_part_data->name[i] = 0; + gpt_part_data->translated_name = 0; gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service @@ -1196,7 +1200,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) if (gpt_part_data->legacy_boot) pte->Attributes.LegacyBIOSBootable = 1; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) pte->PartitionName[i] = (efi_char16_t) PED_CPU_TO_LE16 ((uint16_t) gpt_part_data->name[i]); } @@ -1371,6 +1375,8 @@ gpt_partition_duplicate (const PedPartition *part) goto error_free_part; *result_data = *part_data; + if (part_data->translated_name) + result_data->translated_name = strdup (part_data->translated_name); return result; error_free_part: @@ -1385,6 +1391,8 @@ gpt_partition_destroy (PedPartition *part) if (part->type == 0) { PED_ASSERT (part->disk_specific != NULL); + GPTPartitionData *gpt_part_data = part->disk_specific; + free (gpt_part_data->translated_name); free (part->disk_specific); } @@ -1776,15 +1784,53 @@ gpt_partition_set_name (PedPartition *part, const char *name) { GPTPartitionData *gpt_part_data = part->disk_specific; - strncpy (gpt_part_data->name, name, 36); - gpt_part_data->name[36] = 0; + free(gpt_part_data->translated_name); + gpt_part_data->translated_name = strdup(name); + iconv_t conv = iconv_open ("UTF-16", nl_langinfo (CODESET)); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = gpt_part_data->translated_name; + char *outbuff = (char *)&gpt_part_data->name; + size_t inbuffsize = strlen (inbuff); + size_t outbuffsize = 72; + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + return; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); } static const char * gpt_partition_get_name (const PedPartition *part) { GPTPartitionData *gpt_part_data = part->disk_specific; - return gpt_part_data->name; + if (gpt_part_data->translated_name == NULL) + { + char buffer[200]; + iconv_t conv = iconv_open (nl_langinfo (CODESET), "UTF-16"); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = (char *)&gpt_part_data->name; + char *outbuff = buffer; + size_t inbuffsize = 72; + size_t outbuffsize = sizeof(buffer); + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + *outbuff = 0; + gpt_part_data->translated_name = strdup (buffer); + return gpt_part_data->translated_name; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); + } + return gpt_part_data->translated_name; } static int -- 1.8.3.2 From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 19 Dec 2013 22:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138749125018957 (code B ref 15591); Thu, 19 Dec 2013 22:15:02 +0000 Received: (at 15591) by debbugs.gnu.org; 19 Dec 2013 22:14:10 +0000 Received: from localhost ([127.0.0.1]:59090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtlr7-0004vh-Om for submit@debbugs.gnu.org; Thu, 19 Dec 2013 17:14:10 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:42894) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtlr4-0004vY-K7 for 15591@debbugs.gnu.org; Thu, 19 Dec 2013 17:14:07 -0500 Received: by mail-pa0-f51.google.com with SMTP id fa1so1763809pad.38 for <15591@debbugs.gnu.org>; Thu, 19 Dec 2013 14:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=3lXx1Ue9OR7QAc/vLG+UrLYCk1A4SsQZcgK74TTCvSM=; b=e7CGw27AA3kD3X98aWOKB7JHAb0mz88Hzs93jBJ+HospucskcvKruluBQZ5CiKkEcy zehdOKoiUGMIooIFZBHx/DG2EkfA/AJtCfKBASJKc/a5xq0qls9+FtMRhWwjODDTEHTf 8AK39+hBSj6pBONrYL6qNKMbb9KfppcvMe3OPDET9NsOKjZbLe/iHgpRG9IdPJYE0XQA OgPFyD5JPli0/e7rEANY5Bnc2GmOTwG5bAy36z/pnp5a2OxqqnyLYtkmD9bv5bePi4Rr dF60yOc6BK/Z59Ok143O067IS8QbF+C/JGiZQNPFSZQAWmIf3bTHitKMCWbxZSgmXk7F ptKQ== X-Received: by 10.66.145.166 with SMTP id sv6mr4472847pab.31.1387491245786; Thu, 19 Dec 2013 14:14:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Thu, 19 Dec 2013 14:13:45 -0800 (PST) In-Reply-To: <1387488356-9975-1-git-send-email-psusi@ubuntu.com> References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Thu, 19 Dec 2013 14:13:45 -0800 X-Google-Sender-Auth: gPYxpG9kvBPpygHTZBy2ejvxFoU Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Dec 19, 2013 at 1:25 PM, Phillip Susi 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. Hi Philip, Thanks for fixing that. Your patch looks good. One nit: > + gpt_part_data->translated_name = strdup(name); Would you please adjust that to handle strdup failure? Perhaps just by using xstrdup in place of strdup. Also, it'd be great to add a test case that fails without this fix? Thanks, Jim From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Thu, 19 Dec 2013 22:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138749129719065 (code B ref 15591); Thu, 19 Dec 2013 22:15:03 +0000 Received: (at 15591) by debbugs.gnu.org; 19 Dec 2013 22:14:57 +0000 Received: from localhost ([127.0.0.1]:59096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtlrt-0004xR-G5 for submit@debbugs.gnu.org; Thu, 19 Dec 2013 17:14:57 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:42728) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vtlrr-0004xJ-D7 for 15591@debbugs.gnu.org; Thu, 19 Dec 2013 17:14:55 -0500 Received: by mail-pd0-f180.google.com with SMTP id q10so1687812pdj.39 for <15591@debbugs.gnu.org>; Thu, 19 Dec 2013 14:14:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=zvEl+otpp7QsFycx6qi0SmmA7i/BdshFXnfoLB8NgJc=; b=x69S4hiq374PFa59UdPvn8MSPoEll2d+tqsDOXMoWGTX3D5D5piMsv24wy2ce1imuY GFN9hZCcoLjQaLShWoYCP3WX3+vs+iDr3vtbZk8nPrl6pnbaZb6h7PEJ2w6Ayv1zxaS5 RxC6RuFZf6mtkEdAasgj6TqNQaHDRYj7T50Yxb7ggbZIWu2oWbIrkzbRMQorHcOKmnfH MnIb7hzDpx4ZNmtOomlnC+h1YbKy3rWP2SpfSBG7W1dBvUga/4aIZznIoQ3TcNYukqno +CsVGUCUfweGWnEBZSjEFwoBe62MFmdQJlMab4IersDOW49gSGWmlldg2cBOg9XZdLb6 LOeQ== X-Received: by 10.68.185.68 with SMTP id fa4mr4447795pbc.136.1387491294700; Thu, 19 Dec 2013 14:14:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Thu, 19 Dec 2013 14:14:34 -0800 (PST) In-Reply-To: References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Thu, 19 Dec 2013 14:14:34 -0800 X-Google-Sender-Auth: S7DTQBAtUt7TVIoSRSXH-SQaefA Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Oh, and since this is a bug fix, it deserves mention in NEWS. From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 20 Dec 2013 02:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138750514416237 (code B ref 15591); Fri, 20 Dec 2013 02:06:02 +0000 Received: (at 15591) by debbugs.gnu.org; 20 Dec 2013 02:05:44 +0000 Received: from localhost ([127.0.0.1]:59257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtpTD-0004Dp-Ps for submit@debbugs.gnu.org; Thu, 19 Dec 2013 21:05:43 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:43729) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtpTA-0004Db-9z for 15591@debbugs.gnu.org; Thu, 19 Dec 2013 21:05:40 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=Pb0Ze0ZI5mYA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=98muXBR8bTeerJyRugkA:9 a=wPNLvfGTeEIA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:54634] helo=[192.168.1.141]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 4D/18-11872-3F5A3B25; Fri, 20 Dec 2013 02:05:39 +0000 Message-ID: <52B3A5F3.4020700@ubuntu.com> Date: Thu, 19 Dec 2013 21:05:39 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/19/2013 05:13 PM, Jim Meyering wrote: > Also, it'd be great to add a test case that fails without this > fix? I can create a partition table using a unicode name, but can I include an arbitrary binary image in the test suite? I seem to remember the test suite wanting to copy the shell script to its own directory to execute it. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJSs6XzAAoJEI5FoCIzSKrwDXQH/2xAWiH2DaTgVB9pRaJ8sgtt XQ7UVFWwf3bTlw9bxh1m3hH5cLanod+tLyLaXywcCqJ24fALpOUHnXiw+sCRntuj UGAcqDXQj37PHWoe2eQ7XWuAJEi0Fch1TRNp2+rtvaruR0FlwsdXQxvbqQotyCgu eiBWUNGaWlHPbteCZNdwZi3NMQnwQ5w7B4S9kmIvhP90/0xLPdajzhDZOIuFRPs7 dn0nrQdOYkFFM4VRVRptGrT5+YdaZAUD1hcZJOe7NSIbZcOVoMmvD17IGehYniPA fIte+UPF2wiBaVCrwuwQgWfkxhs6VWDLu5YTH7BY0kFcEqUKemMMMKwJvipmQlM= =CRYw -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 20 Dec 2013 05:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.13875177478382 (code B ref 15591); Fri, 20 Dec 2013 05:36:02 +0000 Received: (at 15591) by debbugs.gnu.org; 20 Dec 2013 05:35:47 +0000 Received: from localhost ([127.0.0.1]:59320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtskV-0002B8-8z for submit@debbugs.gnu.org; Fri, 20 Dec 2013 00:35:47 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:54685) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtskS-0002As-62 for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 00:35:45 -0500 Received: by mail-pa0-f44.google.com with SMTP id fa1so2157103pad.31 for <15591@debbugs.gnu.org>; Thu, 19 Dec 2013 21:35:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=BzF4GJBd0e8cR5X3mGRTy7bj60YkJgUMBMvZhajxiCI=; b=upglMAGwdIV5/v0Nh8ioW807EAjezZgk5dkUYtc6FMPYDJh97pFyjynL1z3rvWruCS N87RkV5xA0JwBNkT8AHRC/efKKrYXZItRFx4dcvx9Wrz4Tv+zY5YQDy7P2x5SPXOrXUF nYCy42YctzRXs4tXfCjoQOWULFtIdyJpgj9hYkrho5EouLIyDL8CmtTvh0dHqvpxZFi/ /MdfBKJXgMAIBwYEKYJR3hpATOk6ewv4v7cnSqhBVnD85tvCt9gvrUhmdeOWeq/19k/C YY3a4yhwBDl262fwo1IZrcX+aDFvPKNgT1htwdZ3O5XYuUAjVycXqPg+GgXtak5ISByD w6pw== X-Received: by 10.68.189.165 with SMTP id gj5mr6210418pbc.111.1387517743161; Thu, 19 Dec 2013 21:35:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Thu, 19 Dec 2013 21:35:23 -0800 (PST) In-Reply-To: <52B3A5F3.4020700@ubuntu.com> References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> From: Jim Meyering Date: Thu, 19 Dec 2013 21:35:23 -0800 X-Google-Sender-Auth: sQFn_7DMhNgej8ixAktJDYcrHyI Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Thu, Dec 19, 2013 at 6:05 PM, Phillip Susi wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > On 12/19/2013 05:13 PM, Jim Meyering wrote: >> Also, it'd be great to add a test case that fails without this >> fix? > > I can create a partition table using a unicode name, but can I include > an arbitrary binary image in the test suite? I seem to remember the > test suite wanting to copy the shell script to its own directory to > execute it. Ideally, the script would create a partition table from scratch and then create a partition table with a unicode name, then verify that it can be read/displayed properly. Then there's no issue with storing an image in git. If you don't have the time or inclination, point me to an offending image and I'll derive a stand-alone test that doesn't need that image. From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 20 Dec 2013 14:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138754897210852 (code B ref 15591); Fri, 20 Dec 2013 14:17:02 +0000 Received: (at 15591) by debbugs.gnu.org; 20 Dec 2013 14:16:12 +0000 Received: from localhost ([127.0.0.1]:59779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu0s7-0002oy-F5 for submit@debbugs.gnu.org; Fri, 20 Dec 2013 09:16:11 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:47166) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu0s5-0002op-8R for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 09:16:09 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=oVFiZj9fevMA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=Qsx_du5GiBkA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=nWc9EEMMgVJsm9KkwRMA:9 a=wPNLvfGTeEIA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:49327] helo=[10.1.1.236]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 31/AE-11872-82154B25; Fri, 20 Dec 2013 14:16:08 +0000 Message-ID: <52B45128.8000209@ubuntu.com> Date: Fri, 20 Dec 2013 09:16:08 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/20/2013 12:35 AM, Jim Meyering wrote: > Ideally, the script would create a partition table from scratch > and then create a partition table with a unicode name, then verify > that it can be read/displayed properly. Then there's no issue > with storing an image in git. > > If you don't have the time or inclination, point me to an > offending image and I'll derive a stand-alone test that doesn't > need that image. You can create one with parted after applying the patch, or with gdisk, and entering a unicode character in the name. Also git has no problem with binary files; util-linux includes several bzip2'd binary disk images for its test suite. Note that trying to use unicode characters with parted without this patch appears to work, since writing the string spreads it out over multiple bytes with zeros between, and reading it back undoes this damage. Setting the name with gdisk causes parted to puke when it reads it. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJStFEoAAoJEI5FoCIzSKrwR60H/2Ir5tUMia+lABWgkQFD8yxO us84cUqTUvxrCLqhZTrYIuUPYyC87LfQgDe8cYdpIS9qHY5kLH6ZlnyDdJnHTyFb H7kyemBwwqHWS4SAzcv5ZDLvS5eDDWk/qlitbSaZweVTtmU+SoGnMv75+BpobI1P DifugCznT1qWqGiuKOmCVIHFFoH0cKnbxoWEP3py9mGFSywhwkurTrSk+Az1Ryax EaQlNlX7DaZHCxLcyzlvctvoFK/nnOAHAXG/y+fDVSeVnAsSzqlACQiqjyc+lomD /4CBrG+lHBJOfmLaH+nXjA+HVhsd1PkQ4DKQX/B35Y94qAi1Z36Q/44XDJfA5eI= =IKnB -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 20 Dec 2013 19:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138756673414020 (code B ref 15591); Fri, 20 Dec 2013 19:13:02 +0000 Received: (at 15591) by debbugs.gnu.org; 20 Dec 2013 19:12:14 +0000 Received: from localhost ([127.0.0.1]:60449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu5Ub-0003e4-To for submit@debbugs.gnu.org; Fri, 20 Dec 2013 14:12:14 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:36164) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu5UZ-0003dt-00 for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 14:12:12 -0500 Received: by mail-pb0-f45.google.com with SMTP id rp16so2987183pbb.18 for <15591@debbugs.gnu.org>; Fri, 20 Dec 2013 11:12:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=FdgLpRSfkAsE/EGtPTa9NNWjq9LC7dC2j365VSXXgys=; b=cWvvfysPFB9sPl5KcTOsmrWcinaQrHv62WDn5GB4ThZvS378bOFlCYkC3cAXoqgNkh oGP5YnMyWa7btVWNcDKSlAPUxdYjhOFGcxYmmYKooGh+Qi3b7x46u2108b8+Vj6NOz+W YFbUNZ2cB0XQIN5+1sSXY7kJcfAn6m804Z6pAqrtdQUqK6VTanwB+c6E2TKPWakS/82D rLW+EjY3P6zUjI+ncWQHTXG3sS4dgt8dQQIQ1vRJm9IVSqrYuCFelvcLcLN2tg2moZ8m bclMeynlYewcgo34pq0PlotkrbkxoxQXYYaOj2jrnu1DretR4molcBGmmzWytyY2do8r +gjQ== X-Received: by 10.66.145.166 with SMTP id sv6mr10616427pab.31.1387566730003; Fri, 20 Dec 2013 11:12:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Fri, 20 Dec 2013 11:11:48 -0800 (PST) In-Reply-To: <52B45128.8000209@ubuntu.com> References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> From: Jim Meyering Date: Fri, 20 Dec 2013 11:11:48 -0800 X-Google-Sender-Auth: UAN_1shsnyIBYwINK2-fJSFwpUs Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Fri, Dec 20, 2013 at 6:16 AM, Phillip Susi wrote: ... > You can create one with parted after applying the patch, or with > gdisk, and entering a unicode character in the name. Also git has no > problem with binary files; util-linux includes several bzip2'd binary > disk images for its test suite. > > Note that trying to use unicode characters with parted without this > patch appears to work, since writing the string spreads it out over > multiple bytes with zeros between, and reading it back undoes this > damage. Setting the name with gdisk causes parted to puke when it > reads it. Thanks for explaining. In that case, we can create a test image with a unicode character partition name, and use dd to inspect the on-disk bytes, looking for the desired (new) behavior. That should fail with the pre-patch parted and succeed with the fixed version. Sure, git can handle arbitrary files... but I have a general aversion to storing test images in version control when there is an easy way to avoid it. Would you mind doing that? From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Fri, 20 Dec 2013 19:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138756779516052 (code B ref 15591); Fri, 20 Dec 2013 19:30:03 +0000 Received: (at 15591) by debbugs.gnu.org; 20 Dec 2013 19:29:55 +0000 Received: from localhost ([127.0.0.1]:60458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu5li-0004Ap-U5 for submit@debbugs.gnu.org; Fri, 20 Dec 2013 14:29:55 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:44622) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vu5lg-0004Ac-ML for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 14:29:53 -0500 X-Authority-Analysis: v=2.0 cv=b8cwE66x c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=oVFiZj9fevMA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=Qsx_du5GiBkA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=ALELYyk8NxdYlBnQ7NUA:9 a=wPNLvfGTeEIA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:54163] helo=[10.1.1.236]) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 4A/F4-21976-FAA94B25; Fri, 20 Dec 2013 19:29:52 +0000 Message-ID: <52B49AAF.5080906@ubuntu.com> Date: Fri, 20 Dec 2013 14:29:51 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/20/2013 2:11 PM, Jim Meyering wrote: > Thanks for explaining. In that case, we can create a test image > with a unicode character partition name, and use dd to inspect the > on-disk bytes, looking for the desired (new) behavior. That should > fail with the pre-patch parted and succeed with the fixed version. Ahh, of course, why didn't I think of that? > Sure, git can handle arbitrary files... but I have a general > aversion to storing test images in version control when there is an > easy way to avoid it. > > Would you mind doing that? I'll try to work it up tonight. Say, if you have some time for patch reviewing these days, think you could take a look at the online resize patch set? They have been in Debian and Ubuntu now for a bit and the last gparted livecd is using them, so it would be nice to finally get them applied upstream and a new release done. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJStJqvAAoJEI5FoCIzSKrwtY0H/1bIPdZ7uiN2SYoBbyVvN3Lz FU1oL2+uEkM7vVX+6aUcES3S29gjmjUOTUpGmLdv9QwL1gg3hD/RtRpvd7ax8GYy NfbIi71pGBL+tPsi05h7UosGplx+8IVbSBr5cZIrrCqe3ftH0FCJb0NBhaG8dRy7 N1OuQx+RZhedt0r3X88P2yeU/JSNQJGvpFidRNRYmCDAKjJOD0DToJJKutTU/rCI fMEQiZ8B0OU6DWSQSYF+xBecuiBnhXTLDmbikSrQrZcts7ZEGY6xychTN+i/AcUJ bMUNeyhGYaAkXmLaSCApDqkKFHhc0kRomQkrEMnF7jSkm3r8hmFqygfVXrIiH2c= =LCO8 -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly References: <52584A71.2080301@ubuntu.com> In-Reply-To: <52584A71.2080301@ubuntu.com> Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 02:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org, jim@meyering.net Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.13875927353043 (code B ref 15591); Sat, 21 Dec 2013 02:26:02 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 02:25:35 +0000 Received: from localhost ([127.0.0.1]:60635 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuCFx-0000n0-Qe for submit@debbugs.gnu.org; Fri, 20 Dec 2013 21:25:34 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:38733) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuCFu-0000mo-Ju for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 21:25:31 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=nY8CUcLLpFgA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=IkcTkHD0fZMA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=qluqBLp8y1oA:10 a=mDV3o1hIAAAA:8 a=4EbxZd6ZcUw8dWY0hMcA:9 a=QEXdDO2ut3YA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:35950] helo=localhost.localdomain) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 4B/E5-11872-91CF4B25; Sat, 21 Dec 2013 02:25:30 +0000 From: Phillip Susi Date: Fri, 20 Dec 2013 21:25:28 -0500 Message-Id: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) 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. --- libparted/labels/gpt.c | 60 ++++++++++++++++++++++++++++++++++++++++------ tests/Makefile.am | 1 + tests/t0251-gpt-unicode.sh | 40 +++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 tests/t0251-gpt-unicode.sh diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 66c96e6..25007cb 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "xalloc.h" #include "verify.h" @@ -196,7 +198,7 @@ struct __attribute__ ((packed)) _GuidPartitionEntry_t uint64_t StartingLBA; uint64_t EndingLBA; GuidPartitionEntryAttributes_t Attributes; - efi_char16_t PartitionName[72 / sizeof (efi_char16_t)]; + efi_char16_t PartitionName[36]; }; #define GPT_PMBR_LBA 0 @@ -281,7 +283,8 @@ typedef struct _GPTPartitionData { efi_guid_t type; efi_guid_t uuid; - char name[37]; + efi_char16_t name[37]; + char *translated_name; int lvm; int raid; int boot; @@ -797,10 +800,11 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) gpt_part_data = part->disk_specific; gpt_part_data->type = pte->PartitionTypeGuid; gpt_part_data->uuid = pte->UniquePartitionGuid; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) gpt_part_data->name[i] = (efi_char16_t) PED_LE16_TO_CPU ((uint16_t) pte->PartitionName[i]); gpt_part_data->name[i] = 0; + gpt_part_data->translated_name = 0; gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service @@ -1210,7 +1214,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) if (gpt_part_data->legacy_boot) pte->Attributes.LegacyBIOSBootable = 1; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) pte->PartitionName[i] = (efi_char16_t) PED_CPU_TO_LE16 ((uint16_t) gpt_part_data->name[i]); } @@ -1386,6 +1390,8 @@ gpt_partition_duplicate (const PedPartition *part) goto error_free_part; *result_data = *part_data; + if (part_data->translated_name) + result_data->translated_name = strdup (part_data->translated_name); return result; error_free_part: @@ -1400,6 +1406,8 @@ gpt_partition_destroy (PedPartition *part) if (part->type == 0) { PED_ASSERT (part->disk_specific != NULL); + GPTPartitionData *gpt_part_data = part->disk_specific; + free (gpt_part_data->translated_name); free (part->disk_specific); } @@ -1820,15 +1828,53 @@ gpt_partition_set_name (PedPartition *part, const char *name) { GPTPartitionData *gpt_part_data = part->disk_specific; - strncpy (gpt_part_data->name, name, 36); - gpt_part_data->name[36] = 0; + free(gpt_part_data->translated_name); + gpt_part_data->translated_name = strdup(name); + iconv_t conv = iconv_open ("UTF-16", nl_langinfo (CODESET)); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = gpt_part_data->translated_name; + char *outbuff = (char *)&gpt_part_data->name; + size_t inbuffsize = strlen (inbuff) + 1; + size_t outbuffsize = 72; + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + return; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); } static const char * gpt_partition_get_name (const PedPartition *part) { GPTPartitionData *gpt_part_data = part->disk_specific; - return gpt_part_data->name; + if (gpt_part_data->translated_name == NULL) + { + char buffer[200]; + iconv_t conv = iconv_open (nl_langinfo (CODESET), "UTF-16"); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = (char *)&gpt_part_data->name; + char *outbuff = buffer; + size_t inbuffsize = 72; + size_t outbuffsize = sizeof(buffer); + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + *outbuff = 0; + gpt_part_data->translated_name = strdup (buffer); + return gpt_part_data->translated_name; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); + } + return gpt_part_data->translated_name; } static int diff --git a/tests/Makefile.am b/tests/Makefile.am index 16ec5d2..7a6fe8f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,6 +27,7 @@ TESTS = \ t0212-gpt-many-partitions.sh \ t0220-gpt-msftres.sh \ t0250-gpt.sh \ + t0251-gpt-unicode.sh \ t0280-gpt-corrupt.sh \ t0281-gpt-grow.sh \ t0282-gpt-move-backup.sh \ diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh new file mode 100644 index 0000000..580015e --- /dev/null +++ b/tests/t0251-gpt-unicode.sh @@ -0,0 +1,40 @@ +#!/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 . + +. "${srcdir=.}/init.sh"; path_prepend_ ../parted + +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 + +# 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 +cat <> exp +00000000 66 00 6f 00 6f 00 24 1d 00 00 |f.o.o.$...| +0000000a +EOF +compare exp out || fail=1 + +Exit $fail -- 1.8.3.2 From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 02:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.13875928883377 (code B ref 15591); Sat, 21 Dec 2013 02:29:01 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 02:28:08 +0000 Received: from localhost ([127.0.0.1]:60639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuCIR-0000sN-5L for submit@debbugs.gnu.org; Fri, 20 Dec 2013 21:28:07 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:51398) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuCIP-0000sA-6Y for 15591@debbugs.gnu.org; Fri, 20 Dec 2013 21:28:05 -0500 X-Authority-Analysis: v=2.0 cv=dq5Z+ic4 c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=Pb0Ze0ZI5mYA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=KGpZ0Pk9ntYxiLhg8f4A:9 a=wPNLvfGTeEIA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:35951] helo=[192.168.1.141]) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 4D/92-21884-4BCF4B25; Sat, 21 Dec 2013 02:28:04 +0000 Message-ID: <52B4FCB4.8090205@ubuntu.com> Date: Fri, 20 Dec 2013 21:28:04 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 So I added a test and just fired off the revised patch. Running the test suite though, things go fubar. A bunch of tests fail with parted crashing with a segfault. The first one is t0205-gpt-list-clobbers-pmbr. The thing is, when I run the exact same commands the test does by hand, they work just fine. Got any ideas? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJStPyxAAoJEI5FoCIzSKrwV9AIAJOs/L5G8A5kQSfEhMekqjb2 XnRaqSFBY7uWLCFvbqozx6mFPfTIqkB0sP72XaqSWGTGSGYx0TXlkUIqt5Cc9Ltf eZ9vjcuPkw+s6pnF4Z8wwc20dd5j53ZoMUI7db+h+lHss1PY+QcUmHVGfyNf4PaY IQNu2Sk7raxhc12GwNpotESLXoAK8SULElNvWMU2El+24oUejKW6nfw2E/RQRmEf BKA6ZxwlsMTw19zDGVYqcDbZdcatZPLpSu+/Svy7UzY0mBB1d/bIHk6sDoor+EIO c++hVT6We1hfY8mOWwXDYAhJHVd3OsCZ9lMQGOzXTsJwV73PuJMCwZ7loVJTevk= =Df7T -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 18:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138765070929813 (code B ref 15591); Sat, 21 Dec 2013 18:32:01 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 18:31:49 +0000 Received: from localhost ([127.0.0.1]:33482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRL1-0007km-Ll for submit@debbugs.gnu.org; Sat, 21 Dec 2013 13:31:48 -0500 Received: from mail-pb0-f50.google.com ([209.85.160.50]:43406) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRKy-0007kd-IL for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 13:31:45 -0500 Received: by mail-pb0-f50.google.com with SMTP id rr13so3898960pbb.9 for <15591@debbugs.gnu.org>; Sat, 21 Dec 2013 10:31:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=ONzm8gOdDT5K3+FdV7B29RqndEo3QxMHxbP9TaBWiyY=; b=KVXTUDRGw/eyT7NMnT6HVisfcPD7+U+U8Zy1SJOyRtFiMF8q/ZRUyp/roIitoklxtn i3kqOC9LMwNnzrmJdCGoqqLPZ95X3g3ppWn42P+rEpD9sBOFBr9dpM3EiZcg1IlCloc/ 3uxpQun8JqAShKmoGAn2Mo395pmnt0uQZyR+jX/Mis4RsuzevddO/E5C7rsoCp9hPKvg ok1pOxsEElePhFOF4D+5xRuS/jsw0h2hoJKh7MmjEcmOXWJr/P04XaFcn+1ODbf72etR 91BjpTwMk3yiR9ZRV14OEn3V58ltSLfxCMuqH2MZNoXacy26ssLkftSv4eSo6x+772p6 LWTQ== X-Received: by 10.68.209.193 with SMTP id mo1mr16579062pbc.38.1387650703663; Sat, 21 Dec 2013 10:31:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sat, 21 Dec 2013 10:31:22 -0800 (PST) In-Reply-To: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Sat, 21 Dec 2013 10:31:22 -0800 X-Google-Sender-Auth: H1yLV0s7kFm9fvHt_yGFMXQfpPo Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Fri, Dec 20, 2013 at 6:25 PM, Phillip Susi 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=3Dloop-file > + > +# create zeroed device > +truncate -s 10m $dev || fail=3D1 > + > +# create gpt label with named partition > +parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 foo=E1= =B4=A4 > empty 2>&1 || fail=3D1 Please keep the contents of this test source file ASCII, e.g., part_name=3D$(printf 'foo\341\264\244') parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 foo=E1=B4= =A4 > empty 2>&1 || fail=3D1 > +# ensure there was no output > +compare /dev/null empty || fail=3D1 > + > +# check for expected output > +dd if=3D$dev bs=3D1 skip=3D$((512+$sector_size_+58)) count=3D10 2>/dev/n= ull | hd > + > out || fail=3D1 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 <> 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=3D1 From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 18:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138765081230073 (code B ref 15591); Sat, 21 Dec 2013 18:34:01 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 18:33:32 +0000 Received: from localhost ([127.0.0.1]:33494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRMh-0007oy-HT for submit@debbugs.gnu.org; Sat, 21 Dec 2013 13:33:31 -0500 Received: from mail-pb0-f50.google.com ([209.85.160.50]:62364) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRMd-0007om-GI for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 13:33:29 -0500 Received: by mail-pb0-f50.google.com with SMTP id rr13so3891807pbb.37 for <15591@debbugs.gnu.org>; Sat, 21 Dec 2013 10:33:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=WoGtBD7LqyKHD3PkcuLuWrRSCKK3NWeTooHv5e00c6Q=; b=TEN8uU5FViUAdTStuiruAos6bgU2FuhY8ZLX6aJ+6mFF+vULckqP7fgO7S+oN/ua/7 9t2qvxN4MgenH8KRRUBylqCT34jM5Aol23eJEwasHf6rhLz9gMl4RdNagednXyuj85IV m6mg8N9XvpMYEbAeCA043G/kZ6JNtYUSvD0tvvstLwy6iTSvZO8ViiA9NInwHcDZ3+t5 IqTsUoNzSASvYRsv0Ftt+C27ZoUIpXV1Wj72gH8/gbWiNO+t+xzu+YWzGdWw2D1nt1bP WsmgyqYewSoMCndTrPWs4nY4g6Ii0dgLXsMKruNpdoQYbGdAAp+smgCwKSQDSsUd1bMh s5Hg== X-Received: by 10.67.5.233 with SMTP id cp9mr15965232pad.147.1387650806851; Sat, 21 Dec 2013 10:33:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sat, 21 Dec 2013 10:33:06 -0800 (PST) In-Reply-To: <52B49AAF.5080906@ubuntu.com> References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> <52B49AAF.5080906@ubuntu.com> From: Jim Meyering Date: Sat, 21 Dec 2013 10:33:06 -0800 X-Google-Sender-Auth: 9G90zfH40xQx27Dphrx3pH02RpY Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) > Say, if you have some time for patch reviewing these days, think you > could take a look at the online resize patch set? They have been in > Debian and Ubuntu now for a bit and the last gparted livecd is using > them, so it would be nice to finally get them applied upstream and a > new release done. I've put it on my list, but may not get to it before the new year. If I don't reply by say Jan 10 or so, feel free to prod me :-) From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 18:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138765105530592 (code B ref 15591); Sat, 21 Dec 2013 18:38:01 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 18:37:35 +0000 Received: from localhost ([127.0.0.1]:33501 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRQc-0007xM-Jy for submit@debbugs.gnu.org; Sat, 21 Dec 2013 13:37:35 -0500 Received: from mail-pd0-f180.google.com ([209.85.192.180]:33994) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuRQa-0007xD-LP for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 13:37:33 -0500 Received: by mail-pd0-f180.google.com with SMTP id q10so3785328pdj.39 for <15591@debbugs.gnu.org>; Sat, 21 Dec 2013 10:37:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=h8kDVUTX1aArQjuqwgVU0+RaOXd4LBCqMT8UfjFWRpw=; b=Iwik3rtw3+FT7tawdPJxoxqYipGB9b11c0N9pxVczASGAzR3wUp6BVEyzUV+Hiwctk jI7vp2MNBFQ2ME7i4abLPvhFwpEJ997zGsoAUDk2N4m6PyF7LLK+ifeQgRO5e/+qtxp6 btJ4BdMXF8vrHX2/GOUZRatQUzvJ8osMjwQ2TFuddDJUGS5vXYYozxyulsNADOTUV/Zb WjPcPCTlaJ9dmO8EJe2H6g/I72bf6N3cPnE5wPSOTzqcRj/dsVe9LXcSCapae+RyIETU zfm/ZW+jn4o8/Uadccz8QOX0eOBj0DyklryUMFZuI//Oosx6RRN24p2/zlaSqdSlSREA ioBw== X-Received: by 10.66.138.40 with SMTP id qn8mr16472937pab.154.1387651051745; Sat, 21 Dec 2013 10:37:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sat, 21 Dec 2013 10:37:10 -0800 (PST) In-Reply-To: <52B4FCB4.8090205@ubuntu.com> References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> <52B4FCB4.8090205@ubuntu.com> From: Jim Meyering Date: Sat, 21 Dec 2013 10:37:10 -0800 X-Google-Sender-Auth: 8ykT3_EpTMlbnXOF4ZcquNluYPE Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > So I added a test and just fired off the revised patch. Thanks for doing that! > Running the > test suite though, things go fubar. A bunch of tests fail with parted > crashing with a segfault. The first one is > t0205-gpt-list-clobbers-pmbr. The thing is, when I run the exact same > commands the test does by hand, they work just fine. Got any ideas? Adjusting per my "use only ASCII in test script" may help. If not, post a revised patch and I'll make time to investigate in the next few days. PS. please attach it or tell your editor not to split long lines --- that mangles patches. From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 23:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138766734031211 (code B ref 15591); Sat, 21 Dec 2013 23:09:02 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 23:09:00 +0000 Received: from localhost ([127.0.0.1]:33747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuVfH-00087K-WB for submit@debbugs.gnu.org; Sat, 21 Dec 2013 18:09:00 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:47439) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuVfF-00087C-QW for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 18:08:58 -0500 X-Authority-Analysis: v=2.0 cv=b8cwE66x c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=Pb0Ze0ZI5mYA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=zG1aFp2a0YSWR5iHJIgA:9 a=wPNLvfGTeEIA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:36777] helo=[192.168.1.141]) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 2F/41-21976-88F16B25; Sat, 21 Dec 2013 23:08:57 +0000 Message-ID: <52B61F88.9050000@ubuntu.com> Date: Sat, 21 Dec 2013 18:08:56 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <52584A71.2080301@ubuntu.com> <1387488356-9975-1-git-send-email-psusi@ubuntu.com> <52B3A5F3.4020700@ubuntu.com> <52B45128.8000209@ubuntu.com> <52B4FCB4.8090205@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/21/2013 01:37 PM, Jim Meyering wrote: > Adjusting per my "use only ASCII in test script" may help. If not, > post a revised patch and I'll make time to investigate in the next > few days. I didn't touch the other tests, so I don't see how having UTF-8 characters in a separate test could cause a failure ( in a test that runs earlier no less ). > PS. please attach it or tell your editor not to split long lines > --- that mangles patches. I don't follow. I send the patches with git-send-email. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJSth+IAAoJEI5FoCIzSKrwkFIH/0zUiaNtD2W5zITWanbYac52 8vzSH1ADoz79Gig4nYu2CylY64np2AloGydtFENHsgvTWgw9O8OhabZ4jTxSJqgI 8dqdS/fdI7kcGHu+z0aqtFU/EIeF0uIk7MXHFKjIEwo2K0KamiKOugRm86JwHqz2 pEs87rvWhL+F7Llgl/6IGvoHrKCvTO/6Be7ObVovwUyW7sbXwTMl7xQBxkef/yGz vxnJ/uhwPOQ2Xkj02/pI8x2RJf2iKYMGe/WL6C33vtK8eQwBUDXcT6go1XT5j8Dt echPqklxI0IKAdCrofyqqS3ta/d3BjF8UaFZNESYxhOcN3ZkrlgkM2lHxJM6BEY= =Pilf -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sat, 21 Dec 2013 23:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138766755231683 (code B ref 15591); Sat, 21 Dec 2013 23:13:01 +0000 Received: (at 15591) by debbugs.gnu.org; 21 Dec 2013 23:12:32 +0000 Received: from localhost ([127.0.0.1]:33751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuVii-0008Ew-Ie for submit@debbugs.gnu.org; Sat, 21 Dec 2013 18:12:32 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:34786) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuVih-0008Ep-0j for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 18:12:31 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=Pb0Ze0ZI5mYA:10 a=dGKi9FcR-IEA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=IkcTkHD0fZMA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=dzDccsLgcWIA:10 a=QfKxxUxMAAAA:8 a=Y3A3U_p0JawdGtZUoIMA:9 a=QEXdDO2ut3YA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:36779] helo=[192.168.1.141]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id E7/25-11872-E5026B25; Sat, 21 Dec 2013 23:12:30 +0000 Message-ID: <52B6205E.9070405@ubuntu.com> Date: Sat, 21 Dec 2013 18:12:30 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/21/2013 01:31 PM, Jim Meyering wrote: > Please keep the contents of this test source file ASCII, e.g., Out of curiosity, why? Doesn't everyone handle UTF-8 these days? > 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 I have used xxd before, how about that? I prefer the ASCII interpretation column as it makes it more understandable. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJStiBeAAoJEI5FoCIzSKrws2MH+gIgHe9Nq0t6WgcjkdgDHpw1 arYsUpcgZToZ5aJal8X4nNyMmEB59bAfAN2bvwVZ63yrptnRnmJQpnlzz6PjDrYL y/mlVjo6/591kJufkmxSWvvuY1fGVhoB+1xIoL7H3roxkrzXzNgoMyhn2k1AEODw gQuTGyXqCJzRiPTzUuXncXROBDFixUYE/Yk/k0OCg4P+f07N1TZ9imNXMcfMFErL dUQlXiP/DE8ksRl3YWMmpRaj2mDcnYiZz3bbVoIrxg15tIFT8aCov+DDBEPc60Oi 6oF/uyUnkPfmfHda6SlNhQOHPY2jtA8EI5oii4GvnqWYyc6fQMk69TGwEnP0Ppk= =Yl// -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Sun, 22 Dec 2013 01:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Jim Meyering Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138767645420779 (code B ref 15591); Sun, 22 Dec 2013 01:41:02 +0000 Received: (at 15591) by debbugs.gnu.org; 22 Dec 2013 01:40:54 +0000 Received: from localhost ([127.0.0.1]:33800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuY2G-0005P2-6n for submit@debbugs.gnu.org; Sat, 21 Dec 2013 20:40:53 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:43272) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuY26-0005Oc-Jg for 15591@debbugs.gnu.org; Sat, 21 Dec 2013 20:40:46 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=Pb0Ze0ZI5mYA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=IkcTkHD0fZMA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=OZhrzm2VFa5_j3qVMMYA:9 a=QEXdDO2ut3YA:10 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:38026] helo=[192.168.1.141]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 75/13-11872-81346B25; Sun, 22 Dec 2013 01:40:41 +0000 Message-ID: <52B64318.5080407@ubuntu.com> Date: Sat, 21 Dec 2013 20:40:40 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 12/21/2013 01:31 PM, Jim Meyering wrote: > Please make the new t*.sh script executable. Why? I notice that half of the scripts are executable, but half are not, and the ones that are can not be executed directly anyhow as it seems they get paths wrong, and the make check rule doesn't care whether they are executable or not. On a related note, can you explain how the test suite works? I'm trying to figure out why I can't just wrap the parted call in gdb to debug the crash since it seems the scripts are run with stdin < /dev/null, but I can not follow the Makefile for the life of me. Looking at the main Makefile.am, it seems that the check rule only runs check-other-sector_sizes, which calls make ss-{1024,2048,4096}. Curiously, 512 byte sectors seem to be missing. The rules for the ss-XXXX targets set PARTED_SECTOR_SIZE and call make check-recursive, but there does not seem to be any such target. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJStkMYAAoJEI5FoCIzSKrwHAUH/Av687crD6gCB/qE4aoOgfsy aJa1jNWRnn6tl1an+j6sCtmYv5xtpZ0xyj7ysyqY5nUOJRcGpRCRyav/v3jkAbWh Tmn90Ubwes5VAZ12wXE3Y/r4LRSo+hbobnadFp4TFrwGgQ+gkrrRM9IbGf12ePX0 CSNsM5dB6+9MrsIHq98z92d8tV0PEvuLSlT7/M/vQU8nhOUFe2Bdy9YvtmwQwPZa zRIeYCiIB94yV1z6LgJjlXeQs8/HNITljHpc6vu3ZfGiBjCqFqADMpYAozJInRKd /QKHJpBZD1XIeFxopRtHBkywwfJRD7W+3nyvf4XmohU3TNLmJoYVAbGo7nhzye8= =bby8 -----END PGP SIGNATURE----- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Mon, 23 Dec 2013 02:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org, jim@meyering.net Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.13877650489928 (code B ref 15591); Mon, 23 Dec 2013 02:18:01 +0000 Received: (at 15591) by debbugs.gnu.org; 23 Dec 2013 02:17:28 +0000 Received: from localhost ([127.0.0.1]:35072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vuv5C-0002a3-OF for submit@debbugs.gnu.org; Sun, 22 Dec 2013 21:17:27 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:41712) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vuv59-0002Zr-4O for 15591@debbugs.gnu.org; Sun, 22 Dec 2013 21:17:24 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=nY8CUcLLpFgA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=qluqBLp8y1oA:10 a=mDV3o1hIAAAA:8 a=HMFHro10-YLqz6dsA4UA:9 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:51089] helo=localhost.localdomain) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 1A/BF-11872-23D97B25; Mon, 23 Dec 2013 02:17:22 +0000 From: Phillip Susi Date: Sun, 22 Dec 2013 21:17:20 -0500 Message-Id: <1387765040-14416-1-git-send-email-psusi@ubuntu.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) 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. --- libparted/labels/gpt.c | 63 ++++++++++++++++++++++++++++++++++++++++------ tests/Makefile.am | 1 + tests/t0251-gpt-unicode.sh | 38 ++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 7 deletions(-) create mode 100755 tests/t0251-gpt-unicode.sh diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 66c96e6..dce89b1 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "xalloc.h" #include "verify.h" @@ -196,7 +198,7 @@ struct __attribute__ ((packed)) _GuidPartitionEntry_t uint64_t StartingLBA; uint64_t EndingLBA; GuidPartitionEntryAttributes_t Attributes; - efi_char16_t PartitionName[72 / sizeof (efi_char16_t)]; + efi_char16_t PartitionName[36]; }; #define GPT_PMBR_LBA 0 @@ -281,7 +283,8 @@ typedef struct _GPTPartitionData { efi_guid_t type; efi_guid_t uuid; - char name[37]; + efi_char16_t name[37]; + char *translated_name; int lvm; int raid; int boot; @@ -797,10 +800,11 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) gpt_part_data = part->disk_specific; gpt_part_data->type = pte->PartitionTypeGuid; gpt_part_data->uuid = pte->UniquePartitionGuid; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) gpt_part_data->name[i] = (efi_char16_t) PED_LE16_TO_CPU ((uint16_t) pte->PartitionName[i]); gpt_part_data->name[i] = 0; + gpt_part_data->translated_name = 0; gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service @@ -1210,7 +1214,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) if (gpt_part_data->legacy_boot) pte->Attributes.LegacyBIOSBootable = 1; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) pte->PartitionName[i] = (efi_char16_t) PED_CPU_TO_LE16 ((uint16_t) gpt_part_data->name[i]); } @@ -1353,6 +1357,7 @@ gpt_partition_new (const PedDisk *disk, gpt_part_data->atvrecv = 0; gpt_part_data->legacy_boot = 0; gpt_part_data->prep = 0; + gpt_part_data->translated_name = 0; uuid_generate ((unsigned char *) &gpt_part_data->uuid); swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); @@ -1386,6 +1391,9 @@ gpt_partition_duplicate (const PedPartition *part) goto error_free_part; *result_data = *part_data; + if (part_data->translated_name) + result_data->translated_name = xstrdup (part_data->translated_name); + else part_data->translated_name = 0; return result; error_free_part: @@ -1400,6 +1408,8 @@ gpt_partition_destroy (PedPartition *part) if (part->type == 0) { PED_ASSERT (part->disk_specific != NULL); + GPTPartitionData *gpt_part_data = part->disk_specific; + free (gpt_part_data->translated_name); free (part->disk_specific); } @@ -1820,15 +1830,54 @@ gpt_partition_set_name (PedPartition *part, const char *name) { GPTPartitionData *gpt_part_data = part->disk_specific; - strncpy (gpt_part_data->name, name, 36); - gpt_part_data->name[36] = 0; + free(gpt_part_data->translated_name); + gpt_part_data->translated_name = xstrdup(name); + iconv_t conv = iconv_open ("UTF-16", nl_langinfo (CODESET)); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = gpt_part_data->translated_name; + char *outbuff = (char *)&gpt_part_data->name; + size_t inbuffsize = strlen (inbuff) + 1; + size_t outbuffsize = 72; + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + return; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); } static const char * gpt_partition_get_name (const PedPartition *part) { GPTPartitionData *gpt_part_data = part->disk_specific; - return gpt_part_data->name; + if (gpt_part_data->translated_name == NULL) + { + char buffer[200]; + iconv_t conv = iconv_open (nl_langinfo (CODESET), "UTF-16"); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = (char *)&gpt_part_data->name; + char *outbuff = buffer; + size_t inbuffsize = 72; + size_t outbuffsize = sizeof(buffer); + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + *outbuff = 0; + gpt_part_data->translated_name = xstrdup (buffer); + return gpt_part_data->translated_name; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); + return ""; + } + return gpt_part_data->translated_name; } static int diff --git a/tests/Makefile.am b/tests/Makefile.am index 16ec5d2..7a6fe8f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,6 +27,7 @@ TESTS = \ t0212-gpt-many-partitions.sh \ t0220-gpt-msftres.sh \ t0250-gpt.sh \ + t0251-gpt-unicode.sh \ t0280-gpt-corrupt.sh \ t0281-gpt-grow.sh \ t0282-gpt-move-backup.sh \ diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh new file mode 100755 index 0000000..a2b4b04 --- /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 . + +. "${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 -- 1.8.3.2 From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Mon, 23 Dec 2013 02:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138776675413070 (code B ref 15591); Mon, 23 Dec 2013 02:46:01 +0000 Received: (at 15591) by debbugs.gnu.org; 23 Dec 2013 02:45:54 +0000 Received: from localhost ([127.0.0.1]:35099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvWk-0003Oj-6s for submit@debbugs.gnu.org; Sun, 22 Dec 2013 21:45:54 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:57345) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvWi-0003Oc-GP for 15591@debbugs.gnu.org; Sun, 22 Dec 2013 21:45:53 -0500 Received: by mail-pa0-f44.google.com with SMTP id fa1so4825818pad.3 for <15591@debbugs.gnu.org>; Sun, 22 Dec 2013 18:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=I75vZKCLNNPR1lsrrNffMoHsxYOgrfn4VpcbhD21j6U=; b=DqPNvkwfQ1bNoJ2EXWLWenq/iuCNiXcKBUVwG72J/5T0A2Lq0H7eeIuqLK08so5Ssn JTy4epRQR5QcZpqyFuVFrFRtOXSeK2duPYwVmX+gTsi3u+dUZkf4RTjhq1L7SiJL+wEI gj69f8BT13L2fGo2qDaBclx7jBV7kpYmR88nA4LMXlTb/TMmmCu5iKYLDN1rVbyWPZmB 6z8VAKEReec9VBwlL16C7WfbnmMEvGhmTYFv6dSO7ro5N289LFaaP64IWa4y9rE4Jo+/ mPl2Ip9Fk3vyyrEvVLiiNTmnD9m5Wlrew9D0Pec609pjK3zVIg3C8qsSDHL/FIuyl97M VuSA== X-Received: by 10.67.3.68 with SMTP id bu4mr1401021pad.144.1387766751723; Sun, 22 Dec 2013 18:45:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sun, 22 Dec 2013 18:45:31 -0800 (PST) In-Reply-To: <1387765040-14416-1-git-send-email-psusi@ubuntu.com> References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> <1387765040-14416-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Sun, 22 Dec 2013 18:45:31 -0800 X-Google-Sender-Auth: s4Za-C3bhctZ_01OBtxbMDIBZC4 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sun, Dec 22, 2013 at 6:17 PM, Phillip Susi wrote: > +# 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 Thank you. That looks correct and is now more portable. To avoid minor "reviewer surprise", I suggest to drop the use of backslash-space and instead use single quotes around the entire line, and use ">" rather than ">>", e.g., echo ' 66 00 6f 00 6f 00 24 1d 00 00' > exp From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Mon, 23 Dec 2013 02:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: Phillip Susi Cc: 15591@debbugs.gnu.org Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138776686813311 (code B ref 15591); Mon, 23 Dec 2013 02:48:02 +0000 Received: (at 15591) by debbugs.gnu.org; 23 Dec 2013 02:47:48 +0000 Received: from localhost ([127.0.0.1]:35110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvYZ-0003Sc-Ff for submit@debbugs.gnu.org; Sun, 22 Dec 2013 21:47:47 -0500 Received: from mail-pb0-f47.google.com ([209.85.160.47]:48780) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvYX-0003SU-3f for 15591@debbugs.gnu.org; Sun, 22 Dec 2013 21:47:45 -0500 Received: by mail-pb0-f47.google.com with SMTP id um1so4772341pbc.20 for <15591@debbugs.gnu.org>; Sun, 22 Dec 2013 18:47:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=lgK1sJjSxPtLZdI5aY4RKyWrmnUtR/2z3PW4z4Hqx4c=; b=xMVOH67fWSuo3XgXsNw8pt9iR51YBtO4lDKDIgZ8Bb1I2omN85nNcm+/RUDeK12YpJ 1WWF2jweLtMfsYh9s3KdyN4iq+HuBRfXfaB8wxQxPV+UyxuzGV5cT316H6HyHOADmdNF ZZZyfDwbk7mZHhqXQBWreZlRegsiBKLoAvEC+IWBHAkXgC00xtPfGtJhW1G0tIcWj0cO nTkpWWYgwTtNGMd88ktWWB/no+Fyng0b/RoJqY2youA4324Ak+OzU6A38knVouCGGPTY ESSBkgg9nnIyLNvnxvIycem0gXzCzX9SHA5ieLh1NTT2qpVDBjjtlQ8s0p/STyW3DDYQ xlNw== X-Received: by 10.66.162.195 with SMTP id yc3mr23349194pab.64.1387766864320; Sun, 22 Dec 2013 18:47:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sun, 22 Dec 2013 18:47:24 -0800 (PST) In-Reply-To: <1387765040-14416-1-git-send-email-psusi@ubuntu.com> References: <1387592728-9301-1-git-send-email-psusi@ubuntu.com> <1387765040-14416-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Sun, 22 Dec 2013 18:47:24 -0800 X-Google-Sender-Auth: r6UZBwAn6pG3_mmxaDgtrFj2TjI Message-ID: Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Oh, and please add an item to NEWS, e.g., the sentence I suggested a day or two ago. From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Mon, 23 Dec 2013 03:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org, jim@meyering.net Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138776839816057 (code B ref 15591); Mon, 23 Dec 2013 03:14:01 +0000 Received: (at 15591) by debbugs.gnu.org; 23 Dec 2013 03:13:18 +0000 Received: from localhost ([127.0.0.1]:35131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvxF-0004At-65 for submit@debbugs.gnu.org; Sun, 22 Dec 2013 22:13:17 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:48862) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuvxB-0004Ah-S6 for 15591@debbugs.gnu.org; Sun, 22 Dec 2013 22:13:14 -0500 X-Authority-Analysis: v=2.0 cv=GqXACzJC c=1 sm=0 a=3SewDSjaRW4vdJyuxQ33ZQ==:17 a=nY8CUcLLpFgA:10 a=S1A5HrydsesA:10 a=DeBnktw0k-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=qluqBLp8y1oA:10 a=mDV3o1hIAAAA:8 a=HMFHro10-YLqz6dsA4UA:9 a=3SewDSjaRW4vdJyuxQ33ZQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 72.238.73.171 Received: from [72.238.73.171] ([72.238.73.171:52026] helo=localhost.localdomain) by cdptpa-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 01/5C-00725-94AA7B25; Mon, 23 Dec 2013 03:13:13 +0000 From: Phillip Susi Date: Sun, 22 Dec 2013 22:13:12 -0500 Message-Id: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) 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. --- NEWS | 1 + libparted/labels/gpt.c | 63 ++++++++++++++++++++++++++++++++++++++++------ tests/Makefile.am | 1 + tests/t0251-gpt-unicode.sh | 38 ++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 7 deletions(-) create mode 100755 tests/t0251-gpt-unicode.sh diff --git a/NEWS b/NEWS index 9d0d931..935fa33 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ GNU parted NEWS -*- outline -*- boot partition type. ** Bug Fixes + Fix gpt to correctly handle non ASCII charcters in partition names If a drive was 100 times an even multiple of two, sizes specified as a percentage would trigger the exact placement rule and refuse to round diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 66c96e6..dce89b1 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include "xalloc.h" #include "verify.h" @@ -196,7 +198,7 @@ struct __attribute__ ((packed)) _GuidPartitionEntry_t uint64_t StartingLBA; uint64_t EndingLBA; GuidPartitionEntryAttributes_t Attributes; - efi_char16_t PartitionName[72 / sizeof (efi_char16_t)]; + efi_char16_t PartitionName[36]; }; #define GPT_PMBR_LBA 0 @@ -281,7 +283,8 @@ typedef struct _GPTPartitionData { efi_guid_t type; efi_guid_t uuid; - char name[37]; + efi_char16_t name[37]; + char *translated_name; int lvm; int raid; int boot; @@ -797,10 +800,11 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) gpt_part_data = part->disk_specific; gpt_part_data->type = pte->PartitionTypeGuid; gpt_part_data->uuid = pte->UniquePartitionGuid; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) gpt_part_data->name[i] = (efi_char16_t) PED_LE16_TO_CPU ((uint16_t) pte->PartitionName[i]); gpt_part_data->name[i] = 0; + gpt_part_data->translated_name = 0; gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service @@ -1210,7 +1214,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) if (gpt_part_data->legacy_boot) pte->Attributes.LegacyBIOSBootable = 1; - for (i = 0; i < 72 / sizeof (efi_char16_t); i++) + for (i = 0; i < 36; i++) pte->PartitionName[i] = (efi_char16_t) PED_CPU_TO_LE16 ((uint16_t) gpt_part_data->name[i]); } @@ -1353,6 +1357,7 @@ gpt_partition_new (const PedDisk *disk, gpt_part_data->atvrecv = 0; gpt_part_data->legacy_boot = 0; gpt_part_data->prep = 0; + gpt_part_data->translated_name = 0; uuid_generate ((unsigned char *) &gpt_part_data->uuid); swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); @@ -1386,6 +1391,9 @@ gpt_partition_duplicate (const PedPartition *part) goto error_free_part; *result_data = *part_data; + if (part_data->translated_name) + result_data->translated_name = xstrdup (part_data->translated_name); + else part_data->translated_name = 0; return result; error_free_part: @@ -1400,6 +1408,8 @@ gpt_partition_destroy (PedPartition *part) if (part->type == 0) { PED_ASSERT (part->disk_specific != NULL); + GPTPartitionData *gpt_part_data = part->disk_specific; + free (gpt_part_data->translated_name); free (part->disk_specific); } @@ -1820,15 +1830,54 @@ gpt_partition_set_name (PedPartition *part, const char *name) { GPTPartitionData *gpt_part_data = part->disk_specific; - strncpy (gpt_part_data->name, name, 36); - gpt_part_data->name[36] = 0; + free(gpt_part_data->translated_name); + gpt_part_data->translated_name = xstrdup(name); + iconv_t conv = iconv_open ("UTF-16", nl_langinfo (CODESET)); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = gpt_part_data->translated_name; + char *outbuff = (char *)&gpt_part_data->name; + size_t inbuffsize = strlen (inbuff) + 1; + size_t outbuffsize = 72; + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + return; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); } static const char * gpt_partition_get_name (const PedPartition *part) { GPTPartitionData *gpt_part_data = part->disk_specific; - return gpt_part_data->name; + if (gpt_part_data->translated_name == NULL) + { + char buffer[200]; + iconv_t conv = iconv_open (nl_langinfo (CODESET), "UTF-16"); + if (conv == (iconv_t)-1) + goto err; + char *inbuff = (char *)&gpt_part_data->name; + char *outbuff = buffer; + size_t inbuffsize = 72; + size_t outbuffsize = sizeof(buffer); + if (iconv (conv, &inbuff, &inbuffsize, &outbuff, &outbuffsize) == -1) + goto err; + iconv_close (conv); + *outbuff = 0; + gpt_part_data->translated_name = xstrdup (buffer); + return gpt_part_data->translated_name; + err: + ped_exception_throw (PED_EXCEPTION_WARNING, + PED_EXCEPTION_IGNORE, + _("Can not translate partition name")); + iconv_close (conv); + return ""; + } + return gpt_part_data->translated_name; } static int diff --git a/tests/Makefile.am b/tests/Makefile.am index 16ec5d2..7a6fe8f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,6 +27,7 @@ TESTS = \ t0212-gpt-many-partitions.sh \ t0220-gpt-msftres.sh \ t0250-gpt.sh \ + t0251-gpt-unicode.sh \ t0280-gpt-corrupt.sh \ t0281-gpt-grow.sh \ t0282-gpt-move-backup.sh \ 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 . + +. "${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 -- 1.8.3.2 From unknown Sat Jun 21 12:35:47 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Phillip Susi Subject: bug#15591: closed (Re: [PATCH] libparted: handle i18n gpt partition names correctly) Message-ID: References: <52584A71.2080301@ubuntu.com> X-Gnu-PR-Message: they-closed 15591 X-Gnu-PR-Package: parted Reply-To: 15591@debbugs.gnu.org Date: Mon, 23 Dec 2013 03:46:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1387770362-19809-1" This is a multi-part message in MIME format... ------------=_1387770362-19809-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15591: gpt mishandles non ascii partition names which was filed against the parted package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15591@debbugs.gnu.org. --=20 15591: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15591 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1387770362-19809-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15591-done) by debbugs.gnu.org; 23 Dec 2013 03:45:32 +0000 Received: from localhost ([127.0.0.1]:35150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuwSR-00058S-O4 for submit@debbugs.gnu.org; Sun, 22 Dec 2013 22:45:31 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:34440) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuwSN-00058F-Rc for 15591-done@debbugs.gnu.org; Sun, 22 Dec 2013 22:45:28 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so4792188pbc.7 for <15591-done@debbugs.gnu.org>; Sun, 22 Dec 2013 19:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=lCrEVkz2z4VLe90PFJcBXs0LhlzOcidMsCObOA+5czI=; b=XBVpFt2O5cpcXZQB9Rf3EE+QdTGYMrB58Sq5iWrnpLAS1j3Im2VDrrE73QxEx5yz3f +TU+ymvB8UdvJfgL186vX7OFzzKT1GXG5df9Q/eHnUyzPobRCUQUDVlQen2ZBL9oXA8h qYb4ksNbDZk/Wrmbqx3veI4i6FZ4/dysKwKwWRkUWTwemf4hYcdjiilYlR+WXw9ULXAz pHRcuGJhijZTC8+1TWPZNd0FVqSieCQSKoOqXhnKYF6FBJ+G3iKYuc74hA0vJBITnuxb dP2DEmmlXYBABkBQ91/zD0XizJSAkxMQyhJf/+xKeeoiugIsGDq4gV8zUkxWY3foAwfJ /xlg== X-Received: by 10.66.25.100 with SMTP id b4mr23232686pag.24.1387770326794; Sun, 22 Dec 2013 19:45:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sun, 22 Dec 2013 19:45:06 -0800 (PST) In-Reply-To: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> References: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Sun, 22 Dec 2013 19:45:06 -0800 X-Google-Sender-Auth: V1UOzHHCkzn6gjTQCRdeZGMiL-0 Message-ID: Subject: Re: [PATCH] libparted: handle i18n gpt partition names correctly To: Phillip Susi Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15591-done Cc: 15591-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Perfect. Thanks! Marking this "done" in the bug-tracker. ------------=_1387770362-19809-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Oct 2013 18:59:18 +0000 Received: from localhost ([127.0.0.1]:43625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUhvh-0004Uy-SR for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44749) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUhvg-0004Ur-0T for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUhvZ-0003Uz-TI for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvZ-0003Uu-Pr for submit@debbugs.gnu.org; Fri, 11 Oct 2013 14:59:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvU-0002SG-9z for bug-parted@gnu.org; Fri, 11 Oct 2013 14:59:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUhvO-0003SX-Kz for bug-parted@gnu.org; Fri, 11 Oct 2013 14:59:04 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:61084) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUhvO-0003SR-Gy for bug-parted@gnu.org; Fri, 11 Oct 2013 14:58:58 -0400 X-Authority-Analysis: v=2.0 cv=auQw+FlV c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=Qsx_du5GiBkA:10 a=sCfsyOEanakA:10 a=CaGQTAwTuEkA:10 a=S1A5HrydsesA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=jI-KHgsGx_YA:10 a=danhDmx_AAAA:8 a=QfKxxUxMAAAA:8 a=QU5NSF2I7XW8Q_w3pIkA:9 a=wPNLvfGTeEIA:10 a=0B7kyOrQLHoA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:52261] helo=[10.1.1.236]) by cdptpa-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 11/C6-01471-17A48525; Fri, 11 Oct 2013 18:58:57 +0000 Message-ID: <52584A71.2080301@ubuntu.com> Date: Fri, 11 Oct 2013 14:58:57 -0400 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: "bug-parted@gnu.org" Subject: gpt mishandles non ascii partition names X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Original bug report: https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1238446 The gpt partition table has 16 bit characters for the name, which I assume are supposed to be UTF-16, but the bloody uefi standard is moot on the subject. Currently parted simply decimates the characters, throwing out the upper 8 bits. This corrupts characters that aren't simple ascii, and at some later point, strlist.c calls mbstrtowcs(), which chokes on the corrupt name causing parted to bail out with "Error during translation". I think that gpt.c needs to translate the UTF-16 to the native multibyte encoding, but I have no idea how to do that. The C standard conversion functions all seem to use the current locale and don't have a way to override it if you know this string is in UTF-16 ( and maybe the current locale is UTF-8 ). -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSWEpxAAoJEJrBOlT6nu75YYYH+gOqxQdKmRmPFfSAFbkOnXzf 9SqhaamWXNmqWLCaKHb4COO0S/Wg5Uu5Kzw0chqFbty0+S+Wa13/SM97S25SxUmh q3sVnWbVwbOW5D2NAGhC7jjGwpZ9F4k45xE4DaHntSD1lsoYfq5+D25+4h7GTNqL vliuuFhzUs5dQke/ONFnRfDb202ZC4j+HE7nBRwRm7VsUswsiiPVV8dz5iSQhkD1 /tx3N63A9aViBpFLlgGZu8XSaBHoE+4ZZ/COEGPzga372GDXyccODe0QfmErqWKI 3s0juqk5uOhUWvrWfzaYDtFEG+3AXuIXm8OT/SEQ4uKlqpCBKsFoBQLRGvoEPOE= =0KW9 -----END PGP SIGNATURE----- ------------=_1387770362-19809-1-- From unknown Sat Jun 21 12:35:47 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Rod Smith Subject: bug#15597: closed (Re: [PATCH] libparted: handle i18n gpt partition names correctly) Message-ID: References: <525979C8.7030106@rodsbooks.com> X-Gnu-PR-Message: they-closed 15597 X-Gnu-PR-Package: parted Reply-To: 15597@debbugs.gnu.org Date: Mon, 23 Dec 2013 03:46:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1387770363-19809-3" This is a multi-part message in MIME format... ------------=_1387770363-19809-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15591: bug-parted Digest, Vol 131, Issue 9 which was filed against the parted package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15597@debbugs.gnu.org. --=20 15591: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15591 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1387770363-19809-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15591-done) by debbugs.gnu.org; 23 Dec 2013 03:45:32 +0000 Received: from localhost ([127.0.0.1]:35150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuwSR-00058S-O4 for submit@debbugs.gnu.org; Sun, 22 Dec 2013 22:45:31 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:34440) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VuwSN-00058F-Rc for 15591-done@debbugs.gnu.org; Sun, 22 Dec 2013 22:45:28 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so4792188pbc.7 for <15591-done@debbugs.gnu.org>; Sun, 22 Dec 2013 19:45:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=lCrEVkz2z4VLe90PFJcBXs0LhlzOcidMsCObOA+5czI=; b=XBVpFt2O5cpcXZQB9Rf3EE+QdTGYMrB58Sq5iWrnpLAS1j3Im2VDrrE73QxEx5yz3f +TU+ymvB8UdvJfgL186vX7OFzzKT1GXG5df9Q/eHnUyzPobRCUQUDVlQen2ZBL9oXA8h qYb4ksNbDZk/Wrmbqx3veI4i6FZ4/dysKwKwWRkUWTwemf4hYcdjiilYlR+WXw9ULXAz pHRcuGJhijZTC8+1TWPZNd0FVqSieCQSKoOqXhnKYF6FBJ+G3iKYuc74hA0vJBITnuxb dP2DEmmlXYBABkBQ91/zD0XizJSAkxMQyhJf/+xKeeoiugIsGDq4gV8zUkxWY3foAwfJ /xlg== X-Received: by 10.66.25.100 with SMTP id b4mr23232686pag.24.1387770326794; Sun, 22 Dec 2013 19:45:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.68.6.66 with HTTP; Sun, 22 Dec 2013 19:45:06 -0800 (PST) In-Reply-To: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> References: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> From: Jim Meyering Date: Sun, 22 Dec 2013 19:45:06 -0800 X-Google-Sender-Auth: V1UOzHHCkzn6gjTQCRdeZGMiL-0 Message-ID: Subject: Re: [PATCH] libparted: handle i18n gpt partition names correctly To: Phillip Susi Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15591-done Cc: 15591-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Perfect. Thanks! Marking this "done" in the bug-tracker. ------------=_1387770363-19809-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Oct 2013 16:33:36 +0000 Received: from localhost ([127.0.0.1]:44534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV28F-0005Bi-8W for submit@debbugs.gnu.org; Sat, 12 Oct 2013 12:33:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48154) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV28C-0005Bb-7N for submit@debbugs.gnu.org; Sat, 12 Oct 2013 12:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV286-0004oG-Io for submit@debbugs.gnu.org; Sat, 12 Oct 2013 12:33:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV286-0004oC-G9 for submit@debbugs.gnu.org; Sat, 12 Oct 2013 12:33:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV281-0006qk-71 for bug-parted@gnu.org; Sat, 12 Oct 2013 12:33:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VV27v-0004lg-Mg for bug-parted@gnu.org; Sat, 12 Oct 2013 12:33:21 -0400 Received: from eastrmfepo202.cox.net ([68.230.241.217]:53941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VV27v-0004lP-IN for bug-parted@gnu.org; Sat, 12 Oct 2013 12:33:15 -0400 Received: from eastrmimpo110 ([68.230.241.223]) by eastrmfepo202.cox.net (InterMail vM.8.01.05.09 201-2260-151-124-20120717) with ESMTP id <20131012163313.SKTE3871.eastrmfepo202.cox.net@eastrmimpo110> for ; Sat, 12 Oct 2013 12:33:13 -0400 Received: from nessus.rodsbooks.com ([98.182.36.23]) by eastrmimpo110 with cox id cGZD1m0070Vxc5u01GZD3W; Sat, 12 Oct 2013 12:33:13 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.525979C9.0079,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=NeA4IR/4 c=1 sm=1 a=5/GQi7ztvdfnmBZvbhqgsw==:17 a=P66V9xvxFGMA:10 a=jaQXcjyXAqUA:10 a=-oC7iYvNpoQA:10 a=8nJEP1OIZ-IA:10 a=28bguoTQAAAA:8 a=lf86WEhIQn0A:10 a=fxJcL_dCAAAA:8 a=0homCqhpAAAA:8 a=TVkev9qf_n93KYuB1EUA:9 a=wPNLvfGTeEIA:10 a=2eKvNQJKnqYA:10 a=_YepGT1rgiMA:10 a=5/GQi7ztvdfnmBZvbhqgsw==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: from [192.168.1.2] (nessus.rodsbooks.com [192.168.1.2]) by nessus.rodsbooks.com (Postfix) with ESMTP id EDFECAAE799 for ; Sat, 12 Oct 2013 12:33:12 -0400 (EDT) Message-ID: <525979C8.7030106@rodsbooks.com> Date: Sat, 12 Oct 2013 12:33:12 -0400 From: Rod Smith User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130925 Thunderbird/17.0.9 MIME-Version: 1.0 To: bug-parted@gnu.org Subject: Re: bug-parted Digest, Vol 131, Issue 9 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) On 10/12/2013 12:01 PM, Phillip Susi wrote: > The gpt partition table has 16 bit characters for the name, which I > assume are supposed to be UTF-16, but the bloody uefi standard is moot > on the subject. The standard says they're "strings," and the default for strings in UEFI is UTF-16LE/UCS-2. > Currently parted simply decimates the characters, > throwing out the upper 8 bits. This corrupts characters that aren't > simple ascii, and at some later point, strlist.c calls mbstrtowcs(), > which chokes on the corrupt name causing parted to bail out with > "Error during translation". > > I think that gpt.c needs to translate the UTF-16 to the native > multibyte encoding, but I have no idea how to do that. The C standard > conversion functions all seem to use the current locale and don't have > a way to override it if you know this string is in UTF-16 ( and maybe > the current locale is UTF-8 ). I agree with you. I haven't studied the parted code on this score, so I don't have any specific suggestions for how to do it in parted. I can offer my experiences with doing it in GPT fdisk (http://www.rodsbooks.com/gdisk/), though: I used libicu (http://site.icu-project.org/) to do the translation. This seems to work pretty well -- at least, it produces results that are inter-operable with what Apple's tools do. You can check the gdisk source code, and particularly the gptpart.cc file, to see how gdisk does it. Search for "UnicodeString" to find what it does. It's been a while since I added libicu support, and I haven't made many changes to it since then, so I don't recall every detail of what I did. I seem to recall that it wasn't really very hard, but I did need to change quite a few output functions to use the libicu calls. FWIW, when I added libicu support to gdisk, I kept the option to compile without libicu, in which case gdisk mangles non-ASCII characters in much the way parted does. Thus, you'll see both sets of code in gdisk. As a practical matter, libicu is a rather large library, and some developers of small emergency disks don't want to include it, so keeping the option to not use libicu is worthwhile. Note that some values are invalid even with libicu, so there's a possibility that you'll run into error conditions, whether using libicu or not. Obviously, sane error handling is better than having the code bail out. -- Rod Smith rodsmith@rodsbooks.com http://www.rodsbooks.com ------------=_1387770363-19809-3-- From unknown Sat Jun 21 12:35:47 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15591: [PATCH] libparted: handle i18n gpt partition names correctly Resent-From: Phillip Susi Original-Sender: "Debbugs-submit" Resent-CC: bug-parted@gnu.org Resent-Date: Mon, 23 Dec 2013 15:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15591 X-GNU-PR-Package: parted X-GNU-PR-Keywords: To: 15591@debbugs.gnu.org, jim@meyering.net Received: via spool by 15591-submit@debbugs.gnu.org id=B15591.138781210612014 (code B ref 15591); Mon, 23 Dec 2013 15:22:01 +0000 Received: (at 15591) by debbugs.gnu.org; 23 Dec 2013 15:21:46 +0000 Received: from localhost ([127.0.0.1]:35998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vv7KD-00037h-Vy for submit@debbugs.gnu.org; Mon, 23 Dec 2013 10:21:46 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:36702) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vv7KB-00037X-SO for 15591@debbugs.gnu.org; Mon, 23 Dec 2013 10:21:44 -0500 X-Authority-Analysis: v=2.0 cv=H69ZMpki c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17 a=oVFiZj9fevMA:10 a=7tyaxzAZ_1AA:10 a=S1A5HrydsesA:10 a=Qsx_du5GiBkA:10 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=0889UXwqurIA:10 a=QfKxxUxMAAAA:8 a=hQDdhaG4CvVa2lL8UZwA:9 a=wPNLvfGTeEIA:10 a=lB-sti7AqFcA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 67.78.168.186 Received: from [67.78.168.186] ([67.78.168.186:55426] helo=[10.1.1.236]) by cdptpa-oedge04.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 6C/2E-11872-60558B25; Mon, 23 Dec 2013 15:21:43 +0000 Message-ID: <52B85506.3050003@ubuntu.com> Date: Mon, 23 Dec 2013 10:21:42 -0500 From: Phillip Susi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 References: <1387768392-14994-1-git-send-email-psusi@ubuntu.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/22/2013 10:45 PM, Jim Meyering wrote: > Perfect. Thanks! Marking this "done" in the bug-tracker. Great, pushed. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSuFUGAAoJEI5FoCIzSKrwE9MH/RKiruOVv5gIDCsOTG9/Cq64 EdB93f/q6mzBZnNwWEeZk9xoNpu4ueUHqOWU89zdsgVd0Dk4S0CyQoh0jAe9p1z1 CF1zdLldOxFSYxj3iQsPg4Wj2B/lAIgPV08b8XY+/De/KrOh8br5lt0NUSVzKuyJ ZTBVYDNnfItW04mva/cXFwztmaLzQK3DIJ/tqszz/4GNongOh5wBtI9B3lzYbOVO KdDksESg6F5izaCw1+nBD70xmDO6qS9VUX0qFlVKdiqQf+wohYKmkakM3DMYIEQ7 hMxMZYaWIQnoheWjyTWGYkzluNwyHqyQjjBamBPRkP5IB2juWHdP+dg2ckZZ9U8= =KyKE -----END PGP SIGNATURE-----