From 0417c3cdb274e41e9b460ad34c2436086c389d3a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 31 Oct 2014 13:38:24 -0700 Subject: [PATCH] - Update to current master commit ac74b83 to fix fat16 resize (#1159083) - tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat (mike.fleetwood) - tests: t3000-resize-fs.sh: Add FAT16 resizing test (mike.fleetwood) - lib-fs-resize: Prevent crash resizing FAT16 file systems (mike.fleetwood) - libparted: also link to UUID_LIBS (heirecka) --- 0002-maint-post-release-administrivia.patch | 50 ++++++++++++++ 0003-libparted-also-link-to-UUID_LIBS.patch | 26 +++++++ ...event-crash-resizing-FAT16-file-syst.patch | 69 +++++++++++++++++++ ...resize-fs.sh-Add-FAT16-resizing-test.patch | 54 +++++++++++++++ ...ze-fs.sh-Add-requirement-on-mkfs.vfa.patch | 68 ++++++++++++++++++ parted.spec | 14 +++- 6 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 0002-maint-post-release-administrivia.patch create mode 100644 0003-libparted-also-link-to-UUID_LIBS.patch create mode 100644 0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch create mode 100644 0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch create mode 100644 0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch diff --git a/0002-maint-post-release-administrivia.patch b/0002-maint-post-release-administrivia.patch new file mode 100644 index 0000000..8d2a23a --- /dev/null +++ b/0002-maint-post-release-administrivia.patch @@ -0,0 +1,50 @@ +From f1cdf08806caf7d71779a5fe67af797c8e3ab09e Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Mon, 28 Jul 2014 23:19:51 -0400 +Subject: [PATCH 2/6] maint: post-release administrivia + +* NEWS: Add header line for next release. +* .prev-version: Record previous version. +* cfg.mk (old_NEWS_hash): Auto-update. +--- + .prev-version | 2 +- + NEWS | 3 +++ + cfg.mk | 2 +- + 3 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/.prev-version b/.prev-version +index 8c50098..a3ec5a4 100644 +--- a/.prev-version ++++ b/.prev-version +@@ -1 +1 @@ +-3.1 ++3.2 +diff --git a/NEWS b/NEWS +index 49c8129..297b0a5 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,8 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release ?.? (????-??-??) [?] ++ ++ + * Noteworthy changes in release 3.2 (2014-07-28) [stable] + + ** New Features +diff --git a/cfg.mk b/cfg.mk +index ade72d7..62a02b6 100644 +--- a/cfg.mk ++++ b/cfg.mk +@@ -43,7 +43,7 @@ local-checks-to-skip = \ + # Now that we have better (check.mk) tests, make this the default. + export VERBOSE = yes + +-old_NEWS_hash = bd453bcf049e292a9677c094d24a29dd ++old_NEWS_hash = 85f2e93c40425e202491675d97e40166 + + include $(srcdir)/dist-check.mk + +-- +1.9.3 + diff --git a/0003-libparted-also-link-to-UUID_LIBS.patch b/0003-libparted-also-link-to-UUID_LIBS.patch new file mode 100644 index 0000000..eb9ab33 --- /dev/null +++ b/0003-libparted-also-link-to-UUID_LIBS.patch @@ -0,0 +1,26 @@ +From 507d8e8d4c60fa6175d327c4f2dac307dc11ccd6 Mon Sep 17 00:00:00 2001 +From: Heiko Becker +Date: Fri, 19 Sep 2014 16:51:34 +0200 +Subject: [PATCH 3/6] libparted: also link to UUID_LIBS + +* libparted/Makefile.am (libparted_la_LIBADD): Add UUID_LIBS. +This fixes building parted with the gold linker. +--- + libparted/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libparted/Makefile.am b/libparted/Makefile.am +index edc5f2e..cb58648 100644 +--- a/libparted/Makefile.am ++++ b/libparted/Makefile.am +@@ -58,6 +58,7 @@ libparted_la_LIBADD = \ + $(DM_LIBS) \ + $(SELINUX_LIBS) \ + $(LIB_BLKID) \ ++ $(UUID_LIBS) \ + $(INTLLIBS) + + EXTRA_DIST = mbr.s +-- +1.9.3 + diff --git a/0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch b/0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch new file mode 100644 index 0000000..4f56b35 --- /dev/null +++ b/0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch @@ -0,0 +1,69 @@ +From 1e9e770f4bc7f3d80e09ecd1df58575fad064163 Mon Sep 17 00:00:00 2001 +From: Mike Fleetwood +Date: Sun, 28 Sep 2014 16:15:48 +0100 +Subject: [PATCH 4/6] lib-fs-resize: Prevent crash resizing FAT16 file systems + +Resizing FAT16 file system crashes in libparted/fs/r/fat/resize.c +create_resize_context() because it was dereferencing NULL pointer +fs_info->info_sector to copy the info_sector. + +Only FAT32 file systems have info_sector populated by fat_open() -> +fat_info_sector_read(). FAT12 and FAT16 file systems don't have an +info_sector so pointer fs_info->info_sector remains assigned NULL from +fat_alloc(). When resizing a FAT file system create_resize_context() +was always dereferencing fs_info->info_sector to memory copy the +info_sector, hence it crashed for FAT12 and FAT16. + +Make create_resize_context() only copy the info_sector for FAT32 file +systems. + +Reported by Christian Hesse in +https://bugzilla.gnome.org/show_bug.cgi?id=735669 +--- + NEWS | 4 ++++ + libparted/fs/r/fat/resize.c | 12 +++++++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/NEWS b/NEWS +index 297b0a5..da7db50 100644 +--- a/NEWS ++++ b/NEWS +@@ -2,6 +2,10 @@ GNU parted NEWS -*- outline -*- + + * Noteworthy changes in release ?.? (????-??-??) [?] + ++** Bug Fixes ++ ++ libparted-fs-resize: Prevent crash resizing FAT16 file systems. ++ + + * Noteworthy changes in release 3.2 (2014-07-28) [stable] + +diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c +index 919acf0..bfe60a0 100644 +--- a/libparted/fs/r/fat/resize.c ++++ b/libparted/fs/r/fat/resize.c +@@ -668,11 +668,17 @@ create_resize_context (PedFileSystem* fs, const PedGeometry* new_geom) + + /* preserve boot code, etc. */ + new_fs_info->boot_sector = ped_malloc (new_geom->dev->sector_size); +- new_fs_info->info_sector = ped_malloc (new_geom->dev->sector_size); + memcpy (new_fs_info->boot_sector, fs_info->boot_sector, + new_geom->dev->sector_size); +- memcpy (new_fs_info->info_sector, fs_info->info_sector, +- new_geom->dev->sector_size); ++ new_fs_info->info_sector = NULL; ++ if (fs_info->fat_type == FAT_TYPE_FAT32) ++ { ++ PED_ASSERT (fs_info->info_sector != NULL); ++ new_fs_info->info_sector = ++ ped_malloc (new_geom->dev->sector_size); ++ memcpy (new_fs_info->info_sector, fs_info->info_sector, ++ new_geom->dev->sector_size); ++ } + + new_fs_info->logical_sector_size = fs_info->logical_sector_size; + new_fs_info->sector_count = new_geom->length; +-- +1.9.3 + diff --git a/0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch b/0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch new file mode 100644 index 0000000..fccf55f --- /dev/null +++ b/0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch @@ -0,0 +1,54 @@ +From d704c4919e7e95c3a2e28f48bb8eeacaf17a7cc8 Mon Sep 17 00:00:00 2001 +From: Mike Fleetwood +Date: Sun, 28 Sep 2014 16:15:49 +0100 +Subject: [PATCH 5/6] tests: t3000-resize-fs.sh: Add FAT16 resizing test + +Add FAT16 resizing test so that we don't regress again. +--- + tests/t3000-resize-fs.sh | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh +index 8cab476..9084eb4 100755 +--- a/tests/t3000-resize-fs.sh ++++ b/tests/t3000-resize-fs.sh +@@ -46,7 +46,7 @@ device_sectors_required=$(echo $default_end | sed 's/s$//') + # Ensure that $dev is large enough for this test + test $device_sectors_required -le $dev_n_sectors || fail=1 + +-for fs_type in hfs+ fat32; do ++for fs_type in hfs+ fat32 fat16; do + + # create an empty $fs_type partition, cylinder aligned, size > 256 MB + parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1 +@@ -59,6 +59,7 @@ for fs_type in hfs+ fat32; do + wait_for_dev_to_appear_ ${dev}1 + + case $fs_type in ++ fat16) mkfs_cmd='mkfs.vfat -F 16'; fsck='fsck.vfat -v';; + fat32) mkfs_cmd='mkfs.vfat -F 32'; fsck='fsck.vfat -v';; + hfs*) mkfs_cmd='mkfs.hfs'; fsck=fsck.hfs;; + *) error "internal error: unhandled fs type: $fs_type";; +@@ -70,8 +71,17 @@ for fs_type in hfs+ fat32; do + # NOTE: shrinking is the only type of resizing that works. + # resize that file system to be one cylinder (8MiB) smaller + fs-resize ${dev}1 0 $new_end > out 2>&1 || fail=1 +- # expect no output +- compare /dev/null out || fail=1 ++ ++ # check for expected output ++ case $fs_type in ++ fat16) cat << EOF > exp || framework_failure ++Information: Would you like to use FAT32? If you leave your file system as FAT16, then you will have no problems. If you convert to FAT32, and MS Windows is installed on this partition, then you must re-install the MS Windows boot loader. If you want to do this, you should consult the Parted manual (or your distribution's manual). Also, converting to FAT32 will make the file system unreadable by MS DOS, MS Windows 95a, and MS Windows NT. ++EOF ++ ;; ++ fat32) cat /dev/null > exp || framework_failure;; # expect no output ++ hfs*) cat /dev/null > exp || framework_failure;; # expect no output ++ esac ++ compare exp out || fail=1 + + # This is known to segfault with fsck.hfs from + # Fedora 16's hfsplus-tools-332.14-12.fc15.x86_64. +-- +1.9.3 + diff --git a/0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch b/0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch new file mode 100644 index 0000000..f803fbe --- /dev/null +++ b/0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch @@ -0,0 +1,68 @@ +From ac74b830ce518c2228b8ae3fba3f1ece82b49f81 Mon Sep 17 00:00:00 2001 +From: Mike Fleetwood +Date: Sun, 28 Sep 2014 16:15:50 +0100 +Subject: [PATCH 6/6] tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat + +Add test skipping requirement on mkfs.vfat for the FAT32 and FAT16 file +system resizing tests. This matches existing test skipping requirement +on mkfs.hfs for the hfs+ file system. + +* tests/t3000-resize-fs.sh: Also correct skip_test_ to skip_. +* tests/t-lib-helpers.sh: Also update message for requirement of hfs. +--- + tests/t-lib-helpers.sh | 8 +++++++- + tests/t3000-resize-fs.sh | 5 +++-- + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh +index 4e83a05..c8684bb 100644 +--- a/tests/t-lib-helpers.sh ++++ b/tests/t-lib-helpers.sh +@@ -20,7 +20,13 @@ require_acl_() + require_hfs_() + { + mkfs.hfs 2>&1 | grep '^usage:' \ +- || skip_ "This test requires HFS support." ++ || skip_ "mkfs.hfs: command not found" ++} ++ ++require_fat_() ++{ ++ mkfs.vfat 2>&1 | grep '^Usage:' \ ++ || skip_ "mkfs.vfat: command not found" + } + + # Skip this test if we're not in SELinux "enforcing" mode. +diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh +index 9084eb4..a79a307 100755 +--- a/tests/t3000-resize-fs.sh ++++ b/tests/t3000-resize-fs.sh +@@ -18,7 +18,7 @@ + + . "${srcdir=.}/init.sh"; path_prepend_ ../parted . + require_hfs_ +- ++require_fat_ + require_root_ + require_scsi_debug_module_ + require_512_byte_sector_size_ +@@ -31,7 +31,7 @@ default_end=546147s + + # create memory-backed device + scsi_debug_setup_ dev_size_mb=550 > dev-name || +- skip_test_ 'failed to create scsi_debug device' ++ skip_ 'failed to create scsi_debug device' + dev=$(cat dev-name) + + fail=0 +@@ -47,6 +47,7 @@ device_sectors_required=$(echo $default_end | sed 's/s$//') + test $device_sectors_required -le $dev_n_sectors || fail=1 + + for fs_type in hfs+ fat32 fat16; do ++ echo "fs_type=$fs_type" + + # create an empty $fs_type partition, cylinder aligned, size > 256 MB + parted -a min -s $dev mkpart p1 $start $default_end > out 2>&1 || fail=1 +-- +1.9.3 + diff --git a/parted.spec b/parted.spec index faf7c0e..bfbbea0 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.2 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -15,6 +15,11 @@ Source2: pubkey.jim.meyering Source3: pubkey.phillip.susi Patch0001: 0001-tests-Try-several-UTF8-locales.patch +Patch0002: 0002-maint-post-release-administrivia.patch +Patch0003: 0003-libparted-also-link-to-UUID_LIBS.patch +Patch0004: 0004-lib-fs-resize-Prevent-crash-resizing-FAT16-file-syst.patch +Patch0005: 0005-tests-t3000-resize-fs.sh-Add-FAT16-resizing-test.patch +Patch0006: 0006-tests-t3000-resize-fs.sh-Add-requirement-on-mkfs.vfa.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: e2fsprogs-devel @@ -156,6 +161,13 @@ fi %changelog +* Fri Oct 31 2014 Brian C. Lane 3.2-4 +- Update to current master commit ac74b83 to fix fat16 resize (#1159083) +- tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat (mike.fleetwood) +- tests: t3000-resize-fs.sh: Add FAT16 resizing test (mike.fleetwood) +- lib-fs-resize: Prevent crash resizing FAT16 file systems (mike.fleetwood) +- libparted: also link to UUID_LIBS (heirecka) + * Sun Aug 17 2014 Fedora Release Engineering - 3.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild