udevadm_info() fails if any value contains "="

Bug #1899699 reported by Gregory Smith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
New
Undecided
Unassigned

Bug Description

Description:
  curtin.udev.udevadm_info() uses split("=", 2), but intended to use split("=", 1).

  This was observed while attempting to install Ubuntu 20.04 on Nutanix AHV.

Example:
  ubuntu-server@ubuntu-server:~$ sudo udevadm info --export --query=property /dev/sda | grep '=.*='
  SCSI_IDENT_TARGET_VENDOR='clusterid=58296284039924012'
  ubuntu-server@ubuntu-server:~$ export PYTHONPATH=/snap/subiquity/1966/lib/python3.6/site-packages
  ubuntu-server@ubuntu-server:~$ /snap/subiquity/1966/usr/bin/python3
  Python 3.6.9 (default, Jul 17 2020, 12:50:27)
  [GCC 8.4.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from curtin.udev import udevadm_info
  >>> udevadm_info("/dev/sda")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/snap/subiquity/1966/lib/python3.6/site-packages/curtin/udev.py", line 95, in udevadm_info
      key, value = line.split('=', 2)
  ValueError: too many values to unpack (expected 2)

Revision history for this message
Gregory Smith (gasmith84) wrote :
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Hmm I thought this was fixed but apparently not. I've proposed https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/392197 to get this done.

Revision history for this message
Ryan Harper (raharper) wrote :

Dupe of this: https://bugs.launchpad.net/curtin/+bug/1895021

with MP here:

https://code.launchpad.net/~sbykov/curtin/+git/curtin/+merge/390527

I didn't follow up (sorry) but I think we should take the PR with the a new unittest instead of modifying the existing one.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Ah maybe seeing that MP go by was why I thought this was fixed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.