From 8f6ffc09bb3967bda8c417cb1648eb9e041522c0 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 11:07:08 +0000 Subject: import cloud-utils-growpart-0.29-5.el7 --- diff --git a/SOURCES/0001-growpart-fix-bug-occurring-if-start-sector-and-size-.patch b/SOURCES/0001-growpart-fix-bug-occurring-if-start-sector-and-size-.patch new file mode 100644 index 0000000..4c94d21 --- /dev/null +++ b/SOURCES/0001-growpart-fix-bug-occurring-if-start-sector-and-size-.patch @@ -0,0 +1,116 @@ +From 827ca9237044f4821eb442fee1eef07ec7c3448c Mon Sep 17 00:00:00 2001 +From: Lars Kellogg-Stedman +Date: Thu, 6 Dec 2018 15:32:35 -0500 +Subject: [PATCH] growpart: fix bug occurring if start sector and size were the + same. + +The existing sed expression would erroneously change the start sector +of a partition, rather than the size, if the start sector and size +were identical. This commit modifies the sed expression so that it +will only operate on the final match in the line. + +bzr-revno: 338.1.1 +(cherry picked from commit 7b11ac4d3abe16525639cff9198f5e7f8303280b) +--- + bin/growpart | 2 +- + test/test-growpart-start-matches-size | 75 +++++++++++++++++++++++++++ + 2 files changed, 76 insertions(+), 1 deletion(-) + create mode 100755 test/test-growpart-start-matches-size + +diff --git a/bin/growpart b/bin/growpart +index 13eda6e..4069fd4 100755 +--- a/bin/growpart ++++ b/bin/growpart +@@ -314,7 +314,7 @@ resize_sfdisk() { + # now, change the size for this partition in ${dump_out} to be the + # new size + new_size=$((${max_end}-${pt_start})) +- sed "\|^\s*${dpart} |s/${pt_size},/${new_size},/" "${dump_out}" \ ++ sed "\|^\s*${dpart} |s/\(.*\)${pt_size},/\1${new_size},/" "${dump_out}" \ + >"${new_out}" || + fail "failed to change size in output" + +diff --git a/test/test-growpart-start-matches-size b/test/test-growpart-start-matches-size +new file mode 100755 +index 0000000..9967827 +--- /dev/null ++++ b/test/test-growpart-start-matches-size +@@ -0,0 +1,75 @@ ++#!/bin/bash ++# ++# Create a disk image where there exists a partition whose sizes matches the ++# start sector. ++# brought up under bug 1807171, which describes an error in the sed expression ++# used to generate the replacement partition map ++ ++set -e ++ ++TEMP_D="" ++ ++rq() { ++ local out="${TEMP_D}/out" ++ "$@" > "$out" 2>&1 || { echo "FAILED:" "$@"; cat "$out"; return 1; } ++} ++fail() { echo "FAILED:" "$@" 1>&2; exit 1; } ++ ++setup_img() { ++ local img_fp="$1" img="" ++ img=$(basename "$img_fp") ++ sfdisk "${img_fp}" <"$err" > "$out"; then ++ cat "$err" "$out" ++ fail "[resizer=$resizer] growpart failed" ++ fi ++ echo "==== after ====" ++ ( cd "${TEMP_D}" && sfdisk --dump "${img##*/}" ) ++ echo ++ echo "==== after sgdisk ===" ++ ( cd "${TEMP_D}" && sgdisk --print "${img##*/}" ) ++ echo "==== growpart-stderr ===" ++ cat "$err" ++ echo "==== growpart-stdout ====" ++ cat "$out" ++ [ "$(cat $out)" = "$expected" ] || { ++ fail "[resizer=$resizer] output ^^^ did not match expected vvv:${CR}$expected" ++ } ++done ++ ++# vi: ts=4 noexpandtab +-- +2.17.2 + diff --git a/SPECS/cloud-utils-growpart.spec b/SPECS/cloud-utils-growpart.spec index 62b69fe..088f410 100644 --- a/SPECS/cloud-utils-growpart.spec +++ b/SPECS/cloud-utils-growpart.spec @@ -1,12 +1,13 @@ Name: cloud-utils-growpart Version: 0.29 -Release: 2%{?dist}.2 +Release: 5%{?dist} License: GPLv3 Group: System Environment/Base Source0: https://launchpad.net/cloud-utils/trunk/%{version}/+download/cloud-utils-%{version}.tar.gz +Patch0001: 0001-growpart-fix-bug-occurring-if-start-sector-and-size-.patch +Patch2: 0002-growpart-fix-bug-when-resizing-a-middle-partition-wi.patch URL: https://launchpad.net/cloud-utils Source1: LICENSE -Patch1: 0002-growpart-fix-bug-when-resizing-a-middle-partition-wi.patch BuildArch: noarch @@ -19,16 +20,13 @@ Requires: util-linux # systems. #Requires: gdisk - - %description This package provides the growpart script for growing a partition. It is primarily used in cloud images in conjunction with the dracut-modules-growroot package to grow the root partition on first boot. %prep -%setup -q -n cloud-utils-%{version} -%patch1 -p1 +%autosetup -n cloud-utils-%{version} -p1 %build @@ -49,10 +47,13 @@ cp man/growpart.* $RPM_BUILD_ROOT/%{_mandir}/man1/ %doc %{_mandir}/man1/growpart.* %changelog -* Tue Jul 09 2019 Miroslav Rezanina - 0.29-2.el7_6.2 -- growpart: fix bug when resizing a middle partition with sgdisk [rhbz#1726564] -- Resolves: rhbz#1726564 - (When growing GPT partitions use [start of next - 1] instead of [start of next] as the new end sector.) +* Mon Jun 03 2019 Miroslav Rezanina - 0.29-5 +- Fix bug when resizing a middle partition with sgdisk +- Resolves: rhbz#1695091 + +* Mon Dec 10 2018 Lars Kellogg-Stedman - 0.29-3 +- Fix growpart error when partition size matches partition offset +- Resolves: rhbz#1593451 * Wed Apr 19 2017 Charalampos Stratakis - 0.29-2 - Import to RHEL 7