** Also affects: curtin (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: curtin (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: curtin (Ubuntu)
       Status: New => Fix Released

** Changed in: curtin (Ubuntu Xenial)
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1598310

Title:
  Curtin block.get_blockdev_sector_size incorrectly assumes
  block._lsblock will return a dictionary with only a single entry

Status in curtin:
  Fix Committed
Status in curtin package in Ubuntu:
  Fix Released
Status in curtin source package in Xenial:
  Fix Committed

Bug description:
  [Impact]

   * Curtin block module method `get_blockdev_sector_size` fails when
     pointed at a device with multiple partitions instead of only 
     a partition.
     
     Curtin has been updated to filter the results to find the expected
     device path and return results for that device.
     
  [Test Case]

   * Install proposed curtin package on a system with a block device with
     multiple partitions.
     - python3 -c 'from curtin import block;
                   block.get_blockdev_sector_size("/dev/sda")'

    PASS: method call returns tuple with values
     - (512, 512)

    FAIL: method call fails with stacktrace like
     - Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "curtin/curtin/block/__init__.py", line 426,
      in get_blockdev_sector_size
       [parent] = info
     ValueError: too many values to unpack (expected 1)

  [Regression Potential]

   * Third-party consumers of curtin modules may have relied on this failure
     to detect devices which contained partitions.


  [Original Description]
  The function curtin.get_blockdev_sector_size will not work when called with a 
devpath which lsblk will return multiple lines of results for.

  This means that in some cases formatting a device other than a
  partition may fail, because block.mkfs checks for logical block size
  using this function.

  For example:
  Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
  [GCC 5.3.1 20160330] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from curtin import block
  >>> block.get_blockdev_sector_size('/dev/sda1')
  (512, 512)
  >>> block.get_blockdev_sector_size('/dev/sda5')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/magicanus/code/curtin-clean/curtin/curtin/block/__init__.py", 
line 426, in get_blockdev_sector_size
      [parent] = info
  ValueError: too many values to unpack (expected 1)
  >>> block.get_blockdev_sector_size('/dev/sda')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/magicanus/code/curtin-clean/curtin/curtin/block/__init__.py", 
line 426, in get_blockdev_sector_size
      [parent] = info
  ValueError: too many values to unpack (expected 1)

To manage notifications about this bug go to:
https://bugs.launchpad.net/curtin/+bug/1598310/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to     : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp

Reply via email to