[Bug 1835124] Re: growpart mishandles image filenames that end in a number
Rafael David Tinoco
rafaeldtinoco at kernelpath.com
Fri Sep 6 14:07:37 UTC 2019
MR:
https://code.launchpad.net/~rafaeldtinoco/ubuntu/+source/cloud-
utils/+git/cloud-utils/+ref/lp1835124
rebases previous merge including your fix.
Feel free to sponsor if review is +1.
Let me know if there are any issues.
Thx Scott!
--
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835124
Title:
growpart mishandles image filenames that end in a number
Status in cloud-utils:
Fix Committed
Status in cloud-utils package in Ubuntu:
Fix Released
Status in cloud-utils source package in Disco:
Fix Committed
Bug description:
[Impact]
* DEP8 race condition for ppc64el (LP: #1836593): intermittent
migration regressions.
* growpart: fix bug when file image ends in a digit (LP: #1835124):
image files can't end in ".ext4", for example, orelse growpart doesn't
work.
* fix spelling error in ec2metadata (LP: #1810857): no impact.
[Test Case]
(k)inaddy at kvirtclone:~$ sudo fdisk /fakedisk.ext4
(m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-262143, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-262143, default 262143): +100mb
Created a new partition 1 of type 'Linux' and of size 95 MiB.
Command (m for help): w
The partition table has been altered.
Syncing disks.
(k)inaddy at kvirtclone:~$ sudo growpart /fakedisk.ext4 1
FAILED: failed to get start and end for /fakedisk.ext41 in /fakedisk.ext4
[Regression Potential]
* Fix tries to recognize if volume is a block device or not. Same code exists for block devices, which reduces probability of issues.
* Fix was done by pkg maintainer and it is already upstreamed.
[Other Info]
* Related Bugs:
* bug 1842682: regression in test-growpart results in test fail device or resource busy
* Original description:
When growpart attempts to determine the partition to resize, it uses
this logic:
$ sed -n '266,275p' $(which growpart)
dpart="${DISK}${PART}" # disk and partition number
if [ -b "${DISK}p${PART}" -a "${DISK%[0-9]}" != "${DISK}" ]; then
# for block devices that end in a number (/dev/nbd0)
# the partition is "<name>p<partition_number>" (/dev/nbd0p1)
dpart="${DISK}p${PART}"
elif [ "${DISK#/dev/loop[0-9]}" != "${DISK}" ]; then
# for /dev/loop devices, sfdisk output will be <name>p<number>
# format also, even though there is not a device there.
dpart="${DISK}p${PART}"
fi
If the disk is an image, and the image filename ends with a number,
the partition will be "${DISK}p${PART}"; however, "${DISK}p${PART}"
will not be a block device. Thus, the partition is improperly
identified as just "${DISK}${PART}".
This gives us a failure like:
+ growpart -v -v -v disk-uefi.ext4 1
update-partition set to true
resizing 1 on disk-uefi.ext4 using resize_sfdisk_gpt
running[sfd_list][erronly] sfdisk --list --unit=S disk-uefi.ext4
6291456 sectors of 512. total size=3221225472 bytes
running[sfd_dump][erronly] sfdisk --unit=S --dump disk-uefi.ext4
## sfdisk --unit=S --dump disk-uefi.ext4
label: gpt
label-id: A9F73A73-50FD-4335-9082-1249985F154D
device: disk-uefi.ext4
unit: sectors
first-lba: 34
last-lba: 6291422
disk-uefi.ext4p1 : start= 227328, size= 4384735, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=C1191CD2-0753-4A53-8CD4-E6079735CA42
disk-uefi.ext4p14 : start= 2048, size= 8192, type=21686148-6449-6E6F-744E-656564454649, uuid=3A2AD377-EB6D-4689-9126-35148C003A95
disk-uefi.ext4p15 : start= 10240, size= 217088, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=98C675C8-4FF6-425C-B783-E77FDE70C967
FAILED: failed to get start and end for disk-uefi.ext41 in disk-uefi.ext4
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-utils/+bug/1835124/+subscriptions
More information about the Ubuntu-sponsors
mailing list