utils/gpt_parser.py: fix partitions names
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 9 Dec 2013 10:23:36 +0000 (12:23 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 9 Dec 2013 11:58:35 +0000 (13:58 +0200)
This patch fixes https://bugs.tizen.org/jira/browse/TIVI-1727.

The problem is that we are using 'UTF-16' encoder name, and it adds BOM
(http://en.wikipedia.org/wiki/Byte_order_mark#UTF-16), and BOM breaks
tools like parted.

The GPT spec says that the partition name is UCS-16 Little Endian, so fix this
by using 'UTF-16LE' instead, which will not add BOM.

I've verified that this fixes TIVI-1727 indeed.

Change-Id: If2fff219177bed877873512457b6355dd0118011
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
mic/utils/gpt_parser.py

index 5d43b70..895600d 100644 (file)
@@ -296,7 +296,7 @@ class GptParser:
                                 entry['first_lba'],
                                 entry['last_lba'],
                                 entry['flags'],
-                                entry['name'].encode('UTF-16'))
+                                entry['name'].encode('UTF-16LE'))
 
         # Write the updated entry to the disk
         entry_offs = header['ptable_offs'] + \