[blivet] Beware of parted possibly returning unicode objects (#973019)
Brian C. Lane
bcl at redhat.com
Thu Jun 20 16:25:54 UTC 2013
On Wed, Jun 19, 2013 at 01:57:12PM +0200, Vratislav Podzimek wrote:
> We return plain strings everywhere so we should encode the unicode object with
> utf-8 and store it as a plain string.
>
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
> blivet/devices.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/blivet/devices.py b/blivet/devices.py
> index 4877a39..6aa6c26 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -1374,8 +1374,8 @@ class PartitionDevice(StorageDevice):
> if self.partedPartition is None:
> self._name = self.req_name
> else:
> - self._name = \
> - devicePathToName(self.partedPartition.getDeviceNodeName())
> + dev_node_name = self.partedPartition.getDeviceNodeName()
> + self._name = devicePathToName(dev_node_name.encode("utf-8"))
>
> def dependsOn(self, dep):
> """ Return True if this device depends on dep. """
> --
> 1.7.11.7
Have you tested this? I'm worried about what happens when the ascii
self._name gets used. Are there places where it has to match what parted
returned? eg. looking up the device using the name.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20130620/8476207a/attachment.sig>
More information about the anaconda-patches
mailing list