Bug 1088424 - virt-resize: libguestfs error: part_set_name: parted: /dev/sdb: Error during translation: Invalid or incomplete multibyte or wide character
Summary: virt-resize: libguestfs error: part_set_name: parted: /dev/sdb: Error during ...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pino Toscano
QA Contact:
URL:
Whiteboard:
: 1088738 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-16 15:43 UTC by Richard W.M. Jones
Modified: 2014-04-22 17:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-22 12:34:10 UTC
Embargoed:


Attachments (Terms of Use)
build.log (1.58 MB, text/plain)
2014-04-16 15:43 UTC, Richard W.M. Jones
no flags Details

Description Richard W.M. Jones 2014-04-16 15:43:05 UTC
Created attachment 886926 [details]
build.log

Description of problem:

virt-resize test fails in Rawhide with this error:

parted -s -- /dev/sdb name 1 \xef\xbb\xbfprimary
Error during translation: Invalid or incomplete multibyte or wide character
guestfsd: error: parted: /dev/sdb: Error during translation: Invalid or incomplete multibyte or wide character
libguestfs: trace: part_set_name = -1 (error)
virt-resize: libguestfs error: part_set_name: parted: /dev/sdb: Error during translation: Invalid or incomplete multibyte or wide character

Version-Release number of selected component (if applicable):

libguestfs 1.27.5

How reproducible:

Unknown, at least once.
Only happens in Rawhide, and only seems to have started
happening in the last week or so.

Comment 1 Richard W.M. Jones 2014-04-17 07:29:54 UTC
*** Bug 1088738 has been marked as a duplicate of this bug. ***

Comment 2 Pino Toscano 2014-04-17 09:40:19 UTC
It seems things started to change parted in 3.1-18, with patch
  0066-bug-15591-PATCH-libparted-handle-i18n-gpt-partition-.patch

Apparently sgdisk (part of gdisk), which we use to get the partition name in GPT layouts does not cope well with the encoding written in GPT, and returns also the encoding bytes in the output, as you can also see in the output:

  libguestfs: trace: part_get_name "/dev/sda" 1
  guestfsd: main_loop: proc 54 (statvfs) took 0.01 seconds
  guestfsd: main_loop: new request, len 0x38
  parted -m -- /dev/sda unit b print
  sgdisk /dev/sda -i 1
  Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
  Partition unique GUID: 974123F1-DADF-48FF-9AD0-DB41C13E43C7
  First sector: 64 (at 32.0 KiB)
  Last sector: 65599 (at 32.0 MiB)
  Partition size: 65536 sectors (32.0 MiB)
  Attribute flags: 0000000000000000
  Partition name: '\xef\xbb\xbfprimary'
  libguestfs: trace: part_get_name = "\xef\xbb\xbfprimary"

I'm not totally sure whether it is a sgdisk fault (I see in recent versions grew own UTF-16 handling without using ICU, although the ICU code is still there but not preferred).

What could be done is switch part_get_name into querying parted directly instead of using sgdisk, which most probably should have been done that way since the initial implementation (and it's my fault for that). This should reduce the possible discrepancy in output between tools we use.
The only drawback of this approach is that it requires the -m output of parted, although recent enough versions of parted have it (even the old 2.3, currently provided in Debian, has it), so it shouldn't be an issue.

Patch posted to the mailing list:
  https://www.redhat.com/archives/libguestfs/2014-April/msg00048.html

Comment 3 Pino Toscano 2014-04-22 12:34:10 UTC
https://github.com/libguestfs/libguestfs/commit/0316d247706aab7ce7c2225472feeb51fa8b1664
fixes the issue in libguestfs >= 1.27.6.

Comment 4 Pino Toscano 2014-04-22 17:05:31 UTC
https://github.com/libguestfs/libguestfs/commit/7d01aa56f37e40fefece453751ace54def45837e
fixes the issue in libguestfs >= 1.26.1.


Note You need to log in before you can comment on or make changes to this bug.