From 5f329fbe24daf42f3f00a358125c1bdfd0cb2014 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 2 Oct 2019 10:12:38 -0700 Subject: [PATCH 01/60] - libparted/s390: Re-enabled virtio-attached DASD heuristics Fixes DASD backed virtblk devices --- ...e-enabled-virtio-attached-DASD-heuri.patch | 56 +++++++++++++++++++ parted.spec | 9 ++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch diff --git a/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch b/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch new file mode 100644 index 0000000..3086b0e --- /dev/null +++ b/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch @@ -0,0 +1,56 @@ +From a943ad27eb3fa36b2d3161fd8cca9bfaa3a84911 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 27 Sep 2019 18:34:46 +0300 +Subject: [PATCH] libparted/s390: Re-enabled virtio-attached DASD heuristics + +DASDs attached to KVM guest as virtio-blk devices are only handled +properly, if the unique DASD geometry is detected. Commit id +61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry +detection. Fixed by making sure that HDIO_GETGEO takes precedence +on s390[x]. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: Brian C. Lane +(cherry picked from commit 52360db2f5397b7842d2ed90bf946c5e8fa91750) +--- + libparted/arch/linux.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index bb4d5ea..09ec781 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -867,6 +867,7 @@ _device_probe_geometry (PedDevice* dev) + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); + struct stat dev_stat; + struct hd_geometry geometry; ++ int geometry_is_valid = 0; + int sector_size = 0; + + if (!_device_stat (dev, &dev_stat)) +@@ -884,13 +885,19 @@ _device_probe_geometry (PedDevice* dev) + dev->bios_geom.heads = 0; + dev->bios_geom.cylinders = 0; + ++ geometry_is_valid = !ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) ++ && geometry.sectors && geometry.heads; ++ ++#if defined __s390__ || defined __s390x__ ++ if (geometry_is_valid) { ++#else + if (!ioctl (arch_specific->fd, BLKSSZGET, §or_size)) { + /* get the sector count first */ + dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT); + dev->bios_geom.heads = 255; +- } else if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) +- && geometry.sectors && geometry.heads) { +- /* if BLKSSZGET failed, try the deprecated HDIO_GETGEO */ ++ } else if (geometry_is_valid) { ++ /* if BLKSSZGET failed, use deprecated HDIO_GETGEO result */ ++#endif + dev->bios_geom.sectors = geometry.sectors; + dev->bios_geom.heads = geometry.heads; + } else { +-- +2.21.0 + diff --git a/parted.spec b/parted.spec index e4a6237..8ff91ca 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.2.153 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -14,7 +14,8 @@ Source2: pubkey.phillip.susi Source3: pubkey.brian.lane # Upstream still uses python2 for these scripts -Patch0000: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +Patch0092: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +Patch0100: 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -126,6 +127,10 @@ make check %changelog +* Wed Oct 02 2019 Brian C. Lane - 3.2.153-2 +- libparted/s390: Re-enabled virtio-attached DASD heuristics + Fixes DASD backed virtblk devices + * Mon Aug 12 2019 Brian C. Lane - 3.2.153-1 - New upstream ALPHA release v3.2.153 - Includes all patches except the python2 -> python3 change for test helpers From 9afea59440ddd2ca1318b1705dd7f1a8836df70f Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 11 Oct 2019 08:40:34 -0700 Subject: [PATCH 02/60] - New upstream release v3.3 Includes the DASD virtio-blk fix. - Dropping pre-3.2 changelog entries --- .gitignore | 2 + ...e-enabled-virtio-attached-DASD-heuri.patch | 56 - parted.spec | 1056 +---------------- sources | 4 +- 4 files changed, 11 insertions(+), 1107 deletions(-) delete mode 100644 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch diff --git a/.gitignore b/.gitignore index 04e1669..e5f9ad4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ clog /parted-3.2.tar.xz.sig /parted-3.2.153.tar.xz /parted-3.2.153.tar.xz.sig +/parted-3.3.tar.xz +/parted-3.3.tar.xz.sig diff --git a/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch b/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch deleted file mode 100644 index 3086b0e..0000000 --- a/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch +++ /dev/null @@ -1,56 +0,0 @@ -From a943ad27eb3fa36b2d3161fd8cca9bfaa3a84911 Mon Sep 17 00:00:00 2001 -From: Viktor Mihajlovski -Date: Fri, 27 Sep 2019 18:34:46 +0300 -Subject: [PATCH] libparted/s390: Re-enabled virtio-attached DASD heuristics - -DASDs attached to KVM guest as virtio-blk devices are only handled -properly, if the unique DASD geometry is detected. Commit id -61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry -detection. Fixed by making sure that HDIO_GETGEO takes precedence -on s390[x]. - -Signed-off-by: Viktor Mihajlovski -Signed-off-by: Brian C. Lane -(cherry picked from commit 52360db2f5397b7842d2ed90bf946c5e8fa91750) ---- - libparted/arch/linux.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index bb4d5ea..09ec781 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -867,6 +867,7 @@ _device_probe_geometry (PedDevice* dev) - LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); - struct stat dev_stat; - struct hd_geometry geometry; -+ int geometry_is_valid = 0; - int sector_size = 0; - - if (!_device_stat (dev, &dev_stat)) -@@ -884,13 +885,19 @@ _device_probe_geometry (PedDevice* dev) - dev->bios_geom.heads = 0; - dev->bios_geom.cylinders = 0; - -+ geometry_is_valid = !ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) -+ && geometry.sectors && geometry.heads; -+ -+#if defined __s390__ || defined __s390x__ -+ if (geometry_is_valid) { -+#else - if (!ioctl (arch_specific->fd, BLKSSZGET, §or_size)) { - /* get the sector count first */ - dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT); - dev->bios_geom.heads = 255; -- } else if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) -- && geometry.sectors && geometry.heads) { -- /* if BLKSSZGET failed, try the deprecated HDIO_GETGEO */ -+ } else if (geometry_is_valid) { -+ /* if BLKSSZGET failed, use deprecated HDIO_GETGEO result */ -+#endif - dev->bios_geom.sectors = geometry.sectors; - dev->bios_geom.heads = geometry.heads; - } else { --- -2.21.0 - diff --git a/parted.spec b/parted.spec index 8ff91ca..081cfca 100644 --- a/parted.spec +++ b/parted.spec @@ -3,8 +3,8 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.2.153 -Release: 2%{?dist} +Version: 3.3 +Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -15,7 +15,6 @@ Source3: pubkey.brian.lane # Upstream still uses python2 for these scripts Patch0092: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch -Patch0100: 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -127,6 +126,11 @@ make check %changelog +* Fri Oct 11 2019 Brian C. Lane - 3.3-1 +- New upstream release v3.3 + Includes the DASD virtio-blk fix. +- Dropping pre-3.2 changelog entries + * Wed Oct 02 2019 Brian C. Lane - 3.2.153-2 - libparted/s390: Re-enabled virtio-attached DASD heuristics Fixes DASD backed virtblk devices @@ -368,1049 +372,3 @@ make check - Rebase on upstream stable release v3.2 - Drop upstream patches. - Patch t0251 to use en_US.UTF-8 if possible. Fedora doesn't have C.UTF-8 - -* Wed Jul 30 2014 Tom Callaway 3.1.90-2 -- fix license handling - -* Mon Jul 28 2014 Brian C. Lane 3.1.90-1 -- Rebase on upstream Alpha source release -- drop included patches (all but one) -- add Phillip Susi's GPG key -- make sure gcc warnings as errors remains disabled since we use git for patches - -* Mon Jul 14 2014 Brian C. Lane 3.1-29 -- Rebase on parted master commit 081ed98 -- libparted: Add support for partition resize -- parted: add resizepart command - -* Wed Jun 11 2014 Brian C. Lane 3.1-28 -- Rebase on parted master commit 1da239e2ebd2 -- libparted: Fix bug with dupe and empty name - -* Fri Jun 06 2014 Fedora Release Engineering - 3.1-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - -* Sat May 31 2014 Peter Robinson 3.1-26 -- Move dev docs to devel -- Drop duplicated/outdated docs - -* Tue May 27 2014 Brian C. Lane 3.1-25 -- Use mkfs.xfs to create files (#1101112) - -* Thu May 22 2014 Brian C. Lane 3.1-24 -- Add some missing patches from master and the loop label fixes -- tests: test loop labels (psusi) -- libparted: don't trash filesystem when writing loop label (psusi) -- libparted: give correct partition device name on loop labels (psusi) -- partprobe: do not skip loop labels (psusi) -- libparted: don't create partition on loop label (psusi) -- libparted: fix loop labels to not vanish (psusi) -- libparted: remove all old partitions, even if new label allows less (psusi) -- libparted: remove old partitions *first* before adding new ones (psusi) -- libparted: don't detect fat and ntfs boot sectors as dos MBR (psusi) -- Fix filesystem detection on non 512 byte sectors (psusi) -- tests: fix t2310-dos-extended-2-sector-min-offset.sh (psusi) -- libparted: remove last_usable_if_grown (psusi) - -* Fri May 16 2014 Brian C. Lane 3.1-23 -- Fix partition naming patch for big endian systems. - -* Fri May 16 2014 Brian C. Lane 3.1-22 -- Fix a problem with GPT Partition names using. They are UCS-2LE not UTF-16 - -* Fri Apr 18 2014 Brian C. Lane 3.1-21 -- Fix t1700 probe patch -- remove loop before making new fs - -* Thu Apr 17 2014 Brian C. Lane 3.1-20 -- Use force for xfs in t1700 and a larger file -- Make t4100 xfs filesystem larger and sparse -- Fix part dupe with empty name -- check name when duplicating -- Add ntfs vfat hfsplus to t1700 probe test - -* Wed Apr 09 2014 Brian C. Lane 3.1-19 -- Use little endian packing in gpt tests -- Fix integer overflows with DVH disk label - -* Tue Apr 08 2014 Brian C. Lane 3.1-18 -- Rebase on new upstream master commit cc382c3 -- Drop patches incorporated into upstream -- Still adds the various DASD patches - -* Thu Feb 27 2014 Brian C. Lane 3.1-17 -- Drop hfs_esp patch. Idea didn't work. - -* Wed Sep 11 2013 Brian C. Lane 3.1-16 -- tests: Restrict gpt header munge to little-endian systems -- Add perl Digest::CRC as a build requirement so more tests will run - -* Wed Sep 04 2013 Brian C. Lane 3.1-15 -- libparted: Flush parent device on open (#962611) - -* Wed Aug 28 2013 Brian C. Lane 3.1-14 -- Rebasing Fedora patches with upstream master since v3.1 release -- Summary of important changes from upstream: - - add support for a new Linux-specific GPT partition type code - - partprobe: remove partitions when there is no partition table - - libparted: refactor device-mapper partition sync code - - libparted: remove extraneous blkpg add partition ped exception - - libparted: don't probe every dm device in probe_all -- New Fedora changes: - - libparted: Add Intel Rapid Start Technology partition flag. - - libparted: Add UEFI System Partition flag. - - libparted: Add hfs_esp partition flag to GPT. - - libparted: Recognize btrfs filesystem - - tests: Add btrfs and xfs to the fs probe test - -* Sat Aug 03 2013 Fedora Release Engineering - 3.1-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild - -* Wed Apr 17 2013 Brian C. Lane 3.1-12 -- libparted: mklabel to support EDEV DASD (#953146) -- tests: rewrite t6001 to use /dev/mapper - -* Thu Feb 14 2013 Fedora Release Engineering - 3.1-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild - -* Wed Dec 12 2012 Brian C. Lane 3.1-10 -- libparted: mklabel to support EAV DASD (#707032) -- libparted: Avoid dasd as default disk type while probe (#707032) - -* Thu Nov 01 2012 Brian C. Lane 3.1-9 -- don't canonicalize /dev/md/ paths (#872361) - -* Tue Oct 16 2012 Brian C. Lane 3.1-8 -- change partition UUID to use partX-UUID (#858704) -- fixup losetup usage in tests -- add support for implicit FBA DASD partitions (#707027) -- add support for EAV DASD partitions (#707032) - -* Tue Sep 04 2012 Brian C. Lane 3.1-7 -- reallocate buf after _disk_analyse_block_size (#835601) - -* Fri Aug 03 2012 Brian C. Lane 3.1-6 -- Use dm_udev_wait for dm operations (#844257) (bcl) -- use largest_partnum in _dm_reread_part_table (bcl) -- set uuid on dm partitions (#832145) (bcl) - -* Fri Jul 20 2012 Fedora Release Engineering - 3.1-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild - -* Fri Jun 08 2012 Brian C. Lane 3.1-4 -- Fix crash on ppc64 with GPT (#829960) (rwmj) - -* Tue May 15 2012 Brian C. Lane 3.1-3 -- Added Provides: bundled(gnulib) (#821782) - -* Wed Mar 21 2012 Brian C. Lane 3.1-2 -- libparted: check PMBR before GPT partition table (#805272) -- tests: add a test for the new behavior - -* Tue Mar 13 2012 Brian C. Lane 3.1-1 -- Rebase to upstream parted v3.1 -- removed merged patches -- add new libparted-fs-resize library - -* Fri Feb 03 2012 Brian C. Lane - 3.0-7 -- Update patch for copying flags so that it is generic -- Copy pmbr_boot flag in gpt_duplicate - -* Thu Feb 02 2012 Brian C. Lane - 3.0-6 -- gpt: add commands to manipulate pMBR boot flag (#754850) -- parted: when printing, also print the new disk flags -- tests: update tests for new disk flags output -- tests: add test for GPT PMBR pmbr_boot flag -- doc: update parted documentation - -* Fri Jan 13 2012 Fedora Release Engineering - 3.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Mon Oct 31 2011 Brian C. Lane - 3.0-4 -- Fix ped_disk_duplicate on GPT so that it copies the partition flags (#747947) -- Add new test to check ped_disk_duplicate on msdos, gpt, bsd disk labels -- Add e2fsprogs and dosfstools so that skipped tests will be run - -* Fri Oct 07 2011 Brian C. Lane - 3.0-3 -- Fix handling of zero-length gpt partitions (#728949) -- Fix bug in nilfs2 probe with short partitions (#728949) -- Fix bug in hfs probe code (#714758) -- Make pc98 detection depend on specific signatures (#646053) - -* Wed Jun 29 2011 Richard W.M. Jones - 3.0-2 -- (Re-)apply patch to fix Linux "3.0" problem. - -* Tue Jun 28 2011 Brian C. Lane - 3.0-1 -- Update to parted v3.0 -- Run autoreconf so that patches to .am files will work -- Add patch to Fix snap radius and don't allow values < 1 (#665496) -- Add tests for the snap radius fix. -- Drop patches included in upstream release - -* Sun Jun 5 2011 Richard W.M. Jones - 2.4-2 -- Apply patch which may fix Linux "3.0" problem. - -* Thu May 26 2011 Brian C. Lane - 2.4-1 -- Updating to latest upstream v2.4 -- Drop patches included in upstream - -* Fri Mar 11 2011 Brian C. Lane - 2.3-8 -- Add support for legacy_boot flag for GPT partitions (680562) -- Remove PED_ASSERT for dos geometry calculations (585468) - -* Wed Feb 09 2011 Brian C. Lane - 2.3-7 -- Tell GCC to stop treating unused variable warnings as errors - -* Tue Feb 08 2011 Fedora Release Engineering - 2.3-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Mon Dec 20 2010 Brian C. Lanr - 2.3-5 -- Document the align-check command - Resolves: #642476 -- Default to 1MiB partition alignment - Resolves: #618255 - -* Fri Dec 17 2010 Peter Jones - 2.3-4 -- Handle mac labels with differing physical/logical sector sizes better - -* Wed Sep 29 2010 jkeating - 2.3-3 -- Rebuilt for gcc bug 634757 - -* Fri Sep 17 2010 Brian C. Lane 2.3-2 -- Add patch to handle syncing partition changes when using blkext majors -- Resolves rhbz#634980 -- Related rhbz#629719 - -* Tue Jul 20 2010 Hans de Goede 2.3-1 -- Rebase to new upstream 2.3 release -- Drop all patches (all upstreamed) -- Recognize scsi disks with a high major as such (#611691) - -* Thu May 6 2010 Hans de Goede 2.2-5 -- Also recognize recovery partitions with id 27 / on gpt (#589451) - -* Fri Apr 23 2010 Hans de Goede 2.2-4 -- Properly check dm_task_run return value (#585158) -- Fix mkpartfs (ext2) on partitions >2TB (#585159) - -* Mon Apr 19 2010 Hans de Goede 2.2-3 -- Add a flag for detecting diagnostics / recovery partitions (#583626) - -* Tue Apr 6 2010 Hans de Goede 2.2-2 -- Parted should not canonicalize symlinks under /dev/mapper (#577824) - -* Tue Mar 30 2010 Hans de Goede 2.2-1 -- New upstream version 2.2 (#577478) -- Drop all our patches (all upstreamed) - -* Thu Feb 18 2010 Hans de Goede 2.1-5 -- Copy needs_clobber value in ped_disk_duplicate() (#561976) - -* Wed Feb 10 2010 Hans de Goede 2.1-4 -- Don't crash when reading a DASD disk with PV's on there (#563419) -- Don't overwrite the pmbr when merely printing a gpt table (#563211) - -* Sun Jan 31 2010 Hans de Goede 2.1-3 -- If a drive does not have alignment information available default - to an alignment of 1MiB (#559639) - -* Sun Jan 17 2010 Hans de Goede 2.1-2 -- Fix various memory leaks in error paths (#556012) -- Add %%check section to the specfile, invoking make check - -* Mon Jan 11 2010 Hans de Goede 2.1-1 -- New upstream release 2.1 -- Drop all our patches (all merged upstream) - -* Sun Dec 20 2009 Hans de Goede 1.9.0-25 -- Fix crash when partitioning loopback devices (#546622) -- Drop no-cylinder-align patch: - - its functionality is superseeded by the per disk flags - - its only user (pyparted) has been updated to use those - - this is not upstream so we don't want other programs to start using it - -* Fri Dec 18 2009 Hans de Goede 1.9.0-24 -- Allow partitioning of loopback devices (#546622) -- Add libparted function to query maximum partition length and start - addresses for a given disk (#533417) -- Add per disk flags functions from upstream, this is the way upstream - has implemented the disable cylinder alignment functionality -- Add --align cmdline option to specify how to align new partitions - see the parted man page for details (#361951) -- Make the default alignment for new partitions optimal (#361951) -- When cylinder alignment is disabled, allow use of the last (incomplete) - cylinder of the disk (#533328) -- Don't crash when printing partition tables in Russian (#543029) -- Make parted work correctly with new lvm (#525095) - -* Wed Nov 11 2009 Hans de Goede 1.9.0-23 -- Fix parted not building on s390 - -* Mon Nov 9 2009 Hans de Goede 1.9.0-22 -- Fix error when creating a fresh dasd disk on a dasd device - with a corrupted dasd label (#533808) - -* Fri Nov 6 2009 Hans de Goede 1.9.0-21 -- Fix a compiler warning which is causing build errors (#532425) - -* Tue Nov 3 2009 Hans de Goede 1.9.0-20 -- Fix error when creating a fresh dasd disk (#532425) -- Rewrite dasd disk duplication patches, as the old old ones conflicted - with fixing creating a fresh dasd disk - -* Fri Oct 30 2009 Hans de Goede 1.9.0-19 -- Fix a segfault introduced by -18 when operating on plain files - -* Thu Oct 29 2009 Hans de Goede 1.9.0-18 -- Add functions to query device / partition table alignments (#528030) - -* Thu Oct 8 2009 Hans de Goede 1.9.0-17 -- Only change the partition type to 82 when setting the swap flag on dos - labels, not when resetting it - -* Tue Oct 6 2009 Hans de Goede 1.9.0-16 -- Correctly handle GPT labels on big endian machines - -* Tue Oct 6 2009 Hans de Goede 1.9.0-15 -- ped_partition_is_busy() should not throw exceptions (#527035) -- msdos_partition_is_flag_available() should return 1 for swap flag (#513729) - -* Mon Aug 31 2009 Joel Granados 1.9.0-14 -- Patchs for 'commit to os' for linux. Thx to hansg. - -* Fri Aug 28 2009 Karsten Hopp 1.9.0-13 -- volkey is only 4 chars, don't overflow destination buffer with 84 chars - -* Fri Aug 21 2009 Joel Granados - 1.9.0-12 -- libuuid-devel is now valid for s390 builds. - -* Wed Aug 12 2009 Ville Skyttä - 1.9.0-11 -- Use xz compressed upstream tarball. - -* Wed Aug 12 2009 Joel Granados - 1.9.0-10 -- Make install with exclude docs work without an error message. - -* Wed Jul 29 2009 Joel Granados - 1.9.0-9 -- Add parenthesis where needed (#511907) - -* Mon Jul 27 2009 Joel Granados - 1.9.0-8 -- Add the swap flag to the dos type labels - -* Sat Jul 25 2009 Fedora Release Engineering - 1.9.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Thu Jul 23 2009 Joel Granados - 1.9.0-6 -- Rebuild usiing the official tar.gz at http://ftp.gnu.org/gnu/parted/parted-1.9.0.tar.gz - -* Wed Jul 22 2009 Joel Granados - 1.9.0-5.20090721git980c -- Better handle a duplicate error. - -* Tue Jul 21 2009 Joel Granados - 1.9.0-4.20090721git980c -- New snapshot. -- Add patches to make dasd duplicate disk work. - -* Sat Jul 18 2009 Lubomir Rintel - 1.9.0-3.20090610git32dc -- Fix a typo in the errno patch - -* Mon Jul 13 2009 Joel Granados - 1.9.0-2.20090610git32dc -- Correctly number the snapshot. - -* Fri Jul 10 2009 Joel Granados - 1.9.0-1 -- New version. - -* Thu Mar 26 2009 Joel Granados - 1.8.8-15 -- Begin to identify virtio devices. -- Actually change the partition type in msdos lables (dcantrell). - -* Mon Mar 23 2009 Joel Granados - 1.8.8-14 -- Correct the behavior of upated_mode functions when the ASSERT fails (thx to hansg). - -* Thu Feb 26 2009 Joel Granados - 1.8.8-13 -- Fix parted build for gcc-4.4 - -* Thu Feb 26 2009 Fedora Release Engineering - 1.8.8-13 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Thu Jan 22 2009 Joel Granados - 1.8.8-12 -- Avoid the calling of stat for strings that don't begin with the "/" char (#353191). - -* Sat Dec 13 2008 Tom "spot" Callaway - 1.8.8-11 -- fix typo in last patch - -* Sat Dec 13 2008 Tom "spot" Callaway - 1.8.8-10 -- enable RAID partition types on sun disklabels for sparc - -* Thu Nov 06 2008 Joel Granados - 1.8.8-9 -- Fix the build for the s390(x) archs (#470211). - -* Thu Jun 05 2008 Peter Jones - 1.8.8-8 -- Fix some of the atvrecv code (and the msftres code) so that the flags - actually stick. - -* Thu Jun 05 2008 Peter Jones - 1.8.8-7 -- Added "atvrecv" flag patch from atv-bootloader project. - -* Thu May 29 2008 Joel Granados - 1.8.8-6 -- Do a better job at recognizing the dos partition. (#246423) - -* Thu Apr 10 2008 David Cantrell - 1.8.8-5 -- Allow RAID or LVM partition types on BSD disklabels. - (jay.estabrook AT hp.com, #427114) - -* Thu Apr 10 2008 Peter Jones - 1.8.8-4 -- Don't interactively ask to fix an AlternateGPT's location when not - at the end of the disk; this is so that disk images written to a - usb-key can work reasonably. - -* Mon Feb 04 2008 David Cantrell - 1.8.8-3 -- Fixes so parted compiles with gcc-4.3 (#431397) - -* Sun Jan 13 2008 David Cantrell - 1.8.8-2 -- Move libparted libraries to /lib (#428420) - -* Wed Jan 02 2008 David Cantrell - 1.8.8-1 -- Upgraded to GNU parted-1.8.8 -- License for GNU parted is now GPLv3+ - -* Thu Dec 13 2007 David Cantrell - 1.8.6-13 -- Modify parted man page to indicate which flags are valid for which - disk labels (#242711) - -* Mon Nov 05 2007 David Cantrell - 1.8.6-12 -- Add KNOWN ISSUES section to parted(8) man page explaining that we cannot - currently do ext3 resizing inside parted (#367101) -- Update the xvd patch to include 'xvd' in the string table that parted - uses when printing device types (#366971) -- Do not install the linux.h or gnu.h headers - -* Tue Oct 30 2007 David Cantrell - 1.8.6-11 -- Do not install fdasd.h and vtoc.h header files - -* Thu Oct 04 2007 David Cantrell - 1.8.6-10 -- Do not install the testsuite tools - -* Thu Oct 04 2007 David Cantrell - 1.8.6-9 -- Always define PED_DEVICE_DM regardless of compile time options - -* Tue Aug 21 2007 David Cantrell - 1.8.6-8 -- Rebuild - -* Wed Aug 08 2007 David Cantrell - 1.8.6-7 -- Update License tag to GPLv2+ - -* Tue Aug 07 2007 David Cantrell - 1.8.6-6 -- Detect Xen virtual block devices and set model name appropriately - -* Thu Apr 19 2007 David Cantrell - 1.8.6-5 -- Spec file cleanups for merge review (#226230) - -* Fri Apr 13 2007 David Cantrell - 1.8.6-4 -- Fix primary partition cylinder alignment error for DOS disk labels (#229745) -- Do not build and package up libparted.a, only the shared library - -* Wed Apr 11 2007 David Cantrell - 1.8.6-3 -- Fix off-by-one bug in parted(8) when displaying disk label (#235901) - -* Wed Mar 21 2007 David Cantrell - 1.8.6-2 -- Do not translate partition name from disk label (#224182) - -* Tue Mar 20 2007 David Cantrell - 1.8.6-1 -- Upgrade to GNU parted-1.8.6, summary of major change(s): - a) Revert linux-swap(new) and linux-swap(old) fs types, it's - linux-swap for all swap types (#233085) - -* Tue Mar 20 2007 David Cantrell - 1.8.5-1 -- Upgrade to GNU parted-1.8.5 (added missing po files) - -* Fri Mar 16 2007 David Cantrell - 1.8.4-1 -- Upgrade to GNU parted-1.8.4, summary of major changes: - a) Update to use newest GNU developer tools - b) Use gnulib, the GNU portability library - c) HFS+ resize support - d) Windows Vista fixes - e) AIX disk label fixes - f) >512 byte logical sector read support on Linux -- Spec file cleanups per Fedora packaging guidelines - -* Thu Feb 08 2007 David Cantrell - 1.8.2-5 -- Remove period from end of summary line (package review) -- Use preferred BuildRoot (package review) -- BR device-mapper-devel - -* Tue Jan 30 2007 David Cantrell - 1.8.2-4 -- Patched parted.8 man page to show partition names apply to GPT disklabels - as well as Mac and PC98 disklabels (#221600) - -* Mon Jan 22 2007 David Cantrell - 1.8.2-3 -- Remove BR for libtermcap-devel -- Specifically preserve starting alignment of 0x800 on Windows Vista - (see http://support.microsoft.com/kb/923332 for details) -- Fix incorrect sector parameter used to initialize a new PedAlignment - -* Thu Jan 18 2007 David Cantrell - 1.8.2-2 -- Preserve starting sector for primary NTFS 3.1 partitions (Windows - Vista) when modifying the DOS disk label. NTFS 3.1 partitions do - not start on the 2nd head of the 1st cylinder at the beginning of - the drive. - -* Fri Jan 12 2007 David Cantrell - 1.8.2-1 -- Upgrade to GNU parted-1.8.2 - -* Fri Dec 15 2006 David Cantrell - 1.8.1-2 -- Fix a segfault when initializing new volumes (pjones) - -* Mon Dec 04 2006 David Cantrell - 1.8.1-1 -- Upgrade to GNU parted-1.8.1 - -* Fri Nov 17 2006 David Cantrell - 1.8.0-1 -- Upgrade to GNU parted-1.8.0 - -* Thu Nov 02 2006 David Cantrell - 1.7.1-18 -- Detect Apple_Boot partition types correctly (#204714) - -* Thu Oct 26 2006 David Cantrell - 1.7.1-17 -- For init_generic() failures on user-mode Linux block devices, goto - error_free_arch_specific instead of error_free_dev. - -* Wed Oct 04 2006 David Cantrell - 1.7.1-16 -- Don't throw PED_EXCEPTION_ERROR in ped_geometry_read() if accessing - sectors outside of partition boundary, since returning false will - shift ped_geometry_check() to the correct sectors. - -* Wed Aug 23 2006 David Cantrell - 1.7.1-15 -- Fixed gpt patch (*asked_already -> asked_already, whoops) - -* Tue Aug 22 2006 David Cantrell - 1.7.1-14 -- Improve error message returned by _parse_header() on GPT-labeled disks - so users actually have an idea of how to correct the problem -- Fix off-by-one error with LastUsableLBA and PartitionEntryLBA overlap - to prevent possible data corruption when using non-parted GPT editing - tools - -* Mon Aug 21 2006 Peter Jones - 1.7.1-13 -- Don't use the "volume name" as the device node name on dm device - partitions, it isn't really what we want at all. - -* Thu Aug 17 2006 David Cantrell - 1.7.1-12 -- Updated O_DIRECT patch to work around s390 problems -- Update LastUsableLBA on GPT-labeled disks after LUN resize (#194238) -- Fix exception when backup GPT table is not in the correction location - and parted tries to move it (#194238) - -* Tue Aug 15 2006 David Cantrell - 1.7.1-11 -- Expand error buffer to 8192 bytes in vtoc_error() -- Do not apply O_DIRECT patch on S/390 or S/390x platforms - -* Mon Aug 14 2006 David Cantrell - 1.7.1-10 -- Removed bad header file patch (#200577) - -* Wed Jul 12 2006 Jesse Keating - 1.7.1-9.1 -- rebuild - -* Wed Jul 5 2006 Peter Jones - 1.7.1-9 -- add ped_exception_get_handler() - -* Mon Jun 26 2006 Florian La Roche - 1.7.1-8 -- remove info files in preun - -* Thu Jun 22 2006 David Cantrell - 1.7.1-7 -- PED_SECTOR_SIZE -> PED_SECTOR_SIZE_DEFAULT - -* Thu Jun 22 2006 David Cantrell - 1.7.1-6 -- Roll dasd patches together -- Use O_DIRECT to prevent first partition corruption on GPT disks - -* Thu Jun 15 2006 Jeremy Katz - 1.7.1-5 -- fix segfaults with dasd devices - -* Wed Jun 7 2006 Jeremy Katz - 1.7.1-4 -- move .so symlink to -devel subpackage - -* Sun May 28 2006 David Cantrell - 1.7.1-3 -- Rebuild - -* Sun May 28 2006 David Cantrell - 1.7.1-2 -- Removed mac-swraid patch (added upstream) -- Updated device-mapper patch for parted-1.7.1 - -* Sat May 27 2006 David Cantrell - 1.7.1-1 -- Upgraded to parted-1.7.1 - -* Fri May 19 2006 David Cantrell - 1.7.0-1 -- Upgraded to parted-1.7.0 - -* Thu Apr 13 2006 David Cantrell - 1.6.25.1-1 -- Upgraded to parted-1.6.25.1 -- BuildRequires libtool - -* Tue Mar 14 2006 Jeremy Katz - 1.6.25-8 -- fix ppc swraid -- BR gettext-devel - -* Wed Feb 22 2006 Peter Jones - 1.6.25-7 -- close /proc/devices correctly - -* Fri Feb 10 2006 Jesse Keating - 1.6.25-6.1 -- bump again for double-long bug on ppc(64) - -* Tue Feb 7 2006 Peter Jones 1.6.25-6 -- Fix dm partition naming. - -* Tue Feb 7 2006 Jesse Keating 1.6.25-5.2 -- rebuilt for new gcc4.1 snapshot and glibc changes - -* Fri Dec 9 2005 Jesse Keating -- rebuilt - -* Fri Dec 2 2005 Peter Jones 1.6.25-5 -- rebuild for new device-mapper - -* Thu Dec 1 2005 Peter Jones 1.6.25-4 -- change device-mapper code to call dm_task_update_nodes() after - tasks which change device nodes. - -* Wed Nov 16 2005 Peter Jones 1.6.25-3 -- fix /proc/devices parser bug - -* Tue Nov 15 2005 Peter Jones 1.6.25-2 -- add support for partitions on dm devices - -* Wed Nov 09 2005 Chris Lumens 1.6.25-1 -- Updated to 1.6.25. -- Update DASD, iseries, and SX8 patches. - -* Tue Aug 30 2005 Chris Lumens 1.6.24-1 -- Updated to 1.6.24. - -* Mon Jul 18 2005 Chris Lumens 1.6.23-2 -- Add buildreq for texinfo. - -* Fri Jul 08 2005 Chris Lumens 1.6.23-1 -- Updated to 1.6.23. -- Get rid of separate Mac patches that are now included in upstream. -- Update DASD and AIX patches. - -* Tue Jun 07 2005 Chris Lumens 1.6.22-3 -- Modified Apple_Free patch to take care of the case where the partitions - are unnamed, causing many errors to be printed (#159047). - -* Thu May 05 2005 Chris Lumens 1.6.22-2 -- Added upstream patch to display certain Apple_Free partitions (#154479). - -* Wed Mar 23 2005 Chris Lumens 1.6.22-1 -- Updated to 1.6.22. -- Get rid of separate gc4 patch that's now included upstream. -- Take Mac LVM patch from parted CVS. - -* Mon Mar 14 2005 Chris Lumens 1.6.21-3 -- Include patches from parted CVS for new gcc4 warnings. - -* Sun Feb 20 2005 Paul Nasrat 1.6.21-2 -- Support lvm flags on mac partitions (#121266) - -* Fri Jan 21 2005 Chris Lumens 1.6.21-1 -- Updated to 1.6.21 - -* Wed Jan 12 2005 Tim Waugh 1.6.20-2 -- Rebuilt for new readline. - -* Fri Jan 07 2005 Chris Lumens 1.6.20-1 -- Updated to 1.6.20 (#139257, #142100). -- Updated DASD and AIX patches for 1.6.20. - -* Tue Dec 14 2004 Jeremy Katz - 1.6.19-2 -- add support for Promise SX8 devices - -* Sun Nov 28 2004 Jeremy Katz - 1.6.19-1 -- update to 1.6.19 (#138419) - -* Sun Nov 21 2004 Jeremy Katz - 1.6.18-1 -- update to 1.6.18 - -* Sat Nov 20 2004 Miloslav Trmac - 1.6.16-3 -- Convert pt_BR-parted.8 to UTF-8 - -* Thu Nov 11 2004 Jeremy Katz - 1.6.16-2 -- add patch from Matt Domsch to fix consistency of GPT disk labels - with the EFI specification for disks > 2TB (#138480) -- understand the new Sun UFS partition ID -- merge the new geometry probing from CVS to see if that helps the - assertions people are seeing (#138419) - -* Mon Nov 8 2004 Jeremy Katz - 1.6.16-1 -- update to 1.6.16 -- rebuild for python 2.4 - -* Mon Oct 18 2004 Jeremy Katz - 1.6.15-5 -- add patch from Matt Domsch to add a unique signature to new DOS labels - so that we can later determine which BIOS disk is which (#106674) - -* Fri Oct 15 2004 Phil Knirsch 1.6.15-4 -- Fixed dasd patch (had some duplicate file patches in it) -- Fixed problem with parted segfaulting on SCSI discs on s390 (#133997) - -* Tue Oct 12 2004 Jeremy Katz - 1.6.15-3 -- add patch from peterm to fix printing of the size of large devices (#135468) - -* Thu Oct 07 2004 Phil Knirsch 1.6.15-2 -- Fixed geometry calculation for bios_geo in dasd_init() - -* Mon Sep 20 2004 Jeremy Katz - 1.6.15-1 -- 1.6.15 - -* Fri Sep 10 2004 Jeremy Katz - 1.6.14-1 -- update to 1.6.14 - -* Tue Aug 24 2004 Jeremy Katz - 1.6.12-2 -- fix assertion error when checking flags on non-active partition (#130692) -- buildrequires: gettext-devel - -* Mon Aug 16 2004 Jeremy Katz - 1.6.12-1 -- update to 1.6.12 with major changes to CHS handling to hopefully fix #115980 -- adjust dasd patch accordingly, drop some included patches - -* Mon Jul 19 2004 Karsten Hopp 1.6.11-4 -- update dasd patch for dos-type partitions on mainframes (scsi disks) - -* Fri Jun 25 2004 Jeremy Katz - 1.6.11-3 -- install-info (#77687) - -* Tue Jun 15 2004 Elliot Lee - 1.6.11-2 -- rebuilt - -* Tue Jun 1 2004 Jeremy Katz -- -devel requires main package (#124938) - -* Thu May 13 2004 Jeremy Katz - 1.6.11-1 -- update to 1.6.11 - -* Tue May 11 2004 Jeremy Katz - 1.6.9-4 -- add patch from Matt Domsch to not use the get/set last sector ioctls - with a 2.6 kernel (#121455) - -* Thu Apr 15 2004 David Woodhouse - 1.6.9-3 -- Fix Mac partition detection to close #112937 - -* Tue Apr 13 2004 Jeremy Katz - 1.6.9-2 -- another minor tweak for 2.6's lack of sane geometry handling - -* Mon Apr 12 2004 Jeremy Katz - 1.6.9-1 -- update to 1.6.9 -- need automake17 -- python-devel is superfluous with pyparted as a separate package -- lose the fake-libtool stuff, 1.6.9 was disted with newer auto* - -* Mon Mar 15 2004 Elliot Lee 1.6.6-2 -- Fix parted's "part-static" option to close #118183. Woohoo, a fake-libtool.sh :) - -* Fri Mar 12 2004 Jeremy Katz - 1.6.6-1 -- update to 1.6.6 -- split dasd into a patch instead of included in the tarball -- python module is now in the pyparted package (separate src.rpm) -- ExcludeArch: ppc64 (#118183) - -* Tue Mar 02 2004 Elliot Lee -- rebuilt - -* Fri Feb 13 2004 Elliot Lee -- rebuilt - -* Fri Feb 6 2004 Jeremy Katz -- add automake buildrequires (#115063) - -* Thu Jan 22 2004 Jeremy Katz 1.6.3-33 -- 2.6 removes the geometry fixups that used to be present for IDE disks. - According to Andries, just follow what's in the partition table and don't - worry about what Linux "detects" - -* Thu Nov 6 2003 Jeremy Katz 1.6.3-32 -- rebuild for python 2.3 - -* Mon Oct 27 2003 Jeremy Katz 1.6.3-31 -- add patch from Michael Schwendt for segfault - -* Wed Sep 17 2003 Jeremy Katz 1.6.3-30 -- rebuild - -* Wed Sep 17 2003 Jeremy Katz 1.6.3-29 -- and don't barf on the old (broken) 1.02 gpt rev - -* Tue Sep 16 2003 Jeremy Katz 1.6.3-28 -- rebuild - -* Tue Sep 16 2003 Jeremy Katz 1.6.3-27 -- write out the correct gpt revision (#103664) -- add buildrequires on ncurses-devel - -* Thu Sep 4 2003 Bill Nottingham 1.6.3-26 -- rebuild - -* Thu Sep 4 2003 Bill Nottingham 1.6.3-25 -- don't buildreq libunicode-devel - -* Thu Aug 07 2003 Elliot Lee 1.6.3-24 -- Fix libtool - -* Wed Jul 09 2003 Phil Knirsch 1.6.3-23 -- Fixed dasd_write and dasd_read to support lvm and raid partitions. - -* Wed Jun 18 2003 Phil Knirsch 1.6.3-22 -- Fixed a small bug in VTOC fdasd_check_volume() (#97300). - -* Wed Jun 04 2003 Elliot Lee 1.6.3-21 -- rebuilt - -* Wed Jun 4 2003 Matt Wilson 1.6.3-20 -- don't detect AIX physical volumes as msdos partition tables (#91748) -- added stubbed code for manipulating AIX PVs, enough to clobber the - signature. (#91748) - -* Wed Jun 04 2003 Phil Knirsch 1.6.3-19 -- Added LDL disk layout support for s390(x). - -* Sun May 18 2003 Matt Wilson 1.6.3-18 -- use metadata partitions to protect DASD VTOC -- stash DASD specific data in disk specific areas, not arch specific - areas. - -* Fri May 16 2003 Matt Wilson 1.6.3-18 -- recongnize iseries viodasd (#90449) - -* Thu May 08 2003 Phil Knirsch 1.6.3-17 -- Fixed problem with probing partitions on s390(x) with new partition code. - -* Mon May 05 2003 Phil Knirsch 1.6.3-16 -- Fixed partiton reread code for s390(x). - -* Fri May 02 2003 Phil Knirsch 1.6.3-15 -- Rewrote partition handling for s390(x) dasd devices. No more empty partitions. - -* Wed Mar 12 2003 Phil Knirsch 1.6.3-13 -- Finished updating vtoc and fdasd code to latest s390-utils version. - -* Thu Mar 06 2003 Phil Knirsch 1.6.3-12 -- Fixed vtoc handling on s390(x) dasd devices. - -* Thu Feb 06 2003 Karsten Hopp 1.6.3-11 -- use different define to enable DASD debugging - Otherwise we'll get a lot of dasd debug output because DEBUG is - always defined - -* Wed Jan 22 2003 Tim Powers -- rebuilt - -* Wed Jan 22 2003 Karsten Hopp 1.6.3-9 -- missed one debug message - -* Tue Jan 21 2003 Karsten Hopp 1.6.3-8 -- add patch from CVS to disable debug messages on s390 - -* Tue Jan 14 2003 Matt Wilson 1.6.3-7 -- updated to a new tarball of parted that includes a fs.probe_specific binding - -* Sun Dec 1 2002 Matt Wilson 1.6.3-6 -- hack in partition.native_type (#78118) - -* Thu Nov 7 2002 Matt Wilson -- added a patch to avoid SIGFPE when fat sector size is 0 - -* Tue Nov 5 2002 Matt Wilson -- use --disable-dynamic-loading - -* Mon Nov 4 2002 Matt Wilson -- add device.disk_new_fresh() - -* Fri Nov 1 2002 Matt Wilson -- 1.6.3 - -* Fri Oct 4 2002 Jeremy Katz 1.4.24-7 -- use make LIBTOOL=/usr/bin/libtool instead of recreating everything -- add patch from Jack Howarth to self host properly -- add patch to treat GPT structs as little-endian always and treat GUIDS - as little-endian blobs -- add patch to recognize hp service partitions - -* Wed Sep 25 2002 Jeremy Katz 1.4.24-6hammer -- libtoolize, etc for x86_64 -- hack to get the python module in the right place until python.m4 - from automake is fixed - -* Fri Jun 21 2002 Tim Powers 1.4.24-6 -- automated rebuild - -* Sun May 26 2002 Tim Powers 1.4.24-5 -- automated rebuild - -* Wed May 22 2002 Jeremy Katz 1.4.24-4 -- rebuild in new environment - -* Fri Mar 22 2002 Matt Wilson 1.4.24-3 -- fixed the probe-with-open behavior (again) - -* Fri Feb 22 2002 Matt Wilson 1.4.24-1 -- rebuild - -* Tue Feb 12 2002 Matt Wilson 1.4.24-1 -- 1.4.24 - -* Wed Jan 09 2002 Tim Powers -- automated rebuild - -* Mon Jan 7 2002 Jeremy Katz 1.4.20-4 -- build with final python 2.2 - -* Wed Dec 12 2001 Jeremy Katz 1.4.20-3 -- update from CVS and rebuild in new environment - -* Thu Oct 25 2001 Jeremy Katz 1.4.20-2 -- build both python1.5 and python2 modules - -* Fri Oct 19 2001 Matt Wilson 1.4.20-1 -- 1.4.20 final - -* Thu Oct 11 2001 Matt Wilson 1.4.20-0.1pre3 -- new dist from CVS with new autoconf and automake -- gpt is in 1.4.20, removed patch1 (gpt support) -- partstatic is in 1.4.20, removed patch2 (partstatic patch) - -* Tue Aug 28 2001 Matt Wilson 1.4.16-8 -- new dist from cvs with changes to the python binding: register - DEVICE_I20 and DEVICE_ATARAID, check to make sure that a partition - exists in the PedDisk when using it to find ped_disk_next_partition - -* Tue Aug 21 2001 Matt Wilson 1.4.16-7 -- really disable pc98 support (SF #51632) - -* Fri Aug 17 2001 Matt Wilson 1.4.16-6 -- added a patch (Patch1) to link the c library in dynamically, the - rest of the libs statically for the parted binary (MF #49358) - -* Tue Aug 7 2001 Matt Wilson -- made a new dist from CVS that includes binding for - disk.get_partition_by_sector and accessing the name of a disk type - -* Mon Aug 6 2001 Matt Wilson 1.4.16-4 -- created a new dist from CVS that fixes ext3 detection when - _probe_with_open is needed (#50292) - -* Fri Jul 20 2001 Matt Wilson -- rewrite scsi id code (#49533) - -* Fri Jul 20 2001 Matt Wilson -- added build requires (#49549) - -* Tue Jul 17 2001 Matt Wilson -- 1.4.16 -- regenerated gpt patch against 1.4.16, incorporated - parted-1.4.15-pre1-gpt-printf.patch into the same patch, removed Patch1 - -* Tue Jul 10 2001 Matt Wilson -- added a new dist tarball that contains python wrappers to get disk types - -* Tue Jul 10 2001 Tim Powers -- run ldconfig on un/install - -* Tue Jul 10 2001 Matt Wilson -- added a fix from clausen for border case when there is an extended - on the last cyl - -* Mon Jul 9 2001 Matt Wilson -- 1.4.15 - -* Thu Jul 5 2001 Matt Wilson -- added patch from Arjan to enable ataraid support - -* Wed Jul 4 2001 Matt Wilson -- imported 1.4.15-pre2 into CVS and made a new dist tarball - -* Tue Jun 26 2001 Matt Wilson -- added a new dist tarball that contains a check in python code to - make sure that a partition exists within a disk before trying to - remove it from the disk -- also changed _probe_with_open to make the first probed filesystem win - -* Tue Jun 26 2001 Bill Nottingham -- fix filesystem type reading on GPT disks - -* Tue Jun 26 2001 Matt Wilson -- added another fix for ext2/ext3 -- added Patch4 to move the crc32 function into its own namespace so - we don't colide with zlib when both are in the same executable space - -* Mon Jun 25 2001 Matt Wilson -- added a new dist tarball from CVS that includes - ext3 probing - -* Wed Jun 6 2001 Matt Wilson -- updated dist with binding for partition.geom.disk - -* Tue Jun 5 2001 Matt Wilson -- make a new dist tarball that has new python binding changes - -* Tue May 29 2001 Bill Nottingham -- add major numbers for cciss -- add libunicode-devel buildprereq - -* Sun May 27 2001 Matthew Wilson -- added type, heads, and sectors to the python binding for PedDevice - -* Fri May 4 2001 Matt Wilson -- added parted-1.4.11-gpt-pmbralign.patch from Matt Domsch - -* Wed May 2 2001 Matt Wilson -- include python binding -- enable shared library (for python binding, we want fpic code) - with --enable-shared -- build parted binary static with --enable-all-static -- don't run libtoolize on this. - -* Wed May 02 2001 Bill Nottingham -- update to 1.4.11 -- add EFI GPT patch from Matt Domsch () -- don't run autoconf, it relies on a newer non-released version - of autoconf... - -* Fri Feb 23 2001 Trond Eivind Glomsrød -- langify - -* Wed Jan 17 2001 Florian La Roche -- update to 1.4.7 - -* Thu Dec 14 2000 Bill Nottingham -- rebuild because of broken fileutils - -* Fri Nov 03 2000 Florian La Roche -- update to 1.2.12 - -* Wed Nov 01 2000 Florian La Roche -- update to 1.2.11 - -* Tue Oct 17 2000 Florian La Roche -- update to 1.2.10 - -* Sun Sep 10 2000 Florian La Roche -- update to 1.2.9 - -* Tue Aug 29 2000 Florian La Roche -- fix bug when just hitting "return" with no user input - -* Sun Aug 20 2000 Florian La Roche -- 1.2.8 -- blksize patch not needed anymore -- move changelog to the end of the spec file - -* Wed Aug 16 2000 Matt Wilson -- 1.2.7 -- patched configure script to ignore the 2.4 blkpg.h header (fixes #15835). - -* Fri Aug 4 2000 Florian La Roche -- update to 1.2.6 - -* Sat Jul 22 2000 Florian La Roche -- update to 1.2.5 -- add more docu - -* Wed Jul 12 2000 Prospector -- automatic rebuild - -* Mon Jun 12 2000 Matt Wilson -- initialization of spec file. diff --git a/sources b/sources index 98268d4..ed18e98 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.2.153.tar.xz) = 149772c95f12430f6eb64ae1dc83a905059263bf8ec9a84bb2d2ff573d3a1b76d5dd67dfb511973f9fb63a9843e098b126e5f5c2c93cec7c926b6a1abe646a43 -SHA512 (parted-3.2.153.tar.xz.sig) = 6c84f7434fd36da94472f2a8c59ce3b0a5aa22f474ea5f90def27f1db391c86bd700a851ebc82519fa7dc44a9f23c4efc2c3374b9e6f04b845d2e34399d06702 +SHA512 (parted-3.3.tar.xz) = d1384694a491aa53bab6206fdeccd1d192de2ed379fe25aa865dd6aa06ed945a728e85b2ccc2fb23f5aa9dfee4a8bd8f0f2be1dd386cb8e8861b73382c6a07e4 +SHA512 (parted-3.3.tar.xz.sig) = b96f048b92e4056ca327635b3b6c00c86e9213be1af4d42ddc1dace91fe44bf40f2d99052ef04509ef8097fea69eca758bcb0de37ef7afc6a1c0d982c2aac5bd From 512a61e4a850d41d20fc25ad7320ef0becebcc2c Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 16 Dec 2019 14:31:02 -0800 Subject: [PATCH 03/60] - tests: Test incomplete resizepart command - Fix end_input usage in do_resizepart Resolves: rhbz#1701411 --- ...er-move-and-msdos-overlap-to-python3.patch | 7 ++-- ...s-Test-incomplete-resizepart-command.patch | 25 ++++++++++++++ ...Fix-end_input-usage-in-do_resizepart.patch | 34 +++++++++++++++++++ parted.spec | 13 +++++-- 4 files changed, 73 insertions(+), 6 deletions(-) rename 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch => 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch (78%) create mode 100644 0003-tests-Test-incomplete-resizepart-command.patch create mode 100644 0004-Fix-end_input-usage-in-do_resizepart.patch diff --git a/0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch b/0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch similarity index 78% rename from 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch rename to 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch index 1c7dff3..90bf71a 100644 --- a/0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +++ b/0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch @@ -1,8 +1,9 @@ -From 38badae4d6b858da713b383b9bc7bdad6294ca1b Mon Sep 17 00:00:00 2001 +From 22a4baba11ab299722e68f9ea37a53869afef7e1 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 27 Jun 2018 13:47:33 -0700 -Subject: [PATCH 92/92] Switch gpt-header-move and msdos-overlap to python3 +Subject: [PATCH 1/4] Switch gpt-header-move and msdos-overlap to python3 +python2 is EOL on January 1, 2020 so it is time to switch to python3. --- tests/gpt-header-move | 2 +- tests/msdos-overlap | 2 +- @@ -29,5 +30,5 @@ index d6ae8d6..b2b03e6 100755 Write an overlapping partition to a msdos disk -- -2.17.1 +2.23.0 diff --git a/0003-tests-Test-incomplete-resizepart-command.patch b/0003-tests-Test-incomplete-resizepart-command.patch new file mode 100644 index 0000000..cbea90a --- /dev/null +++ b/0003-tests-Test-incomplete-resizepart-command.patch @@ -0,0 +1,25 @@ +From 679da92c54c75d7fca1fd825f1d42a750d115f2d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 23 Apr 2019 10:25:20 -0700 +Subject: [PATCH 3/4] tests: Test incomplete resizepart command + +--- + tests/t3200-resize-partition.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh +index 4565e99..06dbe68 100755 +--- a/tests/t3200-resize-partition.sh ++++ b/tests/t3200-resize-partition.sh +@@ -63,6 +63,8 @@ parted -m -s $dev u s p > out 2>&1 || fail=1 + wait_for_dev_to_appear_ ${dev}1 || { warn_ "${dev}1 did not appear" fail=1; } + sleep 1 + ++# Running it without end should not core-dump or prompt ++parted -s $dev resizepart 1 > out 2> err || fail=1 + + # extend the filesystem to end on sector 4096 + new_end=4096s +-- +2.23.0 + diff --git a/0004-Fix-end_input-usage-in-do_resizepart.patch b/0004-Fix-end_input-usage-in-do_resizepart.patch new file mode 100644 index 0000000..2d570fd --- /dev/null +++ b/0004-Fix-end_input-usage-in-do_resizepart.patch @@ -0,0 +1,34 @@ +From ca845aeeddb17343c9289816833ca352f7c0d87b Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 23 Apr 2019 13:52:25 -0700 +Subject: [PATCH 4/4] Fix end_input usage in do_resizepart + +It needs to be set to NULL, since it may not get set by the call to +command_line_get_sector +--- + parted/parted.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 9dcdb05..df0c7ed 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1545,6 +1545,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + PedGeometry *range_end = NULL; + PedConstraint* constraint; + int rc = 0; ++ char* end_input = NULL; + + if (!disk) { + disk = ped_disk_new (*dev); +@@ -1565,7 +1566,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + + start = part->geom.start; + end = oldend = part->geom.end; +- char *end_input; + if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) + goto error; + _adjust_end_if_iec(&start, &end, range_end, end_input); +-- +2.23.0 + diff --git a/parted.spec b/parted.spec index 081cfca..aec2298 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -13,8 +13,10 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane -# Upstream still uses python2 for these scripts -Patch0092: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +# Upstream patches since v3.3 release +Patch0001: 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +Patch0002: 0003-tests-Test-incomplete-resizepart-command.patch +Patch0003: 0004-Fix-end_input-usage-in-do_resizepart.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -126,6 +128,11 @@ make check %changelog +* Mon Dec 16 2019 Brian C. Lane - 3.3-2 +- tests: Test incomplete resizepart command +- Fix end_input usage in do_resizepart + Resolves: rhbz#1701411 + * Fri Oct 11 2019 Brian C. Lane - 3.3-1 - New upstream release v3.3 Includes the DASD virtio-blk fix. From 5dbd295bd4c43c85cad13cb48d6d4dd1e2501581 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jan 2020 20:57:28 +0000 Subject: [PATCH 04/60] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index aec2298..bf7ea58 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -128,6 +128,9 @@ make check %changelog +* Wed Jan 29 2020 Fedora Release Engineering - 3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Mon Dec 16 2019 Brian C. Lane - 3.3-2 - tests: Test incomplete resizepart command - Fix end_input usage in do_resizepart From ac53ea06add6fa72e4e1fda2148e26441778f20e Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 2 Mar 2020 09:00:47 -0800 Subject: [PATCH 05/60] - Add chromeos_kernel partition flag for gpt disklabels - Add bls_boot partition flag for msdos and gpt disklabels --- ...d-Add-ChromeOS-Kernel-partition-flag.patch | 283 ++++++++++++++++++ ...pport-for-MSDOS-partition-type-bls_b.patch | 139 +++++++++ ...dd-support-for-bls_boot-to-GPT-disks.patch | 248 +++++++++++++++ parted.spec | 7 + 4 files changed, 677 insertions(+) create mode 100644 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch create mode 100644 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch create mode 100644 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch diff --git a/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch b/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch new file mode 100644 index 0000000..7a4605a --- /dev/null +++ b/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch @@ -0,0 +1,283 @@ +From e29dfafcf2d9a6886a66506bc84efb4badc5f6d6 Mon Sep 17 00:00:00 2001 +From: Alper Nebi Yasak +Date: Thu, 10 Oct 2019 21:03:22 +0300 +Subject: [PATCH] libparted: Add ChromeOS Kernel partition flag + +This adds a GPT-only partition type flag, chromeos_kernel, for use on +Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309. + +The firmware/bootloader in these machines relies on special images being +written to partitions of this type. Among multiple such partitions, it +decides which one it will boot from based on the GUID-specific partition +attributes. This patch is not intended to and does not manipulate these +bits. + +Google refers to these partitions as "ChromeOS kernel" partitions. They +also define partitions for rootfs, firmware, and a reserved one; but +these are not necessary for the boot flow and are not included here. + +Relevant ChromiumOS documentation: +https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format + +Signed-off-by: Alper Nebi Yasak +--- + doc/C/parted.8 | 2 +- + doc/parted.texi | 4 ++++ + include/parted/disk.in.h | 5 +++-- + libparted/disk.c | 2 ++ + libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 55 insertions(+), 3 deletions(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 15932c2..d40279e 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -112,7 +112,7 @@ or an LVM logical volume if necessary. + .B set \fIpartition\fP \fIflag\fP \fIstate\fP + Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. + Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", +-"legacy_boot", "irst", "msftres", "esp" and "palo". ++"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo". + \fIstate\fP should be either "on" or "off". + .TP + .B unit \fIunit\fP +diff --git a/doc/parted.texi b/doc/parted.texi +index 77c9628..f983d2c 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -874,6 +874,10 @@ partition. + (MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT + it is an alias for boot. + ++@item chromeos_kernel ++(GPT) - this flag indicates a partition that can be used with the Chrome OS ++bootloader and verified boot implementation. ++ + @item lba + (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and + MS Windows ME based operating systems to use Linear (LBA) mode. +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index a3b380d..b257c27 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -75,10 +75,11 @@ enum _PedPartitionFlag { + PED_PARTITION_LEGACY_BOOT=15, + PED_PARTITION_MSFT_DATA=16, + PED_PARTITION_IRST=17, +- PED_PARTITION_ESP=18 ++ PED_PARTITION_ESP=18, ++ PED_PARTITION_CHROMEOS_KERNEL=19 + }; + #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP ++#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +diff --git a/libparted/disk.c b/libparted/disk.c +index 5aaac5a..d1f1077 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -2407,6 +2407,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) + return N_("irst"); + case PED_PARTITION_ESP: + return N_("esp"); ++ case PED_PARTITION_CHROMEOS_KERNEL: ++ return N_("chromeos_kernel"); + + default: + ped_exception_throw ( +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 8e9500b..b8b58cd 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -156,6 +156,10 @@ typedef struct + ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \ + PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \ + { 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }}) ++#define PARTITION_CHROMEOS_KERNEL_GUID \ ++ ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \ ++ PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \ ++ { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }}) + + struct __attribute__ ((packed)) _GuidPartitionTableHeader_t + { +@@ -303,6 +307,7 @@ typedef struct _GPTPartitionData + int legacy_boot; + int prep; + int irst; ++ int chromeos_kernel; + } GPTPartitionData; + + static PedDiskType gpt_disk_type; +@@ -826,6 +831,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + = gpt_part_data->legacy_boot + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; + + if (pte->Attributes.RequiredToFunction & 0x1) +@@ -857,6 +863,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + gpt_part_data->prep = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) + gpt_part_data->irst = 1; ++ else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) ++ gpt_part_data->chromeos_kernel = 1; + + return part; + } +@@ -1377,6 +1385,7 @@ gpt_partition_new (const PedDisk *disk, + gpt_part_data->prep = 0; + gpt_part_data->translated_name = 0; + gpt_part_data->irst = 0; ++ gpt_part_data->chromeos_kernel = 0; + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid (&gpt_part_data->uuid); + memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); +@@ -1507,6 +1516,11 @@ gpt_partition_set_system (PedPartition *part, + gpt_part_data->type = PARTITION_IRST_GUID; + return 1; + } ++ if (gpt_part_data->chromeos_kernel) ++ { ++ gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; ++ return 1; ++ } + + if (fs_type) + { +@@ -1653,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_BIOS_GRUB: +@@ -1668,6 +1683,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_RAID: +@@ -1683,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_LVM: +@@ -1698,6 +1715,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_SWAP: +@@ -1713,6 +1731,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HPSERVICE: +@@ -1728,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_MSFT_RESERVED: +@@ -1743,6 +1763,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_MSFT_DATA: +@@ -1758,6 +1779,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + gpt_part_data->msftdata = 1; + } else { +@@ -1777,6 +1799,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftres + = gpt_part_data->prep + = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_APPLE_TV_RECOVERY: +@@ -1791,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftres + = gpt_part_data->msftdata + = gpt_part_data->prep ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->msftrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_PREP: +@@ -1805,6 +1829,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftres + = gpt_part_data->irst + = gpt_part_data->atvrecv ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->msftrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_IRST: +@@ -1820,8 +1845,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftdata + = gpt_part_data->msftrecv + = gpt_part_data->prep ++ = gpt_part_data->chromeos_kernel + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); ++ case PED_PARTITION_CHROMEOS_KERNEL: ++ gpt_part_data->chromeos_kernel = state; ++ if (state) ++ gpt_part_data->boot ++ = gpt_part_data->bios_grub ++ = gpt_part_data->raid ++ = gpt_part_data->lvm ++ = gpt_part_data->swap ++ = gpt_part_data->hp_service ++ = gpt_part_data->msftres ++ = gpt_part_data->msftdata ++ = gpt_part_data->msftrecv ++ = gpt_part_data->atvrecv ++ = gpt_part_data->prep ++ = gpt_part_data->irst = 0; ++ return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: + gpt_part_data->hidden = state; + return 1; +@@ -1874,6 +1916,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + return gpt_part_data->irst; + case PED_PARTITION_SWAP: + return gpt_part_data->swap; ++ case PED_PARTITION_CHROMEOS_KERNEL: ++ return gpt_part_data->chromeos_kernel; + case PED_PARTITION_LBA: + case PED_PARTITION_ROOT: + default: +@@ -1903,6 +1947,7 @@ gpt_partition_is_flag_available (const PedPartition *part, + case PED_PARTITION_PREP: + case PED_PARTITION_IRST: + case PED_PARTITION_ESP: ++ case PED_PARTITION_CHROMEOS_KERNEL: + return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: +-- +2.24.1 + diff --git a/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch b/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch new file mode 100644 index 0000000..7bba38a --- /dev/null +++ b/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch @@ -0,0 +1,139 @@ +From d6056299028f60b96802487de0d1d65e51e1fd33 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 19 Dec 2019 16:05:59 -0800 +Subject: [PATCH 6/7] libparted: Add support for MSDOS partition type bls_boot + (0xea) + +This type is used by the Boot Loader Specification to identify a +compatible /boot boot partition. +--- + doc/C/parted.8 | 2 +- + libparted/labels/dos.c | 33 ++++++++++++++++++++------------- + 2 files changed, 21 insertions(+), 14 deletions(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index d40279e..297c39a 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -112,7 +112,7 @@ or an LVM logical volume if necessary. + .B set \fIpartition\fP \fIflag\fP \fIstate\fP + Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. + Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", +-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo". ++"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo". + \fIstate\fP should be either "on" or "off". + .TP + .B unit \fIunit\fP +diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c +index ed1341e..d859b33 100644 +--- a/libparted/labels/dos.c ++++ b/libparted/labels/dos.c +@@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = { + #define PARTITION_HFS 0xaf + #define PARTITION_SUN_UFS 0xbf + #define PARTITION_DELL_DIAG 0xde ++#define PARTITION_BLS_BOOT 0xea + #define PARTITION_GPT 0xee + #define PARTITION_ESP 0xef + #define PARTITION_PALO 0xf0 +@@ -165,6 +166,7 @@ typedef struct { + int diag; + int irst; + int esp; ++ int bls_boot; + OrigState* orig; /* used for CHS stuff */ + } DosPartitionData; + +@@ -961,6 +963,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, + dos_data->prep = raw_part->type == PARTITION_PREP; + dos_data->irst = raw_part->type == PARTITION_IRST; + dos_data->esp = raw_part->type == PARTITION_ESP; ++ dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT; + dos_data->orig = ped_malloc (sizeof (OrigState)); + if (!dos_data->orig) { + ped_partition_destroy (part); +@@ -1340,22 +1343,10 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type, + + if (ped_partition_is_active (part)) { + part->disk_specific +- = dos_data = ped_malloc (sizeof (DosPartitionData)); ++ = dos_data = ped_calloc (sizeof (DosPartitionData)); + if (!dos_data) + goto error_free_part; +- dos_data->orig = NULL; + dos_data->system = PARTITION_LINUX; +- dos_data->hidden = 0; +- dos_data->msftres = 0; +- dos_data->boot = 0; +- dos_data->diag = 0; +- dos_data->raid = 0; +- dos_data->lvm = 0; +- dos_data->lba = 0; +- dos_data->palo = 0; +- dos_data->prep = 0; +- dos_data->irst = 0; +- dos_data->esp = 0; + } else { + part->disk_specific = NULL; + } +@@ -1394,6 +1385,7 @@ msdos_partition_duplicate (const PedPartition* part) + new_dos_data->prep = old_dos_data->prep; + new_dos_data->irst = old_dos_data->irst; + new_dos_data->esp = old_dos_data->esp; ++ new_dos_data->bls_boot = old_dos_data->bls_boot; + + if (old_dos_data->orig) { + new_dos_data->orig = ped_malloc (sizeof (OrigState)); +@@ -1492,6 +1484,10 @@ msdos_partition_set_system (PedPartition* part, + dos_data->system = PARTITION_ESP; + return 1; + } ++ if (dos_data->bls_boot) { ++ dos_data->system = PARTITION_BLS_BOOT; ++ return 1; ++ } + + if (!fs_type) + dos_data->system = PARTITION_LINUX; +@@ -1534,6 +1530,7 @@ clear_flags (DosPartitionData *dos_data) + dos_data->irst = 0; + dos_data->esp = 0; + dos_data->raid = 0; ++ dos_data->bls_boot = 0; + } + + static int +@@ -1635,6 +1632,12 @@ msdos_partition_set_flag (PedPartition* part, + dos_data->esp = state; + return ped_partition_set_system (part, part->fs_type); + ++ case PED_PARTITION_BLS_BOOT: ++ if (state) ++ clear_flags (dos_data); ++ dos_data->bls_boot = state; ++ return ped_partition_set_system (part, part->fs_type); ++ + default: + return 0; + } +@@ -1689,6 +1692,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) + case PED_PARTITION_ESP: + return dos_data->esp; + ++ case PED_PARTITION_BLS_BOOT: ++ return dos_data->bls_boot; ++ + default: + return 0; + } +@@ -1719,6 +1725,7 @@ msdos_partition_is_flag_available (const PedPartition* part, + case PED_PARTITION_PREP: + case PED_PARTITION_IRST: + case PED_PARTITION_ESP: ++ case PED_PARTITION_BLS_BOOT: + case PED_PARTITION_DIAG: + return 1; + +-- +2.24.1 + diff --git a/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch b/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch new file mode 100644 index 0000000..d46742f --- /dev/null +++ b/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch @@ -0,0 +1,248 @@ +From e5fe9328c890a266544a7ef0d272150519fdfc5d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Dec 2019 10:52:35 -0800 +Subject: [PATCH 7/7] libparted: Add support for bls_boot to GPT disks + +This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to +indicate that the partition is a Boot Loader Specification compatible +/boot partition. +--- + doc/parted.texi | 4 ++++ + include/parted/disk.in.h | 5 +++-- + libparted/disk.c | 2 ++ + libparted/labels/gpt.c | 47 +++++++++++++++++++++++++++++++++++++++- + 4 files changed, 55 insertions(+), 3 deletions(-) + +diff --git a/doc/parted.texi b/doc/parted.texi +index f983d2c..213fc84 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -844,6 +844,10 @@ GRUB BIOS partition. + (GPT) - this flag is used to tell special purpose software that the GPT + partition may be bootable. + ++@item bls_boot ++(MS-DOS, GPT) - Enable this to indicate that the selected partition is a ++Linux Boot Loader Specification compatible /boot partition. ++ + @item boot + (Mac, MS-DOS, PC98) - should be enabled if you want to boot off the + partition. The semantics vary between disk labels. For MS-DOS disk +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index b257c27..fadb995 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -76,10 +76,11 @@ enum _PedPartitionFlag { + PED_PARTITION_MSFT_DATA=16, + PED_PARTITION_IRST=17, + PED_PARTITION_ESP=18, +- PED_PARTITION_CHROMEOS_KERNEL=19 ++ PED_PARTITION_CHROMEOS_KERNEL=19, ++ PED_PARTITION_BLS_BOOT=20 + }; + #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL ++#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +diff --git a/libparted/disk.c b/libparted/disk.c +index d1f1077..099837b 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -2409,6 +2409,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) + return N_("esp"); + case PED_PARTITION_CHROMEOS_KERNEL: + return N_("chromeos_kernel"); ++ case PED_PARTITION_BLS_BOOT: ++ return N_("bls_boot"); + + default: + ped_exception_throw ( +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index b8b58cd..93f7add 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -160,6 +160,10 @@ typedef struct + ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \ + PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \ + { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }}) ++#define PARTITION_BLS_BOOT_GUID \ ++ ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \ ++ PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ ++ { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) + + struct __attribute__ ((packed)) _GuidPartitionTableHeader_t + { +@@ -308,6 +312,7 @@ typedef struct _GPTPartitionData + int prep; + int irst; + int chromeos_kernel; ++ int bls_boot; + } GPTPartitionData; + + static PedDiskType gpt_disk_type; +@@ -832,6 +837,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; + + if (pte->Attributes.RequiredToFunction & 0x1) +@@ -865,6 +871,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + gpt_part_data->irst = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) + gpt_part_data->chromeos_kernel = 1; ++ else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID)) ++ gpt_part_data->bls_boot = 1; + + return part; + } +@@ -1386,6 +1394,7 @@ gpt_partition_new (const PedDisk *disk, + gpt_part_data->translated_name = 0; + gpt_part_data->irst = 0; + gpt_part_data->chromeos_kernel = 0; ++ gpt_part_data->bls_boot = 0; + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid (&gpt_part_data->uuid); + memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); +@@ -1521,6 +1530,11 @@ gpt_partition_set_system (PedPartition *part, + gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; + return 1; + } ++ if (gpt_part_data->bls_boot) ++ { ++ gpt_part_data->type = PARTITION_BLS_BOOT_GUID; ++ return 1; ++ } + + if (fs_type) + { +@@ -1668,6 +1682,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_BIOS_GRUB: +@@ -1684,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_RAID: +@@ -1700,6 +1716,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_LVM: +@@ -1716,6 +1733,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_SWAP: +@@ -1732,6 +1750,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HPSERVICE: +@@ -1748,6 +1767,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_MSFT_RESERVED: +@@ -1764,6 +1784,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_MSFT_DATA: +@@ -1780,6 +1801,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + gpt_part_data->msftdata = 1; + } else { +@@ -1830,6 +1852,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->irst + = gpt_part_data->atvrecv + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->msftrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_IRST: +@@ -1846,6 +1869,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->prep + = gpt_part_data->chromeos_kernel ++ = gpt_part_data->bls_boot + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_CHROMEOS_KERNEL: +@@ -1862,7 +1886,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->msftrecv + = gpt_part_data->atvrecv + = gpt_part_data->prep +- = gpt_part_data->irst = 0; ++ = gpt_part_data->irst ++ = gpt_part_data->bls_boot = 0; ++ return gpt_partition_set_system (part, part->fs_type); ++ case PED_PARTITION_BLS_BOOT: ++ gpt_part_data->bls_boot = state; ++ if (state) ++ gpt_part_data->boot ++ = gpt_part_data->raid ++ = gpt_part_data->lvm ++ = gpt_part_data->swap ++ = gpt_part_data->bios_grub ++ = gpt_part_data->hp_service ++ = gpt_part_data->msftres ++ = gpt_part_data->msftdata ++ = gpt_part_data->msftrecv ++ = gpt_part_data->prep ++ = gpt_part_data->irst ++ = gpt_part_data->chromeos_kernel ++ = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: + gpt_part_data->hidden = state; +@@ -1914,6 +1956,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + return gpt_part_data->prep; + case PED_PARTITION_IRST: + return gpt_part_data->irst; ++ case PED_PARTITION_BLS_BOOT: ++ return gpt_part_data->bls_boot; + case PED_PARTITION_SWAP: + return gpt_part_data->swap; + case PED_PARTITION_CHROMEOS_KERNEL: +@@ -1948,6 +1992,7 @@ gpt_partition_is_flag_available (const PedPartition *part, + case PED_PARTITION_IRST: + case PED_PARTITION_ESP: + case PED_PARTITION_CHROMEOS_KERNEL: ++ case PED_PARTITION_BLS_BOOT: + return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: +-- +2.24.1 + diff --git a/parted.spec b/parted.spec index bf7ea58..a8aee83 100644 --- a/parted.spec +++ b/parted.spec @@ -17,6 +17,9 @@ Source3: pubkey.brian.lane Patch0001: 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch Patch0002: 0003-tests-Test-incomplete-resizepart-command.patch Patch0003: 0004-Fix-end_input-usage-in-do_resizepart.patch +Patch0004: 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch +Patch0005: 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch +Patch0006: 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -128,6 +131,10 @@ make check %changelog +* Fri Mar 06 2020 Brian C. Lane - 3.3-3 +- Add chromeos_kernel partition flag for gpt disklabels +- Add bls_boot partition flag for msdos and gpt disklabels + * Wed Jan 29 2020 Fedora Release Engineering - 3.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From a21276aeadfd05ed5fa21c3983b204b8579c596a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 14 Jul 2020 02:28:02 +0000 Subject: [PATCH 06/60] Use make macros https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro --- parted.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/parted.spec b/parted.spec index a8aee83..b4d3e32 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -87,12 +87,12 @@ CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS # Don't use rpath! %{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool %{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -V=1 %{__make} %{?_smp_mflags} +%make_build %install %{__rm} -rf %{buildroot} -%{__make} install DESTDIR=%{buildroot} +%make_install # Remove components we do not ship %{__rm} -rf %{buildroot}%{_libdir}/*.la @@ -131,6 +131,10 @@ make check %changelog +* Tue Jul 14 2020 Tom Stellard - 3.3-4 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + * Fri Mar 06 2020 Brian C. Lane - 3.3-3 - Add chromeos_kernel partition flag for gpt disklabels - Add bls_boot partition flag for msdos and gpt disklabels From c4782e273c38cc61e14cea7e1e236e77448995c3 Mon Sep 17 00:00:00 2001 From: Bruno Goncalves Date: Thu, 23 Jul 2020 13:59:51 +0200 Subject: [PATCH 07/60] update test.yml make sure git is installed in the VM before extracting the source --- tests/tests.yml | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/tests/tests.yml b/tests/tests.yml index 46066eb..5fde476 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -1,33 +1,14 @@ --- -# Run parted's tests by rebuilding the rpm and running the %check section - hosts: localhost - vars: - package: parted - tenv_workdir: "/tmp/workdir" tags: - - classic - tasks: - - name: Copy the spec file over to the workdir - copy: - src: "{{ playbook_dir }}/../{{ package }}.spec" - dest: "{{ tenv_workdir }}/" - -- hosts: localhost - vars: - tenv_workdir: "/tmp/workdir" + - classic roles: - - role: standard-test-source - tags: - - always - - - role: standard-test-basic - tags: - - classic - - required_packages: - - dnf - - rpm-build - - tests: - - simple: - run: "./run_tests.sh {{ tenv_workdir }}" + - role: standard-test-source + required_packages: + - dnf + - rpm-build + - git + - role: standard-test-basic + tests: + - simple: + run: "./run_tests.sh {{ tenv_workdir }}" From ec86b620a22dceeae76d87eec8df2446a97ecb21 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 21 Jul 2020 09:29:18 -0700 Subject: [PATCH 08/60] Switch to using %autosetup instead of %setup and git --- parted.spec | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/parted.spec b/parted.spec index b4d3e32..77cfeda 100644 --- a/parted.spec +++ b/parted.spec @@ -67,17 +67,10 @@ Parted library, you need to install this package. %prep -%setup -q +%autosetup -S git_am gpg2 --import %{SOURCE2} %{SOURCE3} gpg2 --verify %{SOURCE1} %{SOURCE0} -git init -git config user.email "parted-owner@fedoraproject.org" -git config user.name "Fedora Ninjas" -git add . -git commit -a -q -m "%{version} baseline." -[ -n "%{patches}" ] && git am %{patches} iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS -git commit -a -m "run iconv" %build autoreconf @@ -133,7 +126,9 @@ make check %changelog * Tue Jul 14 2020 Tom Stellard - 3.3-4 - Use make macros -- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro +- Switch to using %%autosetup instead of %%setup and git (bcl) +- Update tests.yml to install git and simplify source usage (bgoncalv) * Fri Mar 06 2020 Brian C. Lane - 3.3-3 - Add chromeos_kernel partition flag for gpt disklabels From 7bd556f35f910cff80f988370a7dfae5045a4ae7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 28 Jul 2020 13:12:47 +0000 Subject: [PATCH 09/60] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 77cfeda..f8040ed 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -124,6 +124,9 @@ make check %changelog +* Tue Jul 28 2020 Fedora Release Engineering - 3.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Tue Jul 14 2020 Tom Stellard - 3.3-4 - Use make macros https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro From 0dd29ac6e146bd9e8f865e526ec393fe75aee111 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 25 Sep 2020 10:13:17 -0700 Subject: [PATCH 10/60] - tests: Add a test for resizepart on a busy partition (bcl) - parted: Preserve resizepart End when prompted for busy partition (bcl) - tests: Add f2fs to the fs probe test (romain.perier) - Add support for the F2FS filesystem (romain.perier) - Removed reference to ped_file_system_create (max) --- ...-reference-to-ped_file_system_create.patch | 29 +++ ...-Add-support-for-the-F2FS-filesystem.patch | 201 ++++++++++++++++++ ...-tests-Add-f2fs-to-the-fs-probe-test.patch | 27 +++ ...resizepart-End-when-prompted-for-bus.patch | 53 +++++ ...t-for-resizepart-on-a-busy-partition.patch | 85 ++++++++ parted.spec | 14 +- 6 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 0008-Removed-reference-to-ped_file_system_create.patch create mode 100644 0009-Add-support-for-the-F2FS-filesystem.patch create mode 100644 0010-tests-Add-f2fs-to-the-fs-probe-test.patch create mode 100644 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch create mode 100644 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch diff --git a/0008-Removed-reference-to-ped_file_system_create.patch b/0008-Removed-reference-to-ped_file_system_create.patch new file mode 100644 index 0000000..5307d5a --- /dev/null +++ b/0008-Removed-reference-to-ped_file_system_create.patch @@ -0,0 +1,29 @@ +From 8c50fec522f475c51e2aaa3c972ce4c6690dda92 Mon Sep 17 00:00:00 2001 +From: Max Campbell +Date: Thu, 12 Dec 2019 16:54:29 +0100 +Subject: [PATCH 08/12] Removed reference to ped_file_system_create + +Removed a reference to the removed function ped_file_system_create in +the docs for ped_file_system_clobber. + +Signed-off-by: Brian C. Lane +--- + libparted/fs/r/filesys.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c +index d57447c..dd316aa 100644 +--- a/libparted/fs/r/filesys.c ++++ b/libparted/fs/r/filesys.c +@@ -213,8 +213,6 @@ error_close_dev: + * file system occupies a given region described by \p geom. + * After this operation ped_file_system_probe() won't detect any file system. + * +- * \note ped_file_system_create() calls this before creating a new file system. +- * + * \return \c 1 on success, \c 0 on failure + */ + static int +-- +2.26.2 + diff --git a/0009-Add-support-for-the-F2FS-filesystem.patch b/0009-Add-support-for-the-F2FS-filesystem.patch new file mode 100644 index 0000000..c0578fd --- /dev/null +++ b/0009-Add-support-for-the-F2FS-filesystem.patch @@ -0,0 +1,201 @@ +From c6b61814cd4cf958e12d35a36184ff7d767e57d9 Mon Sep 17 00:00:00 2001 +From: Romain Perier +Date: Fri, 20 Mar 2020 17:43:16 +0100 +Subject: [PATCH 09/12] Add support for the F2FS filesystem + +This adds a basic support for the Flash-Friendly File System. So +we can manipulate the file system by using the PedFileSystem API and we +can do basic device probing for autodetecting the current fs. + +Signed-off-by: Romain Perier +Signed-off-by: Brian C. Lane +--- + libparted/fs/Makefile.am | 2 ++ + libparted/fs/f2fs/f2fs.c | 60 ++++++++++++++++++++++++++++++++++++++++ + libparted/fs/f2fs/f2fs.h | 57 ++++++++++++++++++++++++++++++++++++++ + libparted/libparted.c | 4 +++ + 4 files changed, 123 insertions(+) + create mode 100644 libparted/fs/f2fs/f2fs.c + create mode 100644 libparted/fs/f2fs/f2fs.h + +diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am +index 74f275a..e40eee8 100644 +--- a/libparted/fs/Makefile.am ++++ b/libparted/fs/Makefile.am +@@ -32,6 +32,8 @@ libfs_la_SOURCES = \ + fat/count.h \ + fat/fat.c \ + fat/fat.h \ ++ f2fs/f2fs.c \ ++ f2fs/f2fs.h \ + hfs/hfs.c \ + hfs/hfs.h \ + hfs/probe.c \ +diff --git a/libparted/fs/f2fs/f2fs.c b/libparted/fs/f2fs/f2fs.c +new file mode 100644 +index 0000000..64883e9 +--- /dev/null ++++ b/libparted/fs/f2fs/f2fs.c +@@ -0,0 +1,60 @@ ++/* ++ libparted/fs/f2fs - Flash-Friendly File System ++ Copyright (C) 2020 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++*/ ++ ++#include ++ ++#include ++#include ++ ++#include "f2fs.h" ++ ++static PedGeometry* ++f2fs_probe (PedGeometry* geom) ++{ ++ struct f2fs_super_block *sb = alloca(geom->dev->sector_size); ++ ++ if (!ped_geometry_read (geom, sb, F2FS_SB_OFFSET, 1)) ++ return NULL; ++ ++ if (PED_LE32_TO_CPU(sb->magic) == F2FS_MAGIC) ++ return ped_geometry_new (geom->dev, geom->start, geom->length); ++ ++ return NULL; ++} ++ ++static PedFileSystemOps f2fs_ops = { ++ probe: f2fs_probe, ++}; ++ ++static PedFileSystemType f2fs_type = { ++ next: NULL, ++ ops: &f2fs_ops, ++ name: "f2fs", ++}; ++ ++void ++ped_file_system_f2fs_init () ++{ ++ ped_file_system_type_register (&f2fs_type); ++} ++ ++void ++ped_file_system_f2fs_done () ++{ ++ ped_file_system_type_unregister (&f2fs_type); ++} +diff --git a/libparted/fs/f2fs/f2fs.h b/libparted/fs/f2fs/f2fs.h +new file mode 100644 +index 0000000..c96b88f +--- /dev/null ++++ b/libparted/fs/f2fs/f2fs.h +@@ -0,0 +1,57 @@ ++/* ++ libparted/fs/f2fs - Flash-Friendly File System ++ Copyright (C) 2020 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++*/ ++#ifndef _F2FS_H ++#define _F2FS_H ++ ++#define F2FS_MAGIC 0xF2F52010 ++#define F2FS_MAX_VOLUME_NAME 512 ++#define F2FS_SB_OFFSET 0x02 ++ ++struct f2fs_super_block { ++ uint32_t magic; /* Magic Number */ ++ uint16_t major_ver; /* Major Version */ ++ uint16_t minor_ver; /* Minor Version */ ++ uint32_t log_sectorsize; /* log2 sector size in bytes */ ++ uint32_t log_sectors_per_block; /* log2 # of sectors per block */ ++ uint32_t log_blocksize; /* log2 block size in bytes */ ++ uint32_t log_blocks_per_seg; /* log2 # of blocks per segment */ ++ uint32_t segs_per_sec; /* # of segments per section */ ++ uint32_t secs_per_zone; /* # of sections per zone */ ++ uint32_t checksum_offset; /* checksum offset inside super block */ ++ uint64_t block_count; /* total # of user blocks */ ++ uint32_t section_count; /* total # of sections */ ++ uint32_t segment_count; /* total # of segments */ ++ uint32_t segment_count_ckpt; /* # of segments for checkpoint */ ++ uint32_t segment_count_sit; /* # of segments for SIT */ ++ uint32_t segment_count_nat; /* # of segments for NAT */ ++ uint32_t segment_count_ssa; /* # of segments for SSA */ ++ uint32_t segment_count_main; /* # of segments for main area */ ++ uint32_t segment0_blkaddr; /* start block address of segment 0 */ ++ uint32_t cp_blkaddr; /* start block address of checkpoint */ ++ uint32_t sit_blkaddr; /* start block address of SIT */ ++ uint32_t nat_blkaddr; /* start block address of NAT */ ++ uint32_t ssa_blkaddr; /* start block address of SSA */ ++ uint32_t main_blkaddr; /* start block address of main area */ ++ uint32_t root_ino; /* root inode number */ ++ uint32_t node_ino; /* node inode number */ ++ uint32_t meta_ino; /* meta inode number */ ++ uint8_t uuid[16]; /* 128-bit uuid for volume */ ++ uint16_t volume_name[F2FS_MAX_VOLUME_NAME]; /* volume name */ ++} __attribute__((packed)); ++ ++#endif +diff --git a/libparted/libparted.c b/libparted/libparted.c +index 00f5ff8..4a57a80 100644 +--- a/libparted/libparted.c ++++ b/libparted/libparted.c +@@ -109,6 +109,7 @@ extern void ped_file_system_linux_swap_init (void); + extern void ped_file_system_jfs_init (void); + extern void ped_file_system_hfs_init (void); + extern void ped_file_system_fat_init (void); ++extern void ped_file_system_f2fs_init (void); + extern void ped_file_system_ext2_init (void); + extern void ped_file_system_nilfs2_init (void); + extern void ped_file_system_btrfs_init (void); +@@ -126,6 +127,7 @@ init_file_system_types () + ped_file_system_jfs_init (); + ped_file_system_hfs_init (); + ped_file_system_fat_init (); ++ ped_file_system_f2fs_init (); + ped_file_system_ext2_init (); + ped_file_system_nilfs2_init (); + ped_file_system_btrfs_init (); +@@ -186,6 +188,7 @@ _init() + extern void ped_file_system_nilfs2_done (void); + extern void ped_file_system_ext2_done (void); + extern void ped_file_system_fat_done (void); ++extern void ped_file_system_f2fs_done (void); + extern void ped_file_system_hfs_done (void); + extern void ped_file_system_jfs_done (void); + extern void ped_file_system_linux_swap_done (void); +@@ -202,6 +205,7 @@ done_file_system_types () + { + ped_file_system_nilfs2_done (); + ped_file_system_ext2_done (); ++ ped_file_system_f2fs_done (); + ped_file_system_fat_done (); + ped_file_system_hfs_done (); + ped_file_system_jfs_done (); +-- +2.26.2 + diff --git a/0010-tests-Add-f2fs-to-the-fs-probe-test.patch b/0010-tests-Add-f2fs-to-the-fs-probe-test.patch new file mode 100644 index 0000000..cf376ad --- /dev/null +++ b/0010-tests-Add-f2fs-to-the-fs-probe-test.patch @@ -0,0 +1,27 @@ +From eaada0bc9e1cc8adb3a0260707d9474a3e01b835 Mon Sep 17 00:00:00 2001 +From: Romain Perier +Date: Fri, 20 Mar 2020 17:43:17 +0100 +Subject: [PATCH 10/12] tests: Add f2fs to the fs probe test + +Signed-off-by: Romain Perier +Signed-off-by: Brian C. Lane +--- + tests/t1700-probe-fs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 1fe3309..9150a37 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -23,7 +23,7 @@ dev=loop-file + ss=$sector_size_ + n_sectors=$((512*1024)) + +-for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf; do ++for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do + + ( mkfs.$type 2>&1 | grep -i '^usage' ) > /dev/null \ + || { warn_ "$ME: no $type support"; continue; } +-- +2.26.2 + diff --git a/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch b/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch new file mode 100644 index 0000000..292cc69 --- /dev/null +++ b/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch @@ -0,0 +1,53 @@ +From 691dabc930a6d544dfd8da787cddd159bab34b1e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 31 Aug 2020 16:40:07 -0700 +Subject: [PATCH 11/12] parted: Preserve resizepart End when prompted for busy + partition + +Resizing busy partitions is allowed, but the user is prompted, which +erases the cmdline. It is annoying to have to re-end the ending location +after answering Yes. This saves the word and pushes it back onto the +cmdline after the user agrees to resize the busy partition. +--- + parted/parted.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/parted/parted.c b/parted/parted.c +index df0c7ed..dbd38d0 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1546,6 +1546,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + PedConstraint* constraint; + int rc = 0; + char* end_input = NULL; ++ char* end_size = NULL; + + if (!disk) { + disk = ped_disk_new (*dev); +@@ -1561,9 +1562,23 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + + if (!command_line_get_partition (_("Partition number?"), disk, &part)) + goto error; ++ ++ /* Save the optional End value if the partition is busy. */ ++ if (ped_partition_is_busy(part)) { ++ if (command_line_get_word_count()) ++ end_size = command_line_pop_word(); ++ } ++ ++ /* If the partition is busy this may clear the command_line and prompt the user */ + if (!_partition_warn_busy (part)) + goto error; + ++ /* Push the End value back onto the command_line, if it exists */ ++ if (end_size) { ++ command_line_push_word(end_size); ++ free(end_size); ++ } ++ + start = part->geom.start; + end = oldend = part->geom.end; + if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) +-- +2.26.2 + diff --git a/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch b/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch new file mode 100644 index 0000000..327d872 --- /dev/null +++ b/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch @@ -0,0 +1,85 @@ +From dfc611bd5126840d68493ad0e761511a71325af7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 1 Sep 2020 14:51:54 -0700 +Subject: [PATCH 12/12] tests: Add a test for resizepart on a busy partition + +This makes sure that the resizepart on a busy partition with the size on +the cmdline will work. +--- + tests/t3200-resize-partition.sh | 44 ++++++++++++++++++++++++++++++--- + 1 file changed, 40 insertions(+), 4 deletions(-) + +diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh +index 06dbe68..2200977 100755 +--- a/tests/t3200-resize-partition.sh ++++ b/tests/t3200-resize-partition.sh +@@ -2,7 +2,7 @@ + # exercise the resize sub-command + # based on t3000-resize-fs.sh test + +-# Copyright (C) 2009-2011, 2019 Free Software Foundation, Inc. ++# Copyright (C) 2009-2020 Free Software Foundation, Inc. + + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +@@ -66,8 +66,8 @@ sleep 1 + # Running it without end should not core-dump or prompt + parted -s $dev resizepart 1 > out 2> err || fail=1 + +-# extend the filesystem to end on sector 4096 +-new_end=4096s ++# extend the filesystem to end on sector 2048 ++new_end=2048s + parted -s $dev resizepart 1 $new_end > out 2> err || fail=1 + # expect no output + compare /dev/null out || fail=1 +@@ -77,9 +77,45 @@ compare /dev/null err || fail=1 + parted -m -s $dev u s p > out 2>&1 || fail=1 + + sed -n 3p out > k && mv k out || fail=1 +-printf "1:$default_start:$new_end:3073s:::$ms;\n" > exp || fail=1 ++printf "1:$default_start:$new_end:1025s:::$ms;\n" > exp || fail=1 + compare exp out || fail=1 + ++## Make sure resizing a busy partition works when user answers 'yes' ++# Format the partition and mount it for the busy check ++mkfs.ext4 "${dev}1" || skip_ mkfs.ext4 failed ++ ++# be sure to unmount upon interrupt, failure, etc. ++cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } ++ ++mount_point=$(pwd)/mnt ++ ++mkdir $mount_point || fail=1 ++mount "${dev}1" "$mount_point" || fail=1 ++ ++# extend the filesystem to end on sector 4096 ++new_end=4096s ++echo yes | parted ---pretend-input-tty $dev resizepart 1 $new_end > out 2>&1 ++cat > exp < out ++compare exp out || fail=1 ++ ++# print partition table ++parted -m -s $dev u s p > out 2>&1 || fail=1 ++ ++sed -n 3p out > k && mv k out || fail=1 ++printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1 ++compare exp out || fail=1 ++ ++umount "${dev}1" || fail=1 ++ + # Remove the partition explicitly, so that mklabel doesn't evoke a warning. + parted -s $dev rm 1 || fail=1 + +-- +2.26.2 + diff --git a/parted.spec b/parted.spec index f8040ed..13c77b5 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -20,6 +20,11 @@ Patch0003: 0004-Fix-end_input-usage-in-do_resizepart.patch Patch0004: 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch Patch0005: 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch Patch0006: 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch +Patch0007: 0008-Removed-reference-to-ped_file_system_create.patch +Patch0008: 0009-Add-support-for-the-F2FS-filesystem.patch +Patch0009: 0010-tests-Add-f2fs-to-the-fs-probe-test.patch +Patch0010: 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch +Patch0011: 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -124,6 +129,13 @@ make check %changelog +* Fri Sep 25 2020 Brian C. Lane - 3.3-6 +- tests: Add a test for resizepart on a busy partition (bcl) +- parted: Preserve resizepart End when prompted for busy partition (bcl) +- tests: Add f2fs to the fs probe test (romain.perier) +- Add support for the F2FS filesystem (romain.perier) +- Removed reference to ped_file_system_create (max) + * Tue Jul 28 2020 Fedora Release Engineering - 3.3-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 28a7decb695a715faceda28938f8d2bc307739f6 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 5 Nov 2020 09:38:13 -0800 Subject: [PATCH 11/60] - Do not link to libselinux --- ...o-not-link-to-libsepol-or-libselinux.patch | 143 ++++++++++++++++++ parted.spec | 9 +- 2 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 0013-Do-not-link-to-libsepol-or-libselinux.patch diff --git a/0013-Do-not-link-to-libsepol-or-libselinux.patch b/0013-Do-not-link-to-libsepol-or-libselinux.patch new file mode 100644 index 0000000..196732b --- /dev/null +++ b/0013-Do-not-link-to-libsepol-or-libselinux.patch @@ -0,0 +1,143 @@ +From 2a2e05f09be4dd350bc91747f03378e7c534265d Mon Sep 17 00:00:00 2001 +From: Petr Lautrbach +Date: Tue, 3 Nov 2020 15:06:34 +0100 +Subject: [PATCH] Do not link to libsepol or libselinux + +Given that there's no code which would use it there's no reason to link +to libsepol or libselinux even when they are available. + +Signed-off-by: Brian C. Lane +--- + AUTHORS | 8 ++++---- + configure.ac | 12 ------------ + libparted/Makefile.am | 1 - + parted.spec.in | 15 ++------------- + 4 files changed, 6 insertions(+), 30 deletions(-) + +diff --git a/AUTHORS b/AUTHORS +index 530a28b..8119934 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -72,7 +72,7 @@ Matthew Wilson + * Don't detect AIX physical volumes as msdos partition tables + * Code for manipulating AIX PVs + +-Martin von Lwis ++Martin von Löwis + * German translations + + Baty Jean-Marc +@@ -113,7 +113,7 @@ Ben Collins + * Sun disk label support (libparted/disk_sun.c) + * stubs for UFS + +-Vincent Stelh ++Vincent Stelhé + * move syntax patch (make END specification optional). Trivial + for copyright purposes (no disclaimer needed) + +@@ -132,7 +132,7 @@ Matt Domsch + Kjetil Torgrim Homme + * Norweigen translations + +-Jrgen Tegnr ++Jörgen Tegnér + * Swedish translations + + Keld Simonsen +@@ -153,7 +153,7 @@ Vicente E. Llorens + Yury Umanets + * basis of libparted/fs_reiserfs + +-Bernardo Joo Torres da Silveira ++Bernardo João Torres da Silveira + + * pt_BR translation of FAQ and parted.texi + +diff --git a/configure.ac b/configure.ac +index c46a3ff..ef78600 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -89,11 +89,6 @@ if test $ENABLE_DEVICE_MAPPER = yes; then + 1, [device mapper (libdevmapper) support]) + fi + +-AC_ARG_ENABLE([selinux], +- [ --enable-selinux enable SELinux support [default=no]], , +- enable_selinux=no +-) +- + AC_ARG_ENABLE([discover-only], + [ --enable-discover-only support only reading/probing [default=no]], , + enable_discover_only=no +@@ -320,13 +315,6 @@ package as well (it may be called device-mapper-devel or something similar).] + fi + AC_SUBST([DM_LIBS]) + +-dnl Check for SELinux +-SELINUX_LIBS="" +-if test "$enable_selinux" = yes; then +- SELINUX_LIBS="-lselinux -lsepol" +-fi +-AC_SUBST([SELINUX_LIBS]) +- + dnl Check for termcap + if test "$with_readline" = yes; then + OLD_LIBS="$LIBS" +diff --git a/libparted/Makefile.am b/libparted/Makefile.am +index bcdde77..e52aa2a 100644 +--- a/libparted/Makefile.am ++++ b/libparted/Makefile.am +@@ -55,7 +55,6 @@ libparted_la_LIBADD = \ + $(top_builddir)/lib/libgnulib.la \ + $(OS_LIBS) \ + $(DM_LIBS) \ +- $(SELINUX_LIBS) \ + $(LIB_BLKID) \ + $(UUID_LIBS) \ + $(INTLLIBS) +diff --git a/parted.spec.in b/parted.spec.in +index bdbe218..d0e2b11 100644 +--- a/parted.spec.in ++++ b/parted.spec.in +@@ -1,15 +1,9 @@ +-# Default to disabling device-mapper and SELinux ++# Default to disabling device-mapper + %define use_devmapper 0 +-%define use_selinux 0 +-%define use_sepol 0 + + # Enable device-mapper support if we find devmapper + %define use_devmapper %(pkg-config --libs devmapper >/dev/null 2>&1; [ $? -eq 0 ] && echo 1) + +-# Enable SELinux if we find libselinux and libsepol +-%define use_selinux %([ -r %{_libdir}/libselinux.a ] && echo 1) +-%define use_sepol %([ -r %{_libdir}/libsepol.so ] && echo 1) +- + Summary: The GNU disk partition manipulation program + Name: @PACKAGE@ + Version: @VERSION@ +@@ -22,7 +16,7 @@ Group: Applications/System + BuildRequires: e2fsprogs-devel readline-devel ncurses-devel gperf + BuildRequires: automake libtool gettext-devel texinfo pkgconfig + +-BuildRequires: device-mapper-devel, libselinux-devel libsepol-devel ++BuildRequires: device-mapper-devel + + Prereq: /sbin/install-info + +@@ -52,11 +46,6 @@ Parted library, you need to install this package. + --enable-device-mapper \ + %else + --disable-devmapper \ +-%endif +-%if "%{use_selinux}" == "1" && "%{use_sepol}" == "1" +- --enable-selinux \ +-%else +- --disable-selinux \ + %endif + --enable-part-static \ + --enable-pc98=no \ +-- +2.26.2 + diff --git a/parted.spec b/parted.spec index 13c77b5..637aeea 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -25,6 +25,7 @@ Patch0008: 0009-Add-support-for-the-F2FS-filesystem.patch Patch0009: 0010-tests-Add-f2fs-to-the-fs-probe-test.patch Patch0010: 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch Patch0011: 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch +Patch0012: 0013-Do-not-link-to-libsepol-or-libselinux.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -33,7 +34,6 @@ BuildRequires: ncurses-devel BuildRequires: gettext-devel BuildRequires: texinfo BuildRequires: device-mapper-devel -BuildRequires: libselinux-devel BuildRequires: libuuid-devel BuildRequires: libblkid-devel >= 2.17 BuildRequires: gnupg2 @@ -81,7 +81,7 @@ iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS autoreconf autoconf CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS -%configure --enable-selinux --disable-static --disable-gcc-warnings +%configure --disable-static --disable-gcc-warnings # Don't use rpath! %{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool %{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool @@ -129,6 +129,9 @@ make check %changelog +* Thu Nov 05 2020 Brian C. Lane - 3.3-7 +- Do not link to libselinux + * Fri Sep 25 2020 Brian C. Lane - 3.3-6 - tests: Add a test for resizepart on a busy partition (bcl) - parted: Preserve resizepart End when prompted for busy partition (bcl) From 633c371306f0da38c70879e948b612775032740a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 1 Dec 2020 09:27:24 -0800 Subject: [PATCH 12/60] - Add upstream commits to fix various gcc 10 warnings (bcl) --- ...dify-device-manage-support-detection.patch | 30 ++ ...-the-dmsetup-tests-to-use-ENABLE_DEV.patch | 59 +++ ...GCC-warning-Wunused-but-set-variable.patch | 51 +++ ...rnings-from-GCC-8-Wunused-variable-a.patch | 67 ++++ ...rnings-from-GCC-s-Wimplicit-fallthro.patch | 44 +++ ...d-a-GCC-warning-for-unused-functions.patch | 61 +++ ...rnings-from-GCC-8-Wsuggest-attribute.patch | 248 +++++++++++++ ...rnings-from-GCC-8-Wsuggest-attribute.patch | 104 ++++++ ...plaints-when-using-boot_code-pointer.patch | 41 ++ ...plaints-when-using-boot_code-pointer.patch | 25 ++ ...mplains-about-signed-sccanf-variable.patch | 38 ++ ...-Fix-unsigned-warning-in-duplicate.c.patch | 25 ++ ...-hfs-Fix-gcc-10-bounds-check-warning.patch | 41 ++ ...gcc-10-warnings-about-cast-alignment.patch | 74 ++++ ...ix-gcc-10-warnings-about-cast-alignm.patch | 75 ++++ ...gcc-10-warnings-about-cast-alignment.patch | 33 ++ ...gcc-10-warnings-about-cast-alignment.patch | 47 +++ ...gcc-10-warnings-about-cast-alignment.patch | 49 +++ ...gcc-10-warnings-about-cast-alignment.patch | 39 ++ ...gcc-10-warnings-about-cast-alignment.patch | 51 +++ ...ssert-Fix-incorrect-exception-option.patch | 27 ++ 0035-ui-Fix-command_line_get_disk_flag.patch | 27 ++ ...rning-about-snprintf-truncating-an-i.patch | 31 ++ ...gcc-10-warnings-about-cast-alignment.patch | 98 +++++ ...ix-gcc-10-warnings-about-cast-alignm.patch | 103 ++++++ 0039-fs-r-fat-Remove-disabled-code.patch | 350 ++++++++++++++++++ 0040-fs-r-hfs-Remove-disabled-code.patch | 228 ++++++++++++ 0041-libparted-Remove-disabled-code.patch | 108 ++++++ ...-GCC-warnings-suggesting-pure-for-PE.patch | 112 ++++++ parted.spec | 34 +- 30 files changed, 2319 insertions(+), 1 deletion(-) create mode 100644 0014-t6001-psep-modify-device-manage-support-detection.patch create mode 100644 0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch create mode 100644 0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch create mode 100644 0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch create mode 100644 0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch create mode 100644 0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch create mode 100644 0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch create mode 100644 0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch create mode 100644 0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch create mode 100644 0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch create mode 100644 0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch create mode 100644 0025-tests-Fix-unsigned-warning-in-duplicate.c.patch create mode 100644 0026-hfs-Fix-gcc-10-bounds-check-warning.patch create mode 100644 0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch create mode 100644 0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0034-ped_assert-Fix-incorrect-exception-option.patch create mode 100644 0035-ui-Fix-command_line_get_disk_flag.patch create mode 100644 0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch create mode 100644 0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch create mode 100644 0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch create mode 100644 0039-fs-r-fat-Remove-disabled-code.patch create mode 100644 0040-fs-r-hfs-Remove-disabled-code.patch create mode 100644 0041-libparted-Remove-disabled-code.patch create mode 100644 0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch diff --git a/0014-t6001-psep-modify-device-manage-support-detection.patch b/0014-t6001-psep-modify-device-manage-support-detection.patch new file mode 100644 index 0000000..cbadbae --- /dev/null +++ b/0014-t6001-psep-modify-device-manage-support-detection.patch @@ -0,0 +1,30 @@ +From 0eef2b04caad4a7b251ecf5e1c58ad33582da6e5 Mon Sep 17 00:00:00 2001 +From: Joe Slater +Date: Thu, 20 Jun 2019 14:33:04 -0700 +Subject: [PATCH 14/42] t6001-psep: modify device manage support detection + +Use the method other tests use -- test an environment variable. + +Signed-off-by: Joe Slater +Signed-off-by: Brian C. Lane +--- + tests/t6001-psep.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index e350bd2..73f2d1c 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -21,7 +21,8 @@ + require_root_ + require_udevadm_settle_ + +-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++test "x$ENABLE_DEVICE_MAPPER" = xyes \ ++ || skip_ "no device-mapper support" + + # Device maps names - should be random to not conflict with existing ones on + # the system +-- +2.26.2 + diff --git a/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch b/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch new file mode 100644 index 0000000..539b29d --- /dev/null +++ b/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch @@ -0,0 +1,59 @@ +From 04ca93351a4e25c35562ef705b3d96c3743609ff Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 25 Jun 2019 09:37:32 -0700 +Subject: [PATCH 15/42] tests: Update all the dmsetup tests to use + ENABLE_DEVICE_MAPPER + +--- + tests/t6004-dm-many-partitions.sh | 4 +++- + tests/t6005-dm-uuid.sh | 4 +++- + tests/t6006-dm-512b-sectors.sh | 3 ++- + 3 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh +index b4be975..636c837 100755 +--- a/tests/t6004-dm-many-partitions.sh ++++ b/tests/t6004-dm-many-partitions.sh +@@ -21,7 +21,9 @@ + + require_root_ + require_udevadm_settle_ +-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++test "x$ENABLE_DEVICE_MAPPER" = xyes \ ++ || skip_ "no device-mapper support" + + ss=$sector_size_ + ns=300 +diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh +index 4266747..790c23f 100755 +--- a/tests/t6005-dm-uuid.sh ++++ b/tests/t6005-dm-uuid.sh +@@ -21,7 +21,9 @@ + + require_root_ + require_udevadm_settle_ +-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++test "x$ENABLE_DEVICE_MAPPER" = xyes \ ++ || skip_ "no device-mapper support" + + ss=$sector_size_ + ns=300 +diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh +index bf32135..c0de382 100644 +--- a/tests/t6006-dm-512b-sectors.sh ++++ b/tests/t6006-dm-512b-sectors.sh +@@ -25,7 +25,8 @@ require_scsi_debug_module_ + grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || + skip_ 'this system lacks a new-enough libblkid' + +-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++test "x$ENABLE_DEVICE_MAPPER" = xyes \ ++ || skip_ "no device-mapper support" + + # Device maps names - should be random to not conflict with existing ones on + # the system +-- +2.26.2 + diff --git a/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch b/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch new file mode 100644 index 0000000..6edef57 --- /dev/null +++ b/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch @@ -0,0 +1,51 @@ +From f75af2cfbbd1a2d82ed3df4955014f73737ae13e Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:18 +0900 +Subject: [PATCH 16/42] libparted: Fix a GCC warning -Wunused-but-set-variable + +GCC warns that a variable 'prealloc' defined for _generic_affs_probe() in +fs/amiga/affs.c is set but its value is never used. + + CC amiga/affs.lo +amiga/affs.c: In function '_generic_affs_probe': +amiga/affs.c:54:35: warning: variable 'prealloc' set but not used [-Wunused-but-set-variable] + 54 | int blocksize = 1, reserved = 2, prealloc = 0; + | ^~~~~~~~ +Remove the variable for simplicity and to avoid the warning. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/amiga/affs.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/libparted/fs/amiga/affs.c b/libparted/fs/amiga/affs.c +index 1fde17c..e7c2e47 100644 +--- a/libparted/fs/amiga/affs.c ++++ b/libparted/fs/amiga/affs.c +@@ -52,20 +52,19 @@ _generic_affs_probe (PedGeometry* geom, uint32_t kind) + uint32_t *block; + PedSector root, len, pos; + struct PartitionBlock * part; +- int blocksize = 1, reserved = 2, prealloc = 0; ++ int blocksize = 1, reserved = 2; + + PED_ASSERT (geom != NULL); + PED_ASSERT (geom->dev != NULL); + if (geom->dev->sector_size != 512) + return NULL; +- /* Finds the blocksize, prealloc and reserved values of the partition block */ ++ /* Finds the blocksize and reserved values of the partition block */ + if (!(part = ped_malloc (PED_SECTOR_SIZE_DEFAULT*blocksize))) { + ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, + _("%s : Failed to allocate partition block\n"), __func__); + goto error_part; + } + if (amiga_find_part(geom, part) != NULL) { +- prealloc = PED_BE32_TO_CPU (part->de_PreAlloc); + reserved = PED_BE32_TO_CPU (part->de_Reserved); + reserved = reserved == 0 ? 1 : reserved; + blocksize = PED_BE32_TO_CPU (part->de_SizeBlock) +-- +2.26.2 + diff --git a/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch b/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch new file mode 100644 index 0000000..51278e6 --- /dev/null +++ b/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch @@ -0,0 +1,67 @@ +From d51921b05c32287238b1b0447d7e952884f63eb5 Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:19 +0900 +Subject: [PATCH 17/42] libparted: Fix warnings from GCC 8 -Wunused-variable + and -Warray-bounds + +GCC 8 reports two warnings as follows. + +r/fat/bootsector.c: In function 'fat_boot_sector_set_boot_code': +r/fat/bootsector.c:274:15: warning: unused variable 'fs_info' [-Wunused-variable] + FatSpecific* fs_info = FAT_SPECIFIC (fs); + ^~~~~~~ +In function 'memcpy', + inlined from 'fat_boot_sector_set_boot_code' at r/fat/bootsector.c:283:2: +/usr/include/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' forming offset [126, 128] is out of the bounds [0, 125] [-Warray-bounds] + return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To avoid the warnings, remove the unused variable. Use strcpy in place of +memcpy checking copy length. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/r/fat/bootsector.c | 5 ++--- + libparted/fs/r/fat/bootsector.h | 2 -- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c +index 46d5926..9130900 100644 +--- a/libparted/fs/r/fat/bootsector.c ++++ b/libparted/fs/r/fat/bootsector.c +@@ -271,8 +271,6 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs) + int + fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs) + { +- FatSpecific* fs_info = FAT_SPECIFIC (fs); +- + PED_ASSERT (bsp != NULL); + *bsp = ped_malloc (fs->geom->dev->sector_size); + FatBootSector *bs = *bsp; +@@ -280,7 +278,8 @@ fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs) + + memset (bs, 0, 512); + memcpy (bs->boot_jump, FAT_BOOT_JUMP, 3); +- memcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE, FAT_BOOT_CODE_LENGTH); ++ PED_ASSERT (sizeof(FAT_BOOT_CODE) < sizeof(bs->u.fat32.boot_code)); ++ strcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE); + return 1; + } + +diff --git a/libparted/fs/r/fat/bootsector.h b/libparted/fs/r/fat/bootsector.h +index 6b0363f..42fc3f2 100644 +--- a/libparted/fs/r/fat/bootsector.h ++++ b/libparted/fs/r/fat/bootsector.h +@@ -57,8 +57,6 @@ typedef struct _FatInfoSector FatInfoSector; + /* message: */ \ + FAT_BOOT_MESSAGE + +-#define FAT_BOOT_CODE_LENGTH 128 +- + struct __attribute__ ((packed)) _FatBootSector { + uint8_t boot_jump[3]; /* 00: Boot strap short or near jump */ + uint8_t system_id[8]; /* 03: system name */ +-- +2.26.2 + diff --git a/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch b/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch new file mode 100644 index 0000000..739cbb1 --- /dev/null +++ b/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch @@ -0,0 +1,44 @@ +From 5449d1b1ee763e8ae1057fb7d18f7fbccb7a6fe0 Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:17 +0900 +Subject: [PATCH 18/42] libparted: Fix warnings from GCC's + -Wimplicit-fallthrough + +Two case statements have intentional fall-throughs but do not have +comments to note it. GCC detects and warns those case statements. To +avoid the warning, add fall-through comments. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/amiga/amiga.c | 1 + + libparted/fs/r/hfs/reloc.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/libparted/fs/amiga/amiga.c b/libparted/fs/amiga/amiga.c +index be10dae..eb63f24 100644 +--- a/libparted/fs/amiga/amiga.c ++++ b/libparted/fs/amiga/amiga.c +@@ -217,6 +217,7 @@ _amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block, stru + return NULL; + } + } ++ /* FALLTHROUGH */ + case PED_EXCEPTION_IGNORE : + case PED_EXCEPTION_UNHANDLED : + default : +diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c +index 0b8ddc1..d0477ae 100644 +--- a/libparted/fs/r/hfs/reloc.c ++++ b/libparted/fs/r/hfs/reloc.c +@@ -224,6 +224,7 @@ hfs_do_move (PedFileSystem* fs, unsigned int *ptr_src, + priv_data->catalog_file + ->cache[ref->ref_index].start_block = + PED_CPU_TO_BE16(new_start); ++ /* FALLTHROUGH */ + case CR_BTREE_EXT_0 : + file = priv_data->extent_file; + goto CR_BTREE; +-- +2.26.2 + diff --git a/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch b/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch new file mode 100644 index 0000000..3e0af16 --- /dev/null +++ b/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch @@ -0,0 +1,61 @@ +From bed9c6a17ee82c87bf47981149e224f2e34baedb Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:23 +0900 +Subject: [PATCH 19/42] libparted: Avoid a GCC warning for unused functions + +libparted/fs/r/hfs/hfs.c has a '#if 0' block. The block refers two +functions hfsplus_clobber() and hfs_clobber(). It have GCC report a +warning below. + + CC r/hfs/hfs.lo +r/hfs/hfs.c:343:1: warning: 'hfsplus_clobber' defined but not used [-Wunused-function] + 343 | hfsplus_clobber (PedGeometry* geom) + | ^~~~~~~~~~~~~~~ + +To avoid the warning, add two more '#if 0' to disable the two functions. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/r/hfs/hfs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c +index 6be0390..0aababd 100644 +--- a/libparted/fs/r/hfs/hfs.c ++++ b/libparted/fs/r/hfs/hfs.c +@@ -59,6 +59,7 @@ static PedFileSystemType hfsplus_type; + + /* ----- HFS ----- */ + ++#if 0 + /* This is a very unundoable operation */ + /* Maybe I shouldn't touch the alternate MDB ? */ + /* Anyway clobber is call before other fs creation */ +@@ -78,6 +79,7 @@ hfs_clobber (PedGeometry* geom) + (!!ped_geometry_write (geom, buf, geom->length - 1, 1)) & + (!!ped_geometry_sync (geom)); + } ++#endif + + PedFileSystem * + hfs_open (PedGeometry* geom) +@@ -339,6 +341,7 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) + #include "reloc_plus.h" + #include "journal.h" + ++#if 0 + static int + hfsplus_clobber (PedGeometry* geom) + { +@@ -374,6 +377,7 @@ hfsplus_clobber (PedGeometry* geom) + /* non-embedded or envelop destroy as hfs */ + return ( hfs_clobber (geom) && i ); + } ++#endif + + int + hfsplus_close (PedFileSystem *fs) +-- +2.26.2 + diff --git a/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch b/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch new file mode 100644 index 0000000..60c7900 --- /dev/null +++ b/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch @@ -0,0 +1,248 @@ +From 20c136159b37f11822b591941c077bb2be6ede05 Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:21 +0900 +Subject: [PATCH 20/42] libparted: Fix warnings from GCC 8 + -Wsuggest-attribute=pure + +As GCC 8 suggests, add 'pure' attribute to 17 functions. After adding +pure attributes, GCC suggested three more functions to add pure +attributes. Add pure attribute to those functions also. In total, add +pure attributes to 20 functions. + +I read code of the functions and confirmed the 20 functions are pure: +they have no effect except the return value, and their return value +depend only on the parameters and/or global variables. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/fat/bootsector.c | 2 +- + libparted/fs/r/fat/bootsector.c | 2 +- + libparted/fs/r/fat/calc.c | 4 ++-- + libparted/fs/r/fat/context.c | 4 ++-- + libparted/fs/r/fat/count.c | 4 ++-- + libparted/fs/r/fat/table.c | 2 +- + libparted/fs/r/fat/traverse.c | 14 +++++++------- + libparted/fs/r/hfs/advfs.c | 4 ++-- + libparted/fs/r/hfs/advfs_plus.c | 4 ++-- + 9 files changed, 20 insertions(+), 20 deletions(-) + +diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c +index 0c3ae77..2a03696 100644 +--- a/libparted/fs/fat/bootsector.c ++++ b/libparted/fs/fat/bootsector.c +@@ -86,7 +86,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom) + /* + Don't trust the FAT12, FAT16 or FAT32 label string. + */ +-FatType ++FatType _GL_ATTRIBUTE_PURE + fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom) + { + PedSector logical_sector_size; +diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c +index 9130900..34134cc 100644 +--- a/libparted/fs/r/fat/bootsector.c ++++ b/libparted/fs/r/fat/bootsector.c +@@ -85,7 +85,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom) + /* + Don't trust the FAT12, FAT16 or FAT32 label string. + */ +-FatType ++FatType _GL_ATTRIBUTE_PURE + fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom) + { + PedSector logical_sector_size; +diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c +index e524007..60c6bac 100644 +--- a/libparted/fs/r/fat/calc.c ++++ b/libparted/fs/r/fat/calc.c +@@ -314,7 +314,7 @@ fat_calc_resize_sizes ( + friends, to allow room for this space. If too much of this space is left + over, everyone will complain, so we have to be greedy, and use it all up... + */ +-PedSector ++PedSector _GL_ATTRIBUTE_PURE + fat_calc_align_sectors (const PedFileSystem* new_fs, + const PedFileSystem* old_fs) + { +@@ -359,7 +359,7 @@ fat_calc_align_sectors (const PedFileSystem* new_fs, + return align; + } + +-int ++int _GL_ATTRIBUTE_PURE + fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +diff --git a/libparted/fs/r/fat/context.c b/libparted/fs/r/fat/context.c +index 5c27d09..170094c 100644 +--- a/libparted/fs/r/fat/context.c ++++ b/libparted/fs/r/fat/context.c +@@ -124,7 +124,7 @@ fat_op_context_destroy (FatOpContext* ctx) + free (ctx); + } + +-FatFragment ++FatFragment _GL_ATTRIBUTE_PURE + fat_op_context_map_static_fragment (const FatOpContext* ctx, FatFragment frag) + { + FatSpecific* new_fs_info = FAT_SPECIFIC (ctx->new_fs); +@@ -160,7 +160,7 @@ fat_op_context_map_static_cluster (const FatOpContext* ctx, FatCluster clst) + return 0; + } + +-FatFragment ++FatFragment _GL_ATTRIBUTE_PURE + fat_op_context_map_fragment (const FatOpContext* ctx, FatFragment frag) + { + return ctx->remap [frag]; +diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c +index 250e80d..2b65e72 100644 +--- a/libparted/fs/r/fat/count.c ++++ b/libparted/fs/r/fat/count.c +@@ -338,7 +338,7 @@ fat_collect_cluster_info (PedFileSystem* fs) { + return 1; + } + +-FatClusterFlag ++FatClusterFlag _GL_ATTRIBUTE_PURE + fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -346,7 +346,7 @@ fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster) + return fs_info->cluster_info [cluster].flag; + } + +-PedSector ++PedSector _GL_ATTRIBUTE_PURE + fat_get_cluster_usage (PedFileSystem* fs, FatCluster cluster) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c +index fe8e040..98b0499 100644 +--- a/libparted/fs/r/fat/table.c ++++ b/libparted/fs/r/fat/table.c +@@ -371,7 +371,7 @@ fat_table_is_bad (const FatTable* ft, FatCluster cluster) + /* + returns true if represents an EOF marker + */ +-int ++int _GL_ATTRIBUTE_PURE + fat_table_is_eof (const FatTable* ft, FatCluster cluster) + { + return _test_code_eof (ft, cluster); +diff --git a/libparted/fs/r/fat/traverse.c b/libparted/fs/r/fat/traverse.c +index fc8a795..50b94bd 100644 +--- a/libparted/fs/r/fat/traverse.c ++++ b/libparted/fs/r/fat/traverse.c +@@ -31,7 +31,7 @@ + + static char tmp_buffer [4096]; + +-int ++int _GL_ATTRIBUTE_PURE + fat_traverse_entries_per_buffer (FatTraverseInfo* trav_info) + { + return trav_info->buffer_size / sizeof (FatDirEntry); +@@ -226,7 +226,7 @@ fat_traverse_next_dir_entry (FatTraverseInfo *trav_info) + return trav_info->dir_entries + trav_info->current_entry; + } + +-FatCluster ++FatCluster _GL_ATTRIBUTE_PURE + fat_dir_entry_get_first_cluster (FatDirEntry* dir_entry, PedFileSystem *fs) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -269,7 +269,7 @@ fat_dir_entry_set_first_cluster (FatDirEntry* dir_entry, PedFileSystem* fs, + } + } + +-uint32_t ++uint32_t _GL_ATTRIBUTE_PURE + fat_dir_entry_get_length (FatDirEntry* dir_entry) + { + return PED_LE32_TO_CPU (dir_entry->length); +@@ -284,7 +284,7 @@ fat_dir_entry_is_null_term (const FatDirEntry* dir_entry) + return memcmp (&null_entry, dir_entry, sizeof (null_entry)) == 0; + } + +-int ++int _GL_ATTRIBUTE_PURE + fat_dir_entry_is_active (FatDirEntry* dir_entry) + { + if ((unsigned char) dir_entry->name[0] == DELETED_FLAG) return 0; +@@ -293,7 +293,7 @@ fat_dir_entry_is_active (FatDirEntry* dir_entry) + return 1; + } + +-int ++int _GL_ATTRIBUTE_PURE + fat_dir_entry_is_file (FatDirEntry* dir_entry) { + if (dir_entry->attributes == VFAT_ATTR) return 0; + if (dir_entry->attributes & VOLUME_LABEL_ATTR) return 0; +@@ -302,7 +302,7 @@ fat_dir_entry_is_file (FatDirEntry* dir_entry) { + return 1; + } + +-int ++int _GL_ATTRIBUTE_PURE + fat_dir_entry_is_system_file (FatDirEntry* dir_entry) + { + if (!fat_dir_entry_is_file (dir_entry)) return 0; +@@ -310,7 +310,7 @@ fat_dir_entry_is_system_file (FatDirEntry* dir_entry) + || (dir_entry->attributes & HIDDEN_ATTR); + } + +-int ++int _GL_ATTRIBUTE_PURE + fat_dir_entry_is_directory (FatDirEntry* dir_entry) + { + if (dir_entry->attributes == VFAT_ATTR) return 0; +diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c +index d0afa30..0a39960 100644 +--- a/libparted/fs/r/hfs/advfs.c ++++ b/libparted/fs/r/hfs/advfs.c +@@ -239,7 +239,7 @@ errbb: hfs_free_bad_blocks_list(priv_data->bad_blocks_xtent_list); + } + + /* This function check if fblock is a bad block */ +-int ++int _GL_ATTRIBUTE_PURE + hfs_is_bad_block (const PedFileSystem *fs, unsigned int fblock) + { + HfsPrivateFSData* priv_data = (HfsPrivateFSData*) +@@ -304,7 +304,7 @@ hfs_get_empty_end (const PedFileSystem *fs) + + /* return the block which should be used to pack data to have at + least free fblock blocks at the end of the volume */ +-unsigned int ++unsigned int _GL_ATTRIBUTE_PURE + hfs_find_start_pack (const PedFileSystem *fs, unsigned int fblock) + { + HfsPrivateFSData* priv_data = (HfsPrivateFSData*) +diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c +index 5453c25..2b6fd87 100644 +--- a/libparted/fs/r/hfs/advfs_plus.c ++++ b/libparted/fs/r/hfs/advfs_plus.c +@@ -247,7 +247,7 @@ errbbp: hfsplus_free_bad_blocks_list(priv_data->bad_blocks_xtent_list); + } + + /* This function check if fblock is a bad block */ +-int ++int _GL_ATTRIBUTE_PURE + hfsplus_is_bad_block (const PedFileSystem *fs, unsigned int fblock) + { + HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*) +@@ -358,7 +358,7 @@ hfsplus_get_min_size (const PedFileSystem *fs) + + /* return the block which should be used to pack data to have + at least free fblock blocks at the end of the volume */ +-unsigned int ++unsigned int _GL_ATTRIBUTE_PURE + hfsplus_find_start_pack (const PedFileSystem *fs, unsigned int fblock) + { + HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*) +-- +2.26.2 + diff --git a/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch b/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch new file mode 100644 index 0000000..8951e18 --- /dev/null +++ b/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch @@ -0,0 +1,104 @@ +From 34347779d3235186a68a040d3f3166ff45e65dac Mon Sep 17 00:00:00 2001 +From: Shin'ichiro Kawasaki +Date: Wed, 14 Aug 2019 10:59:20 +0900 +Subject: [PATCH 21/42] libparted: Fix warnings from GCC 8 + -Wsuggest-attribute=const + +As GCC 8 suggests, add 'const' attribute to six functions. After adding +const attributes, GCC suggested two more functions to add const +attributes. Add const attributes to those functions also. In total, add +const attributes to 8 functions. + +I read code of the functions and confirmed they are const: they examine +only their arguments and have no effect other than return value. + +Signed-off-by: Shin'ichiro Kawasaki +Signed-off-by: Brian C. Lane +--- + libparted/fs/r/fat/calc.c | 14 +++++++------- + libparted/fs/r/fat/table.c | 2 +- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c +index 60c6bac..18e0455 100644 +--- a/libparted/fs/r/fat/calc.c ++++ b/libparted/fs/r/fat/calc.c +@@ -23,7 +23,7 @@ + #ifndef DISCOVER_ONLY + + /* returns the minimum size of clusters for a given file system type */ +-PedSector ++PedSector _GL_ATTRIBUTE_CONST + fat_min_cluster_size (FatType fat_type) { + switch (fat_type) { + case FAT_TYPE_FAT12: return 1; +@@ -33,7 +33,7 @@ fat_min_cluster_size (FatType fat_type) { + return 0; + } + +-static PedSector ++static PedSector _GL_ATTRIBUTE_CONST + _smallest_power2_over (PedSector ceiling) + { + PedSector result = 1; +@@ -45,7 +45,7 @@ _smallest_power2_over (PedSector ceiling) + } + + /* returns the minimum size of clusters for a given file system type */ +-PedSector ++PedSector _GL_ATTRIBUTE_CONST + fat_recommend_min_cluster_size (FatType fat_type, PedSector size) { + switch (fat_type) { + case FAT_TYPE_FAT12: return 1; +@@ -59,7 +59,7 @@ fat_recommend_min_cluster_size (FatType fat_type, PedSector size) { + } + + /* returns the maxmimum size of clusters for a given file system type */ +-PedSector ++PedSector _GL_ATTRIBUTE_CONST + fat_max_cluster_size (FatType fat_type) { + switch (fat_type) { + case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */ +@@ -70,7 +70,7 @@ fat_max_cluster_size (FatType fat_type) { + } + + /* returns the minimum number of clusters for a given file system type */ +-FatCluster ++FatCluster _GL_ATTRIBUTE_CONST + fat_min_cluster_count (FatType fat_type) { + switch (fat_type) { + case FAT_TYPE_FAT12: +@@ -83,7 +83,7 @@ fat_min_cluster_count (FatType fat_type) { + } + + /* returns the maximum number of clusters for a given file system type */ +-FatCluster ++FatCluster _GL_ATTRIBUTE_CONST + fat_max_cluster_count (FatType fat_type) { + switch (fat_type) { + case FAT_TYPE_FAT12: return 0xff0; +@@ -94,7 +94,7 @@ fat_max_cluster_count (FatType fat_type) { + } + + /* what is this supposed to be? What drugs are M$ on? (Can I have some? :-) */ +-PedSector ++PedSector _GL_ATTRIBUTE_CONST + fat_min_reserved_sector_count (FatType fat_type) + { + return (fat_type == FAT_TYPE_FAT32) ? 32 : 1; +diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c +index 98b0499..394a519 100644 +--- a/libparted/fs/r/fat/table.c ++++ b/libparted/fs/r/fat/table.c +@@ -462,7 +462,7 @@ fat_table_set_avail (FatTable* ft, FatCluster cluster) + + #endif /* !DISCOVER_ONLY */ + +-int ++int _GL_ATTRIBUTE_CONST + fat_table_entry_size (FatType fat_type) + { + switch (fat_type) { +-- +2.26.2 + diff --git a/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch b/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch new file mode 100644 index 0000000..822ce58 --- /dev/null +++ b/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch @@ -0,0 +1,41 @@ +From b11bbb5a0b5c357816bff424c2a325806d60f20b Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 9 Nov 2020 14:33:37 -0800 +Subject: [PATCH 22/42] bsd: Fix gcc complaints when using boot_code pointer + +--- + libparted/labels/bsd.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c +index 6946563..8483641 100644 +--- a/libparted/labels/bsd.c ++++ b/libparted/labels/bsd.c +@@ -307,19 +307,16 @@ error: + static void + _probe_and_add_boot_code (const PedDisk* disk) + { +- char *old_boot_code; +- BSDRawLabel *old_label; ++ BSDDiskData *old_data; + + void *s0; + if (!ptt_read_sector (disk->dev, 0, &s0)) + return; +- old_boot_code = ((BSDDiskData*) s0)->boot_code; +- old_label = &((BSDDiskData*) s0)->label; +- +- if (old_boot_code [0] +- && old_label->d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { ++ old_data = (BSDDiskData*) s0; ++ if (old_data->boot_code [0] ++ && old_data->label.d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { + BSDDiskData *bsd_specific = (BSDDiskData*) disk->disk_specific; +- memcpy (bsd_specific, old_boot_code, sizeof (BSDDiskData)); ++ memcpy (bsd_specific, old_data, sizeof (BSDDiskData)); + } + free (s0); + } +-- +2.26.2 + diff --git a/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch b/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch new file mode 100644 index 0000000..9f97c6f --- /dev/null +++ b/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch @@ -0,0 +1,25 @@ +From 1ff56b03ec960435d55e200300093581ba874d53 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 9 Nov 2020 15:09:07 -0800 +Subject: [PATCH 23/42] dos: Fix gcc complaints when using boot_code pointer + +--- + libparted/labels/dos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c +index d859b33..bfa253b 100644 +--- a/libparted/labels/dos.c ++++ b/libparted/labels/dos.c +@@ -1291,7 +1291,7 @@ msdos_write (const PedDisk* disk) + DosRawTable *table = (DosRawTable *) s0; + + if (!table->boot_code[0]) { +- memset (table->boot_code, 0, 512); ++ memset (table, 0, 512); + memcpy (table->boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE)); + } + +-- +2.26.2 + diff --git a/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch b/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch new file mode 100644 index 0000000..f95b520 --- /dev/null +++ b/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch @@ -0,0 +1,38 @@ +From c3e648518235e1f77ca496c1234459e4bac300ad Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 9 Nov 2020 15:16:22 -0800 +Subject: [PATCH 24/42] linux: Fix gcc complains about signed sccanf variables + +--- + libparted/arch/linux.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 09ec781..4c17720 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -720,9 +720,9 @@ _get_linux_version () + static int kver = -1; + + struct utsname uts; +- int major = 0; +- int minor = 0; +- int teeny = 0; ++ unsigned int major = 0; ++ unsigned int minor = 0; ++ unsigned int teeny = 0; + + if (kver != -1) + return kver; +@@ -2884,7 +2884,7 @@ _dm_get_partition_start_and_length(PedPartition const *part, + char *params; + char *target_type; + dm_get_next_target(task, NULL, (uint64_t *)start, (uint64_t *)length, &target_type, ¶ms); +- if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3) ++ if (sscanf (params, "%d:%d %Lu", &major, &minor, start) != 3) + goto err; + rc = 1; + +-- +2.26.2 + diff --git a/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch b/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch new file mode 100644 index 0000000..44c3c04 --- /dev/null +++ b/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch @@ -0,0 +1,25 @@ +From 09fb0fc6dadde9982d243567cf92743149895102 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 9 Nov 2020 15:53:30 -0800 +Subject: [PATCH 25/42] tests: Fix unsigned warning in duplicate.c + +--- + tests/duplicate.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/duplicate.c b/tests/duplicate.c +index a9dde84..771faab 100644 +--- a/tests/duplicate.c ++++ b/tests/duplicate.c +@@ -134,7 +134,7 @@ main (int argc, char **argv) + { + if (!ped_partition_is_flag_available(disk_part, flag)) + continue; +- fprintf (stderr, "Checking partition flag %d\n", flag); ++ fprintf (stderr, "Checking partition flag %u\n", flag); + fprintf (stderr, "%d ? %d\n", ped_partition_get_flag (disk_part, flag), + ped_partition_get_flag (copy_part, flag)); + assert (ped_partition_get_flag (disk_part, flag) +-- +2.26.2 + diff --git a/0026-hfs-Fix-gcc-10-bounds-check-warning.patch b/0026-hfs-Fix-gcc-10-bounds-check-warning.patch new file mode 100644 index 0000000..f80873b --- /dev/null +++ b/0026-hfs-Fix-gcc-10-bounds-check-warning.patch @@ -0,0 +1,41 @@ +From b7ccc1b29674937ab4c97d0e1b7b5bfd6f366b92 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Nov 2020 15:42:46 -0800 +Subject: [PATCH 26/42] hfs: Fix gcc 10 bounds check warning + +binfo is actually a list of structs that cannot be known until runtime, +so use a variable length array. +--- + libparted/fs/hfs/hfs.h | 2 +- + libparted/fs/r/hfs/hfs.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libparted/fs/hfs/hfs.h b/libparted/fs/hfs/hfs.h +index 4fa2e95..0a9392a 100644 +--- a/libparted/fs/hfs/hfs.h ++++ b/libparted/fs/hfs/hfs.h +@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader { + uint32_t bytes_used; + uint32_t checksum; + uint32_t pad; +- HfsJBlockInfo binfo[1]; ++ HfsJBlockInfo binfo[]; + }; + typedef struct _HfsJBlockListHeader HfsJBlockListHeader; + +diff --git a/libparted/fs/r/hfs/hfs.h b/libparted/fs/r/hfs/hfs.h +index 4fa2e95..0a9392a 100644 +--- a/libparted/fs/r/hfs/hfs.h ++++ b/libparted/fs/r/hfs/hfs.h +@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader { + uint32_t bytes_used; + uint32_t checksum; + uint32_t pad; +- HfsJBlockInfo binfo[1]; ++ HfsJBlockInfo binfo[]; + }; + typedef struct _HfsJBlockListHeader HfsJBlockListHeader; + +-- +2.26.2 + diff --git a/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..dd00068 --- /dev/null +++ b/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,74 @@ +From 868fab2fea9ad6422b2ee9b3c1ab9e69d5a4f9a7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Nov 2020 16:15:49 -0800 +Subject: [PATCH 27/42] hfs/advfs: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/r/hfs/advfs.c | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c +index 0a39960..1ce4319 100644 +--- a/libparted/fs/r/hfs/advfs.c ++++ b/libparted/fs/r/hfs/advfs.c +@@ -87,12 +87,14 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, + HfsPrivateGenericKey* record_key = NULL; + unsigned int node_number, record_number; + int i; ++ uint16_t record_pos; + + /* Read the header node */ + if (!hfs_file_read_sector(b_tree_file, node, 0)) + return 0; +- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(PED_SECTOR_SIZE_DEFAULT-2)))))); ++ uint16_t offset; ++ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); ++ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); + + /* Get the node number of the root */ + node_number = PED_BE32_TO_CPU(header->root_node); +@@ -107,13 +109,13 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, + while (1) { + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = record_number; i; i--) { +- record_key = (HfsPrivateGenericKey*) +- (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); ++ uint16_t value; ++ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); ++ record_pos = PED_BE16_TO_CPU(value); ++ record_key = (HfsPrivateGenericKey*) (node + record_pos); + /* check for obvious error in FS */ +- if (((uint8_t*)record_key - node < HFS_FIRST_REC) +- || ((uint8_t*)record_key - node +- >= PED_SECTOR_SIZE_DEFAULT ++ if ((record_pos< HFS_FIRST_REC) ++ || (record_pos>= PED_SECTOR_SIZE_DEFAULT + - 2 * (signed)(record_number+1))) { + ped_exception_throw ( + PED_EXCEPTION_ERROR, +@@ -129,8 +131,9 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, + unsigned int skip; + + skip = (1 + record_key->key_length + 1) & ~1; +- node_number = PED_BE32_TO_CPU (*((uint32_t *) +- (((uint8_t *) record_key) + skip))); ++ uint32_t value; ++ memcpy(&value, node+record_pos+skip, sizeof(uint32_t)); ++ node_number = PED_BE32_TO_CPU(value); + if (!hfs_file_read_sector(b_tree_file, node, + node_number)) + return 0; +@@ -146,7 +149,7 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, + if (record_ref) { + record_ref->node_size = 1; /* in sectors */ + record_ref->node_number = node_number; +- record_ref->record_pos = (uint8_t*)record_key - node; ++ record_ref->record_pos = record_pos; + record_ref->record_number = i; + } + +-- +2.26.2 + diff --git a/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch b/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch new file mode 100644 index 0000000..f39c720 --- /dev/null +++ b/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch @@ -0,0 +1,75 @@ +From 6cb1ed79543f9a9425de2b334a41e08836edc6b8 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Nov 2020 17:05:59 -0800 +Subject: [PATCH 28/42] hfs/advfs_plus: Fix gcc 10 warnings about cast + alignment + +--- + libparted/fs/r/hfs/advfs_plus.c | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c +index 2b6fd87..2141746 100644 +--- a/libparted/fs/r/hfs/advfs_plus.c ++++ b/libparted/fs/r/hfs/advfs_plus.c +@@ -80,6 +80,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, + HfsPPrivateGenericKey* record_key = NULL; + unsigned int node_number, record_number, size, bsize; + int i; ++ uint16_t record_pos; + + /* Read the header node */ + if (!hfsplus_file_read_sector(b_tree_file, node_1, 0)) +@@ -93,7 +94,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, + + /* Get the size of a node in sectors and allocate buffer */ + size = (bsize = PED_BE16_TO_CPU (header->node_size)) / PED_SECTOR_SIZE_DEFAULT; +- node = (uint8_t*) ped_malloc (bsize); ++ node = ped_malloc (bsize); + if (!node) + return 0; + HfsPNodeDescriptor *desc = (HfsPNodeDescriptor*) node; +@@ -107,13 +108,13 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, + while (1) { + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = record_number; i; i--) { +- record_key = (HfsPPrivateGenericKey*) +- (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(bsize - 2*i))))); ++ uint16_t value; ++ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); ++ record_pos = PED_BE16_TO_CPU(value); ++ record_key = (HfsPPrivateGenericKey*) (node + record_pos); + /* check for obvious error in FS */ +- if (((uint8_t*)record_key - node < HFS_FIRST_REC) +- || ((uint8_t*)record_key - node +- >= (signed)bsize ++ if ((record_pos < HFS_FIRST_REC) ++ || (record_pos >= (signed)bsize + - 2 * (signed)(record_number+1))) { + ped_exception_throw ( + PED_EXCEPTION_ERROR, +@@ -131,8 +132,9 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, + + skip = ( 2 + PED_BE16_TO_CPU (record_key->key_length) + + 1 ) & ~1; +- node_number = PED_BE32_TO_CPU (*((uint32_t *) +- (((uint8_t *) record_key) + skip))); ++ uint32_t value; ++ memcpy(&value, node+record_pos+skip, sizeof(uint32_t)); ++ node_number = PED_BE32_TO_CPU(value); + if (!hfsplus_file_read(b_tree_file, node, + (PedSector) node_number * size, + size)) { +@@ -151,7 +153,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, + if (record_ref) { + record_ref->node_size = size; /* in sectors */ + record_ref->node_number = node_number; +- record_ref->record_pos = (uint8_t*)record_key - node; ++ record_ref->record_pos = record_pos; + record_ref->record_number = i; + } + +-- +2.26.2 + diff --git a/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..cde8032 --- /dev/null +++ b/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,33 @@ +From 006ad756c70603212309157fa05c5d855e25f07e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 13:33:36 -0800 +Subject: [PATCH 29/42] hfs/hfs: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/r/hfs/hfs.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c +index 0aababd..09899da 100644 +--- a/libparted/fs/r/hfs/hfs.c ++++ b/libparted/fs/r/hfs/hfs.c +@@ -891,12 +891,11 @@ hfsplus_wrapper_update (PedFileSystem* fs) + ref.record_number = 1; + } + +- ref.record_pos = +- PED_BE16_TO_CPU (*((uint16_t *) +- (node + (PED_SECTOR_SIZE_DEFAULT +- - 2*ref.record_number)))); ++ uint16_t value; ++ memcpy(&value, node+PED_SECTOR_SIZE_DEFAULT - (2*ref.record_number), sizeof(uint16_t)); ++ ref.record_pos = PED_BE16_TO_CPU(value); + ret_key = (HfsExtentKey*) (node + ref.record_pos); +- ret_data = (HfsExtDescriptor*) ( node + ref.record_pos ++ ret_data = (HfsExtDescriptor*) (node + ref.record_pos + + sizeof (HfsExtentKey) ); + } + +-- +2.26.2 + diff --git a/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch b/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..05ff94c --- /dev/null +++ b/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,47 @@ +From 1e086dba260630b63e0822731522ce04c081d95e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Nov 2020 14:39:06 -0800 +Subject: [PATCH 30/42] ext2: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/ext2/ext2_fs.h | 2 +- + libparted/fs/ext2/interface.c | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h +index ac1b6a0..362f8bc 100644 +--- a/libparted/fs/ext2/ext2_fs.h ++++ b/libparted/fs/ext2/ext2_fs.h +@@ -173,7 +173,7 @@ struct ext2_inode + + #define i_size_high i_dir_acl + +-struct ext2_super_block ++struct __attribute__ ((packed)) ext2_super_block + { + uint32_t s_inodes_count; /* Inodes count */ + uint32_t s_blocks_count; /* Blocks count */ +diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c +index a49568b..01c224e 100644 +--- a/libparted/fs/ext2/interface.c ++++ b/libparted/fs/ext2/interface.c +@@ -33,12 +33,13 @@ struct ext2_dev_handle* ext2_make_dev_handle_from_parted_geometry(PedGeometry* g + static PedGeometry* + _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver) + { ++ struct ext2_super_block *sb; + const int sectors = (4096 + geom->dev->sector_size - 1) / + geom->dev->sector_size; +- char *sb_v = alloca (sectors * geom->dev->sector_size); +- if (!ped_geometry_read(geom, sb_v, 0, sectors)) ++ uint8_t *buf = alloca (sectors * geom->dev->sector_size); ++ if (!ped_geometry_read(geom, buf, 0, sectors)) + return NULL; +- struct ext2_super_block *sb = (struct ext2_super_block *)(sb_v + 1024); ++ sb = (struct ext2_super_block *)(buf+1024); + + if (EXT2_SUPER_MAGIC(*sb) == EXT2_SUPER_MAGIC_CONST) { + PedSector block_size = (EXT2_MIN_BLOCK_SIZE << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb))) / geom->dev->sector_size; +-- +2.26.2 + diff --git a/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch b/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..b8898a2 --- /dev/null +++ b/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,49 @@ +From 362571d09da09fb2b6fab7037af26d83b2d39b75 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:08:31 -0800 +Subject: [PATCH 31/42] nilfs2: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/nilfs2/nilfs2.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c +index 3ca4808..2871179 100644 +--- a/libparted/fs/nilfs2/nilfs2.c ++++ b/libparted/fs/nilfs2/nilfs2.c +@@ -34,8 +34,7 @@ + /* secondary superblock offset in 512byte blocks. */ + #define NILFS_SB2_OFFSET(devsize) ((((devsize)>>3) - 1) << 3) + +-struct nilfs2_super_block +-{ ++struct __attribute__ ((packed)) nilfs2_super_block { + uint32_t s_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_magic; +@@ -112,18 +111,18 @@ nilfs2_probe (PedGeometry* geom) + return NULL; + const int sectors = (4096 + geom->dev->sector_size - 1) / + geom->dev->sector_size; +- char *buf = alloca (sectors * geom->dev->sector_size); ++ uint8_t *buf = alloca (sectors * geom->dev->sector_size); + const int sectors2 = (1024 + geom->dev->sector_size -1 ) / + geom->dev->sector_size; + void *buff2 = alloca (sectors2 * geom->dev->sector_size); + + if (ped_geometry_read(geom, buf, 0, sectors)) +- sb = (struct nilfs2_super_block *)(buf+1024); ++ sb = (struct nilfs2_super_block*)(buf + 1024); + if (ped_geometry_read(geom, buff2, sb2off, sectors2)) +- sb2 = buff2; ++ sb2 = (struct nilfs2_super_block*)buff2; + + if ((!sb || !is_valid_nilfs_sb(sb)) && +- (!sb2 || !is_valid_nilfs_sb(sb2)) ) ++ (!sb2 || !is_valid_nilfs_sb(sb2))) + return NULL; + + /* reserve 4k bytes for secondary superblock */ +-- +2.26.2 + diff --git a/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..d19fee2 --- /dev/null +++ b/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,39 @@ +From e2ee2628c5d75b375db90a486b906c0d2405b8b3 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:18:42 -0800 +Subject: [PATCH 32/42] ntfs: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/ntfs/ntfs.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c +index 3bfb28e..a3a6550 100644 +--- a/libparted/fs/ntfs/ntfs.c ++++ b/libparted/fs/ntfs/ntfs.c +@@ -35,16 +35,17 @@ + PedGeometry* + ntfs_probe (PedGeometry* geom) + { +- char *buf = alloca (geom->dev->sector_size); ++ uint8_t *buf = alloca(geom->dev->sector_size); + PedGeometry *newg = NULL; + + if (!ped_geometry_read(geom, buf, 0, 1)) + return 0; + +- if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0) +- newg = ped_geometry_new (geom->dev, geom->start, +- PED_LE64_TO_CPU (*(uint64_t*) +- (buf + 0x28))); ++ if (strncmp (NTFS_SIGNATURE, ((char *)buf + 3), strlen (NTFS_SIGNATURE)) == 0) { ++ uint64_t length; ++ memcpy(&length, buf + 0x28, sizeof(uint64_t)); ++ newg = ped_geometry_new (geom->dev, geom->start, length); ++ } + return newg; + } + +-- +2.26.2 + diff --git a/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..3713d61 --- /dev/null +++ b/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,51 @@ +From 65d95eaf5692f7d19f2b550dee4c9b585ce79938 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:19:10 -0800 +Subject: [PATCH 33/42] ufs: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/ufs/ufs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libparted/fs/ufs/ufs.c b/libparted/fs/ufs/ufs.c +index 27cb036..f677b60 100644 +--- a/libparted/fs/ufs/ufs.c ++++ b/libparted/fs/ufs/ufs.c +@@ -45,14 +45,14 @@ + #define UFS_MAGIC_FEA 0x00195612 + #define UFS_MAGIC_4GB 0x05231994 + +-struct ufs_csum { ++struct __attribute__ ((packed)) ufs_csum { + uint32_t cs_ndir; /* number of directories */ + uint32_t cs_nbfree; /* number of free blocks */ + uint32_t cs_nifree; /* number of free inodes */ + uint32_t cs_nffree; /* number of free frags */ + }; + +-struct ufs_super_block { ++struct __attribute__ ((packed)) ufs_super_block { + uint32_t fs_link; /* UNUSED */ + uint32_t fs_rlink; /* UNUSED */ + uint32_t fs_sblkno; /* addr of super-block in filesys */ +@@ -176,7 +176,7 @@ ufs_probe_sun (PedGeometry* geom) + { + const int sectors = ((3 * 512) + geom->dev->sector_size - 1) / + geom->dev->sector_size; +- char * buf = alloca (sectors * geom->dev->sector_size); ++ uint8_t* buf = alloca (sectors * geom->dev->sector_size); + struct ufs_super_block *sb; + + if (geom->length < 5) +@@ -212,7 +212,7 @@ ufs_probe_hp (PedGeometry* geom) + return 0; + const int sectors = ((3 * 512) + geom->dev->sector_size - 1) / + geom->dev->sector_size; +- char * buf = alloca (sectors * geom->dev->sector_size); ++ uint8_t* buf = alloca (sectors * geom->dev->sector_size); + + if (!ped_geometry_read (geom, buf, 16 * 512 / geom->dev->sector_size, sectors)) + return 0; +-- +2.26.2 + diff --git a/0034-ped_assert-Fix-incorrect-exception-option.patch b/0034-ped_assert-Fix-incorrect-exception-option.patch new file mode 100644 index 0000000..863c640 --- /dev/null +++ b/0034-ped_assert-Fix-incorrect-exception-option.patch @@ -0,0 +1,27 @@ +From c21ee3827639343920d3f08cff319620d3582d2a Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:19:36 -0800 +Subject: [PATCH 34/42] ped_assert: Fix incorrect exception option + +PED_EXCEPTION_FATAL is a type, not an option. A PED_EXCEPTION_BUG should +always select CANCEL. +--- + libparted/debug.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/debug.c b/libparted/debug.c +index c4932ca..227673e 100644 +--- a/libparted/debug.c ++++ b/libparted/debug.c +@@ -106,7 +106,7 @@ void ped_assert (const char* cond_text, + /* Throw the exception */ + ped_exception_throw ( + PED_EXCEPTION_BUG, +- PED_EXCEPTION_FATAL, ++ PED_EXCEPTION_CANCEL, + _("Assertion (%s) at %s:%d in function %s() failed."), + cond_text, file, line, function); + abort (); +-- +2.26.2 + diff --git a/0035-ui-Fix-command_line_get_disk_flag.patch b/0035-ui-Fix-command_line_get_disk_flag.patch new file mode 100644 index 0000000..d7a88f3 --- /dev/null +++ b/0035-ui-Fix-command_line_get_disk_flag.patch @@ -0,0 +1,27 @@ +From 45e4c689c81cc55f849d3f90168a6b89c0168191 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:30:57 -0800 +Subject: [PATCH 35/42] ui: Fix command_line_get_disk_flag + +It was using PedPartitionFlag instead of PedDiskFlag when walking the +available flags. +--- + parted/ui.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parted/ui.c b/parted/ui.c +index 7b5374d..8e1f2fe 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -1138,7 +1138,7 @@ command_line_get_disk_flag (const char* prompt, const PedDisk* disk, + PedDiskFlag* flag) + { + StrList* opts = NULL; +- PedPartitionFlag walk = 0; ++ PedDiskFlag walk = 0; + char* flag_name; + + while ( (walk = ped_disk_flag_next (walk)) ) { +-- +2.26.2 + diff --git a/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch b/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch new file mode 100644 index 0000000..8202798 --- /dev/null +++ b/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch @@ -0,0 +1,31 @@ +From 6e34cb98ddef0c9fd47359a2006265e7251e8830 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 12 Nov 2020 16:49:29 -0800 +Subject: [PATCH 36/42] ui: Fix gcc 10 warning about snprintf truncating an int + +Double the storage to 20 bytes. +--- + parted/ui.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/parted/ui.c b/parted/ui.c +index 8e1f2fe..73fdcf5 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -909,11 +909,11 @@ command_line_get_word (const char* prompt, const char* def, + int + command_line_get_integer (const char* prompt, int* value) + { +- char def_str [10]; ++ char def_str [20]; + char* input; + long ret; + +- snprintf (def_str, 10, "%d", *value); ++ snprintf (def_str, 20, "%d", *value); + input = command_line_get_word (prompt, *value ? def_str : NULL, + NULL, 1); + if (!input) +-- +2.26.2 + diff --git a/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch b/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch new file mode 100644 index 0000000..25f1ff0 --- /dev/null +++ b/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch @@ -0,0 +1,98 @@ +From 76bf966849534a832c30cd89dbbb8a32939dcbed Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 13 Nov 2020 15:12:06 -0800 +Subject: [PATCH 37/42] hfs/reloc: Fix gcc 10 warnings about cast alignment + +--- + libparted/fs/r/hfs/reloc.c | 35 ++++++++++++++++++++--------------- + 1 file changed, 20 insertions(+), 15 deletions(-) + +diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c +index d0477ae..68b14ae 100644 +--- a/libparted/fs/r/hfs/reloc.c ++++ b/libparted/fs/r/hfs/reloc.c +@@ -373,6 +373,7 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, + HfsExtDescriptor* extent; + unsigned int leaf_node, record_number; + unsigned int i, j; ++ uint16_t catalog_pos; + + if (!priv_data->catalog_file->sect_nb) { + ped_exception_throw ( +@@ -385,8 +386,9 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, + + if (!hfs_file_read_sector (priv_data->catalog_file, node, 0)) + return 0; +- header = (HfsHeaderRecord*)(node + PED_BE16_TO_CPU(*((uint16_t*) +- (node+(PED_SECTOR_SIZE_DEFAULT-2))))); ++ uint16_t offset; ++ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); ++ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); + + for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node); + leaf_node; +@@ -397,14 +399,15 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = 1; i <= record_number; ++i) { + /* undocumented alignement */ ++ uint16_t value; ++ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); ++ catalog_pos = PED_BE16_TO_CPU(value); ++ catalog_key = (HfsCatalogKey*) (node + catalog_pos); + unsigned int skip; +- catalog_key = (HfsCatalogKey*) (node + PED_BE16_TO_CPU( +- *((uint16_t*)(node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); + skip = (1 + catalog_key->key_length + 1) & ~1; +- catalog_data = (HfsCatalog*)( ((uint8_t*)catalog_key) +- + skip ); ++ catalog_data = (HfsCatalog*)(node+catalog_pos+skip); + /* check for obvious error in FS */ +- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC) ++ if ((catalog_pos < HFS_FIRST_REC) + || ((uint8_t*)catalog_data - node + >= PED_SECTOR_SIZE_DEFAULT + - 2 * (signed)(record_number+1))) { +@@ -467,6 +470,7 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, + HfsExtDescriptor* extent; + unsigned int leaf_node, record_number; + unsigned int i, j; ++ uint16_t extent_pos; + + if (!priv_data->extent_file->sect_nb) { + ped_exception_throw ( +@@ -479,8 +483,9 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, + + if (!hfs_file_read_sector (priv_data->extent_file, node, 0)) + return 0; +- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(PED_SECTOR_SIZE_DEFAULT-2)))))); ++ uint16_t offset; ++ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); ++ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); + + for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node); + leaf_node; +@@ -491,14 +496,14 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = 1; i <= record_number; i++) { + uint8_t where; +- extent_key = (HfsExtentKey*) +- (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); ++ uint16_t value; ++ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); ++ extent_pos = PED_BE16_TO_CPU(value); ++ extent_key = (HfsExtentKey*)(node + extent_pos); + /* size is cst */ +- extent = (HfsExtDescriptor*)(((uint8_t*)extent_key) +- + sizeof (HfsExtentKey)); ++ extent = (HfsExtDescriptor*)(node+extent_pos+sizeof(HfsExtentKey)); + /* check for obvious error in FS */ +- if (((uint8_t*)extent_key - node < HFS_FIRST_REC) ++ if ((extent_pos < HFS_FIRST_REC) + || ((uint8_t*)extent - node + >= PED_SECTOR_SIZE_DEFAULT + - 2 * (signed)(record_number+1))) { +-- +2.26.2 + diff --git a/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch b/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch new file mode 100644 index 0000000..9c4d712 --- /dev/null +++ b/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch @@ -0,0 +1,103 @@ +From f496795a850976d211d3f5c673b868c3c90a8c3d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 13 Nov 2020 15:25:35 -0800 +Subject: [PATCH 38/42] hfs/reloc_plus: Fix gcc 10 warnings about cast + alignment + +--- + libparted/fs/r/hfs/reloc_plus.c | 33 +++++++++++++++++++-------------- + 1 file changed, 19 insertions(+), 14 deletions(-) + +diff --git a/libparted/fs/r/hfs/reloc_plus.c b/libparted/fs/r/hfs/reloc_plus.c +index cebadbe..44c0a77 100644 +--- a/libparted/fs/r/hfs/reloc_plus.c ++++ b/libparted/fs/r/hfs/reloc_plus.c +@@ -486,6 +486,7 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, + unsigned int i, j, size, bsize; + uint32_t jib = priv_data->jib_start_block, + jl = priv_data->jl_start_block; ++ uint16_t catalog_pos; + + if (!priv_data->catalog_file->sect_nb) { + ped_exception_throw ( +@@ -520,15 +521,16 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, + unsigned int skip; + uint8_t where; + +- catalog_key = (HfsPCatalogKey*) +- ( node + PED_BE16_TO_CPU (*((uint16_t *) +- (node+(bsize - 2*i)))) ); ++ uint16_t value; ++ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); ++ catalog_pos = PED_BE16_TO_CPU(value); ++ catalog_key = (HfsPCatalogKey*)(node + catalog_pos); + skip = ( 2 + PED_BE16_TO_CPU (catalog_key->key_length) + + 1) & ~1; + catalog_data = (HfsPCatalog*) + (((uint8_t*)catalog_key) + skip); + /* check for obvious error in FS */ +- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC) ++ if ((catalog_pos < HFS_FIRST_REC) + || ((uint8_t*)catalog_data - node + >= (signed) bsize + - 2 * (signed)(record_number+1))) { +@@ -609,6 +611,7 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, + HfsPExtDescriptor* extent; + unsigned int leaf_node, record_number; + unsigned int i, j, size, bsize; ++ uint16_t extent_pos; + + if (!priv_data->extents_file->sect_nb) { + ped_exception_throw ( +@@ -640,13 +643,14 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = 1; i <= record_number; i++) { + uint8_t where; +- extent_key = (HfsPExtentKey*) +- (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(bsize - 2*i))))); ++ uint16_t value; ++ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); ++ extent_pos = PED_BE16_TO_CPU(value); ++ extent_key = (HfsPExtentKey*)(node + extent_pos); + extent = (HfsPExtDescriptor*) + (((uint8_t*)extent_key) + sizeof (HfsPExtentKey)); + /* check for obvious error in FS */ +- if (((uint8_t*)extent_key - node < HFS_FIRST_REC) ++ if ((extent_pos < HFS_FIRST_REC) + || ((uint8_t*)extent - node + >= (signed)bsize + - 2 * (signed)(record_number+1))) { +@@ -724,6 +728,7 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs, + HfsPExtDescriptor* extent; + unsigned int leaf_node, record_number; + unsigned int i, j, size, bsize; ++ uint16_t generic_pos; + + /* attributes file is facultative */ + if (!priv_data->attributes_file->sect_nb) +@@ -751,15 +756,15 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs, + record_number = PED_BE16_TO_CPU (desc->rec_nb); + for (i = 1; i <= record_number; i++) { + unsigned int skip; +- generic_key = (HfsPPrivateGenericKey*) +- (node + PED_BE16_TO_CPU(*((uint16_t *) +- (node+(bsize - 2*i))))); ++ uint16_t value; ++ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); ++ generic_pos = PED_BE16_TO_CPU(value); ++ generic_key = (HfsPPrivateGenericKey*)(node + generic_pos); + skip = ( 2 + PED_BE16_TO_CPU (generic_key->key_length) + + 1 ) & ~1; +- fork_ext_data = (HfsPForkDataAttr*) +- (((uint8_t*)generic_key) + skip); ++ fork_ext_data = (HfsPForkDataAttr*)(node+generic_pos+skip); + /* check for obvious error in FS */ +- if (((uint8_t*)generic_key - node < HFS_FIRST_REC) ++ if ((generic_pos < HFS_FIRST_REC) + || ((uint8_t*)fork_ext_data - node + >= (signed) bsize + - 2 * (signed)(record_number+1))) { +-- +2.26.2 + diff --git a/0039-fs-r-fat-Remove-disabled-code.patch b/0039-fs-r-fat-Remove-disabled-code.patch new file mode 100644 index 0000000..a6528b1 --- /dev/null +++ b/0039-fs-r-fat-Remove-disabled-code.patch @@ -0,0 +1,350 @@ +From d2cc30120427394f6eaaa60acfbe647fb82a9762 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Nov 2020 13:21:25 -0800 +Subject: [PATCH 39/42] fs/r/fat: Remove disabled code + +--- + libparted/fs/r/fat/count.c | 83 ----------------- + libparted/fs/r/fat/fat.c | 175 ------------------------------------ + libparted/fs/r/fat/resize.c | 17 ---- + 3 files changed, 275 deletions(-) + +diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c +index 2b65e72..51e1aa2 100644 +--- a/libparted/fs/r/fat/count.c ++++ b/libparted/fs/r/fat/count.c +@@ -27,66 +27,6 @@ + + #ifndef DISCOVER_ONLY + +-#if 0 +-/* extremely ugly hack: stick everything that obviously isn't an unmovable file +- * in here. Note: DAT is a bit dubious. Unfortunately, it's used by the +- * registry, so it'll be all over the place :-( +- */ +-static char* movable_extensions[] = { +- "", +- "1ST", +- "AVI", +- "BAK", "BAT", "BMP", +- "CFG", "COM", "CSS", +- "DAT", "DLL", "DOC", "DRV", +- "EXE", +- "FAQ", "FLT", "FON", +- "GID", "GIF", +- "HLP", "HTT", "HTM", +- "ICO", "INI", +- "JPG", +- "LNK", "LOG", +- "KBD", +- "ME", "MID", "MSG", +- "OCX", "OLD", +- "PIF", "PNG", "PRV", +- "RTF", +- "SCR", "SYS", +- "TMP", "TTF", "TXT", +- "URL", +- "WAV", +- "VBX", "VOC", "VXD", +- NULL +-}; +- +-static char* +-get_extension (char* file_name) +-{ +- char* ext; +- +- ext = strrchr (file_name, '.'); +- if (!ext) +- return ""; +- if (strchr (ext, '\\')) +- return ""; +- return ext + 1; +-} +- +-static int +-is_movable_system_file (char* file_name) +-{ +- char* ext = get_extension (file_name); +- int i; +- +- for (i = 0; movable_extensions [i]; i++) { +- if (strcasecmp (ext, movable_extensions [i]) == 0) +- return 1; +- } +- +- return 0; +-} +-#endif /* 0 */ +- + /* + prints out the sequence of clusters for a given file chain, beginning + at start_cluster. +@@ -248,29 +188,6 @@ flag_traverse_dir (FatTraverseInfo* trav_info) { + print_chain (fs, first_cluster); + #endif + +-#if 0 +- if (fat_dir_entry_is_system_file (this_entry) +- && !is_movable_system_file (file_name)) { +- PedExceptionOption ex_status; +- ex_status = ped_exception_throw ( +- PED_EXCEPTION_WARNING, +- PED_EXCEPTION_IGNORE_CANCEL, +- _("The file %s is marked as a system file. " +- "This means moving it could cause some " +- "programs to stop working."), +- file_name); +- +- switch (ex_status) { +- case PED_EXCEPTION_CANCEL: +- return 0; +- +- case PED_EXCEPTION_UNHANDLED: +- ped_exception_catch (); +- case PED_EXCEPTION_IGNORE: +- } +- } +-#endif /* 0 */ +- + if (fat_dir_entry_is_directory (this_entry)) { + if (!flag_traverse_fat (fs, file_name, first_cluster, + FAT_FLAG_DIRECTORY, size)) +diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c +index ad57d36..0b2fee9 100644 +--- a/libparted/fs/r/fat/fat.c ++++ b/libparted/fs/r/fat/fat.c +@@ -613,68 +613,6 @@ fat_get_resize_constraint (const PedFileSystem* fs) + return fat_get_copy_constraint (fs, fs->geom->dev); + } + +-/* FIXME: fat_calc_sizes() needs to say "too big" or "too small", or +- * something. This is a really difficult (maths) problem to do +- * nicely... +- * So, this algorithm works if dev->length / 2 is a valid fat_type +- * size. (Which is how I got the magic numbers below) +- */ +-#if 0 +-/* returns: -1 too small, 0 ok, 1 too big */ +-static int +-_test_create_size (PedSector length, FatType fat_type, +- PedSector cluster_sectors, PedSector cluster_count) +-{ +- PedSector rootdir_sectors; +- PedSector _cluster_sectors; +- FatCluster _cluster_count; +- PedSector _fat_size; +- +- rootdir_sectors = (fat_type == FAT_TYPE_FAT16) ? 16 : 0; +- +- if (!fat_calc_sizes (length, 0, fat_type, rootdir_sectors, +- &_cluster_sectors, &_cluster_count, &_fat_size)) +- return -1; // XXX: doesn't work... can't see a better way! +- +- if (_cluster_sectors < cluster_sectors) +- return -1; +- if (_cluster_sectors > cluster_sectors) +- return 1; +- +- if (_cluster_count < cluster_count) +- return -1; +- if (_cluster_count > cluster_count) +- return 1; +- +- return 0; +-} +- +-static PedSector +-_get_create_size (PedSector upper_bound, FatType fat_type, +- PedSector cluster_sectors, FatCluster cluster_count) +-{ +- PedSector min_length = 0; +- PedSector max_length = upper_bound; +- PedSector length; +- +- while (1) { +- length = (min_length + max_length) / 2; +- switch (_test_create_size (length, fat_type, cluster_sectors, +- cluster_count)) { +- case -1: min_length = length; break; +- case 0: return length; +- case 1: max_length = length; break; +- } +- /* hack... won't always be able to get max cluster count +- * with max cluster size, etc. */ +- if (max_length - min_length == 1) +- return min_length; +- } +- +- return 0; /* shut gcc up */ +-} +-#endif +- + PedConstraint* + fat_get_create_constraint_fat16 (const PedDevice* dev) + { +@@ -685,19 +623,8 @@ fat_get_create_constraint_fat16 (const PedDevice* dev) + if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1)) + return NULL; + +-#if 0 +- min_size = _get_create_size (dev->length, FAT_TYPE_FAT16, +- fat_min_cluster_size (FAT_TYPE_FAT16), +- fat_min_cluster_count (FAT_TYPE_FAT16)); +- max_size = _get_create_size (dev->length, FAT_TYPE_FAT16, +- fat_max_cluster_size (FAT_TYPE_FAT16), +- fat_max_cluster_count (FAT_TYPE_FAT16)); +- if (!min_size) +- return NULL; +-#else + min_size = 65794; + max_size = 2097153; +-#endif + + return ped_constraint_new ( + ped_alignment_any, ped_alignment_any, +@@ -714,15 +641,7 @@ fat_get_create_constraint_fat32 (const PedDevice* dev) + if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1)) + return NULL; + +-#if 0 +- min_size = _get_create_size (dev->length, FAT_TYPE_FAT32, +- fat_min_cluster_size (FAT_TYPE_FAT32), +- fat_min_cluster_count (FAT_TYPE_FAT32)); +- if (!min_size) +- return NULL; +-#else + min_size = 525224; +-#endif + + return ped_constraint_new ( + ped_alignment_any, ped_alignment_any, +@@ -730,97 +649,3 @@ fat_get_create_constraint_fat32 (const PedDevice* dev) + min_size, dev->length); + } + #endif /* !DISCOVER_ONLY */ +- +-#if 0 +- +-static PedFileSystemOps fat16_ops = { +- probe: fat_probe_fat16, +-#ifndef DISCOVER_ONLY +- clobber: fat_clobber, +- open: fat_open, +- create: fat_create_fat16, +- close: fat_close, +- check: fat_check, +- resize: fat_resize, +- copy: fat_copy, +- get_create_constraint: fat_get_create_constraint_fat16, +- get_resize_constraint: fat_get_resize_constraint, +- get_copy_constraint: fat_get_copy_constraint, +-#else /* !DISCOVER_ONLY */ +- clobber: NULL, +- open: NULL, +- create: NULL, +- close: NULL, +- check: NULL, +- resize: NULL, +- copy: NULL, +- get_create_constraint: NULL, +- get_resize_constraint: NULL, +- get_copy_constraint: NULL, +-#endif /* !DISCOVER_ONLY */ +-}; +- +-static PedFileSystemOps fat32_ops = { +- probe: fat_probe_fat32, +-#ifndef DISCOVER_ONLY +- clobber: fat_clobber, +- open: fat_open, +- create: fat_create_fat32, +- close: fat_close, +- check: fat_check, +- resize: fat_resize, +- copy: fat_copy, +- get_create_constraint: fat_get_create_constraint_fat32, +- get_resize_constraint: fat_get_resize_constraint, +- get_copy_constraint: fat_get_copy_constraint, +-#else /* !DISCOVER_ONLY */ +- clobber: NULL, +- open: NULL, +- create: NULL, +- close: NULL, +- check: NULL, +- resize: NULL, +- copy: NULL, +- get_create_constraint: NULL, +- get_resize_constraint: NULL, +- get_copy_constraint: NULL, +-#endif /* !DISCOVER_ONLY */ +-}; +- +-#define FAT_BLOCK_SIZES ((int[2]){512, 0}) +- +-PedFileSystemType fat16_type = { +- next: NULL, +- ops: &fat16_ops, +- name: "fat16", +- block_sizes: FAT_BLOCK_SIZES +-}; +- +-PedFileSystemType fat32_type = { +- next: NULL, +- ops: &fat32_ops, +- name: "fat32", +- block_sizes: FAT_BLOCK_SIZES +-}; +- +-void +-ped_file_system_fat_init () +-{ +- if (sizeof (FatBootSector) != 512) { +- ped_exception_throw (PED_EXCEPTION_BUG, PED_EXCEPTION_CANCEL, +- _("GNU Parted was miscompiled: the FAT boot sector " +- "should be 512 bytes. FAT support will be disabled.")); +- } else { +- ped_file_system_type_register (&fat16_type); +- ped_file_system_type_register (&fat32_type); +- } +-} +- +-void +-ped_file_system_fat_done () +-{ +- ped_file_system_type_unregister (&fat16_type); +- ped_file_system_type_unregister (&fat32_type); +-} +- +-#endif +diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c +index 71113d4..2a0955d 100644 +--- a/libparted/fs/r/fat/resize.c ++++ b/libparted/fs/r/fat/resize.c +@@ -446,23 +446,6 @@ fat_construct_new_fat (FatOpContext* ctx) + fat_table_set (new_fs_info->fat, new_cluster, new_next_cluster); + } + +-#if 0 +-#ifdef PED_VERBOSE +- for (old_cluster=2; old_cluster < old_fs_info->cluster_count+2; +- old_cluster++) { +- if (fat_table_is_available (old_fs_info->fat, old_cluster)) +- continue; +- +- printf ("%d->%d\t(next: %d->%d)\n", +- old_cluster, +- ctx->remap [old_cluster], +- fat_table_get (old_fs_info->fat, old_cluster), +- fat_table_get (new_fs_info->fat, +- ctx->remap [old_cluster])); +- } +-#endif /* PED_VERBOSE */ +-#endif +- + if (old_fs_info->fat_type == FAT_TYPE_FAT32 + && new_fs_info->fat_type == FAT_TYPE_FAT32) { + new_fs_info->root_cluster +-- +2.26.2 + diff --git a/0040-fs-r-hfs-Remove-disabled-code.patch b/0040-fs-r-hfs-Remove-disabled-code.patch new file mode 100644 index 0000000..fcbea96 --- /dev/null +++ b/0040-fs-r-hfs-Remove-disabled-code.patch @@ -0,0 +1,228 @@ +From 0d5f047b2855f3d39fa3afe6ec2a6129d18ddf33 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Nov 2020 13:22:52 -0800 +Subject: [PATCH 40/42] fs/r/hfs: Remove disabled code + +--- + libparted/fs/r/hfs/hfs.c | 194 --------------------------------------- + 1 file changed, 194 deletions(-) + +diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c +index 09899da..1da093c 100644 +--- a/libparted/fs/r/hfs/hfs.c ++++ b/libparted/fs/r/hfs/hfs.c +@@ -59,28 +59,6 @@ static PedFileSystemType hfsplus_type; + + /* ----- HFS ----- */ + +-#if 0 +-/* This is a very unundoable operation */ +-/* Maybe I shouldn't touch the alternate MDB ? */ +-/* Anyway clobber is call before other fs creation */ +-/* So this is a non-issue */ +-static int +-hfs_clobber (PedGeometry* geom) +-{ +- uint8_t buf[PED_SECTOR_SIZE_DEFAULT]; +- +- memset (buf, 0, PED_SECTOR_SIZE_DEFAULT); +- +- /* destroy boot blocks, mdb, alternate mdb ... */ +- return (!!ped_geometry_write (geom, buf, 0, 1)) & +- (!!ped_geometry_write (geom, buf, 1, 1)) & +- (!!ped_geometry_write (geom, buf, 2, 1)) & +- (!!ped_geometry_write (geom, buf, geom->length - 2, 1)) & +- (!!ped_geometry_write (geom, buf, geom->length - 1, 1)) & +- (!!ped_geometry_sync (geom)); +-} +-#endif +- + PedFileSystem * + hfs_open (PedGeometry* geom) + { +@@ -341,44 +319,6 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) + #include "reloc_plus.h" + #include "journal.h" + +-#if 0 +-static int +-hfsplus_clobber (PedGeometry* geom) +-{ +- unsigned int i = 1; +- uint8_t buf[PED_SECTOR_SIZE_DEFAULT]; +- HfsMasterDirectoryBlock *mdb; +- +- mdb = (HfsMasterDirectoryBlock *) buf; +- +- if (!ped_geometry_read (geom, buf, 2, 1)) +- return 0; +- +- if (PED_BE16_TO_CPU (mdb->signature) == HFS_SIGNATURE) { +- /* embedded hfs+ */ +- PedGeometry *embedded; +- +- i = PED_BE32_TO_CPU(mdb->block_size) / PED_SECTOR_SIZE_DEFAULT; +- embedded = ped_geometry_new ( +- geom->dev, +- (PedSector) geom->start +- + PED_BE16_TO_CPU (mdb->start_block) +- + (PedSector) PED_BE16_TO_CPU ( +- mdb->old_new.embedded.location.start_block ) * i, +- (PedSector) PED_BE16_TO_CPU ( +- mdb->old_new.embedded.location.block_count ) * i ); +- if (!embedded) i = 0; +- else { +- i = hfs_clobber (embedded); +- ped_geometry_destroy (embedded); +- } +- } +- +- /* non-embedded or envelop destroy as hfs */ +- return ( hfs_clobber (geom) && i ); +-} +-#endif +- + int + hfsplus_close (PedFileSystem *fs) + { +@@ -1224,137 +1164,3 @@ hfsplus_extract (PedFileSystem* fs, PedTimer* timer) + #endif /* HFS_EXTRACT_FS */ + + #endif /* !DISCOVER_ONLY */ +- +-#if 0 +-static PedFileSystemOps hfs_ops = { +- probe: hfs_probe, +-#ifndef DISCOVER_ONLY +- clobber: hfs_clobber, +- open: hfs_open, +- create: NULL, +- close: hfs_close, +-#ifndef HFS_EXTRACT_FS +- check: NULL, +-#else +- check: hfs_extract, +-#endif +- copy: NULL, +- resize: hfs_resize, +- get_create_constraint: NULL, +- get_resize_constraint: hfs_get_resize_constraint, +- get_copy_constraint: NULL, +-#else /* DISCOVER_ONLY */ +- clobber: NULL, +- open: NULL, +- create: NULL, +- close: NULL, +- check: NULL, +- copy: NULL, +- resize: NULL, +- get_create_constraint: NULL, +- get_resize_constraint: NULL, +- get_copy_constraint: NULL, +-#endif /* DISCOVER_ONLY */ +-}; +- +-static PedFileSystemOps hfsplus_ops = { +- probe: hfsplus_probe, +-#ifndef DISCOVER_ONLY +- clobber: hfsplus_clobber, +- open: hfsplus_open, +- create: NULL, +- close: hfsplus_close, +-#ifndef HFS_EXTRACT_FS +- check: NULL, +-#else +- check: hfsplus_extract, +-#endif +- copy: NULL, +- resize: hfsplus_resize, +- get_create_constraint: NULL, +- get_resize_constraint: hfsplus_get_resize_constraint, +- get_copy_constraint: NULL, +-#else /* DISCOVER_ONLY */ +- clobber: NULL, +- open: NULL, +- create: NULL, +- close: NULL, +- check: NULL, +- copy: NULL, +- resize: NULL, +- get_create_constraint: NULL, +- get_resize_constraint: NULL, +- get_copy_constraint: NULL, +-#endif /* DISCOVER_ONLY */ +-}; +- +-static PedFileSystemOps hfsx_ops = { +- probe: hfsx_probe, +-#ifndef DISCOVER_ONLY +- clobber: hfs_clobber, /* NOT hfsplus_clobber ! +- HFSX can't be embedded */ +- open: hfsplus_open, +- create: NULL, +- close: hfsplus_close, +-#ifndef HFS_EXTRACT_FS +- check: NULL, +-#else +- check: hfsplus_extract, +-#endif +- copy: NULL, +- resize: hfsplus_resize, +- get_create_constraint: NULL, +- get_resize_constraint: hfsplus_get_resize_constraint, +- get_copy_constraint: NULL, +-#else /* DISCOVER_ONLY */ +- clobber: NULL, +- open: NULL, +- create: NULL, +- close: NULL, +- check: NULL, +- copy: NULL, +- resize: NULL, +- get_create_constraint: NULL, +- get_resize_constraint: NULL, +- get_copy_constraint: NULL, +-#endif /* DISCOVER_ONLY */ +-}; +- +- +-static PedFileSystemType hfs_type = { +- next: NULL, +- ops: &hfs_ops, +- name: "hfs", +- block_sizes: HFS_BLOCK_SIZES +-}; +- +-static PedFileSystemType hfsplus_type = { +- next: NULL, +- ops: &hfsplus_ops, +- name: "hfs+", +- block_sizes: HFSP_BLOCK_SIZES +-}; +- +-static PedFileSystemType hfsx_type = { +- next: NULL, +- ops: &hfsx_ops, +- name: "hfsx", +- block_sizes: HFSX_BLOCK_SIZES +-}; +- +-void +-ped_file_system_hfs_init () +-{ +- ped_file_system_type_register (&hfs_type); +- ped_file_system_type_register (&hfsplus_type); +- ped_file_system_type_register (&hfsx_type); +-} +- +-void +-ped_file_system_hfs_done () +-{ +- ped_file_system_type_unregister (&hfs_type); +- ped_file_system_type_unregister (&hfsplus_type); +- ped_file_system_type_unregister (&hfsx_type); +-} +-#endif +-- +2.26.2 + diff --git a/0041-libparted-Remove-disabled-code.patch b/0041-libparted-Remove-disabled-code.patch new file mode 100644 index 0000000..42580e8 --- /dev/null +++ b/0041-libparted-Remove-disabled-code.patch @@ -0,0 +1,108 @@ +From 945b13aed7e9762e00bda1b54e2c18eb3373a31d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Nov 2020 13:26:31 -0800 +Subject: [PATCH 41/42] libparted: Remove disabled code + +--- + libparted/arch/gnu.c | 40 ---------------------------------------- + libparted/labels/mac.c | 14 -------------- + libparted/labels/pc98.c | 5 ----- + 3 files changed, 59 deletions(-) + +diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c +index 321b70a..922b93d 100644 +--- a/libparted/arch/gnu.c ++++ b/libparted/arch/gnu.c +@@ -359,46 +359,6 @@ gnu_close (PedDevice* dev) + dev->dirty = 0; + } + +-#if 0 +- if (dev->dirty && dev->boot_dirty && dev->type != PED_DEVICE_FILE) { +- /* ouch! */ +- ped_exception_throw ( +- PED_EXCEPTION_WARNING, +- PED_EXCEPTION_OK, +- _("The partition table cannot be re-read. This means " +- "you need to reboot before mounting any " +- "modified partitions. You also need to reinstall " +- "your boot loader before you reboot (which may " +- "require mounting modified partitions). It is " +- "impossible do both things! So you'll need to " +- "boot off a rescue disk, and reinstall your boot " +- "loader from the rescue disk. Read section 4 of " +- "the Parted User documentation for more " +- "information.")); +- return 1; +- } +- +- if (dev->dirty && dev->type != PED_DEVICE_FILE) { +- ped_exception_throw ( +- PED_EXCEPTION_WARNING, +- PED_EXCEPTION_IGNORE, +- _("The partition table on %s cannot be re-read " +- "(%s). This means the Hurd knows nothing about any " +- "modifications you made. You should reboot your " +- "computer before doing anything with %s."), +- dev->path, strerror (errno), dev->path); +- } +- +- if (dev->boot_dirty && dev->type != PED_DEVICE_FILE) { +- ped_exception_throw ( +- PED_EXCEPTION_WARNING, +- PED_EXCEPTION_OK, +- _("You should reinstall your boot loader before " +- "rebooting. Read section 4 of the Parted User " +- "documentation for more information.")); +- } +-#endif +- + return 1; + } + +diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c +index 8980885..af9f4c3 100644 +--- a/libparted/labels/mac.c ++++ b/libparted/labels/mac.c +@@ -560,20 +560,6 @@ _rawpart_analyse (MacRawPartition* raw_part, PedDisk* disk, int num) + mac_part_data->data_region_length + = PED_BE32_TO_CPU (raw_part->data_count); + +- /* boot region - we have no idea what this is for, but Mac OSX +- * seems to put garbage here, and doesn't pay any attention to +- * it afterwards. [clausen, dan burcaw] +- */ +-#if 0 +- if (raw_part->boot_start) { +- ped_exception_throw ( +- PED_EXCEPTION_ERROR, +- PED_EXCEPTION_CANCEL, +- _("The boot region doesn't start at the start " +- "of the partition.")); +- goto error_destroy_part; +- } +-#endif + mac_part_data->boot_region_length + = PED_BE32_TO_CPU (raw_part->boot_count); + +diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c +index 328cd8d..b8993c4 100644 +--- a/libparted/labels/pc98.c ++++ b/libparted/labels/pc98.c +@@ -418,13 +418,8 @@ fill_raw_part (PC98RawPartition* raw_part, const PedPartition* part) + return 0; + } + raw_part->end_cyl = PED_CPU_TO_LE16(c); +-#if 0 +- raw_part->end_head = h; +- raw_part->end_sector = s; +-#else + raw_part->end_head = 0; + raw_part->end_sector = 0; +-#endif + + return 1; + } +-- +2.26.2 + diff --git a/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch b/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch new file mode 100644 index 0000000..acc7497 --- /dev/null +++ b/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch @@ -0,0 +1,112 @@ +From 8df7974ac36fcea82551c3f6990f981b659e2635 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 20 Nov 2020 14:08:33 -0800 +Subject: [PATCH 42/42] libparted/fs: Fix GCC warnings suggesting pure for + PED_ASSERT functions + +There was some question about whether or not pure should be used for +functions with PED_ASSERT (or exit) in them. It should be fine, since +the values checked by the ASSERT are passed to the function directly. +Behavior should be exactly the same for the same inputs. +--- + libparted/fs/r/fat/calc.c | 12 ++++++------ + libparted/fs/r/fat/clstdup.c | 4 ++-- + libparted/fs/r/hfs/cache.c | 2 +- + 3 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c +index 18e0455..26c4d18 100644 +--- a/libparted/fs/r/fat/calc.c ++++ b/libparted/fs/r/fat/calc.c +@@ -369,7 +369,7 @@ fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector) + + fs_info->cluster_sectors * fs_info->cluster_count; + } + +-FatFragment ++FatFragment _GL_ATTRIBUTE_PURE + fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -379,7 +379,7 @@ fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster) + return (cluster - 2) * fs_info->cluster_frags; + } + +-FatCluster ++FatCluster _GL_ATTRIBUTE_PURE + fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -389,7 +389,7 @@ fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag) + return frag / fs_info->cluster_frags + 2; + } + +-PedSector ++PedSector _GL_ATTRIBUTE_PURE + fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -399,7 +399,7 @@ fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag) + return frag * fs_info->frag_sectors + fs_info->cluster_offset; + } + +-FatFragment ++FatFragment _GL_ATTRIBUTE_PURE + fat_sector_to_frag (const PedFileSystem* fs, PedSector sector) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -409,7 +409,7 @@ fat_sector_to_frag (const PedFileSystem* fs, PedSector sector) + return (sector - fs_info->cluster_offset) / fs_info->frag_sectors; + } + +-PedSector ++PedSector _GL_ATTRIBUTE_PURE + fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +@@ -420,7 +420,7 @@ fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster) + + fs_info->cluster_offset; + } + +-FatCluster ++FatCluster _GL_ATTRIBUTE_PURE + fat_sector_to_cluster (const PedFileSystem* fs, PedSector sector) + { + FatSpecific* fs_info = FAT_SPECIFIC (fs); +diff --git a/libparted/fs/r/fat/clstdup.c b/libparted/fs/r/fat/clstdup.c +index 7456f60..cfd1552 100644 +--- a/libparted/fs/r/fat/clstdup.c ++++ b/libparted/fs/r/fat/clstdup.c +@@ -126,7 +126,7 @@ fetch_fragments (FatOpContext* ctx) + + /* finds the first fragment that is not going to get overwritten (that needs to + get read in) */ +-static FatFragment ++static FatFragment _GL_ATTRIBUTE_PURE + get_first_underlay (const FatOpContext* ctx, int first, int last) + { + int old; +@@ -147,7 +147,7 @@ get_first_underlay (const FatOpContext* ctx, int first, int last) + + /* finds the last fragment that is not going to get overwritten (that needs to + get read in) */ +-static FatFragment ++static FatFragment _GL_ATTRIBUTE_PURE + get_last_underlay (const FatOpContext* ctx, int first, int last) + { + int old; +diff --git a/libparted/fs/r/hfs/cache.c b/libparted/fs/r/hfs/cache.c +index 5e5b071..fc11fe9 100644 +--- a/libparted/fs/r/hfs/cache.c ++++ b/libparted/fs/r/hfs/cache.c +@@ -173,7 +173,7 @@ hfsc_cache_add_extent(HfsCPrivateCache* cache, uint32_t start, uint32_t length, + return ext; + } + +-HfsCPrivateExtent* ++HfsCPrivateExtent* _GL_ATTRIBUTE_PURE + hfsc_cache_search_extent(HfsCPrivateCache* cache, uint32_t start) + { + HfsCPrivateExtent* ret; +-- +2.26.2 + diff --git a/parted.spec b/parted.spec index 637aeea..2a8cf61 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -26,6 +26,35 @@ Patch0009: 0010-tests-Add-f2fs-to-the-fs-probe-test.patch Patch0010: 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch Patch0011: 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch Patch0012: 0013-Do-not-link-to-libsepol-or-libselinux.patch +Patch0013: 0014-t6001-psep-modify-device-manage-support-detection.patch +Patch0014: 0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch +Patch0015: 0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch +Patch0016: 0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch +Patch0017: 0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch +Patch0018: 0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch +Patch0019: 0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch +Patch0020: 0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch +Patch0021: 0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch +Patch0022: 0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch +Patch0023: 0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch +Patch0024: 0025-tests-Fix-unsigned-warning-in-duplicate.c.patch +Patch0025: 0026-hfs-Fix-gcc-10-bounds-check-warning.patch +Patch0026: 0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0027: 0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch +Patch0028: 0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0029: 0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0030: 0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0031: 0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0032: 0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0033: 0034-ped_assert-Fix-incorrect-exception-option.patch +Patch0034: 0035-ui-Fix-command_line_get_disk_flag.patch +Patch0035: 0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch +Patch0036: 0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch +Patch0037: 0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch +Patch0038: 0039-fs-r-fat-Remove-disabled-code.patch +Patch0039: 0040-fs-r-hfs-Remove-disabled-code.patch +Patch0040: 0041-libparted-Remove-disabled-code.patch +Patch0041: 0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -129,6 +158,9 @@ make check %changelog +* Mon Nov 30 2020 Brian C. Lane - 3.3-8 +- Add upstream commits to fix various gcc 10 warnings (bcl) + * Thu Nov 05 2020 Brian C. Lane - 3.3-7 - Do not link to libselinux From e59dafa4c952f5b3916326ec807460e56296067c Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 14 Dec 2020 10:27:46 -0800 Subject: [PATCH 13/60] - New upstream ALPHA release v3.3.52 - Includes all patches --- .gitignore | 2 ++ parted.spec | 55 ++++++++--------------------------------------------- sources | 4 ++-- 3 files changed, 12 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index e5f9ad4..ee363b3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ clog /parted-3.2.153.tar.xz.sig /parted-3.3.tar.xz /parted-3.3.tar.xz.sig +/parted-3.3.52.tar.xz +/parted-3.3.52.tar.xz.sig diff --git a/parted.spec b/parted.spec index 2a8cf61..66c8d35 100644 --- a/parted.spec +++ b/parted.spec @@ -3,8 +3,8 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.3 -Release: 8%{?dist} +Version: 3.3.52 +Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -13,49 +13,6 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane -# Upstream patches since v3.3 release -Patch0001: 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch -Patch0002: 0003-tests-Test-incomplete-resizepart-command.patch -Patch0003: 0004-Fix-end_input-usage-in-do_resizepart.patch -Patch0004: 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch -Patch0005: 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch -Patch0006: 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch -Patch0007: 0008-Removed-reference-to-ped_file_system_create.patch -Patch0008: 0009-Add-support-for-the-F2FS-filesystem.patch -Patch0009: 0010-tests-Add-f2fs-to-the-fs-probe-test.patch -Patch0010: 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch -Patch0011: 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch -Patch0012: 0013-Do-not-link-to-libsepol-or-libselinux.patch -Patch0013: 0014-t6001-psep-modify-device-manage-support-detection.patch -Patch0014: 0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch -Patch0015: 0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch -Patch0016: 0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch -Patch0017: 0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch -Patch0018: 0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch -Patch0019: 0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch -Patch0020: 0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch -Patch0021: 0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch -Patch0022: 0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch -Patch0023: 0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch -Patch0024: 0025-tests-Fix-unsigned-warning-in-duplicate.c.patch -Patch0025: 0026-hfs-Fix-gcc-10-bounds-check-warning.patch -Patch0026: 0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0027: 0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch -Patch0028: 0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0029: 0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0030: 0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0031: 0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0032: 0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0033: 0034-ped_assert-Fix-incorrect-exception-option.patch -Patch0034: 0035-ui-Fix-command_line_get_disk_flag.patch -Patch0035: 0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch -Patch0036: 0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch -Patch0037: 0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch -Patch0038: 0039-fs-r-fat-Remove-disabled-code.patch -Patch0039: 0040-fs-r-hfs-Remove-disabled-code.patch -Patch0040: 0041-libparted-Remove-disabled-code.patch -Patch0041: 0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch - BuildRequires: gcc BuildRequires: e2fsprogs-devel BuildRequires: readline-devel @@ -143,9 +100,9 @@ make check %{_mandir}/man8/parted.8.gz %{_mandir}/man8/partprobe.8.gz %{_libdir}/libparted.so.2 -%{_libdir}/libparted.so.2.0.2 +%{_libdir}/libparted.so.2.0.3 %{_libdir}/libparted-fs-resize.so.0 -%{_libdir}/libparted-fs-resize.so.0.0.2 +%{_libdir}/libparted-fs-resize.so.0.0.3 %{_infodir}/parted.info.* %files devel @@ -158,6 +115,10 @@ make check %changelog +* Mon Dec 14 2020 Brian C. Lane - 3.3.52-1 +- New upstream ALPHA release v3.3.52 +- Includes all patches + * Mon Nov 30 2020 Brian C. Lane - 3.3-8 - Add upstream commits to fix various gcc 10 warnings (bcl) diff --git a/sources b/sources index ed18e98..c03ef29 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.3.tar.xz) = d1384694a491aa53bab6206fdeccd1d192de2ed379fe25aa865dd6aa06ed945a728e85b2ccc2fb23f5aa9dfee4a8bd8f0f2be1dd386cb8e8861b73382c6a07e4 -SHA512 (parted-3.3.tar.xz.sig) = b96f048b92e4056ca327635b3b6c00c86e9213be1af4d42ddc1dace91fe44bf40f2d99052ef04509ef8097fea69eca758bcb0de37ef7afc6a1c0d982c2aac5bd +SHA512 (parted-3.3.52.tar.xz) = dceea49a7d26accecf68d447dbfc0078b99d0e4ecbfd565aee972c6a3a72e67165e5a32fad40ebf6b970ad6b93b4b42aa173532082f1a2071e92c1da8f3b4e87 +SHA512 (parted-3.3.52.tar.xz.sig) = ffd382193a98213e155b8412cc8058d639d6cac1653fe2b0ba0bd0b4eaf6f89a62a91bb19ff8643bf68ca720fa36723553fd0b38c674a407de89fb3f1b120304 From 04d1488083b82573a810d0f249aab97cc18ceeb5 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 23:00:08 +0000 Subject: [PATCH 14/60] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 66c8d35..0c543ee 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.3.52 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -115,6 +115,9 @@ make check %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 3.3.52-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Mon Dec 14 2020 Brian C. Lane - 3.3.52-1 - New upstream ALPHA release v3.3.52 - Includes all patches From 8207dbd150159d5f2c3187d789192ee598581c53 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 27 Jan 2021 16:33:04 -0800 Subject: [PATCH 15/60] - New stable upstream release v3.4 --- .gitignore | 2 ++ parted.spec | 7 +++++-- sources | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index ee363b3..b06228a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ clog /parted-3.3.tar.xz.sig /parted-3.3.52.tar.xz /parted-3.3.52.tar.xz.sig +/parted-3.4.tar.xz +/parted-3.4.tar.xz.sig diff --git a/parted.spec b/parted.spec index 0c543ee..c61e125 100644 --- a/parted.spec +++ b/parted.spec @@ -3,8 +3,8 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.3.52 -Release: 2%{?dist} +Version: 3.4 +Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -115,6 +115,9 @@ make check %changelog +* Wed Jan 27 2021 Brian C. Lane - 3.4-1 +- New stable upstream release v3.4 + * Tue Jan 26 2021 Fedora Release Engineering - 3.3.52-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sources b/sources index c03ef29..ea881f9 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.3.52.tar.xz) = dceea49a7d26accecf68d447dbfc0078b99d0e4ecbfd565aee972c6a3a72e67165e5a32fad40ebf6b970ad6b93b4b42aa173532082f1a2071e92c1da8f3b4e87 -SHA512 (parted-3.3.52.tar.xz.sig) = ffd382193a98213e155b8412cc8058d639d6cac1653fe2b0ba0bd0b4eaf6f89a62a91bb19ff8643bf68ca720fa36723553fd0b38c674a407de89fb3f1b120304 +SHA512 (parted-3.4.tar.xz) = e69bd1b610778e980d4595d04892f2ea1faf4ae9bfc98cd62abfc70066423f08ddaa396f9461c7beb1330d023232274606b6b26091a0458aeedd0f3f57536690 +SHA512 (parted-3.4.tar.xz.sig) = 6b11812267e66470ba2908ee1cc78b232b0bc2519787f5a17b92cd5f8ba904b1a836833f19c5244b23d4c7810437eeb26fbbd68fac819391b342709682345472 From a0755650dee4615d87017ead8d947b4ecf98b058 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 3 Feb 2021 09:25:25 -0800 Subject: [PATCH 16/60] Trim changelog back to v3.3 and remove old patches from git --- ...er-move-and-msdos-overlap-to-python3.patch | 34 -- ...s-Test-incomplete-resizepart-command.patch | 25 -- ...Fix-end_input-usage-in-do_resizepart.patch | 34 -- ...d-Add-ChromeOS-Kernel-partition-flag.patch | 283 -------------- ...pport-for-MSDOS-partition-type-bls_b.patch | 139 ------- ...dd-support-for-bls_boot-to-GPT-disks.patch | 248 ------------- ...-reference-to-ped_file_system_create.patch | 29 -- ...-Add-support-for-the-F2FS-filesystem.patch | 201 ---------- ...-tests-Add-f2fs-to-the-fs-probe-test.patch | 27 -- ...resizepart-End-when-prompted-for-bus.patch | 53 --- ...t-for-resizepart-on-a-busy-partition.patch | 85 ----- ...o-not-link-to-libsepol-or-libselinux.patch | 143 ------- ...dify-device-manage-support-detection.patch | 30 -- ...-the-dmsetup-tests-to-use-ENABLE_DEV.patch | 59 --- ...GCC-warning-Wunused-but-set-variable.patch | 51 --- ...rnings-from-GCC-8-Wunused-variable-a.patch | 67 ---- ...rnings-from-GCC-s-Wimplicit-fallthro.patch | 44 --- ...d-a-GCC-warning-for-unused-functions.patch | 61 --- ...rnings-from-GCC-8-Wsuggest-attribute.patch | 248 ------------- ...rnings-from-GCC-8-Wsuggest-attribute.patch | 104 ------ ...plaints-when-using-boot_code-pointer.patch | 41 -- ...plaints-when-using-boot_code-pointer.patch | 25 -- ...mplains-about-signed-sccanf-variable.patch | 38 -- ...-Fix-unsigned-warning-in-duplicate.c.patch | 25 -- ...-hfs-Fix-gcc-10-bounds-check-warning.patch | 41 -- ...gcc-10-warnings-about-cast-alignment.patch | 74 ---- ...ix-gcc-10-warnings-about-cast-alignm.patch | 75 ---- ...gcc-10-warnings-about-cast-alignment.patch | 33 -- ...gcc-10-warnings-about-cast-alignment.patch | 47 --- ...gcc-10-warnings-about-cast-alignment.patch | 49 --- ...gcc-10-warnings-about-cast-alignment.patch | 39 -- ...gcc-10-warnings-about-cast-alignment.patch | 51 --- ...ssert-Fix-incorrect-exception-option.patch | 27 -- 0035-ui-Fix-command_line_get_disk_flag.patch | 27 -- ...rning-about-snprintf-truncating-an-i.patch | 31 -- ...gcc-10-warnings-about-cast-alignment.patch | 98 ----- ...ix-gcc-10-warnings-about-cast-alignm.patch | 103 ------ 0039-fs-r-fat-Remove-disabled-code.patch | 350 ------------------ 0040-fs-r-hfs-Remove-disabled-code.patch | 228 ------------ 0041-libparted-Remove-disabled-code.patch | 108 ------ ...-GCC-warnings-suggesting-pure-for-PE.patch | 112 ------ parted.spec | 242 ------------ 42 files changed, 3829 deletions(-) delete mode 100644 0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch delete mode 100644 0003-tests-Test-incomplete-resizepart-command.patch delete mode 100644 0004-Fix-end_input-usage-in-do_resizepart.patch delete mode 100644 0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch delete mode 100644 0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch delete mode 100644 0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch delete mode 100644 0008-Removed-reference-to-ped_file_system_create.patch delete mode 100644 0009-Add-support-for-the-F2FS-filesystem.patch delete mode 100644 0010-tests-Add-f2fs-to-the-fs-probe-test.patch delete mode 100644 0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch delete mode 100644 0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch delete mode 100644 0013-Do-not-link-to-libsepol-or-libselinux.patch delete mode 100644 0014-t6001-psep-modify-device-manage-support-detection.patch delete mode 100644 0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch delete mode 100644 0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch delete mode 100644 0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch delete mode 100644 0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch delete mode 100644 0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch delete mode 100644 0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch delete mode 100644 0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch delete mode 100644 0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch delete mode 100644 0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch delete mode 100644 0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch delete mode 100644 0025-tests-Fix-unsigned-warning-in-duplicate.c.patch delete mode 100644 0026-hfs-Fix-gcc-10-bounds-check-warning.patch delete mode 100644 0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch delete mode 100644 0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0034-ped_assert-Fix-incorrect-exception-option.patch delete mode 100644 0035-ui-Fix-command_line_get_disk_flag.patch delete mode 100644 0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch delete mode 100644 0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch delete mode 100644 0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch delete mode 100644 0039-fs-r-fat-Remove-disabled-code.patch delete mode 100644 0040-fs-r-hfs-Remove-disabled-code.patch delete mode 100644 0041-libparted-Remove-disabled-code.patch delete mode 100644 0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch diff --git a/0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch b/0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch deleted file mode 100644 index 90bf71a..0000000 --- a/0001-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 22a4baba11ab299722e68f9ea37a53869afef7e1 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 27 Jun 2018 13:47:33 -0700 -Subject: [PATCH 1/4] Switch gpt-header-move and msdos-overlap to python3 - -python2 is EOL on January 1, 2020 so it is time to switch to python3. ---- - tests/gpt-header-move | 2 +- - tests/msdos-overlap | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/gpt-header-move b/tests/gpt-header-move -index 3dda5cb..18f58d0 100755 ---- a/tests/gpt-header-move -+++ b/tests/gpt-header-move -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - - # open img file, subtract 33 from altlba address, and move the last 33 sectors - # back by 33 sectors -diff --git a/tests/msdos-overlap b/tests/msdos-overlap -index d6ae8d6..b2b03e6 100755 ---- a/tests/msdos-overlap -+++ b/tests/msdos-overlap -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - """ - Write an overlapping partition to a msdos disk - --- -2.23.0 - diff --git a/0003-tests-Test-incomplete-resizepart-command.patch b/0003-tests-Test-incomplete-resizepart-command.patch deleted file mode 100644 index cbea90a..0000000 --- a/0003-tests-Test-incomplete-resizepart-command.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 679da92c54c75d7fca1fd825f1d42a750d115f2d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 23 Apr 2019 10:25:20 -0700 -Subject: [PATCH 3/4] tests: Test incomplete resizepart command - ---- - tests/t3200-resize-partition.sh | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh -index 4565e99..06dbe68 100755 ---- a/tests/t3200-resize-partition.sh -+++ b/tests/t3200-resize-partition.sh -@@ -63,6 +63,8 @@ parted -m -s $dev u s p > out 2>&1 || fail=1 - wait_for_dev_to_appear_ ${dev}1 || { warn_ "${dev}1 did not appear" fail=1; } - sleep 1 - -+# Running it without end should not core-dump or prompt -+parted -s $dev resizepart 1 > out 2> err || fail=1 - - # extend the filesystem to end on sector 4096 - new_end=4096s --- -2.23.0 - diff --git a/0004-Fix-end_input-usage-in-do_resizepart.patch b/0004-Fix-end_input-usage-in-do_resizepart.patch deleted file mode 100644 index 2d570fd..0000000 --- a/0004-Fix-end_input-usage-in-do_resizepart.patch +++ /dev/null @@ -1,34 +0,0 @@ -From ca845aeeddb17343c9289816833ca352f7c0d87b Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 23 Apr 2019 13:52:25 -0700 -Subject: [PATCH 4/4] Fix end_input usage in do_resizepart - -It needs to be set to NULL, since it may not get set by the call to -command_line_get_sector ---- - parted/parted.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/parted/parted.c b/parted/parted.c -index 9dcdb05..df0c7ed 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1545,6 +1545,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - PedGeometry *range_end = NULL; - PedConstraint* constraint; - int rc = 0; -+ char* end_input = NULL; - - if (!disk) { - disk = ped_disk_new (*dev); -@@ -1565,7 +1566,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - - start = part->geom.start; - end = oldend = part->geom.end; -- char *end_input; - if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) - goto error; - _adjust_end_if_iec(&start, &end, range_end, end_input); --- -2.23.0 - diff --git a/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch b/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch deleted file mode 100644 index 7a4605a..0000000 --- a/0005-libparted-Add-ChromeOS-Kernel-partition-flag.patch +++ /dev/null @@ -1,283 +0,0 @@ -From e29dfafcf2d9a6886a66506bc84efb4badc5f6d6 Mon Sep 17 00:00:00 2001 -From: Alper Nebi Yasak -Date: Thu, 10 Oct 2019 21:03:22 +0300 -Subject: [PATCH] libparted: Add ChromeOS Kernel partition flag - -This adds a GPT-only partition type flag, chromeos_kernel, for use on -Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309. - -The firmware/bootloader in these machines relies on special images being -written to partitions of this type. Among multiple such partitions, it -decides which one it will boot from based on the GUID-specific partition -attributes. This patch is not intended to and does not manipulate these -bits. - -Google refers to these partitions as "ChromeOS kernel" partitions. They -also define partitions for rootfs, firmware, and a reserved one; but -these are not necessary for the boot flow and are not included here. - -Relevant ChromiumOS documentation: -https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format - -Signed-off-by: Alper Nebi Yasak ---- - doc/C/parted.8 | 2 +- - doc/parted.texi | 4 ++++ - include/parted/disk.in.h | 5 +++-- - libparted/disk.c | 2 ++ - libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 55 insertions(+), 3 deletions(-) - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index 15932c2..d40279e 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -112,7 +112,7 @@ or an LVM logical volume if necessary. - .B set \fIpartition\fP \fIflag\fP \fIstate\fP - Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. - Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", --"legacy_boot", "irst", "msftres", "esp" and "palo". -+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo". - \fIstate\fP should be either "on" or "off". - .TP - .B unit \fIunit\fP -diff --git a/doc/parted.texi b/doc/parted.texi -index 77c9628..f983d2c 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -874,6 +874,10 @@ partition. - (MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT - it is an alias for boot. - -+@item chromeos_kernel -+(GPT) - this flag indicates a partition that can be used with the Chrome OS -+bootloader and verified boot implementation. -+ - @item lba - (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and - MS Windows ME based operating systems to use Linear (LBA) mode. -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index a3b380d..b257c27 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -75,10 +75,11 @@ enum _PedPartitionFlag { - PED_PARTITION_LEGACY_BOOT=15, - PED_PARTITION_MSFT_DATA=16, - PED_PARTITION_IRST=17, -- PED_PARTITION_ESP=18 -+ PED_PARTITION_ESP=18, -+ PED_PARTITION_CHROMEOS_KERNEL=19 - }; - #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP -+#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -diff --git a/libparted/disk.c b/libparted/disk.c -index 5aaac5a..d1f1077 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -2407,6 +2407,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) - return N_("irst"); - case PED_PARTITION_ESP: - return N_("esp"); -+ case PED_PARTITION_CHROMEOS_KERNEL: -+ return N_("chromeos_kernel"); - - default: - ped_exception_throw ( -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 8e9500b..b8b58cd 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -156,6 +156,10 @@ typedef struct - ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \ - PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \ - { 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }}) -+#define PARTITION_CHROMEOS_KERNEL_GUID \ -+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \ -+ PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \ -+ { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }}) - - struct __attribute__ ((packed)) _GuidPartitionTableHeader_t - { -@@ -303,6 +307,7 @@ typedef struct _GPTPartitionData - int legacy_boot; - int prep; - int irst; -+ int chromeos_kernel; - } GPTPartitionData; - - static PedDiskType gpt_disk_type; -@@ -826,6 +831,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - = gpt_part_data->legacy_boot - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; - - if (pte->Attributes.RequiredToFunction & 0x1) -@@ -857,6 +863,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - gpt_part_data->prep = 1; - else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) - gpt_part_data->irst = 1; -+ else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) -+ gpt_part_data->chromeos_kernel = 1; - - return part; - } -@@ -1377,6 +1385,7 @@ gpt_partition_new (const PedDisk *disk, - gpt_part_data->prep = 0; - gpt_part_data->translated_name = 0; - gpt_part_data->irst = 0; -+ gpt_part_data->chromeos_kernel = 0; - uuid_generate ((unsigned char *) &gpt_part_data->uuid); - swap_uuid_and_efi_guid (&gpt_part_data->uuid); - memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); -@@ -1507,6 +1516,11 @@ gpt_partition_set_system (PedPartition *part, - gpt_part_data->type = PARTITION_IRST_GUID; - return 1; - } -+ if (gpt_part_data->chromeos_kernel) -+ { -+ gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; -+ return 1; -+ } - - if (fs_type) - { -@@ -1653,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_BIOS_GRUB: -@@ -1668,6 +1683,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_RAID: -@@ -1683,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_LVM: -@@ -1698,6 +1715,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_SWAP: -@@ -1713,6 +1731,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HPSERVICE: -@@ -1728,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_MSFT_RESERVED: -@@ -1743,6 +1763,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_MSFT_DATA: -@@ -1758,6 +1779,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - gpt_part_data->msftdata = 1; - } else { -@@ -1777,6 +1799,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftres - = gpt_part_data->prep - = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_APPLE_TV_RECOVERY: -@@ -1791,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftres - = gpt_part_data->msftdata - = gpt_part_data->prep -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->msftrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_PREP: -@@ -1805,6 +1829,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftres - = gpt_part_data->irst - = gpt_part_data->atvrecv -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->msftrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_IRST: -@@ -1820,8 +1845,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftdata - = gpt_part_data->msftrecv - = gpt_part_data->prep -+ = gpt_part_data->chromeos_kernel - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); -+ case PED_PARTITION_CHROMEOS_KERNEL: -+ gpt_part_data->chromeos_kernel = state; -+ if (state) -+ gpt_part_data->boot -+ = gpt_part_data->bios_grub -+ = gpt_part_data->raid -+ = gpt_part_data->lvm -+ = gpt_part_data->swap -+ = gpt_part_data->hp_service -+ = gpt_part_data->msftres -+ = gpt_part_data->msftdata -+ = gpt_part_data->msftrecv -+ = gpt_part_data->atvrecv -+ = gpt_part_data->prep -+ = gpt_part_data->irst = 0; -+ return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HIDDEN: - gpt_part_data->hidden = state; - return 1; -@@ -1874,6 +1916,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) - return gpt_part_data->irst; - case PED_PARTITION_SWAP: - return gpt_part_data->swap; -+ case PED_PARTITION_CHROMEOS_KERNEL: -+ return gpt_part_data->chromeos_kernel; - case PED_PARTITION_LBA: - case PED_PARTITION_ROOT: - default: -@@ -1903,6 +1947,7 @@ gpt_partition_is_flag_available (const PedPartition *part, - case PED_PARTITION_PREP: - case PED_PARTITION_IRST: - case PED_PARTITION_ESP: -+ case PED_PARTITION_CHROMEOS_KERNEL: - return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: --- -2.24.1 - diff --git a/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch b/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch deleted file mode 100644 index 7bba38a..0000000 --- a/0006-libparted-Add-support-for-MSDOS-partition-type-bls_b.patch +++ /dev/null @@ -1,139 +0,0 @@ -From d6056299028f60b96802487de0d1d65e51e1fd33 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 19 Dec 2019 16:05:59 -0800 -Subject: [PATCH 6/7] libparted: Add support for MSDOS partition type bls_boot - (0xea) - -This type is used by the Boot Loader Specification to identify a -compatible /boot boot partition. ---- - doc/C/parted.8 | 2 +- - libparted/labels/dos.c | 33 ++++++++++++++++++++------------- - 2 files changed, 21 insertions(+), 14 deletions(-) - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index d40279e..297c39a 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -112,7 +112,7 @@ or an LVM logical volume if necessary. - .B set \fIpartition\fP \fIflag\fP \fIstate\fP - Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. - Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", --"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo". -+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo". - \fIstate\fP should be either "on" or "off". - .TP - .B unit \fIunit\fP -diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c -index ed1341e..d859b33 100644 ---- a/libparted/labels/dos.c -+++ b/libparted/labels/dos.c -@@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = { - #define PARTITION_HFS 0xaf - #define PARTITION_SUN_UFS 0xbf - #define PARTITION_DELL_DIAG 0xde -+#define PARTITION_BLS_BOOT 0xea - #define PARTITION_GPT 0xee - #define PARTITION_ESP 0xef - #define PARTITION_PALO 0xf0 -@@ -165,6 +166,7 @@ typedef struct { - int diag; - int irst; - int esp; -+ int bls_boot; - OrigState* orig; /* used for CHS stuff */ - } DosPartitionData; - -@@ -961,6 +963,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, - dos_data->prep = raw_part->type == PARTITION_PREP; - dos_data->irst = raw_part->type == PARTITION_IRST; - dos_data->esp = raw_part->type == PARTITION_ESP; -+ dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT; - dos_data->orig = ped_malloc (sizeof (OrigState)); - if (!dos_data->orig) { - ped_partition_destroy (part); -@@ -1340,22 +1343,10 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type, - - if (ped_partition_is_active (part)) { - part->disk_specific -- = dos_data = ped_malloc (sizeof (DosPartitionData)); -+ = dos_data = ped_calloc (sizeof (DosPartitionData)); - if (!dos_data) - goto error_free_part; -- dos_data->orig = NULL; - dos_data->system = PARTITION_LINUX; -- dos_data->hidden = 0; -- dos_data->msftres = 0; -- dos_data->boot = 0; -- dos_data->diag = 0; -- dos_data->raid = 0; -- dos_data->lvm = 0; -- dos_data->lba = 0; -- dos_data->palo = 0; -- dos_data->prep = 0; -- dos_data->irst = 0; -- dos_data->esp = 0; - } else { - part->disk_specific = NULL; - } -@@ -1394,6 +1385,7 @@ msdos_partition_duplicate (const PedPartition* part) - new_dos_data->prep = old_dos_data->prep; - new_dos_data->irst = old_dos_data->irst; - new_dos_data->esp = old_dos_data->esp; -+ new_dos_data->bls_boot = old_dos_data->bls_boot; - - if (old_dos_data->orig) { - new_dos_data->orig = ped_malloc (sizeof (OrigState)); -@@ -1492,6 +1484,10 @@ msdos_partition_set_system (PedPartition* part, - dos_data->system = PARTITION_ESP; - return 1; - } -+ if (dos_data->bls_boot) { -+ dos_data->system = PARTITION_BLS_BOOT; -+ return 1; -+ } - - if (!fs_type) - dos_data->system = PARTITION_LINUX; -@@ -1534,6 +1530,7 @@ clear_flags (DosPartitionData *dos_data) - dos_data->irst = 0; - dos_data->esp = 0; - dos_data->raid = 0; -+ dos_data->bls_boot = 0; - } - - static int -@@ -1635,6 +1632,12 @@ msdos_partition_set_flag (PedPartition* part, - dos_data->esp = state; - return ped_partition_set_system (part, part->fs_type); - -+ case PED_PARTITION_BLS_BOOT: -+ if (state) -+ clear_flags (dos_data); -+ dos_data->bls_boot = state; -+ return ped_partition_set_system (part, part->fs_type); -+ - default: - return 0; - } -@@ -1689,6 +1692,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) - case PED_PARTITION_ESP: - return dos_data->esp; - -+ case PED_PARTITION_BLS_BOOT: -+ return dos_data->bls_boot; -+ - default: - return 0; - } -@@ -1719,6 +1725,7 @@ msdos_partition_is_flag_available (const PedPartition* part, - case PED_PARTITION_PREP: - case PED_PARTITION_IRST: - case PED_PARTITION_ESP: -+ case PED_PARTITION_BLS_BOOT: - case PED_PARTITION_DIAG: - return 1; - --- -2.24.1 - diff --git a/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch b/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch deleted file mode 100644 index d46742f..0000000 --- a/0007-libparted-Add-support-for-bls_boot-to-GPT-disks.patch +++ /dev/null @@ -1,248 +0,0 @@ -From e5fe9328c890a266544a7ef0d272150519fdfc5d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 20 Dec 2019 10:52:35 -0800 -Subject: [PATCH 7/7] libparted: Add support for bls_boot to GPT disks - -This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to -indicate that the partition is a Boot Loader Specification compatible -/boot partition. ---- - doc/parted.texi | 4 ++++ - include/parted/disk.in.h | 5 +++-- - libparted/disk.c | 2 ++ - libparted/labels/gpt.c | 47 +++++++++++++++++++++++++++++++++++++++- - 4 files changed, 55 insertions(+), 3 deletions(-) - -diff --git a/doc/parted.texi b/doc/parted.texi -index f983d2c..213fc84 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -844,6 +844,10 @@ GRUB BIOS partition. - (GPT) - this flag is used to tell special purpose software that the GPT - partition may be bootable. - -+@item bls_boot -+(MS-DOS, GPT) - Enable this to indicate that the selected partition is a -+Linux Boot Loader Specification compatible /boot partition. -+ - @item boot - (Mac, MS-DOS, PC98) - should be enabled if you want to boot off the - partition. The semantics vary between disk labels. For MS-DOS disk -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index b257c27..fadb995 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -76,10 +76,11 @@ enum _PedPartitionFlag { - PED_PARTITION_MSFT_DATA=16, - PED_PARTITION_IRST=17, - PED_PARTITION_ESP=18, -- PED_PARTITION_CHROMEOS_KERNEL=19 -+ PED_PARTITION_CHROMEOS_KERNEL=19, -+ PED_PARTITION_BLS_BOOT=20 - }; - #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL -+#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -diff --git a/libparted/disk.c b/libparted/disk.c -index d1f1077..099837b 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -2409,6 +2409,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) - return N_("esp"); - case PED_PARTITION_CHROMEOS_KERNEL: - return N_("chromeos_kernel"); -+ case PED_PARTITION_BLS_BOOT: -+ return N_("bls_boot"); - - default: - ped_exception_throw ( -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index b8b58cd..93f7add 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -160,6 +160,10 @@ typedef struct - ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \ - PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \ - { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }}) -+#define PARTITION_BLS_BOOT_GUID \ -+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \ -+ PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ -+ { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) - - struct __attribute__ ((packed)) _GuidPartitionTableHeader_t - { -@@ -308,6 +312,7 @@ typedef struct _GPTPartitionData - int prep; - int irst; - int chromeos_kernel; -+ int bls_boot; - } GPTPartitionData; - - static PedDiskType gpt_disk_type; -@@ -832,6 +837,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; - - if (pte->Attributes.RequiredToFunction & 0x1) -@@ -865,6 +871,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - gpt_part_data->irst = 1; - else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) - gpt_part_data->chromeos_kernel = 1; -+ else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID)) -+ gpt_part_data->bls_boot = 1; - - return part; - } -@@ -1386,6 +1394,7 @@ gpt_partition_new (const PedDisk *disk, - gpt_part_data->translated_name = 0; - gpt_part_data->irst = 0; - gpt_part_data->chromeos_kernel = 0; -+ gpt_part_data->bls_boot = 0; - uuid_generate ((unsigned char *) &gpt_part_data->uuid); - swap_uuid_and_efi_guid (&gpt_part_data->uuid); - memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); -@@ -1521,6 +1530,11 @@ gpt_partition_set_system (PedPartition *part, - gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; - return 1; - } -+ if (gpt_part_data->bls_boot) -+ { -+ gpt_part_data->type = PARTITION_BLS_BOOT_GUID; -+ return 1; -+ } - - if (fs_type) - { -@@ -1668,6 +1682,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_BIOS_GRUB: -@@ -1684,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_RAID: -@@ -1700,6 +1716,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_LVM: -@@ -1716,6 +1733,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_SWAP: -@@ -1732,6 +1750,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HPSERVICE: -@@ -1748,6 +1767,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_MSFT_RESERVED: -@@ -1764,6 +1784,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_MSFT_DATA: -@@ -1780,6 +1801,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - gpt_part_data->msftdata = 1; - } else { -@@ -1830,6 +1852,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->irst - = gpt_part_data->atvrecv - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->msftrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_IRST: -@@ -1846,6 +1869,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->prep - = gpt_part_data->chromeos_kernel -+ = gpt_part_data->bls_boot - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_CHROMEOS_KERNEL: -@@ -1862,7 +1886,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->msftrecv - = gpt_part_data->atvrecv - = gpt_part_data->prep -- = gpt_part_data->irst = 0; -+ = gpt_part_data->irst -+ = gpt_part_data->bls_boot = 0; -+ return gpt_partition_set_system (part, part->fs_type); -+ case PED_PARTITION_BLS_BOOT: -+ gpt_part_data->bls_boot = state; -+ if (state) -+ gpt_part_data->boot -+ = gpt_part_data->raid -+ = gpt_part_data->lvm -+ = gpt_part_data->swap -+ = gpt_part_data->bios_grub -+ = gpt_part_data->hp_service -+ = gpt_part_data->msftres -+ = gpt_part_data->msftdata -+ = gpt_part_data->msftrecv -+ = gpt_part_data->prep -+ = gpt_part_data->irst -+ = gpt_part_data->chromeos_kernel -+ = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HIDDEN: - gpt_part_data->hidden = state; -@@ -1914,6 +1956,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) - return gpt_part_data->prep; - case PED_PARTITION_IRST: - return gpt_part_data->irst; -+ case PED_PARTITION_BLS_BOOT: -+ return gpt_part_data->bls_boot; - case PED_PARTITION_SWAP: - return gpt_part_data->swap; - case PED_PARTITION_CHROMEOS_KERNEL: -@@ -1948,6 +1992,7 @@ gpt_partition_is_flag_available (const PedPartition *part, - case PED_PARTITION_IRST: - case PED_PARTITION_ESP: - case PED_PARTITION_CHROMEOS_KERNEL: -+ case PED_PARTITION_BLS_BOOT: - return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: --- -2.24.1 - diff --git a/0008-Removed-reference-to-ped_file_system_create.patch b/0008-Removed-reference-to-ped_file_system_create.patch deleted file mode 100644 index 5307d5a..0000000 --- a/0008-Removed-reference-to-ped_file_system_create.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8c50fec522f475c51e2aaa3c972ce4c6690dda92 Mon Sep 17 00:00:00 2001 -From: Max Campbell -Date: Thu, 12 Dec 2019 16:54:29 +0100 -Subject: [PATCH 08/12] Removed reference to ped_file_system_create - -Removed a reference to the removed function ped_file_system_create in -the docs for ped_file_system_clobber. - -Signed-off-by: Brian C. Lane ---- - libparted/fs/r/filesys.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c -index d57447c..dd316aa 100644 ---- a/libparted/fs/r/filesys.c -+++ b/libparted/fs/r/filesys.c -@@ -213,8 +213,6 @@ error_close_dev: - * file system occupies a given region described by \p geom. - * After this operation ped_file_system_probe() won't detect any file system. - * -- * \note ped_file_system_create() calls this before creating a new file system. -- * - * \return \c 1 on success, \c 0 on failure - */ - static int --- -2.26.2 - diff --git a/0009-Add-support-for-the-F2FS-filesystem.patch b/0009-Add-support-for-the-F2FS-filesystem.patch deleted file mode 100644 index c0578fd..0000000 --- a/0009-Add-support-for-the-F2FS-filesystem.patch +++ /dev/null @@ -1,201 +0,0 @@ -From c6b61814cd4cf958e12d35a36184ff7d767e57d9 Mon Sep 17 00:00:00 2001 -From: Romain Perier -Date: Fri, 20 Mar 2020 17:43:16 +0100 -Subject: [PATCH 09/12] Add support for the F2FS filesystem - -This adds a basic support for the Flash-Friendly File System. So -we can manipulate the file system by using the PedFileSystem API and we -can do basic device probing for autodetecting the current fs. - -Signed-off-by: Romain Perier -Signed-off-by: Brian C. Lane ---- - libparted/fs/Makefile.am | 2 ++ - libparted/fs/f2fs/f2fs.c | 60 ++++++++++++++++++++++++++++++++++++++++ - libparted/fs/f2fs/f2fs.h | 57 ++++++++++++++++++++++++++++++++++++++ - libparted/libparted.c | 4 +++ - 4 files changed, 123 insertions(+) - create mode 100644 libparted/fs/f2fs/f2fs.c - create mode 100644 libparted/fs/f2fs/f2fs.h - -diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am -index 74f275a..e40eee8 100644 ---- a/libparted/fs/Makefile.am -+++ b/libparted/fs/Makefile.am -@@ -32,6 +32,8 @@ libfs_la_SOURCES = \ - fat/count.h \ - fat/fat.c \ - fat/fat.h \ -+ f2fs/f2fs.c \ -+ f2fs/f2fs.h \ - hfs/hfs.c \ - hfs/hfs.h \ - hfs/probe.c \ -diff --git a/libparted/fs/f2fs/f2fs.c b/libparted/fs/f2fs/f2fs.c -new file mode 100644 -index 0000000..64883e9 ---- /dev/null -+++ b/libparted/fs/f2fs/f2fs.c -@@ -0,0 +1,60 @@ -+/* -+ libparted/fs/f2fs - Flash-Friendly File System -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+*/ -+ -+#include -+ -+#include -+#include -+ -+#include "f2fs.h" -+ -+static PedGeometry* -+f2fs_probe (PedGeometry* geom) -+{ -+ struct f2fs_super_block *sb = alloca(geom->dev->sector_size); -+ -+ if (!ped_geometry_read (geom, sb, F2FS_SB_OFFSET, 1)) -+ return NULL; -+ -+ if (PED_LE32_TO_CPU(sb->magic) == F2FS_MAGIC) -+ return ped_geometry_new (geom->dev, geom->start, geom->length); -+ -+ return NULL; -+} -+ -+static PedFileSystemOps f2fs_ops = { -+ probe: f2fs_probe, -+}; -+ -+static PedFileSystemType f2fs_type = { -+ next: NULL, -+ ops: &f2fs_ops, -+ name: "f2fs", -+}; -+ -+void -+ped_file_system_f2fs_init () -+{ -+ ped_file_system_type_register (&f2fs_type); -+} -+ -+void -+ped_file_system_f2fs_done () -+{ -+ ped_file_system_type_unregister (&f2fs_type); -+} -diff --git a/libparted/fs/f2fs/f2fs.h b/libparted/fs/f2fs/f2fs.h -new file mode 100644 -index 0000000..c96b88f ---- /dev/null -+++ b/libparted/fs/f2fs/f2fs.h -@@ -0,0 +1,57 @@ -+/* -+ libparted/fs/f2fs - Flash-Friendly File System -+ Copyright (C) 2020 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+*/ -+#ifndef _F2FS_H -+#define _F2FS_H -+ -+#define F2FS_MAGIC 0xF2F52010 -+#define F2FS_MAX_VOLUME_NAME 512 -+#define F2FS_SB_OFFSET 0x02 -+ -+struct f2fs_super_block { -+ uint32_t magic; /* Magic Number */ -+ uint16_t major_ver; /* Major Version */ -+ uint16_t minor_ver; /* Minor Version */ -+ uint32_t log_sectorsize; /* log2 sector size in bytes */ -+ uint32_t log_sectors_per_block; /* log2 # of sectors per block */ -+ uint32_t log_blocksize; /* log2 block size in bytes */ -+ uint32_t log_blocks_per_seg; /* log2 # of blocks per segment */ -+ uint32_t segs_per_sec; /* # of segments per section */ -+ uint32_t secs_per_zone; /* # of sections per zone */ -+ uint32_t checksum_offset; /* checksum offset inside super block */ -+ uint64_t block_count; /* total # of user blocks */ -+ uint32_t section_count; /* total # of sections */ -+ uint32_t segment_count; /* total # of segments */ -+ uint32_t segment_count_ckpt; /* # of segments for checkpoint */ -+ uint32_t segment_count_sit; /* # of segments for SIT */ -+ uint32_t segment_count_nat; /* # of segments for NAT */ -+ uint32_t segment_count_ssa; /* # of segments for SSA */ -+ uint32_t segment_count_main; /* # of segments for main area */ -+ uint32_t segment0_blkaddr; /* start block address of segment 0 */ -+ uint32_t cp_blkaddr; /* start block address of checkpoint */ -+ uint32_t sit_blkaddr; /* start block address of SIT */ -+ uint32_t nat_blkaddr; /* start block address of NAT */ -+ uint32_t ssa_blkaddr; /* start block address of SSA */ -+ uint32_t main_blkaddr; /* start block address of main area */ -+ uint32_t root_ino; /* root inode number */ -+ uint32_t node_ino; /* node inode number */ -+ uint32_t meta_ino; /* meta inode number */ -+ uint8_t uuid[16]; /* 128-bit uuid for volume */ -+ uint16_t volume_name[F2FS_MAX_VOLUME_NAME]; /* volume name */ -+} __attribute__((packed)); -+ -+#endif -diff --git a/libparted/libparted.c b/libparted/libparted.c -index 00f5ff8..4a57a80 100644 ---- a/libparted/libparted.c -+++ b/libparted/libparted.c -@@ -109,6 +109,7 @@ extern void ped_file_system_linux_swap_init (void); - extern void ped_file_system_jfs_init (void); - extern void ped_file_system_hfs_init (void); - extern void ped_file_system_fat_init (void); -+extern void ped_file_system_f2fs_init (void); - extern void ped_file_system_ext2_init (void); - extern void ped_file_system_nilfs2_init (void); - extern void ped_file_system_btrfs_init (void); -@@ -126,6 +127,7 @@ init_file_system_types () - ped_file_system_jfs_init (); - ped_file_system_hfs_init (); - ped_file_system_fat_init (); -+ ped_file_system_f2fs_init (); - ped_file_system_ext2_init (); - ped_file_system_nilfs2_init (); - ped_file_system_btrfs_init (); -@@ -186,6 +188,7 @@ _init() - extern void ped_file_system_nilfs2_done (void); - extern void ped_file_system_ext2_done (void); - extern void ped_file_system_fat_done (void); -+extern void ped_file_system_f2fs_done (void); - extern void ped_file_system_hfs_done (void); - extern void ped_file_system_jfs_done (void); - extern void ped_file_system_linux_swap_done (void); -@@ -202,6 +205,7 @@ done_file_system_types () - { - ped_file_system_nilfs2_done (); - ped_file_system_ext2_done (); -+ ped_file_system_f2fs_done (); - ped_file_system_fat_done (); - ped_file_system_hfs_done (); - ped_file_system_jfs_done (); --- -2.26.2 - diff --git a/0010-tests-Add-f2fs-to-the-fs-probe-test.patch b/0010-tests-Add-f2fs-to-the-fs-probe-test.patch deleted file mode 100644 index cf376ad..0000000 --- a/0010-tests-Add-f2fs-to-the-fs-probe-test.patch +++ /dev/null @@ -1,27 +0,0 @@ -From eaada0bc9e1cc8adb3a0260707d9474a3e01b835 Mon Sep 17 00:00:00 2001 -From: Romain Perier -Date: Fri, 20 Mar 2020 17:43:17 +0100 -Subject: [PATCH 10/12] tests: Add f2fs to the fs probe test - -Signed-off-by: Romain Perier -Signed-off-by: Brian C. Lane ---- - tests/t1700-probe-fs.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh -index 1fe3309..9150a37 100755 ---- a/tests/t1700-probe-fs.sh -+++ b/tests/t1700-probe-fs.sh -@@ -23,7 +23,7 @@ dev=loop-file - ss=$sector_size_ - n_sectors=$((512*1024)) - --for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf; do -+for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do - - ( mkfs.$type 2>&1 | grep -i '^usage' ) > /dev/null \ - || { warn_ "$ME: no $type support"; continue; } --- -2.26.2 - diff --git a/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch b/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch deleted file mode 100644 index 292cc69..0000000 --- a/0011-parted-Preserve-resizepart-End-when-prompted-for-bus.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 691dabc930a6d544dfd8da787cddd159bab34b1e Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 31 Aug 2020 16:40:07 -0700 -Subject: [PATCH 11/12] parted: Preserve resizepart End when prompted for busy - partition - -Resizing busy partitions is allowed, but the user is prompted, which -erases the cmdline. It is annoying to have to re-end the ending location -after answering Yes. This saves the word and pushes it back onto the -cmdline after the user agrees to resize the busy partition. ---- - parted/parted.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/parted/parted.c b/parted/parted.c -index df0c7ed..dbd38d0 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1546,6 +1546,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - PedConstraint* constraint; - int rc = 0; - char* end_input = NULL; -+ char* end_size = NULL; - - if (!disk) { - disk = ped_disk_new (*dev); -@@ -1561,9 +1562,23 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - - if (!command_line_get_partition (_("Partition number?"), disk, &part)) - goto error; -+ -+ /* Save the optional End value if the partition is busy. */ -+ if (ped_partition_is_busy(part)) { -+ if (command_line_get_word_count()) -+ end_size = command_line_pop_word(); -+ } -+ -+ /* If the partition is busy this may clear the command_line and prompt the user */ - if (!_partition_warn_busy (part)) - goto error; - -+ /* Push the End value back onto the command_line, if it exists */ -+ if (end_size) { -+ command_line_push_word(end_size); -+ free(end_size); -+ } -+ - start = part->geom.start; - end = oldend = part->geom.end; - if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) --- -2.26.2 - diff --git a/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch b/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch deleted file mode 100644 index 327d872..0000000 --- a/0012-tests-Add-a-test-for-resizepart-on-a-busy-partition.patch +++ /dev/null @@ -1,85 +0,0 @@ -From dfc611bd5126840d68493ad0e761511a71325af7 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 1 Sep 2020 14:51:54 -0700 -Subject: [PATCH 12/12] tests: Add a test for resizepart on a busy partition - -This makes sure that the resizepart on a busy partition with the size on -the cmdline will work. ---- - tests/t3200-resize-partition.sh | 44 ++++++++++++++++++++++++++++++--- - 1 file changed, 40 insertions(+), 4 deletions(-) - -diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh -index 06dbe68..2200977 100755 ---- a/tests/t3200-resize-partition.sh -+++ b/tests/t3200-resize-partition.sh -@@ -2,7 +2,7 @@ - # exercise the resize sub-command - # based on t3000-resize-fs.sh test - --# Copyright (C) 2009-2011, 2019 Free Software Foundation, Inc. -+# Copyright (C) 2009-2020 Free Software Foundation, Inc. - - # This program is free software; you can redistribute it and/or modify - # it under the terms of the GNU General Public License as published by -@@ -66,8 +66,8 @@ sleep 1 - # Running it without end should not core-dump or prompt - parted -s $dev resizepart 1 > out 2> err || fail=1 - --# extend the filesystem to end on sector 4096 --new_end=4096s -+# extend the filesystem to end on sector 2048 -+new_end=2048s - parted -s $dev resizepart 1 $new_end > out 2> err || fail=1 - # expect no output - compare /dev/null out || fail=1 -@@ -77,9 +77,45 @@ compare /dev/null err || fail=1 - parted -m -s $dev u s p > out 2>&1 || fail=1 - - sed -n 3p out > k && mv k out || fail=1 --printf "1:$default_start:$new_end:3073s:::$ms;\n" > exp || fail=1 -+printf "1:$default_start:$new_end:1025s:::$ms;\n" > exp || fail=1 - compare exp out || fail=1 - -+## Make sure resizing a busy partition works when user answers 'yes' -+# Format the partition and mount it for the busy check -+mkfs.ext4 "${dev}1" || skip_ mkfs.ext4 failed -+ -+# be sure to unmount upon interrupt, failure, etc. -+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } -+ -+mount_point=$(pwd)/mnt -+ -+mkdir $mount_point || fail=1 -+mount "${dev}1" "$mount_point" || fail=1 -+ -+# extend the filesystem to end on sector 4096 -+new_end=4096s -+echo yes | parted ---pretend-input-tty $dev resizepart 1 $new_end > out 2>&1 -+cat > exp < out -+compare exp out || fail=1 -+ -+# print partition table -+parted -m -s $dev u s p > out 2>&1 || fail=1 -+ -+sed -n 3p out > k && mv k out || fail=1 -+printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1 -+compare exp out || fail=1 -+ -+umount "${dev}1" || fail=1 -+ - # Remove the partition explicitly, so that mklabel doesn't evoke a warning. - parted -s $dev rm 1 || fail=1 - --- -2.26.2 - diff --git a/0013-Do-not-link-to-libsepol-or-libselinux.patch b/0013-Do-not-link-to-libsepol-or-libselinux.patch deleted file mode 100644 index 196732b..0000000 --- a/0013-Do-not-link-to-libsepol-or-libselinux.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 2a2e05f09be4dd350bc91747f03378e7c534265d Mon Sep 17 00:00:00 2001 -From: Petr Lautrbach -Date: Tue, 3 Nov 2020 15:06:34 +0100 -Subject: [PATCH] Do not link to libsepol or libselinux - -Given that there's no code which would use it there's no reason to link -to libsepol or libselinux even when they are available. - -Signed-off-by: Brian C. Lane ---- - AUTHORS | 8 ++++---- - configure.ac | 12 ------------ - libparted/Makefile.am | 1 - - parted.spec.in | 15 ++------------- - 4 files changed, 6 insertions(+), 30 deletions(-) - -diff --git a/AUTHORS b/AUTHORS -index 530a28b..8119934 100644 ---- a/AUTHORS -+++ b/AUTHORS -@@ -72,7 +72,7 @@ Matthew Wilson - * Don't detect AIX physical volumes as msdos partition tables - * Code for manipulating AIX PVs - --Martin von Lwis -+Martin von Löwis - * German translations - - Baty Jean-Marc -@@ -113,7 +113,7 @@ Ben Collins - * Sun disk label support (libparted/disk_sun.c) - * stubs for UFS - --Vincent Stelh -+Vincent Stelhé - * move syntax patch (make END specification optional). Trivial - for copyright purposes (no disclaimer needed) - -@@ -132,7 +132,7 @@ Matt Domsch - Kjetil Torgrim Homme - * Norweigen translations - --Jrgen Tegnr -+Jörgen Tegnér - * Swedish translations - - Keld Simonsen -@@ -153,7 +153,7 @@ Vicente E. Llorens - Yury Umanets - * basis of libparted/fs_reiserfs - --Bernardo Joo Torres da Silveira -+Bernardo João Torres da Silveira - - * pt_BR translation of FAQ and parted.texi - -diff --git a/configure.ac b/configure.ac -index c46a3ff..ef78600 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -89,11 +89,6 @@ if test $ENABLE_DEVICE_MAPPER = yes; then - 1, [device mapper (libdevmapper) support]) - fi - --AC_ARG_ENABLE([selinux], -- [ --enable-selinux enable SELinux support [default=no]], , -- enable_selinux=no --) -- - AC_ARG_ENABLE([discover-only], - [ --enable-discover-only support only reading/probing [default=no]], , - enable_discover_only=no -@@ -320,13 +315,6 @@ package as well (it may be called device-mapper-devel or something similar).] - fi - AC_SUBST([DM_LIBS]) - --dnl Check for SELinux --SELINUX_LIBS="" --if test "$enable_selinux" = yes; then -- SELINUX_LIBS="-lselinux -lsepol" --fi --AC_SUBST([SELINUX_LIBS]) -- - dnl Check for termcap - if test "$with_readline" = yes; then - OLD_LIBS="$LIBS" -diff --git a/libparted/Makefile.am b/libparted/Makefile.am -index bcdde77..e52aa2a 100644 ---- a/libparted/Makefile.am -+++ b/libparted/Makefile.am -@@ -55,7 +55,6 @@ libparted_la_LIBADD = \ - $(top_builddir)/lib/libgnulib.la \ - $(OS_LIBS) \ - $(DM_LIBS) \ -- $(SELINUX_LIBS) \ - $(LIB_BLKID) \ - $(UUID_LIBS) \ - $(INTLLIBS) -diff --git a/parted.spec.in b/parted.spec.in -index bdbe218..d0e2b11 100644 ---- a/parted.spec.in -+++ b/parted.spec.in -@@ -1,15 +1,9 @@ --# Default to disabling device-mapper and SELinux -+# Default to disabling device-mapper - %define use_devmapper 0 --%define use_selinux 0 --%define use_sepol 0 - - # Enable device-mapper support if we find devmapper - %define use_devmapper %(pkg-config --libs devmapper >/dev/null 2>&1; [ $? -eq 0 ] && echo 1) - --# Enable SELinux if we find libselinux and libsepol --%define use_selinux %([ -r %{_libdir}/libselinux.a ] && echo 1) --%define use_sepol %([ -r %{_libdir}/libsepol.so ] && echo 1) -- - Summary: The GNU disk partition manipulation program - Name: @PACKAGE@ - Version: @VERSION@ -@@ -22,7 +16,7 @@ Group: Applications/System - BuildRequires: e2fsprogs-devel readline-devel ncurses-devel gperf - BuildRequires: automake libtool gettext-devel texinfo pkgconfig - --BuildRequires: device-mapper-devel, libselinux-devel libsepol-devel -+BuildRequires: device-mapper-devel - - Prereq: /sbin/install-info - -@@ -52,11 +46,6 @@ Parted library, you need to install this package. - --enable-device-mapper \ - %else - --disable-devmapper \ --%endif --%if "%{use_selinux}" == "1" && "%{use_sepol}" == "1" -- --enable-selinux \ --%else -- --disable-selinux \ - %endif - --enable-part-static \ - --enable-pc98=no \ --- -2.26.2 - diff --git a/0014-t6001-psep-modify-device-manage-support-detection.patch b/0014-t6001-psep-modify-device-manage-support-detection.patch deleted file mode 100644 index cbadbae..0000000 --- a/0014-t6001-psep-modify-device-manage-support-detection.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0eef2b04caad4a7b251ecf5e1c58ad33582da6e5 Mon Sep 17 00:00:00 2001 -From: Joe Slater -Date: Thu, 20 Jun 2019 14:33:04 -0700 -Subject: [PATCH 14/42] t6001-psep: modify device manage support detection - -Use the method other tests use -- test an environment variable. - -Signed-off-by: Joe Slater -Signed-off-by: Brian C. Lane ---- - tests/t6001-psep.sh | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh -index e350bd2..73f2d1c 100644 ---- a/tests/t6001-psep.sh -+++ b/tests/t6001-psep.sh -@@ -21,7 +21,8 @@ - require_root_ - require_udevadm_settle_ - --(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" -+test "x$ENABLE_DEVICE_MAPPER" = xyes \ -+ || skip_ "no device-mapper support" - - # Device maps names - should be random to not conflict with existing ones on - # the system --- -2.26.2 - diff --git a/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch b/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch deleted file mode 100644 index 539b29d..0000000 --- a/0015-tests-Update-all-the-dmsetup-tests-to-use-ENABLE_DEV.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 04ca93351a4e25c35562ef705b3d96c3743609ff Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 25 Jun 2019 09:37:32 -0700 -Subject: [PATCH 15/42] tests: Update all the dmsetup tests to use - ENABLE_DEVICE_MAPPER - ---- - tests/t6004-dm-many-partitions.sh | 4 +++- - tests/t6005-dm-uuid.sh | 4 +++- - tests/t6006-dm-512b-sectors.sh | 3 ++- - 3 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh -index b4be975..636c837 100755 ---- a/tests/t6004-dm-many-partitions.sh -+++ b/tests/t6004-dm-many-partitions.sh -@@ -21,7 +21,9 @@ - - require_root_ - require_udevadm_settle_ --(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" -+ -+test "x$ENABLE_DEVICE_MAPPER" = xyes \ -+ || skip_ "no device-mapper support" - - ss=$sector_size_ - ns=300 -diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh -index 4266747..790c23f 100755 ---- a/tests/t6005-dm-uuid.sh -+++ b/tests/t6005-dm-uuid.sh -@@ -21,7 +21,9 @@ - - require_root_ - require_udevadm_settle_ --(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" -+ -+test "x$ENABLE_DEVICE_MAPPER" = xyes \ -+ || skip_ "no device-mapper support" - - ss=$sector_size_ - ns=300 -diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh -index bf32135..c0de382 100644 ---- a/tests/t6006-dm-512b-sectors.sh -+++ b/tests/t6006-dm-512b-sectors.sh -@@ -25,7 +25,8 @@ require_scsi_debug_module_ - grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || - skip_ 'this system lacks a new-enough libblkid' - --(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" -+test "x$ENABLE_DEVICE_MAPPER" = xyes \ -+ || skip_ "no device-mapper support" - - # Device maps names - should be random to not conflict with existing ones on - # the system --- -2.26.2 - diff --git a/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch b/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch deleted file mode 100644 index 6edef57..0000000 --- a/0016-libparted-Fix-a-GCC-warning-Wunused-but-set-variable.patch +++ /dev/null @@ -1,51 +0,0 @@ -From f75af2cfbbd1a2d82ed3df4955014f73737ae13e Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:18 +0900 -Subject: [PATCH 16/42] libparted: Fix a GCC warning -Wunused-but-set-variable - -GCC warns that a variable 'prealloc' defined for _generic_affs_probe() in -fs/amiga/affs.c is set but its value is never used. - - CC amiga/affs.lo -amiga/affs.c: In function '_generic_affs_probe': -amiga/affs.c:54:35: warning: variable 'prealloc' set but not used [-Wunused-but-set-variable] - 54 | int blocksize = 1, reserved = 2, prealloc = 0; - | ^~~~~~~~ -Remove the variable for simplicity and to avoid the warning. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/amiga/affs.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/libparted/fs/amiga/affs.c b/libparted/fs/amiga/affs.c -index 1fde17c..e7c2e47 100644 ---- a/libparted/fs/amiga/affs.c -+++ b/libparted/fs/amiga/affs.c -@@ -52,20 +52,19 @@ _generic_affs_probe (PedGeometry* geom, uint32_t kind) - uint32_t *block; - PedSector root, len, pos; - struct PartitionBlock * part; -- int blocksize = 1, reserved = 2, prealloc = 0; -+ int blocksize = 1, reserved = 2; - - PED_ASSERT (geom != NULL); - PED_ASSERT (geom->dev != NULL); - if (geom->dev->sector_size != 512) - return NULL; -- /* Finds the blocksize, prealloc and reserved values of the partition block */ -+ /* Finds the blocksize and reserved values of the partition block */ - if (!(part = ped_malloc (PED_SECTOR_SIZE_DEFAULT*blocksize))) { - ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, - _("%s : Failed to allocate partition block\n"), __func__); - goto error_part; - } - if (amiga_find_part(geom, part) != NULL) { -- prealloc = PED_BE32_TO_CPU (part->de_PreAlloc); - reserved = PED_BE32_TO_CPU (part->de_Reserved); - reserved = reserved == 0 ? 1 : reserved; - blocksize = PED_BE32_TO_CPU (part->de_SizeBlock) --- -2.26.2 - diff --git a/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch b/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch deleted file mode 100644 index 51278e6..0000000 --- a/0017-libparted-Fix-warnings-from-GCC-8-Wunused-variable-a.patch +++ /dev/null @@ -1,67 +0,0 @@ -From d51921b05c32287238b1b0447d7e952884f63eb5 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:19 +0900 -Subject: [PATCH 17/42] libparted: Fix warnings from GCC 8 -Wunused-variable - and -Warray-bounds - -GCC 8 reports two warnings as follows. - -r/fat/bootsector.c: In function 'fat_boot_sector_set_boot_code': -r/fat/bootsector.c:274:15: warning: unused variable 'fs_info' [-Wunused-variable] - FatSpecific* fs_info = FAT_SPECIFIC (fs); - ^~~~~~~ -In function 'memcpy', - inlined from 'fat_boot_sector_set_boot_code' at r/fat/bootsector.c:283:2: -/usr/include/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' forming offset [126, 128] is out of the bounds [0, 125] [-Warray-bounds] - return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest)); - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To avoid the warnings, remove the unused variable. Use strcpy in place of -memcpy checking copy length. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/r/fat/bootsector.c | 5 ++--- - libparted/fs/r/fat/bootsector.h | 2 -- - 2 files changed, 2 insertions(+), 5 deletions(-) - -diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c -index 46d5926..9130900 100644 ---- a/libparted/fs/r/fat/bootsector.c -+++ b/libparted/fs/r/fat/bootsector.c -@@ -271,8 +271,6 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs) - int - fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs) - { -- FatSpecific* fs_info = FAT_SPECIFIC (fs); -- - PED_ASSERT (bsp != NULL); - *bsp = ped_malloc (fs->geom->dev->sector_size); - FatBootSector *bs = *bsp; -@@ -280,7 +278,8 @@ fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs) - - memset (bs, 0, 512); - memcpy (bs->boot_jump, FAT_BOOT_JUMP, 3); -- memcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE, FAT_BOOT_CODE_LENGTH); -+ PED_ASSERT (sizeof(FAT_BOOT_CODE) < sizeof(bs->u.fat32.boot_code)); -+ strcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE); - return 1; - } - -diff --git a/libparted/fs/r/fat/bootsector.h b/libparted/fs/r/fat/bootsector.h -index 6b0363f..42fc3f2 100644 ---- a/libparted/fs/r/fat/bootsector.h -+++ b/libparted/fs/r/fat/bootsector.h -@@ -57,8 +57,6 @@ typedef struct _FatInfoSector FatInfoSector; - /* message: */ \ - FAT_BOOT_MESSAGE - --#define FAT_BOOT_CODE_LENGTH 128 -- - struct __attribute__ ((packed)) _FatBootSector { - uint8_t boot_jump[3]; /* 00: Boot strap short or near jump */ - uint8_t system_id[8]; /* 03: system name */ --- -2.26.2 - diff --git a/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch b/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch deleted file mode 100644 index 739cbb1..0000000 --- a/0018-libparted-Fix-warnings-from-GCC-s-Wimplicit-fallthro.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 5449d1b1ee763e8ae1057fb7d18f7fbccb7a6fe0 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:17 +0900 -Subject: [PATCH 18/42] libparted: Fix warnings from GCC's - -Wimplicit-fallthrough - -Two case statements have intentional fall-throughs but do not have -comments to note it. GCC detects and warns those case statements. To -avoid the warning, add fall-through comments. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/amiga/amiga.c | 1 + - libparted/fs/r/hfs/reloc.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/libparted/fs/amiga/amiga.c b/libparted/fs/amiga/amiga.c -index be10dae..eb63f24 100644 ---- a/libparted/fs/amiga/amiga.c -+++ b/libparted/fs/amiga/amiga.c -@@ -217,6 +217,7 @@ _amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block, stru - return NULL; - } - } -+ /* FALLTHROUGH */ - case PED_EXCEPTION_IGNORE : - case PED_EXCEPTION_UNHANDLED : - default : -diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c -index 0b8ddc1..d0477ae 100644 ---- a/libparted/fs/r/hfs/reloc.c -+++ b/libparted/fs/r/hfs/reloc.c -@@ -224,6 +224,7 @@ hfs_do_move (PedFileSystem* fs, unsigned int *ptr_src, - priv_data->catalog_file - ->cache[ref->ref_index].start_block = - PED_CPU_TO_BE16(new_start); -+ /* FALLTHROUGH */ - case CR_BTREE_EXT_0 : - file = priv_data->extent_file; - goto CR_BTREE; --- -2.26.2 - diff --git a/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch b/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch deleted file mode 100644 index 3e0af16..0000000 --- a/0019-libparted-Avoid-a-GCC-warning-for-unused-functions.patch +++ /dev/null @@ -1,61 +0,0 @@ -From bed9c6a17ee82c87bf47981149e224f2e34baedb Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:23 +0900 -Subject: [PATCH 19/42] libparted: Avoid a GCC warning for unused functions - -libparted/fs/r/hfs/hfs.c has a '#if 0' block. The block refers two -functions hfsplus_clobber() and hfs_clobber(). It have GCC report a -warning below. - - CC r/hfs/hfs.lo -r/hfs/hfs.c:343:1: warning: 'hfsplus_clobber' defined but not used [-Wunused-function] - 343 | hfsplus_clobber (PedGeometry* geom) - | ^~~~~~~~~~~~~~~ - -To avoid the warning, add two more '#if 0' to disable the two functions. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/r/hfs/hfs.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c -index 6be0390..0aababd 100644 ---- a/libparted/fs/r/hfs/hfs.c -+++ b/libparted/fs/r/hfs/hfs.c -@@ -59,6 +59,7 @@ static PedFileSystemType hfsplus_type; - - /* ----- HFS ----- */ - -+#if 0 - /* This is a very unundoable operation */ - /* Maybe I shouldn't touch the alternate MDB ? */ - /* Anyway clobber is call before other fs creation */ -@@ -78,6 +79,7 @@ hfs_clobber (PedGeometry* geom) - (!!ped_geometry_write (geom, buf, geom->length - 1, 1)) & - (!!ped_geometry_sync (geom)); - } -+#endif - - PedFileSystem * - hfs_open (PedGeometry* geom) -@@ -339,6 +341,7 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) - #include "reloc_plus.h" - #include "journal.h" - -+#if 0 - static int - hfsplus_clobber (PedGeometry* geom) - { -@@ -374,6 +377,7 @@ hfsplus_clobber (PedGeometry* geom) - /* non-embedded or envelop destroy as hfs */ - return ( hfs_clobber (geom) && i ); - } -+#endif - - int - hfsplus_close (PedFileSystem *fs) --- -2.26.2 - diff --git a/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch b/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch deleted file mode 100644 index 60c7900..0000000 --- a/0020-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 20c136159b37f11822b591941c077bb2be6ede05 Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:21 +0900 -Subject: [PATCH 20/42] libparted: Fix warnings from GCC 8 - -Wsuggest-attribute=pure - -As GCC 8 suggests, add 'pure' attribute to 17 functions. After adding -pure attributes, GCC suggested three more functions to add pure -attributes. Add pure attribute to those functions also. In total, add -pure attributes to 20 functions. - -I read code of the functions and confirmed the 20 functions are pure: -they have no effect except the return value, and their return value -depend only on the parameters and/or global variables. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/fat/bootsector.c | 2 +- - libparted/fs/r/fat/bootsector.c | 2 +- - libparted/fs/r/fat/calc.c | 4 ++-- - libparted/fs/r/fat/context.c | 4 ++-- - libparted/fs/r/fat/count.c | 4 ++-- - libparted/fs/r/fat/table.c | 2 +- - libparted/fs/r/fat/traverse.c | 14 +++++++------- - libparted/fs/r/hfs/advfs.c | 4 ++-- - libparted/fs/r/hfs/advfs_plus.c | 4 ++-- - 9 files changed, 20 insertions(+), 20 deletions(-) - -diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c -index 0c3ae77..2a03696 100644 ---- a/libparted/fs/fat/bootsector.c -+++ b/libparted/fs/fat/bootsector.c -@@ -86,7 +86,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom) - /* - Don't trust the FAT12, FAT16 or FAT32 label string. - */ --FatType -+FatType _GL_ATTRIBUTE_PURE - fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom) - { - PedSector logical_sector_size; -diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c -index 9130900..34134cc 100644 ---- a/libparted/fs/r/fat/bootsector.c -+++ b/libparted/fs/r/fat/bootsector.c -@@ -85,7 +85,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom) - /* - Don't trust the FAT12, FAT16 or FAT32 label string. - */ --FatType -+FatType _GL_ATTRIBUTE_PURE - fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom) - { - PedSector logical_sector_size; -diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c -index e524007..60c6bac 100644 ---- a/libparted/fs/r/fat/calc.c -+++ b/libparted/fs/r/fat/calc.c -@@ -314,7 +314,7 @@ fat_calc_resize_sizes ( - friends, to allow room for this space. If too much of this space is left - over, everyone will complain, so we have to be greedy, and use it all up... - */ --PedSector -+PedSector _GL_ATTRIBUTE_PURE - fat_calc_align_sectors (const PedFileSystem* new_fs, - const PedFileSystem* old_fs) - { -@@ -359,7 +359,7 @@ fat_calc_align_sectors (const PedFileSystem* new_fs, - return align; - } - --int -+int _GL_ATTRIBUTE_PURE - fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -diff --git a/libparted/fs/r/fat/context.c b/libparted/fs/r/fat/context.c -index 5c27d09..170094c 100644 ---- a/libparted/fs/r/fat/context.c -+++ b/libparted/fs/r/fat/context.c -@@ -124,7 +124,7 @@ fat_op_context_destroy (FatOpContext* ctx) - free (ctx); - } - --FatFragment -+FatFragment _GL_ATTRIBUTE_PURE - fat_op_context_map_static_fragment (const FatOpContext* ctx, FatFragment frag) - { - FatSpecific* new_fs_info = FAT_SPECIFIC (ctx->new_fs); -@@ -160,7 +160,7 @@ fat_op_context_map_static_cluster (const FatOpContext* ctx, FatCluster clst) - return 0; - } - --FatFragment -+FatFragment _GL_ATTRIBUTE_PURE - fat_op_context_map_fragment (const FatOpContext* ctx, FatFragment frag) - { - return ctx->remap [frag]; -diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c -index 250e80d..2b65e72 100644 ---- a/libparted/fs/r/fat/count.c -+++ b/libparted/fs/r/fat/count.c -@@ -338,7 +338,7 @@ fat_collect_cluster_info (PedFileSystem* fs) { - return 1; - } - --FatClusterFlag -+FatClusterFlag _GL_ATTRIBUTE_PURE - fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -346,7 +346,7 @@ fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster) - return fs_info->cluster_info [cluster].flag; - } - --PedSector -+PedSector _GL_ATTRIBUTE_PURE - fat_get_cluster_usage (PedFileSystem* fs, FatCluster cluster) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c -index fe8e040..98b0499 100644 ---- a/libparted/fs/r/fat/table.c -+++ b/libparted/fs/r/fat/table.c -@@ -371,7 +371,7 @@ fat_table_is_bad (const FatTable* ft, FatCluster cluster) - /* - returns true if represents an EOF marker - */ --int -+int _GL_ATTRIBUTE_PURE - fat_table_is_eof (const FatTable* ft, FatCluster cluster) - { - return _test_code_eof (ft, cluster); -diff --git a/libparted/fs/r/fat/traverse.c b/libparted/fs/r/fat/traverse.c -index fc8a795..50b94bd 100644 ---- a/libparted/fs/r/fat/traverse.c -+++ b/libparted/fs/r/fat/traverse.c -@@ -31,7 +31,7 @@ - - static char tmp_buffer [4096]; - --int -+int _GL_ATTRIBUTE_PURE - fat_traverse_entries_per_buffer (FatTraverseInfo* trav_info) - { - return trav_info->buffer_size / sizeof (FatDirEntry); -@@ -226,7 +226,7 @@ fat_traverse_next_dir_entry (FatTraverseInfo *trav_info) - return trav_info->dir_entries + trav_info->current_entry; - } - --FatCluster -+FatCluster _GL_ATTRIBUTE_PURE - fat_dir_entry_get_first_cluster (FatDirEntry* dir_entry, PedFileSystem *fs) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -269,7 +269,7 @@ fat_dir_entry_set_first_cluster (FatDirEntry* dir_entry, PedFileSystem* fs, - } - } - --uint32_t -+uint32_t _GL_ATTRIBUTE_PURE - fat_dir_entry_get_length (FatDirEntry* dir_entry) - { - return PED_LE32_TO_CPU (dir_entry->length); -@@ -284,7 +284,7 @@ fat_dir_entry_is_null_term (const FatDirEntry* dir_entry) - return memcmp (&null_entry, dir_entry, sizeof (null_entry)) == 0; - } - --int -+int _GL_ATTRIBUTE_PURE - fat_dir_entry_is_active (FatDirEntry* dir_entry) - { - if ((unsigned char) dir_entry->name[0] == DELETED_FLAG) return 0; -@@ -293,7 +293,7 @@ fat_dir_entry_is_active (FatDirEntry* dir_entry) - return 1; - } - --int -+int _GL_ATTRIBUTE_PURE - fat_dir_entry_is_file (FatDirEntry* dir_entry) { - if (dir_entry->attributes == VFAT_ATTR) return 0; - if (dir_entry->attributes & VOLUME_LABEL_ATTR) return 0; -@@ -302,7 +302,7 @@ fat_dir_entry_is_file (FatDirEntry* dir_entry) { - return 1; - } - --int -+int _GL_ATTRIBUTE_PURE - fat_dir_entry_is_system_file (FatDirEntry* dir_entry) - { - if (!fat_dir_entry_is_file (dir_entry)) return 0; -@@ -310,7 +310,7 @@ fat_dir_entry_is_system_file (FatDirEntry* dir_entry) - || (dir_entry->attributes & HIDDEN_ATTR); - } - --int -+int _GL_ATTRIBUTE_PURE - fat_dir_entry_is_directory (FatDirEntry* dir_entry) - { - if (dir_entry->attributes == VFAT_ATTR) return 0; -diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c -index d0afa30..0a39960 100644 ---- a/libparted/fs/r/hfs/advfs.c -+++ b/libparted/fs/r/hfs/advfs.c -@@ -239,7 +239,7 @@ errbb: hfs_free_bad_blocks_list(priv_data->bad_blocks_xtent_list); - } - - /* This function check if fblock is a bad block */ --int -+int _GL_ATTRIBUTE_PURE - hfs_is_bad_block (const PedFileSystem *fs, unsigned int fblock) - { - HfsPrivateFSData* priv_data = (HfsPrivateFSData*) -@@ -304,7 +304,7 @@ hfs_get_empty_end (const PedFileSystem *fs) - - /* return the block which should be used to pack data to have at - least free fblock blocks at the end of the volume */ --unsigned int -+unsigned int _GL_ATTRIBUTE_PURE - hfs_find_start_pack (const PedFileSystem *fs, unsigned int fblock) - { - HfsPrivateFSData* priv_data = (HfsPrivateFSData*) -diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c -index 5453c25..2b6fd87 100644 ---- a/libparted/fs/r/hfs/advfs_plus.c -+++ b/libparted/fs/r/hfs/advfs_plus.c -@@ -247,7 +247,7 @@ errbbp: hfsplus_free_bad_blocks_list(priv_data->bad_blocks_xtent_list); - } - - /* This function check if fblock is a bad block */ --int -+int _GL_ATTRIBUTE_PURE - hfsplus_is_bad_block (const PedFileSystem *fs, unsigned int fblock) - { - HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*) -@@ -358,7 +358,7 @@ hfsplus_get_min_size (const PedFileSystem *fs) - - /* return the block which should be used to pack data to have - at least free fblock blocks at the end of the volume */ --unsigned int -+unsigned int _GL_ATTRIBUTE_PURE - hfsplus_find_start_pack (const PedFileSystem *fs, unsigned int fblock) - { - HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*) --- -2.26.2 - diff --git a/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch b/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch deleted file mode 100644 index 8951e18..0000000 --- a/0021-libparted-Fix-warnings-from-GCC-8-Wsuggest-attribute.patch +++ /dev/null @@ -1,104 +0,0 @@ -From 34347779d3235186a68a040d3f3166ff45e65dac Mon Sep 17 00:00:00 2001 -From: Shin'ichiro Kawasaki -Date: Wed, 14 Aug 2019 10:59:20 +0900 -Subject: [PATCH 21/42] libparted: Fix warnings from GCC 8 - -Wsuggest-attribute=const - -As GCC 8 suggests, add 'const' attribute to six functions. After adding -const attributes, GCC suggested two more functions to add const -attributes. Add const attributes to those functions also. In total, add -const attributes to 8 functions. - -I read code of the functions and confirmed they are const: they examine -only their arguments and have no effect other than return value. - -Signed-off-by: Shin'ichiro Kawasaki -Signed-off-by: Brian C. Lane ---- - libparted/fs/r/fat/calc.c | 14 +++++++------- - libparted/fs/r/fat/table.c | 2 +- - 2 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c -index 60c6bac..18e0455 100644 ---- a/libparted/fs/r/fat/calc.c -+++ b/libparted/fs/r/fat/calc.c -@@ -23,7 +23,7 @@ - #ifndef DISCOVER_ONLY - - /* returns the minimum size of clusters for a given file system type */ --PedSector -+PedSector _GL_ATTRIBUTE_CONST - fat_min_cluster_size (FatType fat_type) { - switch (fat_type) { - case FAT_TYPE_FAT12: return 1; -@@ -33,7 +33,7 @@ fat_min_cluster_size (FatType fat_type) { - return 0; - } - --static PedSector -+static PedSector _GL_ATTRIBUTE_CONST - _smallest_power2_over (PedSector ceiling) - { - PedSector result = 1; -@@ -45,7 +45,7 @@ _smallest_power2_over (PedSector ceiling) - } - - /* returns the minimum size of clusters for a given file system type */ --PedSector -+PedSector _GL_ATTRIBUTE_CONST - fat_recommend_min_cluster_size (FatType fat_type, PedSector size) { - switch (fat_type) { - case FAT_TYPE_FAT12: return 1; -@@ -59,7 +59,7 @@ fat_recommend_min_cluster_size (FatType fat_type, PedSector size) { - } - - /* returns the maxmimum size of clusters for a given file system type */ --PedSector -+PedSector _GL_ATTRIBUTE_CONST - fat_max_cluster_size (FatType fat_type) { - switch (fat_type) { - case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */ -@@ -70,7 +70,7 @@ fat_max_cluster_size (FatType fat_type) { - } - - /* returns the minimum number of clusters for a given file system type */ --FatCluster -+FatCluster _GL_ATTRIBUTE_CONST - fat_min_cluster_count (FatType fat_type) { - switch (fat_type) { - case FAT_TYPE_FAT12: -@@ -83,7 +83,7 @@ fat_min_cluster_count (FatType fat_type) { - } - - /* returns the maximum number of clusters for a given file system type */ --FatCluster -+FatCluster _GL_ATTRIBUTE_CONST - fat_max_cluster_count (FatType fat_type) { - switch (fat_type) { - case FAT_TYPE_FAT12: return 0xff0; -@@ -94,7 +94,7 @@ fat_max_cluster_count (FatType fat_type) { - } - - /* what is this supposed to be? What drugs are M$ on? (Can I have some? :-) */ --PedSector -+PedSector _GL_ATTRIBUTE_CONST - fat_min_reserved_sector_count (FatType fat_type) - { - return (fat_type == FAT_TYPE_FAT32) ? 32 : 1; -diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c -index 98b0499..394a519 100644 ---- a/libparted/fs/r/fat/table.c -+++ b/libparted/fs/r/fat/table.c -@@ -462,7 +462,7 @@ fat_table_set_avail (FatTable* ft, FatCluster cluster) - - #endif /* !DISCOVER_ONLY */ - --int -+int _GL_ATTRIBUTE_CONST - fat_table_entry_size (FatType fat_type) - { - switch (fat_type) { --- -2.26.2 - diff --git a/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch b/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch deleted file mode 100644 index 822ce58..0000000 --- a/0022-bsd-Fix-gcc-complaints-when-using-boot_code-pointer.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b11bbb5a0b5c357816bff424c2a325806d60f20b Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 9 Nov 2020 14:33:37 -0800 -Subject: [PATCH 22/42] bsd: Fix gcc complaints when using boot_code pointer - ---- - libparted/labels/bsd.c | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c -index 6946563..8483641 100644 ---- a/libparted/labels/bsd.c -+++ b/libparted/labels/bsd.c -@@ -307,19 +307,16 @@ error: - static void - _probe_and_add_boot_code (const PedDisk* disk) - { -- char *old_boot_code; -- BSDRawLabel *old_label; -+ BSDDiskData *old_data; - - void *s0; - if (!ptt_read_sector (disk->dev, 0, &s0)) - return; -- old_boot_code = ((BSDDiskData*) s0)->boot_code; -- old_label = &((BSDDiskData*) s0)->label; -- -- if (old_boot_code [0] -- && old_label->d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { -+ old_data = (BSDDiskData*) s0; -+ if (old_data->boot_code [0] -+ && old_data->label.d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) { - BSDDiskData *bsd_specific = (BSDDiskData*) disk->disk_specific; -- memcpy (bsd_specific, old_boot_code, sizeof (BSDDiskData)); -+ memcpy (bsd_specific, old_data, sizeof (BSDDiskData)); - } - free (s0); - } --- -2.26.2 - diff --git a/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch b/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch deleted file mode 100644 index 9f97c6f..0000000 --- a/0023-dos-Fix-gcc-complaints-when-using-boot_code-pointer.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1ff56b03ec960435d55e200300093581ba874d53 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 9 Nov 2020 15:09:07 -0800 -Subject: [PATCH 23/42] dos: Fix gcc complaints when using boot_code pointer - ---- - libparted/labels/dos.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c -index d859b33..bfa253b 100644 ---- a/libparted/labels/dos.c -+++ b/libparted/labels/dos.c -@@ -1291,7 +1291,7 @@ msdos_write (const PedDisk* disk) - DosRawTable *table = (DosRawTable *) s0; - - if (!table->boot_code[0]) { -- memset (table->boot_code, 0, 512); -+ memset (table, 0, 512); - memcpy (table->boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE)); - } - --- -2.26.2 - diff --git a/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch b/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch deleted file mode 100644 index f95b520..0000000 --- a/0024-linux-Fix-gcc-complains-about-signed-sccanf-variable.patch +++ /dev/null @@ -1,38 +0,0 @@ -From c3e648518235e1f77ca496c1234459e4bac300ad Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 9 Nov 2020 15:16:22 -0800 -Subject: [PATCH 24/42] linux: Fix gcc complains about signed sccanf variables - ---- - libparted/arch/linux.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index 09ec781..4c17720 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -720,9 +720,9 @@ _get_linux_version () - static int kver = -1; - - struct utsname uts; -- int major = 0; -- int minor = 0; -- int teeny = 0; -+ unsigned int major = 0; -+ unsigned int minor = 0; -+ unsigned int teeny = 0; - - if (kver != -1) - return kver; -@@ -2884,7 +2884,7 @@ _dm_get_partition_start_and_length(PedPartition const *part, - char *params; - char *target_type; - dm_get_next_target(task, NULL, (uint64_t *)start, (uint64_t *)length, &target_type, ¶ms); -- if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3) -+ if (sscanf (params, "%d:%d %Lu", &major, &minor, start) != 3) - goto err; - rc = 1; - --- -2.26.2 - diff --git a/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch b/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch deleted file mode 100644 index 44c3c04..0000000 --- a/0025-tests-Fix-unsigned-warning-in-duplicate.c.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 09fb0fc6dadde9982d243567cf92743149895102 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 9 Nov 2020 15:53:30 -0800 -Subject: [PATCH 25/42] tests: Fix unsigned warning in duplicate.c - ---- - tests/duplicate.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/duplicate.c b/tests/duplicate.c -index a9dde84..771faab 100644 ---- a/tests/duplicate.c -+++ b/tests/duplicate.c -@@ -134,7 +134,7 @@ main (int argc, char **argv) - { - if (!ped_partition_is_flag_available(disk_part, flag)) - continue; -- fprintf (stderr, "Checking partition flag %d\n", flag); -+ fprintf (stderr, "Checking partition flag %u\n", flag); - fprintf (stderr, "%d ? %d\n", ped_partition_get_flag (disk_part, flag), - ped_partition_get_flag (copy_part, flag)); - assert (ped_partition_get_flag (disk_part, flag) --- -2.26.2 - diff --git a/0026-hfs-Fix-gcc-10-bounds-check-warning.patch b/0026-hfs-Fix-gcc-10-bounds-check-warning.patch deleted file mode 100644 index f80873b..0000000 --- a/0026-hfs-Fix-gcc-10-bounds-check-warning.patch +++ /dev/null @@ -1,41 +0,0 @@ -From b7ccc1b29674937ab4c97d0e1b7b5bfd6f366b92 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Nov 2020 15:42:46 -0800 -Subject: [PATCH 26/42] hfs: Fix gcc 10 bounds check warning - -binfo is actually a list of structs that cannot be known until runtime, -so use a variable length array. ---- - libparted/fs/hfs/hfs.h | 2 +- - libparted/fs/r/hfs/hfs.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libparted/fs/hfs/hfs.h b/libparted/fs/hfs/hfs.h -index 4fa2e95..0a9392a 100644 ---- a/libparted/fs/hfs/hfs.h -+++ b/libparted/fs/hfs/hfs.h -@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader { - uint32_t bytes_used; - uint32_t checksum; - uint32_t pad; -- HfsJBlockInfo binfo[1]; -+ HfsJBlockInfo binfo[]; - }; - typedef struct _HfsJBlockListHeader HfsJBlockListHeader; - -diff --git a/libparted/fs/r/hfs/hfs.h b/libparted/fs/r/hfs/hfs.h -index 4fa2e95..0a9392a 100644 ---- a/libparted/fs/r/hfs/hfs.h -+++ b/libparted/fs/r/hfs/hfs.h -@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader { - uint32_t bytes_used; - uint32_t checksum; - uint32_t pad; -- HfsJBlockInfo binfo[1]; -+ HfsJBlockInfo binfo[]; - }; - typedef struct _HfsJBlockListHeader HfsJBlockListHeader; - --- -2.26.2 - diff --git a/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index dd00068..0000000 --- a/0027-hfs-advfs-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 868fab2fea9ad6422b2ee9b3c1ab9e69d5a4f9a7 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Nov 2020 16:15:49 -0800 -Subject: [PATCH 27/42] hfs/advfs: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/r/hfs/advfs.c | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - -diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c -index 0a39960..1ce4319 100644 ---- a/libparted/fs/r/hfs/advfs.c -+++ b/libparted/fs/r/hfs/advfs.c -@@ -87,12 +87,14 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, - HfsPrivateGenericKey* record_key = NULL; - unsigned int node_number, record_number; - int i; -+ uint16_t record_pos; - - /* Read the header node */ - if (!hfs_file_read_sector(b_tree_file, node, 0)) - return 0; -- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(PED_SECTOR_SIZE_DEFAULT-2)))))); -+ uint16_t offset; -+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); -+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); - - /* Get the node number of the root */ - node_number = PED_BE32_TO_CPU(header->root_node); -@@ -107,13 +109,13 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, - while (1) { - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = record_number; i; i--) { -- record_key = (HfsPrivateGenericKey*) -- (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); -+ uint16_t value; -+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); -+ record_pos = PED_BE16_TO_CPU(value); -+ record_key = (HfsPrivateGenericKey*) (node + record_pos); - /* check for obvious error in FS */ -- if (((uint8_t*)record_key - node < HFS_FIRST_REC) -- || ((uint8_t*)record_key - node -- >= PED_SECTOR_SIZE_DEFAULT -+ if ((record_pos< HFS_FIRST_REC) -+ || (record_pos>= PED_SECTOR_SIZE_DEFAULT - - 2 * (signed)(record_number+1))) { - ped_exception_throw ( - PED_EXCEPTION_ERROR, -@@ -129,8 +131,9 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, - unsigned int skip; - - skip = (1 + record_key->key_length + 1) & ~1; -- node_number = PED_BE32_TO_CPU (*((uint32_t *) -- (((uint8_t *) record_key) + skip))); -+ uint32_t value; -+ memcpy(&value, node+record_pos+skip, sizeof(uint32_t)); -+ node_number = PED_BE32_TO_CPU(value); - if (!hfs_file_read_sector(b_tree_file, node, - node_number)) - return 0; -@@ -146,7 +149,7 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key, - if (record_ref) { - record_ref->node_size = 1; /* in sectors */ - record_ref->node_number = node_number; -- record_ref->record_pos = (uint8_t*)record_key - node; -+ record_ref->record_pos = record_pos; - record_ref->record_number = i; - } - --- -2.26.2 - diff --git a/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch b/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch deleted file mode 100644 index f39c720..0000000 --- a/0028-hfs-advfs_plus-Fix-gcc-10-warnings-about-cast-alignm.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 6cb1ed79543f9a9425de2b334a41e08836edc6b8 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Nov 2020 17:05:59 -0800 -Subject: [PATCH 28/42] hfs/advfs_plus: Fix gcc 10 warnings about cast - alignment - ---- - libparted/fs/r/hfs/advfs_plus.c | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) - -diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c -index 2b6fd87..2141746 100644 ---- a/libparted/fs/r/hfs/advfs_plus.c -+++ b/libparted/fs/r/hfs/advfs_plus.c -@@ -80,6 +80,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, - HfsPPrivateGenericKey* record_key = NULL; - unsigned int node_number, record_number, size, bsize; - int i; -+ uint16_t record_pos; - - /* Read the header node */ - if (!hfsplus_file_read_sector(b_tree_file, node_1, 0)) -@@ -93,7 +94,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, - - /* Get the size of a node in sectors and allocate buffer */ - size = (bsize = PED_BE16_TO_CPU (header->node_size)) / PED_SECTOR_SIZE_DEFAULT; -- node = (uint8_t*) ped_malloc (bsize); -+ node = ped_malloc (bsize); - if (!node) - return 0; - HfsPNodeDescriptor *desc = (HfsPNodeDescriptor*) node; -@@ -107,13 +108,13 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, - while (1) { - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = record_number; i; i--) { -- record_key = (HfsPPrivateGenericKey*) -- (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(bsize - 2*i))))); -+ uint16_t value; -+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); -+ record_pos = PED_BE16_TO_CPU(value); -+ record_key = (HfsPPrivateGenericKey*) (node + record_pos); - /* check for obvious error in FS */ -- if (((uint8_t*)record_key - node < HFS_FIRST_REC) -- || ((uint8_t*)record_key - node -- >= (signed)bsize -+ if ((record_pos < HFS_FIRST_REC) -+ || (record_pos >= (signed)bsize - - 2 * (signed)(record_number+1))) { - ped_exception_throw ( - PED_EXCEPTION_ERROR, -@@ -131,8 +132,9 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, - - skip = ( 2 + PED_BE16_TO_CPU (record_key->key_length) - + 1 ) & ~1; -- node_number = PED_BE32_TO_CPU (*((uint32_t *) -- (((uint8_t *) record_key) + skip))); -+ uint32_t value; -+ memcpy(&value, node+record_pos+skip, sizeof(uint32_t)); -+ node_number = PED_BE32_TO_CPU(value); - if (!hfsplus_file_read(b_tree_file, node, - (PedSector) node_number * size, - size)) { -@@ -151,7 +153,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key, - if (record_ref) { - record_ref->node_size = size; /* in sectors */ - record_ref->node_number = node_number; -- record_ref->record_pos = (uint8_t*)record_key - node; -+ record_ref->record_pos = record_pos; - record_ref->record_number = i; - } - --- -2.26.2 - diff --git a/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index cde8032..0000000 --- a/0029-hfs-hfs-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 006ad756c70603212309157fa05c5d855e25f07e Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 13:33:36 -0800 -Subject: [PATCH 29/42] hfs/hfs: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/r/hfs/hfs.c | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c -index 0aababd..09899da 100644 ---- a/libparted/fs/r/hfs/hfs.c -+++ b/libparted/fs/r/hfs/hfs.c -@@ -891,12 +891,11 @@ hfsplus_wrapper_update (PedFileSystem* fs) - ref.record_number = 1; - } - -- ref.record_pos = -- PED_BE16_TO_CPU (*((uint16_t *) -- (node + (PED_SECTOR_SIZE_DEFAULT -- - 2*ref.record_number)))); -+ uint16_t value; -+ memcpy(&value, node+PED_SECTOR_SIZE_DEFAULT - (2*ref.record_number), sizeof(uint16_t)); -+ ref.record_pos = PED_BE16_TO_CPU(value); - ret_key = (HfsExtentKey*) (node + ref.record_pos); -- ret_data = (HfsExtDescriptor*) ( node + ref.record_pos -+ ret_data = (HfsExtDescriptor*) (node + ref.record_pos - + sizeof (HfsExtentKey) ); - } - --- -2.26.2 - diff --git a/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch b/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index 05ff94c..0000000 --- a/0030-ext2-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 1e086dba260630b63e0822731522ce04c081d95e Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Nov 2020 14:39:06 -0800 -Subject: [PATCH 30/42] ext2: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/ext2/ext2_fs.h | 2 +- - libparted/fs/ext2/interface.c | 7 ++++--- - 2 files changed, 5 insertions(+), 4 deletions(-) - -diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h -index ac1b6a0..362f8bc 100644 ---- a/libparted/fs/ext2/ext2_fs.h -+++ b/libparted/fs/ext2/ext2_fs.h -@@ -173,7 +173,7 @@ struct ext2_inode - - #define i_size_high i_dir_acl - --struct ext2_super_block -+struct __attribute__ ((packed)) ext2_super_block - { - uint32_t s_inodes_count; /* Inodes count */ - uint32_t s_blocks_count; /* Blocks count */ -diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c -index a49568b..01c224e 100644 ---- a/libparted/fs/ext2/interface.c -+++ b/libparted/fs/ext2/interface.c -@@ -33,12 +33,13 @@ struct ext2_dev_handle* ext2_make_dev_handle_from_parted_geometry(PedGeometry* g - static PedGeometry* - _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver) - { -+ struct ext2_super_block *sb; - const int sectors = (4096 + geom->dev->sector_size - 1) / - geom->dev->sector_size; -- char *sb_v = alloca (sectors * geom->dev->sector_size); -- if (!ped_geometry_read(geom, sb_v, 0, sectors)) -+ uint8_t *buf = alloca (sectors * geom->dev->sector_size); -+ if (!ped_geometry_read(geom, buf, 0, sectors)) - return NULL; -- struct ext2_super_block *sb = (struct ext2_super_block *)(sb_v + 1024); -+ sb = (struct ext2_super_block *)(buf+1024); - - if (EXT2_SUPER_MAGIC(*sb) == EXT2_SUPER_MAGIC_CONST) { - PedSector block_size = (EXT2_MIN_BLOCK_SIZE << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb))) / geom->dev->sector_size; --- -2.26.2 - diff --git a/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch b/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index b8898a2..0000000 --- a/0031-nilfs2-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 362571d09da09fb2b6fab7037af26d83b2d39b75 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:08:31 -0800 -Subject: [PATCH 31/42] nilfs2: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/nilfs2/nilfs2.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) - -diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c -index 3ca4808..2871179 100644 ---- a/libparted/fs/nilfs2/nilfs2.c -+++ b/libparted/fs/nilfs2/nilfs2.c -@@ -34,8 +34,7 @@ - /* secondary superblock offset in 512byte blocks. */ - #define NILFS_SB2_OFFSET(devsize) ((((devsize)>>3) - 1) << 3) - --struct nilfs2_super_block --{ -+struct __attribute__ ((packed)) nilfs2_super_block { - uint32_t s_rev_level; - uint16_t s_minor_rev_level; - uint16_t s_magic; -@@ -112,18 +111,18 @@ nilfs2_probe (PedGeometry* geom) - return NULL; - const int sectors = (4096 + geom->dev->sector_size - 1) / - geom->dev->sector_size; -- char *buf = alloca (sectors * geom->dev->sector_size); -+ uint8_t *buf = alloca (sectors * geom->dev->sector_size); - const int sectors2 = (1024 + geom->dev->sector_size -1 ) / - geom->dev->sector_size; - void *buff2 = alloca (sectors2 * geom->dev->sector_size); - - if (ped_geometry_read(geom, buf, 0, sectors)) -- sb = (struct nilfs2_super_block *)(buf+1024); -+ sb = (struct nilfs2_super_block*)(buf + 1024); - if (ped_geometry_read(geom, buff2, sb2off, sectors2)) -- sb2 = buff2; -+ sb2 = (struct nilfs2_super_block*)buff2; - - if ((!sb || !is_valid_nilfs_sb(sb)) && -- (!sb2 || !is_valid_nilfs_sb(sb2)) ) -+ (!sb2 || !is_valid_nilfs_sb(sb2))) - return NULL; - - /* reserve 4k bytes for secondary superblock */ --- -2.26.2 - diff --git a/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index d19fee2..0000000 --- a/0032-ntfs-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,39 +0,0 @@ -From e2ee2628c5d75b375db90a486b906c0d2405b8b3 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:18:42 -0800 -Subject: [PATCH 32/42] ntfs: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/ntfs/ntfs.c | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c -index 3bfb28e..a3a6550 100644 ---- a/libparted/fs/ntfs/ntfs.c -+++ b/libparted/fs/ntfs/ntfs.c -@@ -35,16 +35,17 @@ - PedGeometry* - ntfs_probe (PedGeometry* geom) - { -- char *buf = alloca (geom->dev->sector_size); -+ uint8_t *buf = alloca(geom->dev->sector_size); - PedGeometry *newg = NULL; - - if (!ped_geometry_read(geom, buf, 0, 1)) - return 0; - -- if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0) -- newg = ped_geometry_new (geom->dev, geom->start, -- PED_LE64_TO_CPU (*(uint64_t*) -- (buf + 0x28))); -+ if (strncmp (NTFS_SIGNATURE, ((char *)buf + 3), strlen (NTFS_SIGNATURE)) == 0) { -+ uint64_t length; -+ memcpy(&length, buf + 0x28, sizeof(uint64_t)); -+ newg = ped_geometry_new (geom->dev, geom->start, length); -+ } - return newg; - } - --- -2.26.2 - diff --git a/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch b/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index 3713d61..0000000 --- a/0033-ufs-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 65d95eaf5692f7d19f2b550dee4c9b585ce79938 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:19:10 -0800 -Subject: [PATCH 33/42] ufs: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/ufs/ufs.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/libparted/fs/ufs/ufs.c b/libparted/fs/ufs/ufs.c -index 27cb036..f677b60 100644 ---- a/libparted/fs/ufs/ufs.c -+++ b/libparted/fs/ufs/ufs.c -@@ -45,14 +45,14 @@ - #define UFS_MAGIC_FEA 0x00195612 - #define UFS_MAGIC_4GB 0x05231994 - --struct ufs_csum { -+struct __attribute__ ((packed)) ufs_csum { - uint32_t cs_ndir; /* number of directories */ - uint32_t cs_nbfree; /* number of free blocks */ - uint32_t cs_nifree; /* number of free inodes */ - uint32_t cs_nffree; /* number of free frags */ - }; - --struct ufs_super_block { -+struct __attribute__ ((packed)) ufs_super_block { - uint32_t fs_link; /* UNUSED */ - uint32_t fs_rlink; /* UNUSED */ - uint32_t fs_sblkno; /* addr of super-block in filesys */ -@@ -176,7 +176,7 @@ ufs_probe_sun (PedGeometry* geom) - { - const int sectors = ((3 * 512) + geom->dev->sector_size - 1) / - geom->dev->sector_size; -- char * buf = alloca (sectors * geom->dev->sector_size); -+ uint8_t* buf = alloca (sectors * geom->dev->sector_size); - struct ufs_super_block *sb; - - if (geom->length < 5) -@@ -212,7 +212,7 @@ ufs_probe_hp (PedGeometry* geom) - return 0; - const int sectors = ((3 * 512) + geom->dev->sector_size - 1) / - geom->dev->sector_size; -- char * buf = alloca (sectors * geom->dev->sector_size); -+ uint8_t* buf = alloca (sectors * geom->dev->sector_size); - - if (!ped_geometry_read (geom, buf, 16 * 512 / geom->dev->sector_size, sectors)) - return 0; --- -2.26.2 - diff --git a/0034-ped_assert-Fix-incorrect-exception-option.patch b/0034-ped_assert-Fix-incorrect-exception-option.patch deleted file mode 100644 index 863c640..0000000 --- a/0034-ped_assert-Fix-incorrect-exception-option.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c21ee3827639343920d3f08cff319620d3582d2a Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:19:36 -0800 -Subject: [PATCH 34/42] ped_assert: Fix incorrect exception option - -PED_EXCEPTION_FATAL is a type, not an option. A PED_EXCEPTION_BUG should -always select CANCEL. ---- - libparted/debug.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libparted/debug.c b/libparted/debug.c -index c4932ca..227673e 100644 ---- a/libparted/debug.c -+++ b/libparted/debug.c -@@ -106,7 +106,7 @@ void ped_assert (const char* cond_text, - /* Throw the exception */ - ped_exception_throw ( - PED_EXCEPTION_BUG, -- PED_EXCEPTION_FATAL, -+ PED_EXCEPTION_CANCEL, - _("Assertion (%s) at %s:%d in function %s() failed."), - cond_text, file, line, function); - abort (); --- -2.26.2 - diff --git a/0035-ui-Fix-command_line_get_disk_flag.patch b/0035-ui-Fix-command_line_get_disk_flag.patch deleted file mode 100644 index d7a88f3..0000000 --- a/0035-ui-Fix-command_line_get_disk_flag.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 45e4c689c81cc55f849d3f90168a6b89c0168191 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:30:57 -0800 -Subject: [PATCH 35/42] ui: Fix command_line_get_disk_flag - -It was using PedPartitionFlag instead of PedDiskFlag when walking the -available flags. ---- - parted/ui.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/parted/ui.c b/parted/ui.c -index 7b5374d..8e1f2fe 100644 ---- a/parted/ui.c -+++ b/parted/ui.c -@@ -1138,7 +1138,7 @@ command_line_get_disk_flag (const char* prompt, const PedDisk* disk, - PedDiskFlag* flag) - { - StrList* opts = NULL; -- PedPartitionFlag walk = 0; -+ PedDiskFlag walk = 0; - char* flag_name; - - while ( (walk = ped_disk_flag_next (walk)) ) { --- -2.26.2 - diff --git a/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch b/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch deleted file mode 100644 index 8202798..0000000 --- a/0036-ui-Fix-gcc-10-warning-about-snprintf-truncating-an-i.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 6e34cb98ddef0c9fd47359a2006265e7251e8830 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 12 Nov 2020 16:49:29 -0800 -Subject: [PATCH 36/42] ui: Fix gcc 10 warning about snprintf truncating an int - -Double the storage to 20 bytes. ---- - parted/ui.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/parted/ui.c b/parted/ui.c -index 8e1f2fe..73fdcf5 100644 ---- a/parted/ui.c -+++ b/parted/ui.c -@@ -909,11 +909,11 @@ command_line_get_word (const char* prompt, const char* def, - int - command_line_get_integer (const char* prompt, int* value) - { -- char def_str [10]; -+ char def_str [20]; - char* input; - long ret; - -- snprintf (def_str, 10, "%d", *value); -+ snprintf (def_str, 20, "%d", *value); - input = command_line_get_word (prompt, *value ? def_str : NULL, - NULL, 1); - if (!input) --- -2.26.2 - diff --git a/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch b/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch deleted file mode 100644 index 25f1ff0..0000000 --- a/0037-hfs-reloc-Fix-gcc-10-warnings-about-cast-alignment.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 76bf966849534a832c30cd89dbbb8a32939dcbed Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 13 Nov 2020 15:12:06 -0800 -Subject: [PATCH 37/42] hfs/reloc: Fix gcc 10 warnings about cast alignment - ---- - libparted/fs/r/hfs/reloc.c | 35 ++++++++++++++++++++--------------- - 1 file changed, 20 insertions(+), 15 deletions(-) - -diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c -index d0477ae..68b14ae 100644 ---- a/libparted/fs/r/hfs/reloc.c -+++ b/libparted/fs/r/hfs/reloc.c -@@ -373,6 +373,7 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, - HfsExtDescriptor* extent; - unsigned int leaf_node, record_number; - unsigned int i, j; -+ uint16_t catalog_pos; - - if (!priv_data->catalog_file->sect_nb) { - ped_exception_throw ( -@@ -385,8 +386,9 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, - - if (!hfs_file_read_sector (priv_data->catalog_file, node, 0)) - return 0; -- header = (HfsHeaderRecord*)(node + PED_BE16_TO_CPU(*((uint16_t*) -- (node+(PED_SECTOR_SIZE_DEFAULT-2))))); -+ uint16_t offset; -+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); -+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); - - for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node); - leaf_node; -@@ -397,14 +399,15 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = 1; i <= record_number; ++i) { - /* undocumented alignement */ -+ uint16_t value; -+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); -+ catalog_pos = PED_BE16_TO_CPU(value); -+ catalog_key = (HfsCatalogKey*) (node + catalog_pos); - unsigned int skip; -- catalog_key = (HfsCatalogKey*) (node + PED_BE16_TO_CPU( -- *((uint16_t*)(node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); - skip = (1 + catalog_key->key_length + 1) & ~1; -- catalog_data = (HfsCatalog*)( ((uint8_t*)catalog_key) -- + skip ); -+ catalog_data = (HfsCatalog*)(node+catalog_pos+skip); - /* check for obvious error in FS */ -- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC) -+ if ((catalog_pos < HFS_FIRST_REC) - || ((uint8_t*)catalog_data - node - >= PED_SECTOR_SIZE_DEFAULT - - 2 * (signed)(record_number+1))) { -@@ -467,6 +470,7 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, - HfsExtDescriptor* extent; - unsigned int leaf_node, record_number; - unsigned int i, j; -+ uint16_t extent_pos; - - if (!priv_data->extent_file->sect_nb) { - ped_exception_throw ( -@@ -479,8 +483,9 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, - - if (!hfs_file_read_sector (priv_data->extent_file, node, 0)) - return 0; -- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(PED_SECTOR_SIZE_DEFAULT-2)))))); -+ uint16_t offset; -+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t)); -+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset)); - - for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node); - leaf_node; -@@ -491,14 +496,14 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = 1; i <= record_number; i++) { - uint8_t where; -- extent_key = (HfsExtentKey*) -- (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i))))); -+ uint16_t value; -+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t)); -+ extent_pos = PED_BE16_TO_CPU(value); -+ extent_key = (HfsExtentKey*)(node + extent_pos); - /* size is cst */ -- extent = (HfsExtDescriptor*)(((uint8_t*)extent_key) -- + sizeof (HfsExtentKey)); -+ extent = (HfsExtDescriptor*)(node+extent_pos+sizeof(HfsExtentKey)); - /* check for obvious error in FS */ -- if (((uint8_t*)extent_key - node < HFS_FIRST_REC) -+ if ((extent_pos < HFS_FIRST_REC) - || ((uint8_t*)extent - node - >= PED_SECTOR_SIZE_DEFAULT - - 2 * (signed)(record_number+1))) { --- -2.26.2 - diff --git a/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch b/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch deleted file mode 100644 index 9c4d712..0000000 --- a/0038-hfs-reloc_plus-Fix-gcc-10-warnings-about-cast-alignm.patch +++ /dev/null @@ -1,103 +0,0 @@ -From f496795a850976d211d3f5c673b868c3c90a8c3d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 13 Nov 2020 15:25:35 -0800 -Subject: [PATCH 38/42] hfs/reloc_plus: Fix gcc 10 warnings about cast - alignment - ---- - libparted/fs/r/hfs/reloc_plus.c | 33 +++++++++++++++++++-------------- - 1 file changed, 19 insertions(+), 14 deletions(-) - -diff --git a/libparted/fs/r/hfs/reloc_plus.c b/libparted/fs/r/hfs/reloc_plus.c -index cebadbe..44c0a77 100644 ---- a/libparted/fs/r/hfs/reloc_plus.c -+++ b/libparted/fs/r/hfs/reloc_plus.c -@@ -486,6 +486,7 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, - unsigned int i, j, size, bsize; - uint32_t jib = priv_data->jib_start_block, - jl = priv_data->jl_start_block; -+ uint16_t catalog_pos; - - if (!priv_data->catalog_file->sect_nb) { - ped_exception_throw ( -@@ -520,15 +521,16 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs, - unsigned int skip; - uint8_t where; - -- catalog_key = (HfsPCatalogKey*) -- ( node + PED_BE16_TO_CPU (*((uint16_t *) -- (node+(bsize - 2*i)))) ); -+ uint16_t value; -+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); -+ catalog_pos = PED_BE16_TO_CPU(value); -+ catalog_key = (HfsPCatalogKey*)(node + catalog_pos); - skip = ( 2 + PED_BE16_TO_CPU (catalog_key->key_length) - + 1) & ~1; - catalog_data = (HfsPCatalog*) - (((uint8_t*)catalog_key) + skip); - /* check for obvious error in FS */ -- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC) -+ if ((catalog_pos < HFS_FIRST_REC) - || ((uint8_t*)catalog_data - node - >= (signed) bsize - - 2 * (signed)(record_number+1))) { -@@ -609,6 +611,7 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, - HfsPExtDescriptor* extent; - unsigned int leaf_node, record_number; - unsigned int i, j, size, bsize; -+ uint16_t extent_pos; - - if (!priv_data->extents_file->sect_nb) { - ped_exception_throw ( -@@ -640,13 +643,14 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs, - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = 1; i <= record_number; i++) { - uint8_t where; -- extent_key = (HfsPExtentKey*) -- (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(bsize - 2*i))))); -+ uint16_t value; -+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); -+ extent_pos = PED_BE16_TO_CPU(value); -+ extent_key = (HfsPExtentKey*)(node + extent_pos); - extent = (HfsPExtDescriptor*) - (((uint8_t*)extent_key) + sizeof (HfsPExtentKey)); - /* check for obvious error in FS */ -- if (((uint8_t*)extent_key - node < HFS_FIRST_REC) -+ if ((extent_pos < HFS_FIRST_REC) - || ((uint8_t*)extent - node - >= (signed)bsize - - 2 * (signed)(record_number+1))) { -@@ -724,6 +728,7 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs, - HfsPExtDescriptor* extent; - unsigned int leaf_node, record_number; - unsigned int i, j, size, bsize; -+ uint16_t generic_pos; - - /* attributes file is facultative */ - if (!priv_data->attributes_file->sect_nb) -@@ -751,15 +756,15 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs, - record_number = PED_BE16_TO_CPU (desc->rec_nb); - for (i = 1; i <= record_number; i++) { - unsigned int skip; -- generic_key = (HfsPPrivateGenericKey*) -- (node + PED_BE16_TO_CPU(*((uint16_t *) -- (node+(bsize - 2*i))))); -+ uint16_t value; -+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t)); -+ generic_pos = PED_BE16_TO_CPU(value); -+ generic_key = (HfsPPrivateGenericKey*)(node + generic_pos); - skip = ( 2 + PED_BE16_TO_CPU (generic_key->key_length) - + 1 ) & ~1; -- fork_ext_data = (HfsPForkDataAttr*) -- (((uint8_t*)generic_key) + skip); -+ fork_ext_data = (HfsPForkDataAttr*)(node+generic_pos+skip); - /* check for obvious error in FS */ -- if (((uint8_t*)generic_key - node < HFS_FIRST_REC) -+ if ((generic_pos < HFS_FIRST_REC) - || ((uint8_t*)fork_ext_data - node - >= (signed) bsize - - 2 * (signed)(record_number+1))) { --- -2.26.2 - diff --git a/0039-fs-r-fat-Remove-disabled-code.patch b/0039-fs-r-fat-Remove-disabled-code.patch deleted file mode 100644 index a6528b1..0000000 --- a/0039-fs-r-fat-Remove-disabled-code.patch +++ /dev/null @@ -1,350 +0,0 @@ -From d2cc30120427394f6eaaa60acfbe647fb82a9762 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 20 Nov 2020 13:21:25 -0800 -Subject: [PATCH 39/42] fs/r/fat: Remove disabled code - ---- - libparted/fs/r/fat/count.c | 83 ----------------- - libparted/fs/r/fat/fat.c | 175 ------------------------------------ - libparted/fs/r/fat/resize.c | 17 ---- - 3 files changed, 275 deletions(-) - -diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c -index 2b65e72..51e1aa2 100644 ---- a/libparted/fs/r/fat/count.c -+++ b/libparted/fs/r/fat/count.c -@@ -27,66 +27,6 @@ - - #ifndef DISCOVER_ONLY - --#if 0 --/* extremely ugly hack: stick everything that obviously isn't an unmovable file -- * in here. Note: DAT is a bit dubious. Unfortunately, it's used by the -- * registry, so it'll be all over the place :-( -- */ --static char* movable_extensions[] = { -- "", -- "1ST", -- "AVI", -- "BAK", "BAT", "BMP", -- "CFG", "COM", "CSS", -- "DAT", "DLL", "DOC", "DRV", -- "EXE", -- "FAQ", "FLT", "FON", -- "GID", "GIF", -- "HLP", "HTT", "HTM", -- "ICO", "INI", -- "JPG", -- "LNK", "LOG", -- "KBD", -- "ME", "MID", "MSG", -- "OCX", "OLD", -- "PIF", "PNG", "PRV", -- "RTF", -- "SCR", "SYS", -- "TMP", "TTF", "TXT", -- "URL", -- "WAV", -- "VBX", "VOC", "VXD", -- NULL --}; -- --static char* --get_extension (char* file_name) --{ -- char* ext; -- -- ext = strrchr (file_name, '.'); -- if (!ext) -- return ""; -- if (strchr (ext, '\\')) -- return ""; -- return ext + 1; --} -- --static int --is_movable_system_file (char* file_name) --{ -- char* ext = get_extension (file_name); -- int i; -- -- for (i = 0; movable_extensions [i]; i++) { -- if (strcasecmp (ext, movable_extensions [i]) == 0) -- return 1; -- } -- -- return 0; --} --#endif /* 0 */ -- - /* - prints out the sequence of clusters for a given file chain, beginning - at start_cluster. -@@ -248,29 +188,6 @@ flag_traverse_dir (FatTraverseInfo* trav_info) { - print_chain (fs, first_cluster); - #endif - --#if 0 -- if (fat_dir_entry_is_system_file (this_entry) -- && !is_movable_system_file (file_name)) { -- PedExceptionOption ex_status; -- ex_status = ped_exception_throw ( -- PED_EXCEPTION_WARNING, -- PED_EXCEPTION_IGNORE_CANCEL, -- _("The file %s is marked as a system file. " -- "This means moving it could cause some " -- "programs to stop working."), -- file_name); -- -- switch (ex_status) { -- case PED_EXCEPTION_CANCEL: -- return 0; -- -- case PED_EXCEPTION_UNHANDLED: -- ped_exception_catch (); -- case PED_EXCEPTION_IGNORE: -- } -- } --#endif /* 0 */ -- - if (fat_dir_entry_is_directory (this_entry)) { - if (!flag_traverse_fat (fs, file_name, first_cluster, - FAT_FLAG_DIRECTORY, size)) -diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c -index ad57d36..0b2fee9 100644 ---- a/libparted/fs/r/fat/fat.c -+++ b/libparted/fs/r/fat/fat.c -@@ -613,68 +613,6 @@ fat_get_resize_constraint (const PedFileSystem* fs) - return fat_get_copy_constraint (fs, fs->geom->dev); - } - --/* FIXME: fat_calc_sizes() needs to say "too big" or "too small", or -- * something. This is a really difficult (maths) problem to do -- * nicely... -- * So, this algorithm works if dev->length / 2 is a valid fat_type -- * size. (Which is how I got the magic numbers below) -- */ --#if 0 --/* returns: -1 too small, 0 ok, 1 too big */ --static int --_test_create_size (PedSector length, FatType fat_type, -- PedSector cluster_sectors, PedSector cluster_count) --{ -- PedSector rootdir_sectors; -- PedSector _cluster_sectors; -- FatCluster _cluster_count; -- PedSector _fat_size; -- -- rootdir_sectors = (fat_type == FAT_TYPE_FAT16) ? 16 : 0; -- -- if (!fat_calc_sizes (length, 0, fat_type, rootdir_sectors, -- &_cluster_sectors, &_cluster_count, &_fat_size)) -- return -1; // XXX: doesn't work... can't see a better way! -- -- if (_cluster_sectors < cluster_sectors) -- return -1; -- if (_cluster_sectors > cluster_sectors) -- return 1; -- -- if (_cluster_count < cluster_count) -- return -1; -- if (_cluster_count > cluster_count) -- return 1; -- -- return 0; --} -- --static PedSector --_get_create_size (PedSector upper_bound, FatType fat_type, -- PedSector cluster_sectors, FatCluster cluster_count) --{ -- PedSector min_length = 0; -- PedSector max_length = upper_bound; -- PedSector length; -- -- while (1) { -- length = (min_length + max_length) / 2; -- switch (_test_create_size (length, fat_type, cluster_sectors, -- cluster_count)) { -- case -1: min_length = length; break; -- case 0: return length; -- case 1: max_length = length; break; -- } -- /* hack... won't always be able to get max cluster count -- * with max cluster size, etc. */ -- if (max_length - min_length == 1) -- return min_length; -- } -- -- return 0; /* shut gcc up */ --} --#endif -- - PedConstraint* - fat_get_create_constraint_fat16 (const PedDevice* dev) - { -@@ -685,19 +623,8 @@ fat_get_create_constraint_fat16 (const PedDevice* dev) - if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1)) - return NULL; - --#if 0 -- min_size = _get_create_size (dev->length, FAT_TYPE_FAT16, -- fat_min_cluster_size (FAT_TYPE_FAT16), -- fat_min_cluster_count (FAT_TYPE_FAT16)); -- max_size = _get_create_size (dev->length, FAT_TYPE_FAT16, -- fat_max_cluster_size (FAT_TYPE_FAT16), -- fat_max_cluster_count (FAT_TYPE_FAT16)); -- if (!min_size) -- return NULL; --#else - min_size = 65794; - max_size = 2097153; --#endif - - return ped_constraint_new ( - ped_alignment_any, ped_alignment_any, -@@ -714,15 +641,7 @@ fat_get_create_constraint_fat32 (const PedDevice* dev) - if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1)) - return NULL; - --#if 0 -- min_size = _get_create_size (dev->length, FAT_TYPE_FAT32, -- fat_min_cluster_size (FAT_TYPE_FAT32), -- fat_min_cluster_count (FAT_TYPE_FAT32)); -- if (!min_size) -- return NULL; --#else - min_size = 525224; --#endif - - return ped_constraint_new ( - ped_alignment_any, ped_alignment_any, -@@ -730,97 +649,3 @@ fat_get_create_constraint_fat32 (const PedDevice* dev) - min_size, dev->length); - } - #endif /* !DISCOVER_ONLY */ -- --#if 0 -- --static PedFileSystemOps fat16_ops = { -- probe: fat_probe_fat16, --#ifndef DISCOVER_ONLY -- clobber: fat_clobber, -- open: fat_open, -- create: fat_create_fat16, -- close: fat_close, -- check: fat_check, -- resize: fat_resize, -- copy: fat_copy, -- get_create_constraint: fat_get_create_constraint_fat16, -- get_resize_constraint: fat_get_resize_constraint, -- get_copy_constraint: fat_get_copy_constraint, --#else /* !DISCOVER_ONLY */ -- clobber: NULL, -- open: NULL, -- create: NULL, -- close: NULL, -- check: NULL, -- resize: NULL, -- copy: NULL, -- get_create_constraint: NULL, -- get_resize_constraint: NULL, -- get_copy_constraint: NULL, --#endif /* !DISCOVER_ONLY */ --}; -- --static PedFileSystemOps fat32_ops = { -- probe: fat_probe_fat32, --#ifndef DISCOVER_ONLY -- clobber: fat_clobber, -- open: fat_open, -- create: fat_create_fat32, -- close: fat_close, -- check: fat_check, -- resize: fat_resize, -- copy: fat_copy, -- get_create_constraint: fat_get_create_constraint_fat32, -- get_resize_constraint: fat_get_resize_constraint, -- get_copy_constraint: fat_get_copy_constraint, --#else /* !DISCOVER_ONLY */ -- clobber: NULL, -- open: NULL, -- create: NULL, -- close: NULL, -- check: NULL, -- resize: NULL, -- copy: NULL, -- get_create_constraint: NULL, -- get_resize_constraint: NULL, -- get_copy_constraint: NULL, --#endif /* !DISCOVER_ONLY */ --}; -- --#define FAT_BLOCK_SIZES ((int[2]){512, 0}) -- --PedFileSystemType fat16_type = { -- next: NULL, -- ops: &fat16_ops, -- name: "fat16", -- block_sizes: FAT_BLOCK_SIZES --}; -- --PedFileSystemType fat32_type = { -- next: NULL, -- ops: &fat32_ops, -- name: "fat32", -- block_sizes: FAT_BLOCK_SIZES --}; -- --void --ped_file_system_fat_init () --{ -- if (sizeof (FatBootSector) != 512) { -- ped_exception_throw (PED_EXCEPTION_BUG, PED_EXCEPTION_CANCEL, -- _("GNU Parted was miscompiled: the FAT boot sector " -- "should be 512 bytes. FAT support will be disabled.")); -- } else { -- ped_file_system_type_register (&fat16_type); -- ped_file_system_type_register (&fat32_type); -- } --} -- --void --ped_file_system_fat_done () --{ -- ped_file_system_type_unregister (&fat16_type); -- ped_file_system_type_unregister (&fat32_type); --} -- --#endif -diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c -index 71113d4..2a0955d 100644 ---- a/libparted/fs/r/fat/resize.c -+++ b/libparted/fs/r/fat/resize.c -@@ -446,23 +446,6 @@ fat_construct_new_fat (FatOpContext* ctx) - fat_table_set (new_fs_info->fat, new_cluster, new_next_cluster); - } - --#if 0 --#ifdef PED_VERBOSE -- for (old_cluster=2; old_cluster < old_fs_info->cluster_count+2; -- old_cluster++) { -- if (fat_table_is_available (old_fs_info->fat, old_cluster)) -- continue; -- -- printf ("%d->%d\t(next: %d->%d)\n", -- old_cluster, -- ctx->remap [old_cluster], -- fat_table_get (old_fs_info->fat, old_cluster), -- fat_table_get (new_fs_info->fat, -- ctx->remap [old_cluster])); -- } --#endif /* PED_VERBOSE */ --#endif -- - if (old_fs_info->fat_type == FAT_TYPE_FAT32 - && new_fs_info->fat_type == FAT_TYPE_FAT32) { - new_fs_info->root_cluster --- -2.26.2 - diff --git a/0040-fs-r-hfs-Remove-disabled-code.patch b/0040-fs-r-hfs-Remove-disabled-code.patch deleted file mode 100644 index fcbea96..0000000 --- a/0040-fs-r-hfs-Remove-disabled-code.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 0d5f047b2855f3d39fa3afe6ec2a6129d18ddf33 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 20 Nov 2020 13:22:52 -0800 -Subject: [PATCH 40/42] fs/r/hfs: Remove disabled code - ---- - libparted/fs/r/hfs/hfs.c | 194 --------------------------------------- - 1 file changed, 194 deletions(-) - -diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c -index 09899da..1da093c 100644 ---- a/libparted/fs/r/hfs/hfs.c -+++ b/libparted/fs/r/hfs/hfs.c -@@ -59,28 +59,6 @@ static PedFileSystemType hfsplus_type; - - /* ----- HFS ----- */ - --#if 0 --/* This is a very unundoable operation */ --/* Maybe I shouldn't touch the alternate MDB ? */ --/* Anyway clobber is call before other fs creation */ --/* So this is a non-issue */ --static int --hfs_clobber (PedGeometry* geom) --{ -- uint8_t buf[PED_SECTOR_SIZE_DEFAULT]; -- -- memset (buf, 0, PED_SECTOR_SIZE_DEFAULT); -- -- /* destroy boot blocks, mdb, alternate mdb ... */ -- return (!!ped_geometry_write (geom, buf, 0, 1)) & -- (!!ped_geometry_write (geom, buf, 1, 1)) & -- (!!ped_geometry_write (geom, buf, 2, 1)) & -- (!!ped_geometry_write (geom, buf, geom->length - 2, 1)) & -- (!!ped_geometry_write (geom, buf, geom->length - 1, 1)) & -- (!!ped_geometry_sync (geom)); --} --#endif -- - PedFileSystem * - hfs_open (PedGeometry* geom) - { -@@ -341,44 +319,6 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer) - #include "reloc_plus.h" - #include "journal.h" - --#if 0 --static int --hfsplus_clobber (PedGeometry* geom) --{ -- unsigned int i = 1; -- uint8_t buf[PED_SECTOR_SIZE_DEFAULT]; -- HfsMasterDirectoryBlock *mdb; -- -- mdb = (HfsMasterDirectoryBlock *) buf; -- -- if (!ped_geometry_read (geom, buf, 2, 1)) -- return 0; -- -- if (PED_BE16_TO_CPU (mdb->signature) == HFS_SIGNATURE) { -- /* embedded hfs+ */ -- PedGeometry *embedded; -- -- i = PED_BE32_TO_CPU(mdb->block_size) / PED_SECTOR_SIZE_DEFAULT; -- embedded = ped_geometry_new ( -- geom->dev, -- (PedSector) geom->start -- + PED_BE16_TO_CPU (mdb->start_block) -- + (PedSector) PED_BE16_TO_CPU ( -- mdb->old_new.embedded.location.start_block ) * i, -- (PedSector) PED_BE16_TO_CPU ( -- mdb->old_new.embedded.location.block_count ) * i ); -- if (!embedded) i = 0; -- else { -- i = hfs_clobber (embedded); -- ped_geometry_destroy (embedded); -- } -- } -- -- /* non-embedded or envelop destroy as hfs */ -- return ( hfs_clobber (geom) && i ); --} --#endif -- - int - hfsplus_close (PedFileSystem *fs) - { -@@ -1224,137 +1164,3 @@ hfsplus_extract (PedFileSystem* fs, PedTimer* timer) - #endif /* HFS_EXTRACT_FS */ - - #endif /* !DISCOVER_ONLY */ -- --#if 0 --static PedFileSystemOps hfs_ops = { -- probe: hfs_probe, --#ifndef DISCOVER_ONLY -- clobber: hfs_clobber, -- open: hfs_open, -- create: NULL, -- close: hfs_close, --#ifndef HFS_EXTRACT_FS -- check: NULL, --#else -- check: hfs_extract, --#endif -- copy: NULL, -- resize: hfs_resize, -- get_create_constraint: NULL, -- get_resize_constraint: hfs_get_resize_constraint, -- get_copy_constraint: NULL, --#else /* DISCOVER_ONLY */ -- clobber: NULL, -- open: NULL, -- create: NULL, -- close: NULL, -- check: NULL, -- copy: NULL, -- resize: NULL, -- get_create_constraint: NULL, -- get_resize_constraint: NULL, -- get_copy_constraint: NULL, --#endif /* DISCOVER_ONLY */ --}; -- --static PedFileSystemOps hfsplus_ops = { -- probe: hfsplus_probe, --#ifndef DISCOVER_ONLY -- clobber: hfsplus_clobber, -- open: hfsplus_open, -- create: NULL, -- close: hfsplus_close, --#ifndef HFS_EXTRACT_FS -- check: NULL, --#else -- check: hfsplus_extract, --#endif -- copy: NULL, -- resize: hfsplus_resize, -- get_create_constraint: NULL, -- get_resize_constraint: hfsplus_get_resize_constraint, -- get_copy_constraint: NULL, --#else /* DISCOVER_ONLY */ -- clobber: NULL, -- open: NULL, -- create: NULL, -- close: NULL, -- check: NULL, -- copy: NULL, -- resize: NULL, -- get_create_constraint: NULL, -- get_resize_constraint: NULL, -- get_copy_constraint: NULL, --#endif /* DISCOVER_ONLY */ --}; -- --static PedFileSystemOps hfsx_ops = { -- probe: hfsx_probe, --#ifndef DISCOVER_ONLY -- clobber: hfs_clobber, /* NOT hfsplus_clobber ! -- HFSX can't be embedded */ -- open: hfsplus_open, -- create: NULL, -- close: hfsplus_close, --#ifndef HFS_EXTRACT_FS -- check: NULL, --#else -- check: hfsplus_extract, --#endif -- copy: NULL, -- resize: hfsplus_resize, -- get_create_constraint: NULL, -- get_resize_constraint: hfsplus_get_resize_constraint, -- get_copy_constraint: NULL, --#else /* DISCOVER_ONLY */ -- clobber: NULL, -- open: NULL, -- create: NULL, -- close: NULL, -- check: NULL, -- copy: NULL, -- resize: NULL, -- get_create_constraint: NULL, -- get_resize_constraint: NULL, -- get_copy_constraint: NULL, --#endif /* DISCOVER_ONLY */ --}; -- -- --static PedFileSystemType hfs_type = { -- next: NULL, -- ops: &hfs_ops, -- name: "hfs", -- block_sizes: HFS_BLOCK_SIZES --}; -- --static PedFileSystemType hfsplus_type = { -- next: NULL, -- ops: &hfsplus_ops, -- name: "hfs+", -- block_sizes: HFSP_BLOCK_SIZES --}; -- --static PedFileSystemType hfsx_type = { -- next: NULL, -- ops: &hfsx_ops, -- name: "hfsx", -- block_sizes: HFSX_BLOCK_SIZES --}; -- --void --ped_file_system_hfs_init () --{ -- ped_file_system_type_register (&hfs_type); -- ped_file_system_type_register (&hfsplus_type); -- ped_file_system_type_register (&hfsx_type); --} -- --void --ped_file_system_hfs_done () --{ -- ped_file_system_type_unregister (&hfs_type); -- ped_file_system_type_unregister (&hfsplus_type); -- ped_file_system_type_unregister (&hfsx_type); --} --#endif --- -2.26.2 - diff --git a/0041-libparted-Remove-disabled-code.patch b/0041-libparted-Remove-disabled-code.patch deleted file mode 100644 index 42580e8..0000000 --- a/0041-libparted-Remove-disabled-code.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 945b13aed7e9762e00bda1b54e2c18eb3373a31d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 20 Nov 2020 13:26:31 -0800 -Subject: [PATCH 41/42] libparted: Remove disabled code - ---- - libparted/arch/gnu.c | 40 ---------------------------------------- - libparted/labels/mac.c | 14 -------------- - libparted/labels/pc98.c | 5 ----- - 3 files changed, 59 deletions(-) - -diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c -index 321b70a..922b93d 100644 ---- a/libparted/arch/gnu.c -+++ b/libparted/arch/gnu.c -@@ -359,46 +359,6 @@ gnu_close (PedDevice* dev) - dev->dirty = 0; - } - --#if 0 -- if (dev->dirty && dev->boot_dirty && dev->type != PED_DEVICE_FILE) { -- /* ouch! */ -- ped_exception_throw ( -- PED_EXCEPTION_WARNING, -- PED_EXCEPTION_OK, -- _("The partition table cannot be re-read. This means " -- "you need to reboot before mounting any " -- "modified partitions. You also need to reinstall " -- "your boot loader before you reboot (which may " -- "require mounting modified partitions). It is " -- "impossible do both things! So you'll need to " -- "boot off a rescue disk, and reinstall your boot " -- "loader from the rescue disk. Read section 4 of " -- "the Parted User documentation for more " -- "information.")); -- return 1; -- } -- -- if (dev->dirty && dev->type != PED_DEVICE_FILE) { -- ped_exception_throw ( -- PED_EXCEPTION_WARNING, -- PED_EXCEPTION_IGNORE, -- _("The partition table on %s cannot be re-read " -- "(%s). This means the Hurd knows nothing about any " -- "modifications you made. You should reboot your " -- "computer before doing anything with %s."), -- dev->path, strerror (errno), dev->path); -- } -- -- if (dev->boot_dirty && dev->type != PED_DEVICE_FILE) { -- ped_exception_throw ( -- PED_EXCEPTION_WARNING, -- PED_EXCEPTION_OK, -- _("You should reinstall your boot loader before " -- "rebooting. Read section 4 of the Parted User " -- "documentation for more information.")); -- } --#endif -- - return 1; - } - -diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c -index 8980885..af9f4c3 100644 ---- a/libparted/labels/mac.c -+++ b/libparted/labels/mac.c -@@ -560,20 +560,6 @@ _rawpart_analyse (MacRawPartition* raw_part, PedDisk* disk, int num) - mac_part_data->data_region_length - = PED_BE32_TO_CPU (raw_part->data_count); - -- /* boot region - we have no idea what this is for, but Mac OSX -- * seems to put garbage here, and doesn't pay any attention to -- * it afterwards. [clausen, dan burcaw] -- */ --#if 0 -- if (raw_part->boot_start) { -- ped_exception_throw ( -- PED_EXCEPTION_ERROR, -- PED_EXCEPTION_CANCEL, -- _("The boot region doesn't start at the start " -- "of the partition.")); -- goto error_destroy_part; -- } --#endif - mac_part_data->boot_region_length - = PED_BE32_TO_CPU (raw_part->boot_count); - -diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c -index 328cd8d..b8993c4 100644 ---- a/libparted/labels/pc98.c -+++ b/libparted/labels/pc98.c -@@ -418,13 +418,8 @@ fill_raw_part (PC98RawPartition* raw_part, const PedPartition* part) - return 0; - } - raw_part->end_cyl = PED_CPU_TO_LE16(c); --#if 0 -- raw_part->end_head = h; -- raw_part->end_sector = s; --#else - raw_part->end_head = 0; - raw_part->end_sector = 0; --#endif - - return 1; - } --- -2.26.2 - diff --git a/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch b/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch deleted file mode 100644 index acc7497..0000000 --- a/0042-libparted-fs-Fix-GCC-warnings-suggesting-pure-for-PE.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 8df7974ac36fcea82551c3f6990f981b659e2635 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 20 Nov 2020 14:08:33 -0800 -Subject: [PATCH 42/42] libparted/fs: Fix GCC warnings suggesting pure for - PED_ASSERT functions - -There was some question about whether or not pure should be used for -functions with PED_ASSERT (or exit) in them. It should be fine, since -the values checked by the ASSERT are passed to the function directly. -Behavior should be exactly the same for the same inputs. ---- - libparted/fs/r/fat/calc.c | 12 ++++++------ - libparted/fs/r/fat/clstdup.c | 4 ++-- - libparted/fs/r/hfs/cache.c | 2 +- - 3 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c -index 18e0455..26c4d18 100644 ---- a/libparted/fs/r/fat/calc.c -+++ b/libparted/fs/r/fat/calc.c -@@ -369,7 +369,7 @@ fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector) - + fs_info->cluster_sectors * fs_info->cluster_count; - } - --FatFragment -+FatFragment _GL_ATTRIBUTE_PURE - fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -379,7 +379,7 @@ fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster) - return (cluster - 2) * fs_info->cluster_frags; - } - --FatCluster -+FatCluster _GL_ATTRIBUTE_PURE - fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -389,7 +389,7 @@ fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag) - return frag / fs_info->cluster_frags + 2; - } - --PedSector -+PedSector _GL_ATTRIBUTE_PURE - fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -399,7 +399,7 @@ fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag) - return frag * fs_info->frag_sectors + fs_info->cluster_offset; - } - --FatFragment -+FatFragment _GL_ATTRIBUTE_PURE - fat_sector_to_frag (const PedFileSystem* fs, PedSector sector) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -409,7 +409,7 @@ fat_sector_to_frag (const PedFileSystem* fs, PedSector sector) - return (sector - fs_info->cluster_offset) / fs_info->frag_sectors; - } - --PedSector -+PedSector _GL_ATTRIBUTE_PURE - fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -@@ -420,7 +420,7 @@ fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster) - + fs_info->cluster_offset; - } - --FatCluster -+FatCluster _GL_ATTRIBUTE_PURE - fat_sector_to_cluster (const PedFileSystem* fs, PedSector sector) - { - FatSpecific* fs_info = FAT_SPECIFIC (fs); -diff --git a/libparted/fs/r/fat/clstdup.c b/libparted/fs/r/fat/clstdup.c -index 7456f60..cfd1552 100644 ---- a/libparted/fs/r/fat/clstdup.c -+++ b/libparted/fs/r/fat/clstdup.c -@@ -126,7 +126,7 @@ fetch_fragments (FatOpContext* ctx) - - /* finds the first fragment that is not going to get overwritten (that needs to - get read in) */ --static FatFragment -+static FatFragment _GL_ATTRIBUTE_PURE - get_first_underlay (const FatOpContext* ctx, int first, int last) - { - int old; -@@ -147,7 +147,7 @@ get_first_underlay (const FatOpContext* ctx, int first, int last) - - /* finds the last fragment that is not going to get overwritten (that needs to - get read in) */ --static FatFragment -+static FatFragment _GL_ATTRIBUTE_PURE - get_last_underlay (const FatOpContext* ctx, int first, int last) - { - int old; -diff --git a/libparted/fs/r/hfs/cache.c b/libparted/fs/r/hfs/cache.c -index 5e5b071..fc11fe9 100644 ---- a/libparted/fs/r/hfs/cache.c -+++ b/libparted/fs/r/hfs/cache.c -@@ -173,7 +173,7 @@ hfsc_cache_add_extent(HfsCPrivateCache* cache, uint32_t start, uint32_t length, - return ext; - } - --HfsCPrivateExtent* -+HfsCPrivateExtent* _GL_ATTRIBUTE_PURE - hfsc_cache_search_extent(HfsCPrivateCache* cache, uint32_t start) - { - HfsCPrivateExtent* ret; --- -2.26.2 - diff --git a/parted.spec b/parted.spec index c61e125..f980b0e 100644 --- a/parted.spec +++ b/parted.spec @@ -163,245 +163,3 @@ make check - New upstream release v3.3 Includes the DASD virtio-blk fix. - Dropping pre-3.2 changelog entries - -* Wed Oct 02 2019 Brian C. Lane - 3.2.153-2 -- libparted/s390: Re-enabled virtio-attached DASD heuristics - Fixes DASD backed virtblk devices - -* Mon Aug 12 2019 Brian C. Lane - 3.2.153-1 -- New upstream ALPHA release v3.2.153 -- Includes all patches except the python2 -> python3 change for test helpers - -* Fri Jul 26 2019 Fedora Release Engineering - 3.2-43 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Wed Apr 24 2019 Björn Esser - 3.2-42 -- Remove hardcoded gzip suffix from GNU info pages - -* Tue Apr 09 2019 Brian C. Lane - 3.2-41 -- Add fix and tests for nilfs2 sigsegv - -* Fri Mar 01 2019 Brian C. Lane - 3.2-40 -- Run the CI tests using rpmbuild -- t6000-dm: Stop using private lvm root - -* Sun Feb 17 2019 Igor Gnatenko - 3.2-39 -- Rebuild for readline 8.0 - -* Thu Jan 31 2019 Brian C. Lane - 3.2-38 -- Add missing patches from Wang Dong -- fix crash due to improper partition number (dongdwdw) -- fix wrong error label jump in mkpart (dongdwdw) -- clean the disk information when commands fail (dongdwdw) -- Remove PED_ASSERT from ped_partition_set_name (bcl) -- Added support for Windows recovery partition (Hans-Joachim.Baader) - -* Tue Oct 16 2018 Brian C. Lane - 3.2-37 -- Read NVMe model names from sysfs (dann.frazier) -- Fix warnings from GCC 7's -Wimplicit-fallthrough (dann.frazier) -- ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure' (dann.frazier) -- Add udf to t1700-probe-fs and to the manpage (bcl) -- libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem (pali.rohar) -- Fix potential command line buffer overflow (xu.simon) -- t6100-mdraid-partitions: Use v0.90 metadata for the test (bcl) -- parted.c: Make sure dev_name is freed (bcl) -- parted.c: Always free peek_word (bcl) -- Fix the length of several strncpy calls (bcl) - -* Thu Jul 19 2018 Brian C. Lane - 3.2-36 -- drop ldconfig, it no longer needs to be called on un/install (bcl) -- Fix msdos-overlap py3 conversion (bcl) - -* Fri Jul 13 2018 Fedora Release Engineering - 3.2-35 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Jun 27 2018 Brian C. Lane - 3.2-34 -- Use python3 in buildroot -- Add make to BuildRequires -- Switch gpt-header-move and msdos-overlap to python3 (bcl) -- Modify gpt-header-move and msdos-overlap to work with py2 or py3 (bcl) -- Fix atari label false positives (psusi) -- Lift 512 byte restriction on fat resize (psusi) -- build: Remove unused traces of dynamic loading (cjwatson) -- Fix resizepart iec unit end sector (psusi) -- mkpart: Allow negative start value when FS-TYPE is not given (mail) -- Fix set and disk_set to not crash when no flags are supported (psusi) -- tests: fix t6100-mdraid-partitions (psusi) -- Fix make check (psusi) -- linux: Include for major() macro. (rjones) - -* Thu Jun 07 2018 Brian C. Lane - 3.2-33 -- Use gpg2 for signature checking - -* Sat Mar 24 2018 Richard W.M. Jones - 3.2-32 -- Fix for missing major/minor() macros in glibc 2.27. - -* Mon Feb 19 2018 Brian C. Lane - 3.2-31 -- Add gcc BuildRequires for future minimal buildroot support -- Remove %%clean section - -* Thu Feb 08 2018 Fedora Release Engineering - 3.2-30 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Tue Dec 19 2017 Brian C. Lane - 3.2-29 -- Add support for NVDIMM devices (sparschauer) -- libparted/labels: link with libiconv if needed (arnout) - -* Mon Jul 31 2017 Brian C. Lane - 3.2-28 -- atari.c: Drop xlocale.h - Resloves: rhbz#1476934 - -* Thu Jul 27 2017 Fedora Release Engineering - 3.2-27 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild - -* Tue Jun 06 2017 Brian C. Lane - 3.2-26 -- libparted: Fix udev cookie leak in _dm_resize_partition (bcl) - Resolves: rhbz#1455564 - -* Mon May 01 2017 Brian C. Lane - 3.2-25 -+ Updating to upstream patches -- tests/t1701-rescue-fs wait for the device to appear. (bcl) -- Increase timeout for rmmod scsi_debug and make it a framework failure (bcl) -- libparted/dasd: add test cases for the new fdasd functions (dongdwdw) -- libparted/dasd: add an exception for changing DASD-LDL partition table - (dongdwdw) -- libpartd/dasd: improve flag processing for DASD-LDL (dongdwdw) -- parted/ui: remove unneccesary information of command line (dongdwdw) -- parted: check the name of partition first when to name a partition (dongdwdw) -- Add support for RAM drives (sparschauer) -- Fix crash when localized (psusi) -- libparted: Fix typo in hfs error message (sebras) -- libparted: Fix MacOS boot support (laurent) -- mac: copy partition type and name correctly (saproj) -- libparted: Add support for atari partition tables (glaubitz) -- libparted:tests: Move get_sector_size() to common.c (glaubitz) -- tests: Update t0220 and t0280 for the swap flag. (bcl) -- libparted: set swap flag on GPT partitions (aschnell) -- libparted/dasd: add test cases for the new fdasd functions (dongdwdw) -- libparted/dasd: add new fdasd functions (dongdwdw) -- libparted/dasd: update and improve fdasd functions (dongdwdw) -- libparted/dasd: unify vtoc handling for cdl/ldl (dongdwdw) -- libparted: Don't warn if no HDIO_GET_IDENTITY ioctl (sparschauer) -- libparted: Fix starting CHS in protective MBR (petr.uzel) -- tests: Stop timing t9040 (#1172675) (bcl) - -* Sat Feb 11 2017 Fedora Release Engineering - 3.2-24 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Thu Jan 12 2017 Igor Gnatenko - 3.2-23 -- Rebuild for readline 7.x - -* Tue Oct 04 2016 Brian C. Lane - 3.2-22 -- tests: t3310-flags.sh: skip pc98 when sector size != 512 (bcl) -- tests: Set optimal blocks to 64 for scsi_debug devices (bcl) -- tests: t3310-flags.sh: Add tests for remaining table types (mike.fleetwood) -- tests: t3310-flags.sh: Add test for dvh table flags (mike.fleetwood) -- tests: t3310-flags.sh: Add test for mac table flags (mike.fleetwood) -- libparted: Remove commented local variable from bsd_partition_set_flag() - (mike.fleetwood) -- libparted: Fix to report success when setting lvm flag on bsd table - (mike.fleetwood) -- tests: t3310-flags.sh: Add test for bsd table flags (mike.fleetwood) -- tests: t3310-flags.sh: Stop excluding certain flags from being tested - (mike.fleetwood) -- tests: t3310-flags.sh: Query libparted for all flags to be tested - (mike.fleetwood) -- libparted: only IEC units are treated as exact (petr.uzel) -- docs: Improve partition description in parted.texi (gareth.randall) -- Add support for NVMe devices (petr.uzel) -- libparted/dasd: correct the offset where the first partition begins - (dongdwdw) - -* Wed Jun 15 2016 Brian C. Lane - 3.2-21 -- Cleanup mkpart manpage entry (#1183077) -- doc: Add information about quoting - -* Thu May 26 2016 Brian C. Lane - 3.2-20 -- libparted: Fix probing AIX disks on other arches -- partprobe: Open the device once for probing - -* Tue Apr 12 2016 Brian C. Lane 3.2-19 -- libparted: Remove fdasd geometry code from alloc_metadata (#1244833) (bcl) -- parted: Display details of partition alignment failure (#726856) (bcl) -- docs: Add list of filesystems for fs-type (#1311596) (bcl) -- Use disk geometry as basis for ext2 sector sizes. (Steven.Lang) -- parted: fix the rescue command (psusi) - -* Tue Mar 29 2016 Brian C. Lane 3.2-18 -- Use BLKSSZGET to get device sector size in _device_probe_geometry() - -* Mon Mar 07 2016 Brian C. Lane 3.2-17 -- lib-fs-resize: Prevent crash resizing FAT with very deep directories -- Add libparted/fs/.libs/ to LD_LIBRARY_PATH during make check - -* Mon Feb 29 2016 Brian C. Lane 3.2-16 -- Cleanup library path usage in specfile - pkgconfig wasn't finding libparted.pc because it was under /usr/lib64/ -- Explicitly reference the library files instead of use wildcards. -- Move libparted-fs-resize.so to the -devel package where it belongs. -- Add a pkgconfig file for the filesystem resize library -- tests: Add udevadm settle to wait_for_ loop -- tests: Add wait to t9042 -- tests: Fix t1700 failing on a host with a 4k xfs file - -* Tue Feb 09 2016 Brian C. Lane 3.2-15 -- fdasd.c Safeguard against geometry misprobing.patch (#1305931) - -* Thu Feb 04 2016 Fedora Release Engineering - 3.2-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Thu Oct 29 2015 Brian C. Lane 3.2-13 -- parted: fix build error on s390 - -* Tue Oct 27 2015 Brian C. Lane 3.2-12 -- dasd: enhance device probing -- fdasd: geometry handling updated from upstream s390-tools - -* Fri Aug 07 2015 Brian C. Lane 3.2-11 -- tests: Fix patch 0012 test for extended partition length -- UI: Avoid memory leaks -- libparted: Fix memory leaks.patch -- libparted: Fix possible memory leaks.patch -- libparted: Stop converting . in-sys-path-to / -- libparted: Use read-only when probing devices on linux -- tests: Use wait_for_dev_to_ functions - -* Mon Jul 13 2015 Brian C. Lane 3.2-10 -- parted: Fix crash with name command and no disklabel (#1226067) - -* Thu Jun 18 2015 Fedora Release Engineering - 3.2-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - -* Fri Jun 05 2015 Brian C. Lane 3.2-8 -- tests: Make sure the extended partition length is 2 (#1135493) -- libparted: BLKPG_RESIZE_PARTITION uses bytes not sectors (#1135493) - -* Tue Apr 28 2015 Brian C. Lane 3.2-7 -- Add python2 as a BuildRequires, used in some of the tests - -* Tue Apr 28 2015 Brian C. Lane 3.2-6 -- Update manpage NAME so whatis will work (bcl) -- libparted: device mapper uses 512b sectors (bcl) -- tests: Add a test for device-mapper partition sizes (bcl) -- parted: don't crash in disk_set when disk label not found (psusi) - -* Fri Nov 07 2014 Brian C. Lane 3.2-5 -- tests: Change minimum size to 256MiB for t1700-probe-fs - -* 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 - -* Wed Aug 13 2014 Brian C. Lane 3.2-2 -- Use a better patch to find the UTF8 locale for t0251 - -* Wed Jul 30 2014 Brian C. Lane 3.2-1 -- Rebase on upstream stable release v3.2 -- Drop upstream patches. -- Patch t0251 to use en_US.UTF-8 if possible. Fedora doesn't have C.UTF-8 From 4ff1a768b478de8adbcf9799a900f1df726b154d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 3 Feb 2021 09:43:00 -0800 Subject: [PATCH 17/60] - Add --fix support from upstream --- ...parted-add-fix-to-fix-in-script-mode.patch | 123 ++++++++++++++++ 0002-doc-Document-fix-flag.patch | 47 ++++++ 0003-tests-Add-tests-for-fix.patch | 135 ++++++++++++++++++ 0004-tests-Fix-test-t1700-probe-fs.patch | 35 +++++ ...041-undetected-in-use-16th-partition.patch | 33 +++++ parted.spec | 12 +- 6 files changed, 384 insertions(+), 1 deletion(-) create mode 100644 0001-parted-add-fix-to-fix-in-script-mode.patch create mode 100644 0002-doc-Document-fix-flag.patch create mode 100644 0003-tests-Add-tests-for-fix.patch create mode 100644 0004-tests-Fix-test-t1700-probe-fs.patch create mode 100644 0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch diff --git a/0001-parted-add-fix-to-fix-in-script-mode.patch b/0001-parted-add-fix-to-fix-in-script-mode.patch new file mode 100644 index 0000000..be907eb --- /dev/null +++ b/0001-parted-add-fix-to-fix-in-script-mode.patch @@ -0,0 +1,123 @@ +From 7c9a96209af2b84e1eec98ad3527f82ddd966cdf Mon Sep 17 00:00:00 2001 +From: Cristian Klein +Date: Fri, 11 Dec 2020 22:19:22 +0100 +Subject: [PATCH 1/5] parted: add --fix to "fix" in script mode + +Use-case: VMs are booted from images that are smaller than their virtual +disk. This means that -- almost by definition -- the secondary GPT +header will be "misplaced", i.e., not at the end of the virtual disk. + +Without this patch, parted cannot be used for custom/exotic partitioning +when the VM boots (e.g., in cloud-init's `bootcmd`). Specifically, it +will fail as follows: + +``` +$ sudo parted --script /dev/vda "mkpart 2 10GB -1" +Warning: Not all of the space available to /dev/vda appears to be used, +you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? +Error: Unable to satisfy all constraints on the partition. +``` + +This happens because, in script mode, exceptions are usually not +resolved. + +This patch adds `--fix`. This allows exceptions to be automatically +resolved with Fix. As a result, the following command will work: + +``` +$ sudo parted --fix --script /dev/vda "mkpart 2 10GB -1" +``` + +Signed-off-by: Brian C. Lane +--- + parted/parted.c | 8 ++++++-- + parted/ui.c | 7 +++++++ + parted/ui.h | 1 + + 3 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index e84e66d..41edb7f 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -116,6 +116,7 @@ static struct option const options[] = { + {"list", 0, NULL, 'l'}, + {"machine", 0, NULL, 'm'}, + {"script", 0, NULL, 's'}, ++ {"fix", 0, NULL, 'f'}, + {"version", 0, NULL, 'v'}, + {"align", required_argument, NULL, 'a'}, + {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY}, +@@ -127,12 +128,14 @@ static const char *const options_help [][2] = { + {"list", N_("lists partition layout on all block devices")}, + {"machine", N_("displays machine parseable output")}, + {"script", N_("never prompts for user intervention")}, ++ {"fix", N_("in script mode, fix instead of abort when asked")}, + {"version", N_("displays the version")}, + {"align=[none|cyl|min|opt]", N_("alignment for new partitions")}, + {NULL, NULL} + }; + + int opt_script_mode = 0; ++int opt_fix_mode = 0; + int pretend_input_tty = 0; + int opt_machine_mode = 0; + int disk_is_modified = 0; +@@ -2191,7 +2194,7 @@ int opt, help = 0, list = 0, version = 0, wrong = 0; + + while (1) + { +- opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsva:", ++ opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsfva:", + options, NULL); + if (opt == -1) + break; +@@ -2201,6 +2204,7 @@ while (1) + case 'l': list = 1; break; + case 'm': opt_machine_mode = 1; break; + case 's': opt_script_mode = 1; break; ++ case 'f': opt_fix_mode = 1; break; + case 'v': version = 1; break; + case 'a': + alignment = XARGMATCH ("--align", optarg, +@@ -2217,7 +2221,7 @@ while (1) + + if (wrong == 1) { + fprintf (stderr, +- _("Usage: %s [-hlmsv] [-a] [DEVICE [COMMAND [PARAMETERS]]...]\n"), ++ _("Usage: %s [-hlmsfv] [-a] [DEVICE [COMMAND [PARAMETERS]]...]\n"), + program_name); + return 0; + } +diff --git a/parted/ui.c b/parted/ui.c +index 973bd26..b5948d3 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -644,6 +644,13 @@ exception_handler (PedException* ex) + if (!option_get_next (ex->options, opt)) + return opt; + ++ /* script-mode and fix? */ ++ int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX); ++ if (opt_script_mode && opt_fix_mode && fix_is_an_option) { ++ printf ("Fixing, due to --fix\n"); ++ return PED_EXCEPTION_FIX; ++ } ++ + /* script-mode: don't handle the exception */ + if (opt_script_mode || (!isatty (0) && !pretend_input_tty)) + return PED_EXCEPTION_UNHANDLED; +diff --git a/parted/ui.h b/parted/ui.h +index 3b07782..e4e88b6 100644 +--- a/parted/ui.h ++++ b/parted/ui.h +@@ -89,6 +89,7 @@ extern void print_using_dev (PedDevice* dev); + + /* in parted.c */ + extern int opt_script_mode; ++extern int opt_fix_mode; + extern int pretend_input_tty; + + extern void print_options_help (); +-- +2.26.2 + diff --git a/0002-doc-Document-fix-flag.patch b/0002-doc-Document-fix-flag.patch new file mode 100644 index 0000000..0961dda --- /dev/null +++ b/0002-doc-Document-fix-flag.patch @@ -0,0 +1,47 @@ +From 8aa569aa60c37526a8c37b06e88a833745a7a6ef Mon Sep 17 00:00:00 2001 +From: Cristian Klein +Date: Fri, 11 Dec 2020 22:19:23 +0100 +Subject: [PATCH 2/5] doc: Document --fix flag + +Also fix copyright year, to please `make syntax-check`. + +Signed-off-by: Brian C. Lane +--- + doc/C/parted.8 | 3 +++ + doc/parted.texi | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 297c39a..d8e556e 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -27,6 +27,9 @@ displays machine parseable output + .B -s, --script + never prompts for user intervention + .TP ++.B -f, --fix ++automatically answer "fix" to exceptions in script mode ++.TP + .B -v, --version + displays the version + .TP +diff --git a/doc/parted.texi b/doc/parted.texi +index d89d74d..33212f0 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -406,6 +406,12 @@ display a help message + @itemx --script + never prompt the user + ++@item -f ++@itemx --fix ++automatically answer exceptions with "fix" in script mode, whcih is useful for: ++GPT header not including full disk size; moving the backup GPT table to the end of the disk; ++MAC fix missing partition map entry; etc. ++ + @item -a alignment-type + @itemx --align alignment-type + Set alignment for newly created partitions, valid alignment types are: +-- +2.26.2 + diff --git a/0003-tests-Add-tests-for-fix.patch b/0003-tests-Add-tests-for-fix.patch new file mode 100644 index 0000000..4fe4ef9 --- /dev/null +++ b/0003-tests-Add-tests-for-fix.patch @@ -0,0 +1,135 @@ +From 6b2c8806b42a7214d726cc2b3dac6b96013a6cce Mon Sep 17 00:00:00 2001 +From: Cristian Klein +Date: Fri, 11 Dec 2020 22:19:24 +0100 +Subject: [PATCH 3/5] tests: Add tests for --fix + +Signed-off-by: Brian C. Lane +--- + tests/Makefile.am | 3 +- + tests/t9060-gpt-grow-script-fix.sh | 100 +++++++++++++++++++++++++++++ + 2 files changed, 102 insertions(+), 1 deletion(-) + create mode 100755 tests/t9060-gpt-grow-script-fix.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 0d7c022..3473e6b 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -89,7 +89,8 @@ TESTS = \ + t9040-many-partitions.sh \ + t9041-undetected-in-use-16th-partition.sh \ + t9042-dos-partition-limit.sh \ +- t9050-partition-table-types.sh ++ t9050-partition-table-types.sh \ ++ t9060-gpt-grow-script-fix.sh + + EXTRA_DIST = \ + $(TESTS) t-local.sh t-lvm.sh \ +diff --git a/tests/t9060-gpt-grow-script-fix.sh b/tests/t9060-gpt-grow-script-fix.sh +new file mode 100755 +index 0000000..4a3a8a9 +--- /dev/null ++++ b/tests/t9060-gpt-grow-script-fix.sh +@@ -0,0 +1,100 @@ ++#!/bin/sh ++# grow a gpt disk, ensure that parted offers to update the gpt size ++# do this in script mode with fix ++ ++# Copyright (C) 2009-2012, 2014, 2019 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++dev=loop-file ++ ++ss=$sector_size_ ++n_sectors=5000 ++ ++dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 ++ ++# create gpt label ++parted -s $dev mklabel gpt > empty 2>&1 || fail=1 ++compare /dev/null empty || fail=1 ++ ++# print the empty table ++parted -m -s $dev unit s print > t 2>&1 || fail=1 ++sed "s,.*/$dev:,$dev:," t > out || fail=1 ++ ++# check for expected output ++printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \ ++ > exp || fail=1 ++compare exp out || fail=1 ++ ++# grow disk ++n_sectors=5500 ++dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 ++ ++# printing must warn, but not fix in script mode ++parted -s $dev print > out 2>&1 || fail=1 ++ ++# Transform the actual output, to avoid spurious differences when ++# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity. ++# normalize the actual output ++mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \ ++ -e "s,^.*/lt-parted: ,parted: ," o2 > out ++ ++# check for expected diagnostic ++cat < exp || fail=1 ++Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? ++Model: (file) ++Disk DEVICE: 2816kB ++Sector size (logical/physical): 512B/512B ++Partition Table: gpt ++Disk Flags: ++ ++Number Start End Size File system Name Flags ++ ++EOF ++compare exp out || fail=1 ++ ++# now we fix ++parted --script --fix $dev print > out 2>&1 || fail=1 ++ ++# Transform the actual output, to avoid spurious differences when ++# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity. ++# normalize the actual output ++mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \ ++ -e "s,^.*/lt-parted: ,parted: ," o2 > out ++ ++# check for expected diagnostic ++cat < exp || fail=1 ++Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? ++Fixing, due to --fix ++Model: (file) ++Disk DEVICE: 2816kB ++Sector size (logical/physical): 512B/512B ++Partition Table: gpt ++Disk Flags: ++ ++Number Start End Size File system Name Flags ++ ++EOF ++compare exp out || fail=1 ++ ++ ++# Now should not warn ++ ++parted -s $dev print > err 2>&1 || fail=1 ++grep Warning: err > k ; mv k err ++compare /dev/null err || fail=1 ++ ++Exit $fail +-- +2.26.2 + diff --git a/0004-tests-Fix-test-t1700-probe-fs.patch b/0004-tests-Fix-test-t1700-probe-fs.patch new file mode 100644 index 0000000..d96b771 --- /dev/null +++ b/0004-tests-Fix-test-t1700-probe-fs.patch @@ -0,0 +1,35 @@ +From 9bb4afe61426419c8bb83a25aa9822e00611c8f3 Mon Sep 17 00:00:00 2001 +From: Cristian Klein +Date: Fri, 11 Dec 2020 22:19:25 +0100 +Subject: [PATCH 4/5] tests: Fix test t1700-probe-fs + +mkfs.ext3 (see version below) was complaining that the filesystem is too small +for a journal, which made the test fail. + +``` +$ mkfs.ext3 -V +mke2fs 1.45.5 (07-Jan-2020) + Using EXT2FS Library version 1.45.5 +``` + +Signed-off-by: Brian C. Lane +--- + tests/t1700-probe-fs.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 848d3e3..5c08e97 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -57,7 +57,7 @@ done + # Some features should indicate ext4 by themselves. + for feature in uninit_bg flex_bg; do + # create an ext3 file system +- dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || skip_ "dd failed" ++ dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed" + mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed" + + # set the feature +-- +2.26.2 + diff --git a/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch b/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch new file mode 100644 index 0000000..a998543 --- /dev/null +++ b/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch @@ -0,0 +1,33 @@ +From 6ed9c9e82ea6cfbee93a47e82e92a90abdb82343 Mon Sep 17 00:00:00 2001 +From: Cristian Klein +Date: Fri, 11 Dec 2020 22:19:26 +0100 +Subject: [PATCH 5/5] tests: Fix t9041-undetected-in-use-16th-partition + +Sometimes fails with: +``` ++ mkfs.ext3 /dev/sda15 +mke2fs 1.45.5 (07-Jan-2020) +/dev/sda15: Not enough space to build proposed filesystem while setting up superblock +``` + +Signed-off-by: Brian C. Lane +--- + tests/t9041-undetected-in-use-16th-partition.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh +index a4a3020..129bf15 100644 +--- a/tests/t9041-undetected-in-use-16th-partition.sh ++++ b/tests/t9041-undetected-in-use-16th-partition.sh +@@ -25,7 +25,7 @@ grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || + skip_ 'this system lacks a new-enough libblkid' + + ss=$sector_size_ +-partition_sectors=256 # sectors per partition ++partition_sectors=512 # sectors per partition + n_partitions=17 # how many partitions to create + start=2048 # start sector for the first partition + gpt_slop=34 # sectors at end of disk reserved for GPT +-- +2.26.2 + diff --git a/parted.spec b/parted.spec index f980b0e..8d352fe 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -13,6 +13,13 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane +# Upstream patches since v3.4 release +Patch0001: 0001-parted-add-fix-to-fix-in-script-mode.patch +Patch0002: 0002-doc-Document-fix-flag.patch +Patch0003: 0003-tests-Add-tests-for-fix.patch +Patch0004: 0004-tests-Fix-test-t1700-probe-fs.patch +Patch0005: 0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel BuildRequires: readline-devel @@ -115,6 +122,9 @@ make check %changelog +* Wed Feb 03 2021 Brian C. Lane - 3.4-2 +- Add --fix support from upstream + * Wed Jan 27 2021 Brian C. Lane - 3.4-1 - New stable upstream release v3.4 From c9bde538a72285442d55e376d25c21d7386db4ff Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 10 Mar 2021 10:18:59 -0800 Subject: [PATCH 18/60] - Use autoreconf -fiv for autoconf 2.71 support Works with both 2.69 and 2.71 --- parted.spec | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/parted.spec b/parted.spec index 8d352fe..8682883 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -31,7 +31,9 @@ BuildRequires: libuuid-devel BuildRequires: libblkid-devel >= 2.17 BuildRequires: gnupg2 BuildRequires: git -BuildRequires: autoconf automake +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool BuildRequires: e2fsprogs BuildRequires: xfsprogs BuildRequires: dosfstools @@ -71,8 +73,7 @@ gpg2 --verify %{SOURCE1} %{SOURCE0} iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS %build -autoreconf -autoconf +autoreconf -fiv CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS %configure --disable-static --disable-gcc-warnings # Don't use rpath! @@ -122,6 +123,10 @@ make check %changelog +* Wed Mar 10 2021 Brian C. Lane - 3.4-3 +- Use autoreconf -fiv for autoconf 2.71 support + Works with both 2.69 and 2.71 + * Wed Feb 03 2021 Brian C. Lane - 3.4-2 - Add --fix support from upstream From 9017fc851980b1d1599a1c0ae476c98fe2ff471b Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 14 Jun 2021 10:38:49 -0700 Subject: [PATCH 19/60] - Fix issues that covscan classifies as important Resolves: rhbz#1938836 - Update gpg key for bcl@redhat.com - Work around a mkswap bug --- ...bparted-Fix-fd-check-in-_flush_cache.patch | 26 +++++++++ ...tential-memory-leak-in-sdmmc_get_pro.patch | 38 +++++++++++++ ...copy-paste-error-in-HFS-journal-code.patch | 34 +++++++++++ ...rted-Fix-end_input-leak-in-do_mkpart.patch | 53 +++++++++++++++++ ...arted-Free-tmp-usage-inside-do_print.patch | 25 ++++++++ ...ed-Fix-memory-leaks-in-do_resizepart.patch | 43 ++++++++++++++ ...rning-about-buffer-size-in-Atari-lab.patch | 57 +++++++++++++++++++ ...x-potential-memory-leak-in-gpt_write.patch | 44 ++++++++++++++ ...-around-a-mkswap-bug-by-using-dev-ze.patch | 34 +++++++++++ ...dev-zero-for-temporary-file-and-mksw.patch | 46 +++++++++++++++ parted.spec | 18 +++++- pubkey.brian.lane | 30 +++++----- 12 files changed, 432 insertions(+), 16 deletions(-) create mode 100644 0006-libparted-Fix-fd-check-in-_flush_cache.patch create mode 100644 0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch create mode 100644 0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch create mode 100644 0009-parted-Fix-end_input-leak-in-do_mkpart.patch create mode 100644 0010-parted-Free-tmp-usage-inside-do_print.patch create mode 100644 0011-parted-Fix-memory-leaks-in-do_resizepart.patch create mode 100644 0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch create mode 100644 0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch create mode 100644 0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch create mode 100644 0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch diff --git a/0006-libparted-Fix-fd-check-in-_flush_cache.patch b/0006-libparted-Fix-fd-check-in-_flush_cache.patch new file mode 100644 index 0000000..ab81467 --- /dev/null +++ b/0006-libparted-Fix-fd-check-in-_flush_cache.patch @@ -0,0 +1,26 @@ +From dacdfc20957d92eff7a3c9fd72baa849b45485e3 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:39:04 -0700 +Subject: [PATCH 06/13] libparted: Fix fd check in _flush_cache + +In theory open() could return 0 so the correct error value is -1. +--- + libparted/arch/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 94ea176..9dc90b5 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -1678,7 +1678,7 @@ _flush_cache (PedDevice* dev) + break; + if (!_partition_is_mounted_by_path (name)) { + fd = open (name, WR_MODE, 0); +- if (fd > 0) { ++ if (fd > -1) { + ioctl (fd, BLKFLSBUF); + retry: + if (fsync (fd) < 0 || close (fd) < 0) +-- +2.31.1 + diff --git a/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch b/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch new file mode 100644 index 0000000..4da211b --- /dev/null +++ b/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch @@ -0,0 +1,38 @@ +From 8e6976661409d7c87b1f0a80ebdddc450b4db2dd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:41:33 -0700 +Subject: [PATCH 07/13] libparted: Fix potential memory leak in + sdmmc_get_product_info + +--- + libparted/arch/linux.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 9dc90b5..aacc94f 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -1399,13 +1399,19 @@ static int + init_sdmmc (PedDevice* dev) + { + char id[128]; +- char *type, *name; ++ char *type = NULL; ++ char *name = NULL; + + if (sdmmc_get_product_info (dev, &type, &name)) { + snprintf (id, sizeof(id) - 1, "%s %s", type, name); + free (type); + free (name); + } else { ++ // One or the other may have been allocated, free it ++ if (type) ++ free(type); ++ if (name) ++ free(name); + snprintf (id, sizeof(id) - 1, "%s", + _("Generic SD/MMC Storage Card")); + } +-- +2.31.1 + diff --git a/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch b/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch new file mode 100644 index 0000000..3965a91 --- /dev/null +++ b/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch @@ -0,0 +1,34 @@ +From acb5300bfc37f8b8c217758e83a31b7ecca84f4a Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:45:57 -0700 +Subject: [PATCH 08/13] fs: Fix copy-paste error in HFS journal code + +--- + libparted/fs/r/hfs/journal.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libparted/fs/r/hfs/journal.c b/libparted/fs/r/hfs/journal.c +index 862d3d3..c7cd009 100644 +--- a/libparted/fs/r/hfs/journal.c ++++ b/libparted/fs/r/hfs/journal.c +@@ -337,12 +337,14 @@ hfsj_replay_journal(PedFileSystem* fs) + } + jh->checksum = HFS_CPU_TO_32(cksum, is_le); + +- /* The 2 following test are in the XNU Darwin source code */ +- /* so I assume they're needed */ ++ /* https://github.com/apple-opensource/hfs/blob/master/core/hfs_journal.c#L1167 ++ * indicates that this is: ++ * wrap the start ptr if it points to the very end of the journal ++ */ + if (jh->start == jh->size) + jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); + if (jh->end == jh->size) +- jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); ++ jh->end = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); + + if (jh->start == jh->end) + return 1; +-- +2.31.1 + diff --git a/0009-parted-Fix-end_input-leak-in-do_mkpart.patch b/0009-parted-Fix-end_input-leak-in-do_mkpart.patch new file mode 100644 index 0000000..9df39be --- /dev/null +++ b/0009-parted-Fix-end_input-leak-in-do_mkpart.patch @@ -0,0 +1,53 @@ +From 3a7f644f21703afcf7088a5994be1a6dff19f679 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:51:12 -0700 +Subject: [PATCH 09/13] parted: Fix end_input leak in do_mkpart + +--- + parted/parted.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 41edb7f..e9aa240 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -645,6 +645,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) + char* part_name = NULL; + char *start_usr = NULL, *end_usr = NULL; + char *start_sol = NULL, *end_sol = NULL; ++ char *end_input = NULL; + + if (*diskp) + disk = *diskp; +@@ -698,12 +699,10 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) + + if (!command_line_get_sector (_("Start?"), *dev, &start, &range_start, NULL)) + goto error; +- char *end_input; + if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) + goto error; + + _adjust_end_if_iec(&start, &end, range_end, end_input); +- free(end_input); + + /* processing starts here */ + part = ped_partition_new (disk, part_type, fs_type, start, end); +@@ -839,6 +838,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) + free (end_usr); + free (start_sol); + free (end_sol); ++ free(end_input); + + if ((*dev)->type != PED_DEVICE_FILE) + disk_is_modified = 1; +@@ -860,6 +860,7 @@ error: + free (end_usr); + free (start_sol); + free (end_sol); ++ free(end_input); + + return 0; + } +-- +2.31.1 + diff --git a/0010-parted-Free-tmp-usage-inside-do_print.patch b/0010-parted-Free-tmp-usage-inside-do_print.patch new file mode 100644 index 0000000..d243374 --- /dev/null +++ b/0010-parted-Free-tmp-usage-inside-do_print.patch @@ -0,0 +1,25 @@ +From fbd83d9df7bf5fd0c830935decb9bbc482bf95f4 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:52:28 -0700 +Subject: [PATCH 10/13] parted: Free tmp usage inside do_print + +str_list_create calls gettext_to_wchar which makes a copy of it. +--- + parted/parted.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/parted/parted.c b/parted/parted.c +index e9aa240..ba152c3 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1192,6 +1192,7 @@ do_print (PedDevice** dev, PedDisk** diskp) + sprintf (tmp, "%2s ", ""); + + StrList *row = str_list_create (tmp, NULL); ++ free(tmp); + + start = ped_unit_format (*dev, part->geom.start); + end = ped_unit_format_byte ( +-- +2.31.1 + diff --git a/0011-parted-Fix-memory-leaks-in-do_resizepart.patch b/0011-parted-Fix-memory-leaks-in-do_resizepart.patch new file mode 100644 index 0000000..24ef01f --- /dev/null +++ b/0011-parted-Fix-memory-leaks-in-do_resizepart.patch @@ -0,0 +1,43 @@ +From 6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 10 Jun 2021 15:55:59 -0700 +Subject: [PATCH 11/13] parted: Fix memory leaks in do_resizepart + +--- + parted/parted.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index ba152c3..22b5818 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1582,7 +1582,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + /* Push the End value back onto the command_line, if it exists */ + if (end_size) { + command_line_push_word(end_size); +- free(end_size); + } + + start = part->geom.start; +@@ -1590,7 +1589,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) + if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) + goto error; + _adjust_end_if_iec(&start, &end, range_end, end_input); +- free(end_input); ++ + /* Do not move start of the partition */ + constraint = constraint_from_start_end_fixed_start (*dev, start, range_end); + if (!ped_disk_set_partition_geom (disk, part, constraint, +@@ -1616,6 +1615,9 @@ error_destroy_constraint: + error: + if (range_end != NULL) + ped_geometry_destroy (range_end); ++ free(end_input); ++ free(end_size); ++ + return rc; + } + +-- +2.31.1 + diff --git a/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch b/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch new file mode 100644 index 0000000..b7cd8e3 --- /dev/null +++ b/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch @@ -0,0 +1,57 @@ +From 86594612f8ae4dbc416e3cd1bc8bb05445df09e5 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 11 Jun 2021 12:05:22 -0700 +Subject: [PATCH 12/13] libparted: Fix warning about buffer size in Atari label + +When the Atari table is empty it copies 'PARTEDATARI' into the id, and +the start and size bytes. This can be confusion, so turn it into a +union of the string and the non-empty values. +--- + libparted/labels/atari.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/libparted/labels/atari.c b/libparted/labels/atari.c +index 7923487..2ac03d2 100644 +--- a/libparted/labels/atari.c ++++ b/libparted/labels/atari.c +@@ -137,9 +137,14 @@ static AtariFS2PartId atr_fs2pid[] = { + + struct __attribute__ ((packed)) _AtariRawPartition { + uint8_t flag; /* bit 0: active; bit 7: bootable */ +- uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */ +- uint32_t start; /* start of partition */ +- uint32_t size; /* length of partition */ ++ union { ++ uint8_t empty[11]; /* Empty table */ ++ struct __attribute__ ((packed)) { ++ uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */ ++ uint32_t start; /* start of partition */ ++ uint32_t size; /* length of partition */ ++ }; ++ }; + }; + typedef struct _AtariRawPartition AtariRawPartition; + +@@ -241,8 +246,8 @@ static int + atr_is_signature_entry (AtariRawPartition* part) + { + return part->flag == 0 +- && !memcmp (part->id, SIGNATURE_EMPTY_TABLE, +- SIGNATURE_EMPTY_SIZE ); ++ && !memcmp (part->empty, SIGNATURE_EMPTY_TABLE, ++ SIGNATURE_EMPTY_SIZE ); + } + + /* Set Parted signature in an AHDI entry */ +@@ -250,7 +255,7 @@ static void + atr_put_signature_entry (AtariRawPartition* part) + { + part->flag = 0; +- memcpy (part->id, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE); ++ memcpy (part->empty, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE); + } + + #define atr_part_known(part, pid_list) (atr_pid_known ((part)->id, pid_list)) +-- +2.31.1 + diff --git a/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch b/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch new file mode 100644 index 0000000..1164a27 --- /dev/null +++ b/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch @@ -0,0 +1,44 @@ +From 16751493376db612abcceae5ae81fd798c0a4d18 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 11 Jun 2021 13:43:02 -0700 +Subject: [PATCH 13/13] libparted: Fix potential memory leak in gpt_write + +_generate_header() can return with 1 after allocating gpt so it needs to +be freed in the error path. +--- + libparted/labels/gpt.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 93f7add..9b987c1 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -1292,8 +1292,10 @@ gpt_write (const PedDisk *disk) + + /* Write PTH and PTEs */ + /* FIXME: Caution: this code is nearly identical to what's just below. */ +- if (_generate_header (disk, 0, ptes_crc, &gpt) != 0) +- goto error_free_ptes; ++ if (_generate_header (disk, 0, ptes_crc, &gpt) != 0) { ++ pth_free(gpt); ++ goto error_free_ptes; ++ } + pth_raw = pth_get_raw (disk->dev, gpt); + pth_free (gpt); + if (pth_raw == NULL) +@@ -1307,8 +1309,10 @@ gpt_write (const PedDisk *disk) + + /* Write Alternate PTH & PTEs */ + /* FIXME: Caution: this code is nearly identical to what's just above. */ +- if (_generate_header (disk, 1, ptes_crc, &gpt) != 0) +- goto error_free_ptes; ++ if (_generate_header (disk, 1, ptes_crc, &gpt) != 0) { ++ pth_free(gpt); ++ goto error_free_ptes; ++ } + pth_raw = pth_get_raw (disk->dev, gpt); + pth_free (gpt); + if (pth_raw == NULL) +-- +2.31.1 + diff --git a/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch b/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch new file mode 100644 index 0000000..cc4a682 --- /dev/null +++ b/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch @@ -0,0 +1,34 @@ +From f801496427db11cc468065dcd77d1c610c0a1047 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 14 Jun 2021 14:23:46 -0700 +Subject: [PATCH 14/15] tests: t0400 - Work around a mkswap bug by using + /dev/zero + +mkswap gets stuck, in some situations, when operating on a file full of +holes (see https://bugzilla.redhat.com/show_bug.cgi?id=1971877) so work +around that by using /dev/zero instead of /dev/null +--- + tests/t0400-loop-clobber-infloop.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tests/t0400-loop-clobber-infloop.sh b/tests/t0400-loop-clobber-infloop.sh +index 2d2190d..d05a8e0 100644 +--- a/tests/t0400-loop-clobber-infloop.sh ++++ b/tests/t0400-loop-clobber-infloop.sh +@@ -22,7 +22,12 @@ + + N=1M + dev=loop-file +-dd if=/dev/null of=$dev bs=1 seek=$N || fail=1 ++ ++cleanup_() { ++ rm -f $dev; ++} ++ ++dd if=/dev/zero of=$dev bs=$N count=1 || fail=1 + + mkswap $dev || fail=1 + +-- +2.31.1 + diff --git a/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch b/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch new file mode 100644 index 0000000..06e058e --- /dev/null +++ b/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch @@ -0,0 +1,46 @@ +From ea1a97b57d4e84005c66bc9c05f2e7c9244b5118 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 14 Jun 2021 15:04:05 -0700 +Subject: [PATCH 15/15] tests: t9050 Use /dev/zero for temporary file and + mkswap + +and clean up the usage a little bit by giving it a proper name and +removing the file when finished. +--- + tests/t9050-partition-table-types.sh | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/tests/t9050-partition-table-types.sh b/tests/t9050-partition-table-types.sh +index 57e004a..d63fa80 100755 +--- a/tests/t9050-partition-table-types.sh ++++ b/tests/t9050-partition-table-types.sh +@@ -35,16 +35,22 @@ pc98 + sun + mkswap + ' ++N=1M ++dev=loop-file + +-dd if=/dev/null of=f bs=1 seek=30M || framework_failure_ ++cleanup_() { ++ rm -f $dev; ++} ++ ++dd if=/dev/zero of=$dev bs=$N count=30 || framework_failure_ + + for i in $types; do + for j in $types; do + echo $i:$j +- case $i in mkswap) mkswap f || fail=1;; +- *) parted -s f mklabel $i || fail=1;; esac ++ case $i in mkswap) mkswap $dev || fail=1;; ++ *) parted -s $dev mklabel $i || fail=1;; esac + case $j in mkswap) continue;; esac +- parted -s f mklabel $j || fail=1 ++ parted -s $dev mklabel $j || fail=1 + done + done + +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 8682883..5a2bc89 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -19,6 +19,16 @@ Patch0002: 0002-doc-Document-fix-flag.patch Patch0003: 0003-tests-Add-tests-for-fix.patch Patch0004: 0004-tests-Fix-test-t1700-probe-fs.patch Patch0005: 0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch +Patch0006: 0006-libparted-Fix-fd-check-in-_flush_cache.patch +Patch0007: 0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch +Patch0008: 0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch +Patch0009: 0009-parted-Fix-end_input-leak-in-do_mkpart.patch +Patch0010: 0010-parted-Free-tmp-usage-inside-do_print.patch +Patch0011: 0011-parted-Fix-memory-leaks-in-do_resizepart.patch +Patch0012: 0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch +Patch0013: 0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch +Patch0014: 0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch +Patch0015: 0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -123,6 +133,12 @@ make check %changelog +* Mon Jun 14 2021 Brian C. Lane - 3.4-4 +- Fix issues that covscan classifies as important + Resolves: rhbz#1938836 +- Update gpg key for bcl@redhat.com +- Work around a mkswap bug + * Wed Mar 10 2021 Brian C. Lane - 3.4-3 - Use autoreconf -fiv for autoconf 2.71 support Works with both 2.69 and 2.71 diff --git a/pubkey.brian.lane b/pubkey.brian.lane index 04ef38a..210282c 100644 --- a/pubkey.brian.lane +++ b/pubkey.brian.lane @@ -7,13 +7,13 @@ PnOOItj7qbrCMASoBx1TG8Zdg8ufehMnfb85x4xxAebXkqJQpEVTjt4lj4p6BhrW R+pIW/nBUrz3OsV7WwPKjSLjJtTJFxYX+RFSCqOdfusuysoOxpIHOx1WxjGUOB5j fnhmq41nWXf8ozb58zSpjDrJ7jGQ9pdUpAtRABEBAAG0HkJyaWFuIEMuIExhbmUg PGJjbEByZWRoYXQuY29tPokBVAQTAQoAPgIbAwIeAQIXgAULCQgHAwUVCgkICwUW -AgMBABYhBLTGtFHk+otCMsoZHhF+jBaO/jp/BQJczi7GBQkTPx1TAAoJEBF+jBaO -/jp/rvMH/2l/2Welr7i/nupMQYh+f1sUQAtDulMUyy3kT2JIDvAPUPVH/JjuQ9DV -YTRd0A5593Y9fb7V3Gsqz+paG9ThGPyWdS8UmufU1XCeGktYJDkwLSwqrLs3p+HT -qE34B9aWU1nQXpWc0/rX/a7NrgWKTs6iVkwZ3bZ+pgwFf9bPHnCCVkn9TJtU2hhA -8vBZwOqzhSTbppXZrw+76rZK83q+2WS76zOlXrFEVAWn5DrQ+sCGTxkhPWA8zLAq -OAtJ14dwZCQGUHCWr7aFY2odIWCJnhukcFr0ot9pdnx9uy2DfAynd2Q/+tiaz1CL -qnc6THA8VNDyzi5EyeDNAE0meoIpK7eIRgQQEQIABgUCS37G6QAKCRAh+2P+lxLC +AgMBABYhBLTGtFHk+otCMsoZHhF+jBaO/jp/BQJglc7SBQkW+DzfAAoJEBF+jBaO +/jp/H4sH/A/92VVmfKssdC41fIO2iBIokLLfAAYzw75unKS84ovjeussUHqgDVCt +ZzXcHixo6oiYGgtyb5/EXTgEK6blZiUgsiWLFcFAo3tvCpMz9xa3XcaSw7MKwHCI +lmcdZalnQD47cu3E0CjFRoo9p3yueDYh3ZjMEzAFilGiZOBeoMwKxCofVqQCstp0 +0XZVMjAD/ZvhuNyXmqYykAcjORY2eVq92tOAdW6cAqv963hlDs6GRdYxBbx6Jorx +8bqpTQA9o/y3g6clt/oPmjAXtBPnHQFH6XlVIXodCPc5iuEe6gFmvL29JDARTkee +hIsqNbrPy11JQkD6EfC6vaWQ5G1DbsWIRgQQEQIABgUCS37G6QAKCRAh+2P+lxLC zbmrAJ9ENIweBGv/eRERFJAhU5vS+pzqQACfbUM8Bl4ayxWcznUVmIlnAkG1+f+J AhwEEAEKAAYFAlVhGI8ACgkQ0phFpw9QF94AEBAAj9g/cR2fv6ognKbd3noTz7zt 8unMKD33s4evHaLQCaeqZLa26RPg2LDlPBmUbyAT75KMqEnAo5Mm5cLTrQY0k3mF @@ -72,13 +72,13 @@ psjonaFP8jA3TqL0QK+yzBRKJnMnLEY1nWE1FtkMRccXvzi0Z/XQVhiWQyTvDFoK tepBFrH9UqWbNHyki22aighumUsW01pcPH2ogSj+HR01r7SfI/y2EkE6loHQfCDy cHmlqYV+X6GZEvf1qu2+EHEQChsHIAxWyshsxM/ZPmx/8e5S3Xmjl7h/6E9wcsIp vnf504sLX5j4Km9I5HgJSRxHxgRPpqJ2/XiClAJanO5gCw0RdQARAQABiQE8BBgB -CgAmAhsMFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAlzOLuYFCRM/HXMACgkQEX6M -Fo7+On8E9gf+JIm8+RBRhkKv++PMgf94UWOQo4Evro5kZZDl//M0M7TOSrZj1KVi -zfQaLWMAq+GQe74tOSQGVlRmPnrn69rpeKNcjy+YyRlDIvknG3fw+EgZUJ7BaNDn -an6nnKNzmUhxI+a2r1V/k1VjUq1cXGNgPEVcyu2Ph3V23zP7zsVrpN2YeTlr/jQB -r1EoGD6JlL0LftBusXUhBv0UhDjaLDCFGdx2dccGTZalQe9vikMQH2ahDfyXQzHc -yWztzh4xM44VBFLBpMwiuocu4yZZnz47FIbD3Oc3KKasa75Vgeh00HNdIItPwID2 -N1oNRAfiyazs6kUwmRHwpvS3JFkcaWhakJkBDQRLfsVzAQgApANWbXDuB+2VBv9G +CgAmAhsMFiEEtMa0UeT6i0IyyhkeEX6MFo7+On8FAmCVzrsFCRb4PMgACgkQEX6M +Fo7+On/svQgAnigeMeQPF3mDhjy88yNwL2cIdP8IPNU/lx70e5IJfL0cOWX8xX7n +n446Tj7KvACWLlFyhCNI3Wm9a2WMTsTKA8gG/WgDFgOONFN+2KyrCza1fgvzgv89 +ybovdksM5PGtS660O8SsMAIa7HUyObnTJHWJIUQxyzZrw9EQ6kX/JB1NHEX/zKfN +n5E0CPeBXfDYvNzUnBuJkTyBBk0zMF/k05RQ0FrA08SkF/YMAWWrzBbMQTnooSuP +7AHuVudX+P3XIqtVLL3S55HMag0hSA0aW0ghSFqiqabmvtLmJOHL7Ai3/FKCafou +SEd7AfZKfWLGgBslnLrcST5ytRNs4LI9KZkBDQRLfsVzAQgApANWbXDuB+2VBv9G i+EZWSKM7KK18xa60wLCRB73cvqxwh98UXBc+iDG3wjnVfqCsZQz+z0tL1in6scJ HpzlLreaPW99rg3RTFuCGxVxEPeALkkKUo6PD5VTJv+daZpkcXSc8j569GA9/JlS uqlBGCyP+M10oBZOPdxk/GOJtzdfDv/snj5zjiLY+6m6wjAEqAcdUxvGXYPLn3oT @@ -104,5 +104,5 @@ UH6H0kR9up567mQO3xy6Rw4NdiLwpGpBjofH8u69vkFMNXxWYwlscM70Ye3uCP6E TFYYdlnD+KHlXtaCKqu4vh9QEVV9lx6qx3Gh4gNcKYQwsGBtNi+QcGlR+cQZnIfQ yNDmEqwON6sW2LqKSrkBjwN18jK3kDSSTMXKAEIM4OTTayqD9jdoA+j6pJ3QF8m5 MupQVzWmw8NNbNuPfGmsE/s= -=a7qH +=Frrv -----END PGP PUBLIC KEY BLOCK----- From cabbcbc98341a50df4c8a38a48394c4f203cecc0 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 22 Jul 2021 17:45:34 +0000 Subject: [PATCH 20/60] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 5a2bc89..343bc11 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -133,6 +133,9 @@ make check %changelog +* Thu Jul 22 2021 Fedora Release Engineering - 3.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon Jun 14 2021 Brian C. Lane - 3.4-4 - Fix issues that covscan classifies as important Resolves: rhbz#1938836 From 1a6875dda151cd7b100a54992a6e2c02f2cf802a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 15 Jun 2021 09:41:44 -0700 Subject: [PATCH 21/60] spec: Install to /usr/sbin and /usr/lib64 parted has, forever, installed to /sbin and /lib64. There is no need to override this anymore. --- parted.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/parted.spec b/parted.spec index 343bc11..6c6f04f 100644 --- a/parted.spec +++ b/parted.spec @@ -1,6 +1,3 @@ -%define _sbindir /sbin -%define _libdir /%{_lib} - Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 From ce8126ec0022ec7931100a0db94f45590042b933 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 3 Aug 2021 15:43:24 -0700 Subject: [PATCH 22/60] - tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests (bcl) - tests/t3000: Check for hfs and vfat support separately (bcl) - tests: Reduce memory usage for tests using scsi_debug module (bcl) - spec: Install to /usr/sbin and /usr/lib64 (bcl) --- ...tests-t1100-Change-dev_size_mb-to-10.patch | 41 ++++++++++++++ ...tests-t1101-Change-dev_size_mb-to-10.patch | 40 ++++++++++++++ ...tests-t1102-Change-dev_size_mb-to-10.patch | 43 +++++++++++++++ ...tests-t1701-Change-dev_size_mb-to-10.patch | 36 +++++++++++++ ...ests-t3000-Change-dev_size_mb-to-267.patch | 32 +++++++++++ ...tests-t3200-Change-dev_size_mb-to-10.patch | 36 +++++++++++++ ...tests-t6006-Change-dev_size_mb-to-10.patch | 48 +++++++++++++++++ ...k-for-hfs-and-vfat-support-separatel.patch | 54 +++++++++++++++++++ ...mkfs.hfsplus-and-fsck.hfsplus-for-re.patch | 43 +++++++++++++++ parted.spec | 21 ++++++-- 10 files changed, 391 insertions(+), 3 deletions(-) create mode 100644 0016-tests-t1100-Change-dev_size_mb-to-10.patch create mode 100644 0017-tests-t1101-Change-dev_size_mb-to-10.patch create mode 100644 0018-tests-t1102-Change-dev_size_mb-to-10.patch create mode 100644 0019-tests-t1701-Change-dev_size_mb-to-10.patch create mode 100644 0020-tests-t3000-Change-dev_size_mb-to-267.patch create mode 100644 0021-tests-t3200-Change-dev_size_mb-to-10.patch create mode 100644 0022-tests-t6006-Change-dev_size_mb-to-10.patch create mode 100644 0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch create mode 100644 0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch diff --git a/0016-tests-t1100-Change-dev_size_mb-to-10.patch b/0016-tests-t1100-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..3e66727 --- /dev/null +++ b/0016-tests-t1100-Change-dev_size_mb-to-10.patch @@ -0,0 +1,41 @@ +From 4a053e111beacbeabeddc20c71d0215aedf219fb Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:26:36 -0700 +Subject: [PATCH 16/24] tests/t1100: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t1100-busy-label.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh +index f1a13df..71b847c 100755 +--- a/tests/t1100-busy-label.sh ++++ b/tests/t1100-busy-label.sh +@@ -21,11 +21,11 @@ require_root_ + require_scsi_debug_module_ + ss=$sector_size_ + +-scsi_debug_setup_ sector_size=$ss dev_size_mb=90 > dev-name || ++scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || + skip_ 'failed to create scsi_debug device' + dev=$(cat dev-name) + +-parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1 ++parted -s "$dev" mklabel msdos mkpart primary fat32 1 4 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + wait_for_dev_to_appear_ ${dev}1 || fail=1 + mkfs.vfat ${dev}1 || fail=1 +@@ -48,7 +48,7 @@ compare exp out || fail=1 + + # Adding a partition must succeed, even though another + # on this same device is mounted (active). +-parted -s "$dev" mkpart primary fat32 41 85 > out 2>&1 || fail=1 ++parted -s "$dev" mkpart primary fat32 5 10 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + parted -s "$dev" u s print + +-- +2.31.1 + diff --git a/0017-tests-t1101-Change-dev_size_mb-to-10.patch b/0017-tests-t1101-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..e01bdaa --- /dev/null +++ b/0017-tests-t1101-Change-dev_size_mb-to-10.patch @@ -0,0 +1,40 @@ +From f1c0f474670612b79a30d70863b4351c5883b5f6 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:27:30 -0700 +Subject: [PATCH 17/24] tests/t1101: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t1101-busy-partition.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh +index e35e6f0..5e37814 100755 +--- a/tests/t1101-busy-partition.sh ++++ b/tests/t1101-busy-partition.sh +@@ -24,7 +24,7 @@ require_root_ + require_scsi_debug_module_ + + # create memory-backed device +-scsi_debug_setup_ dev_size_mb=80 > dev-name || ++scsi_debug_setup_ dev_size_mb=10 > dev-name || + skip_ 'failed to create scsi_debug device' + dev=$(cat dev-name) + +@@ -37,10 +37,10 @@ parted -s "$dev" mklabel msdos > out 2>&1 || fail=1 + # expect no output + compare /dev/null out || fail=1 + +-parted -s "$dev" mkpart primary fat32 1 40 > out 2>&1 || fail=1 ++parted -s "$dev" mkpart primary fat32 1 4 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + +-parted -s "$dev" mkpart primary fat32 40 80 > out 2>&1 || fail=1 ++parted -s "$dev" mkpart primary fat32 4 10 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + # wait for new partition device to appear +-- +2.31.1 + diff --git a/0018-tests-t1102-Change-dev_size_mb-to-10.patch b/0018-tests-t1102-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..d47b442 --- /dev/null +++ b/0018-tests-t1102-Change-dev_size_mb-to-10.patch @@ -0,0 +1,43 @@ +From 29cf5841f7c046e149e3554a0f92a96169681bec Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:28:33 -0700 +Subject: [PATCH 18/24] tests/t1102: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t1102-loop-label.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/t1102-loop-label.sh b/tests/t1102-loop-label.sh +index 091227b..0a120b9 100644 +--- a/tests/t1102-loop-label.sh ++++ b/tests/t1102-loop-label.sh +@@ -23,7 +23,7 @@ require_root_ + require_scsi_debug_module_ + ss=$sector_size_ + +-scsi_debug_setup_ sector_size=$ss dev_size_mb=90 > dev-name || ++scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || + skip_ 'failed to create scsi_debug device' + dev=$(cat dev-name) + +@@ -31,13 +31,13 @@ mke2fs -F $dev + parted -s "$dev" print > out 2>&1 || fail=1 + cat < exp + Model: Linux scsi_debug (scsi) +-Disk DEVICE: 94.4MB ++Disk DEVICE: 10.5MB + Sector size (logical/physical): ${ss}B/${ss}B + Partition Table: loop + Disk Flags: + + Number Start End Size File system Flags +- 1 0.00B 94.4MB 94.4MB ext2 ++ 1 0.00B 10.5MB 10.5MB ext2 + + EOF + mv out o2 && sed -e "s,$dev,DEVICE,;s/ *$//" o2 > out +-- +2.31.1 + diff --git a/0019-tests-t1701-Change-dev_size_mb-to-10.patch b/0019-tests-t1701-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..5c20d02 --- /dev/null +++ b/0019-tests-t1701-Change-dev_size_mb-to-10.patch @@ -0,0 +1,36 @@ +From 843a800098705c71698dabb3c2e549912b17606a Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:29:03 -0700 +Subject: [PATCH 19/24] tests/t1701: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t1701-rescue-fs.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/t1701-rescue-fs.sh b/tests/t1701-rescue-fs.sh +index 050c064..71d545d 100644 +--- a/tests/t1701-rescue-fs.sh ++++ b/tests/t1701-rescue-fs.sh +@@ -22,7 +22,7 @@ require_root_ + require_scsi_debug_module_ + + # create memory-backed device +-scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=32 > dev-name || ++scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=10 > dev-name || + skip_ 'failed to create scsi_debug device' + scsi_dev=$(cat dev-name) + +@@ -39,7 +39,7 @@ parted -s $scsi_dev rm 1 || fail=1 + # rescue the partition + echo yes | parted ---pretend-input-tty $scsi_dev rescue 1m 100% > out 2>&1 + cat > exp < 33.6MB. Do you want to add it to the partition table? ++Information: A ext4 primary partition was found at 1049kB -> 10.5MB. Do you want to add it to the partition table? + Yes/No/Cancel? yes + Information: You may need to update /etc/fstab. + EOF +-- +2.31.1 + diff --git a/0020-tests-t3000-Change-dev_size_mb-to-267.patch b/0020-tests-t3000-Change-dev_size_mb-to-267.patch new file mode 100644 index 0000000..4a1f35d --- /dev/null +++ b/0020-tests-t3000-Change-dev_size_mb-to-267.patch @@ -0,0 +1,32 @@ +From e72dc01c85fb6baa8e065660bda6ec92e21bee49 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:29:29 -0700 +Subject: [PATCH 20/24] tests/t3000: Change dev_size_mb to 267 + +FAT32 needs a minimum partition size of 256MB so this is as small as we +can make it. + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t3000-resize-fs.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh +index 64b038d..1f2e46e 100755 +--- a/tests/t3000-resize-fs.sh ++++ b/tests/t3000-resize-fs.sh +@@ -29,8 +29,8 @@ start=63s + default_end=546147s + new_end=530144s + +-# create memory-backed device +-scsi_debug_setup_ dev_size_mb=550 > dev-name || ++# create memory-backed device. Must be > 256MB+8MB ++scsi_debug_setup_ dev_size_mb=267 > dev-name || + skip_ 'failed to create scsi_debug device' + dev=$(cat dev-name) + +-- +2.31.1 + diff --git a/0021-tests-t3200-Change-dev_size_mb-to-10.patch b/0021-tests-t3200-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..415c9f4 --- /dev/null +++ b/0021-tests-t3200-Change-dev_size_mb-to-10.patch @@ -0,0 +1,36 @@ +From 18556277b93ebb7dd88da5d4928189386c0eb132 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:29:59 -0700 +Subject: [PATCH 21/24] tests/t3200: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t3200-type-change.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh +index 39904e0..3ad8604 100755 +--- a/tests/t3200-type-change.sh ++++ b/tests/t3200-type-change.sh +@@ -25,7 +25,7 @@ grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || + skip_ 'this system lacks a new-enough libblkid' + + # create memory-backed device +-scsi_debug_setup_ dev_size_mb=550 > dev-name || ++scsi_debug_setup_ dev_size_mb=10 > dev-name || + skip_ 'failed to create scsi_debug device' + scsi_dev=$(cat dev-name) + +@@ -34,7 +34,7 @@ scsi_dev=$(cat dev-name) + # partition and ensure that parted doesn't "helpfully" change the partition + # type to match the newly-detected FS type. + +-parted -s $scsi_dev mklabel msdos mkpart primary fat32 64s 80000s || fail=1 ++parted -s $scsi_dev mklabel msdos mkpart primary fat32 1MiB 100% || fail=1 + + parted -s $scsi_dev u s p + +-- +2.31.1 + diff --git a/0022-tests-t6006-Change-dev_size_mb-to-10.patch b/0022-tests-t6006-Change-dev_size_mb-to-10.patch new file mode 100644 index 0000000..909bbe6 --- /dev/null +++ b/0022-tests-t6006-Change-dev_size_mb-to-10.patch @@ -0,0 +1,48 @@ +From 0caf2d7f1363b9c4b3b63cf7d3a1260eb5a72f34 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 12 Jul 2021 15:30:45 -0700 +Subject: [PATCH 22/24] tests/t6006: Change dev_size_mb to 10 + +This is backed by memory, so using more than is needed limits the size +of the system it can run on. +--- + tests/t6006-dm-512b-sectors.sh | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh +index 2460c49..83bf3b1 100644 +--- a/tests/t6006-dm-512b-sectors.sh ++++ b/tests/t6006-dm-512b-sectors.sh +@@ -46,9 +46,9 @@ cleanup_fn_() { + udevadm settle + } + +-# Create a 500M device ++# Create a 10M device + ss=$sector_size_ +-scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name || ++scsi_debug_setup_ sector_size=$ss dev_size_mb=11 > dev-name || + skip_ 'failed to create scsi_debug device' + scsi_dev=$(cat dev-name) + +@@ -58,13 +58,13 @@ scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure + dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure + dev="/dev/mapper/$linear_" + +-# Create msdos partition table with a partition from 1MiB to 100MiB +-parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 ++# Create msdos partition table with a partition from 1MiB to 10MiB ++parted -s $dev mklabel msdos mkpart primary ext2 1MiB 100% > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + wait_for_dev_to_appear_ ${dev}1 || fail=1 + +-# The size of the partition should be 100MiB, or 204800 512b sectors ++# The size of the partition should be 10MiB, or 20480 512b sectors + p1_size=$(blockdev --getsz ${dev}1) || framework_failure +-[ $p1_size == 204800 ] || fail=1 ++[ $p1_size == 20480 ] || fail=1 + + Exit $fail +-- +2.31.1 + diff --git a/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch b/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch new file mode 100644 index 0000000..751a5ed --- /dev/null +++ b/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch @@ -0,0 +1,54 @@ +From 262a9242f5ad121ddcb42edaacadbc2e6a650333 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 15 Jul 2021 08:27:00 -0700 +Subject: [PATCH 23/24] tests/t3000: Check for hfs and vfat support separately + +Previously the whole test would be skipped if either mkfs.hfs or +mkfs.vfat were not installed, leading to missing test coverage. This +change checks for them individually so that the test will run with +either or both of them installed +--- + 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 1f2e46e..282b6fc 100755 +--- a/tests/t3000-resize-fs.sh ++++ b/tests/t3000-resize-fs.sh +@@ -17,12 +17,22 @@ + # along with this program. If not, see . + + . "${srcdir=.}/init.sh"; path_prepend_ ../parted . +-require_hfs_ +-require_fat_ + require_root_ + require_scsi_debug_module_ + require_512_byte_sector_size_ + ++ ++FSTYPES="" ++ ++# Is mkfs.hfs available? ++mkfs.hfs 2>&1 | grep '^usage:' && FSTYPES="hfs+" ++ ++# Is mkfs.vfat available? ++mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16" ++ ++[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfs nor mkfs.vfat installed" ++ ++ + ss=$sector_size_ + + start=63s +@@ -53,7 +63,7 @@ mkdir "$mount_point" || fail=1 + # be sure to unmount upon interrupt, failure, etc. + cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } + +-for fs_type in hfs+ fat32 fat16; do ++for fs_type in $FSTYPES; do + echo "fs_type=$fs_type" + + # create an empty $fs_type partition, cylinder aligned, size > 256 MB +-- +2.31.1 + diff --git a/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch b/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch new file mode 100644 index 0000000..0892734 --- /dev/null +++ b/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch @@ -0,0 +1,43 @@ +From 964bc37f6c95308a64aa96534b29412ce55835fd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 29 Jul 2021 11:19:15 -0700 +Subject: [PATCH 24/24] tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for + resize tests + +--- + tests/t3000-resize-fs.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh +index 282b6fc..cf46c81 100755 +--- a/tests/t3000-resize-fs.sh ++++ b/tests/t3000-resize-fs.sh +@@ -24,13 +24,13 @@ require_512_byte_sector_size_ + + FSTYPES="" + +-# Is mkfs.hfs available? +-mkfs.hfs 2>&1 | grep '^usage:' && FSTYPES="hfs+" ++# Is mkfs.hfsplus available? ++mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+" + + # Is mkfs.vfat available? + mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16" + +-[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfs nor mkfs.vfat installed" ++[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfsplus nor mkfs.vfat installed" + + + ss=$sector_size_ +@@ -79,7 +79,7 @@ for fs_type in $FSTYPES; do + 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;; ++ hfs*) mkfs_cmd='mkfs.hfsplus'; fsck=fsck.hfsplus;; + *) error "internal error: unhandled fs type: $fs_type";; + esac + +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 6c6f04f..09551fb 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -26,6 +26,15 @@ Patch0012: 0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch Patch0013: 0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch Patch0014: 0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch Patch0015: 0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch +Patch0016: 0016-tests-t1100-Change-dev_size_mb-to-10.patch +Patch0017: 0017-tests-t1101-Change-dev_size_mb-to-10.patch +Patch0018: 0018-tests-t1102-Change-dev_size_mb-to-10.patch +Patch0019: 0019-tests-t1701-Change-dev_size_mb-to-10.patch +Patch0020: 0020-tests-t3000-Change-dev_size_mb-to-267.patch +Patch0021: 0021-tests-t3200-Change-dev_size_mb-to-10.patch +Patch0022: 0022-tests-t6006-Change-dev_size_mb-to-10.patch +Patch0023: 0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch +Patch0024: 0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -74,9 +83,8 @@ Parted library, you need to install this package. %prep +%{gpgverify} --keyring='%{SOURCE3}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %autosetup -S git_am -gpg2 --import %{SOURCE2} %{SOURCE3} -gpg2 --verify %{SOURCE1} %{SOURCE0} iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS %build @@ -130,6 +138,13 @@ make check %changelog +* Tue Aug 03 2021 Brian C. Lane - 3.4-6 +- spec: Use the %%gpgverify macro for the signature check +- tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests (bcl) +- tests/t3000: Check for hfs and vfat support separately (bcl) +- tests: Reduce memory usage for tests using scsi_debug module (bcl) +- spec: Install to /usr/sbin and /usr/lib64 (bcl) + * Thu Jul 22 2021 Fedora Release Engineering - 3.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From e7b34705b0f75febf7e7486b095ce13ed7a49a94 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 10 Aug 2021 16:24:56 -0700 Subject: [PATCH 23/60] - libparted: Tell libdevmapper to retry remove when BUSY (bcl) - Resolves: rhbz#1980697 - parted: Escape colons and backslashes in machine output (bcl) - tests: check for vfat kernel support and tools (ross.burton) - tests: add a helper to check the kernel knows about a file system (ross.burton) - tests: add aarch64 and mips64 as a valid 64-bit machines (ross.burton) - libparted: Add swap flag to msdos disklabel (bcl) - Move Exception Option values into enum (bcl) --- ...ve-Exception-Option-values-into-enum.patch | 77 ++++++++++ ...ted-Add-swap-flag-to-msdos-disklabel.patch | 133 ++++++++++++++++++ ...4-and-mips64-as-a-valid-64-bit-machi.patch | 31 ++++ ...er-to-check-the-kernel-knows-about-a.patch | 43 ++++++ ...ck-for-vfat-kernel-support-and-tools.patch | 46 ++++++ ...lons-and-backslashes-in-machine-outp.patch | 91 ++++++++++++ ...ibdevmapper-to-retry-remove-when-BUS.patch | 32 +++++ parted.spec | 20 ++- 8 files changed, 472 insertions(+), 1 deletion(-) create mode 100644 0025-Move-Exception-Option-values-into-enum.patch create mode 100644 0026-libparted-Add-swap-flag-to-msdos-disklabel.patch create mode 100644 0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch create mode 100644 0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch create mode 100644 0029-tests-check-for-vfat-kernel-support-and-tools.patch create mode 100644 0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch create mode 100644 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch diff --git a/0025-Move-Exception-Option-values-into-enum.patch b/0025-Move-Exception-Option-values-into-enum.patch new file mode 100644 index 0000000..44d5310 --- /dev/null +++ b/0025-Move-Exception-Option-values-into-enum.patch @@ -0,0 +1,77 @@ +From fabd4e35427ab156d1e0b28745c926d0253a72cd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Aug 2021 09:40:28 -0700 +Subject: [PATCH 25/30] Move Exception Option values into enum +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Adding enums together doesn't create a new enum value, so when compiling +with warnings you will get warnings like: + +warning: case value ‘96’ not in enumerated type + +for PED_EXCEPTION_IGNORE_CANCEL + +This moved the defines into the enum as new values so that they are +recognized as valid members of the enum with the values staying the +same. + +NOTE: PED_EXCEPTION_OPTION_LAST *MUST* be the last of the individual +options, not the combined options. + +Thanks to D. Hugh Redelmeier for this patch. +--- + include/parted/exception.in.h | 27 ++++++++++++++++----------- + 1 file changed, 16 insertions(+), 11 deletions(-) + +diff --git a/include/parted/exception.in.h b/include/parted/exception.in.h +index 20abb08..3b131fe 100644 +--- a/include/parted/exception.in.h ++++ b/include/parted/exception.in.h +@@ -46,6 +46,7 @@ typedef enum _PedExceptionType PedExceptionType; + * Option for resolving the exception + */ + enum _PedExceptionOption { ++ /* individual options */ + PED_EXCEPTION_UNHANDLED=0, + PED_EXCEPTION_FIX=1, + PED_EXCEPTION_YES=2, +@@ -54,19 +55,23 @@ enum _PedExceptionOption { + PED_EXCEPTION_RETRY=16, + PED_EXCEPTION_IGNORE=32, + PED_EXCEPTION_CANCEL=64, ++ ++ /* combinations of individual options */ ++ PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL, ++ PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO, ++ PED_EXCEPTION_YES_NO_CANCEL = ++ PED_EXCEPTION_YES_NO + PED_EXCEPTION_CANCEL, ++ PED_EXCEPTION_IGNORE_CANCEL = ++ PED_EXCEPTION_IGNORE + PED_EXCEPTION_CANCEL, ++ PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL, ++ PED_EXCEPTION_RETRY_IGNORE_CANCEL = ++ PED_EXCEPTION_RETRY + PED_EXCEPTION_IGNORE_CANCEL, + }; +-typedef enum _PedExceptionOption PedExceptionOption; +-#define PED_EXCEPTION_OK_CANCEL (PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL) +-#define PED_EXCEPTION_YES_NO (PED_EXCEPTION_YES + PED_EXCEPTION_NO) +-#define PED_EXCEPTION_YES_NO_CANCEL (PED_EXCEPTION_YES_NO \ +- + PED_EXCEPTION_CANCEL) +-#define PED_EXCEPTION_IGNORE_CANCEL (PED_EXCEPTION_IGNORE \ +- + PED_EXCEPTION_CANCEL) +-#define PED_EXCEPTION_RETRY_CANCEL (PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL) +-#define PED_EXCEPTION_RETRY_IGNORE_CANCEL (PED_EXCEPTION_RETRY \ +- + PED_EXCEPTION_IGNORE_CANCEL) ++ + #define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX +-#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL ++#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL /* last individual option */ ++ ++typedef enum _PedExceptionOption PedExceptionOption; + + /** + * Structure with information about exception +-- +2.31.1 + diff --git a/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch b/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch new file mode 100644 index 0000000..4f0c713 --- /dev/null +++ b/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch @@ -0,0 +1,133 @@ +From f8dd8c2c255a3c5c398a62ffdc1bcf5468becccd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Aug 2021 13:14:26 -0700 +Subject: [PATCH 26/30] libparted: Add swap flag to msdos disklabel + +Previously you had to set the filesystem type to one of the linux-swap +options at creation time. With this change you can now toggle the +partition swap type using the 'swap' partition flag in the same way that +you can on gpt disklabels. + +Thanks to Arvin Schnell for this patch. +--- + doc/parted.texi | 4 ++-- + libparted/labels/dos.c | 24 ++++++++++++++++++++++-- + 2 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/doc/parted.texi b/doc/parted.texi +index 33212f0..0da68e9 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -897,8 +897,8 @@ MS Windows ME based operating systems to use Linear (LBA) mode. + to be used by Linux. + + @item swap +-(Mac) - this flag should be enabled if the partition is the swap +-device to be used by Linux. ++(MS-DOS, GPT, Mac) - this flag should be enabled if the partition is the ++swap device to be used by Linux. + + @item hidden + (MS-DOS, PC98) - this flag can be enabled to hide partitions from +diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c +index e2aa5e0..b44ccaf 100644 +--- a/libparted/labels/dos.c ++++ b/libparted/labels/dos.c +@@ -160,6 +160,7 @@ typedef struct { + int msftres; + int raid; + int lvm; ++ int swap; + int lba; + int palo; + int prep; +@@ -958,6 +959,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, + dos_data->raid = raw_part->type == PARTITION_LINUX_RAID; + dos_data->lvm = raw_part->type == PARTITION_LINUX_LVM_OLD + || raw_part->type == PARTITION_LINUX_LVM; ++ dos_data->swap = raw_part->type == PARTITION_LINUX_SWAP; + dos_data->lba = raw_part_is_lba (raw_part); + dos_data->palo = raw_part->type == PARTITION_PALO; + dos_data->prep = raw_part->type == PARTITION_PREP; +@@ -1380,6 +1382,7 @@ msdos_partition_duplicate (const PedPartition* part) + new_dos_data->msftres = old_dos_data->msftres; + new_dos_data->raid = old_dos_data->raid; + new_dos_data->lvm = old_dos_data->lvm; ++ new_dos_data->swap = old_dos_data->swap; + new_dos_data->lba = old_dos_data->lba; + new_dos_data->palo = old_dos_data->palo; + new_dos_data->prep = old_dos_data->prep; +@@ -1437,6 +1440,7 @@ msdos_partition_set_system (PedPartition* part, + dos_data->diag = 0; + dos_data->raid = 0; + dos_data->lvm = 0; ++ dos_data->swap = 0; + dos_data->palo = 0; + dos_data->prep = 0; + dos_data->irst = 0; +@@ -1464,6 +1468,10 @@ msdos_partition_set_system (PedPartition* part, + dos_data->system = PARTITION_LINUX_LVM; + return 1; + } ++ if (dos_data->swap) { ++ dos_data->system = PARTITION_LINUX_SWAP; ++ return 1; ++ } + if (dos_data->raid) { + dos_data->system = PARTITION_LINUX_RAID; + return 1; +@@ -1510,9 +1518,10 @@ msdos_partition_set_system (PedPartition* part, + dos_data->system = PARTITION_UDF; + else if (!strcmp (fs_type->name, "sun-ufs")) + dos_data->system = PARTITION_SUN_UFS; +- else if (is_linux_swap (fs_type->name)) ++ else if (is_linux_swap (fs_type->name)) { + dos_data->system = PARTITION_LINUX_SWAP; +- else ++ dos_data->swap = 1; ++ } else + dos_data->system = PARTITION_LINUX; + + return 1; +@@ -1525,6 +1534,7 @@ clear_flags (DosPartitionData *dos_data) + dos_data->hidden = 0; + dos_data->msftres = 0; + dos_data->lvm = 0; ++ dos_data->swap = 0; + dos_data->palo = 0; + dos_data->prep = 0; + dos_data->irst = 0; +@@ -1604,6 +1614,12 @@ msdos_partition_set_flag (PedPartition* part, + dos_data->lvm = state; + return ped_partition_set_system (part, part->fs_type); + ++ case PED_PARTITION_SWAP: ++ if (state) ++ clear_flags (dos_data); ++ dos_data->swap = state; ++ return ped_partition_set_system (part, part->fs_type); ++ + case PED_PARTITION_LBA: + dos_data->lba = state; + return ped_partition_set_system (part, part->fs_type); +@@ -1677,6 +1693,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) + case PED_PARTITION_LVM: + return dos_data->lvm; + ++ case PED_PARTITION_SWAP: ++ return dos_data->swap; ++ + case PED_PARTITION_LBA: + return dos_data->lba; + +@@ -1720,6 +1739,7 @@ msdos_partition_is_flag_available (const PedPartition* part, + case PED_PARTITION_BOOT: + case PED_PARTITION_RAID: + case PED_PARTITION_LVM: ++ case PED_PARTITION_SWAP: + case PED_PARTITION_LBA: + case PED_PARTITION_PALO: + case PED_PARTITION_PREP: +-- +2.31.1 + diff --git a/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch b/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch new file mode 100644 index 0000000..a75a1a9 --- /dev/null +++ b/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch @@ -0,0 +1,31 @@ +From b5e17a613d2ea9894fcc090499dcc73e3ea07f61 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 9 Aug 2021 15:25:50 +0100 +Subject: [PATCH 27/30] tests: add aarch64 and mips64 as a valid 64-bit + machines + +require_64_bit_ in t-lib-helpers.sh has a hard-coded list of uname +machines that are 64-bit, so add aarch64 and mips64 to cover the major +architectures. + +Signed-off-by: Brian C. Lane +--- + tests/t-lib-helpers.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh +index 9312343..dddb44e 100644 +--- a/tests/t-lib-helpers.sh ++++ b/tests/t-lib-helpers.sh +@@ -411,7 +411,7 @@ device_mapper_required_() + require_64bit_() + { + case $(uname -m) in +- x86_64|ppc64) ++ aarch64|mips64|ppc64|x86_64) + return 0;; + *) + skip_ "This test requires a 64 bit system" +-- +2.31.1 + diff --git a/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch b/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch new file mode 100644 index 0000000..c12abc1 --- /dev/null +++ b/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch @@ -0,0 +1,43 @@ +From 8e97e5f7ad7cc8a1e6233306a45fcdbf08c959bd Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 9 Aug 2021 15:25:51 +0100 +Subject: [PATCH 28/30] tests: add a helper to check the kernel knows about a + file system + +Some tests need both the file system tools (eg mkfs.vfat) and kernel +support (eg vfat kernel module) to pass. + +There are already helpers such as require_fat_ which check for mkfs.vfat, +but if the kernel doesn't support the filesystem then mounting the disk +image will fail. + +Add require_filesystem_, which checks for either the filesystem name in +/proc/filesystems (so it's built-in, or already loaded) or if the name +is a valid module (so can be loaded on demand). + +Signed-off-by: Brian C. Lane +--- + tests/t-lib-helpers.sh | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh +index dddb44e..33151bb 100644 +--- a/tests/t-lib-helpers.sh ++++ b/tests/t-lib-helpers.sh +@@ -418,3 +418,13 @@ require_64bit_() + ;; + esac + } ++ ++# Check if the specified filesystem is either built into the kernel, or can be loaded ++# as a module ++# Usage: has_filesystem vfat ++# Ruturns 0 if the filesystem is available, otherwise skips the test ++require_filesystem_() ++{ ++ grep -q $1 /proc/filesystems && return 0 ++ modprobe --quiet --dry-run $1 || skip_ "this test requires kernel support for $1" ++} +-- +2.31.1 + diff --git a/0029-tests-check-for-vfat-kernel-support-and-tools.patch b/0029-tests-check-for-vfat-kernel-support-and-tools.patch new file mode 100644 index 0000000..80b6c33 --- /dev/null +++ b/0029-tests-check-for-vfat-kernel-support-and-tools.patch @@ -0,0 +1,46 @@ +From 231a1e1d3ab525272b44bd20f703f9253fd1ed5c Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Mon, 9 Aug 2021 15:25:52 +0100 +Subject: [PATCH 29/30] tests: check for vfat kernel support and tools + +t1100-busy-label.sh and t1101-busy-partition.sh create and mount VFAT +partitions, so check for both the tools and the kernel support. + +Fixes bug#49594. + +Signed-off-by: Brian C. Lane +--- + tests/t1100-busy-label.sh | 3 +++ + tests/t1101-busy-partition.sh | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh +index 71b847c..a77a70f 100755 +--- a/tests/t1100-busy-label.sh ++++ b/tests/t1100-busy-label.sh +@@ -19,6 +19,9 @@ + . "${srcdir=.}/init.sh"; path_prepend_ ../parted + require_root_ + require_scsi_debug_module_ ++require_fat_ ++require_filesystem_ vfat ++ + ss=$sector_size_ + + scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || +diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh +index 5e37814..c936718 100755 +--- a/tests/t1101-busy-partition.sh ++++ b/tests/t1101-busy-partition.sh +@@ -22,6 +22,8 @@ test "$VERBOSE" = yes && parted --version + + require_root_ + require_scsi_debug_module_ ++require_fat_ ++require_filesystem_ vfat + + # create memory-backed device + scsi_debug_setup_ dev_size_mb=10 > dev-name || +-- +2.31.1 + diff --git a/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch b/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch new file mode 100644 index 0000000..0a7f8e1 --- /dev/null +++ b/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch @@ -0,0 +1,91 @@ +From 33f7bb2f9967856afac2411831ef16dcf95746ab Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 Aug 2021 15:49:48 -0700 +Subject: [PATCH 30/30] parted: Escape colons and backslashes in machine output + +The device path, device model, and partition name could all contain +colons or backslashes. This escapes all of these with a backslash. + +Thanks to Arvin Schnell for the patch. +--- + parted/parted.c | 42 ++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 38 insertions(+), 4 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 22b5818..65b5ab2 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -985,6 +985,32 @@ _print_disk_geometry (const PedDevice *dev) + free (cyl_size); + } + ++static char * ++_escape_machine_string (const char *str) ++{ ++ size_t i, j; ++ char *dest; ++ ++ dest = ped_malloc (2 * strlen(str) + 1); ++ if (!dest) ++ return NULL; ++ ++ for (i = 0, j = 0; str[i] != '\0'; i++, j++) { ++ switch (str[i]) { ++ case ':': ++ case '\\': ++ dest[j++] = '\\'; ++ /* fallthrough */ ++ default: ++ dest[j] = str[i]; ++ break; ++ } ++ } ++ dest[j] = '\0'; ++ ++ return dest; ++} ++ + static void + _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + { +@@ -1005,6 +1031,9 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + char *disk_flags = disk_print_flags (diskp); + + if (opt_machine_mode) { ++ char *escaped_path = _escape_machine_string (dev->path); ++ char *escaped_model = _escape_machine_string (dev->model); ++ + switch (default_unit) { + case PED_UNIT_CHS: puts ("CHS;"); + break; +@@ -1015,9 +1044,11 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + + } + printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n", +- dev->path, end, transport[dev->type], ++ escaped_path, end, transport[dev->type], + dev->sector_size, dev->phys_sector_size, +- pt_name, dev->model, disk_flags); ++ pt_name, escaped_model, disk_flags); ++ free (escaped_path); ++ free (escaped_model); + } else { + printf (_("Model: %s (%s)\n"), + dev->model, transport[dev->type]); +@@ -1289,8 +1320,11 @@ do_print (PedDevice** dev, PedDisk** diskp) + putchar (':'); + + if (has_name) +- printf ("%s:", ped_partition_get_name (part)); +- else ++ { ++ char *escaped_name = _escape_machine_string (ped_partition_get_name (part)); ++ printf ("%s:", escaped_name); ++ free (escaped_name); ++ } else + putchar (':'); + + char *flags = partition_print_flags (part); +-- +2.31.1 + diff --git a/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch b/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch new file mode 100644 index 0000000..b640be6 --- /dev/null +++ b/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch @@ -0,0 +1,32 @@ +From 9e194581edf31ddd2474e7be5393578542b4ef8d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 9 Jul 2021 10:54:51 -0700 +Subject: [PATCH] libparted: Tell libdevmapper to retry remove when BUSY + +This sets the libdevmapper retry remove flag, which will retry a remove +command if it is BUSY. + +parted already has it's own BUSY retry code, but when run with +device-mapper an error can be printed by libdevmapper which can be +confusing to the user. + +Resolves: rhbz#1980697 +--- + libparted/arch/linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index aacc94f..758d36a 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2855,6 +2855,7 @@ _dm_remove_partition(PedDisk* disk, int partno) + if (!task) + goto err; + dm_task_set_name (task, part_name); ++ dm_task_retry_remove(task); + if (!dm_task_set_cookie (task, &cookie, 0)) + goto err; + rc = _dm_task_run_wait (task, cookie); +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 09551fb..3813d29 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -35,6 +35,14 @@ Patch0021: 0021-tests-t3200-Change-dev_size_mb-to-10.patch Patch0022: 0022-tests-t6006-Change-dev_size_mb-to-10.patch Patch0023: 0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch Patch0024: 0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch +Patch0025: 0025-Move-Exception-Option-values-into-enum.patch +Patch0026: 0026-libparted-Add-swap-flag-to-msdos-disklabel.patch +Patch0027: 0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch +Patch0028: 0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch +Patch0029: 0029-tests-check-for-vfat-kernel-support-and-tools.patch +Patch0030: 0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch +# Fixes rhbz#1980697 but not yet upstream +Patch0031: 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -138,6 +146,16 @@ make check %changelog +* Tue Aug 10 2021 Brian C. Lane - 3.4-7 +- libparted: Tell libdevmapper to retry remove when BUSY (bcl) + Resolves: rhbz#1980697 +- parted: Escape colons and backslashes in machine output (bcl) +- tests: check for vfat kernel support and tools (ross.burton) +- tests: add a helper to check the kernel knows about a file system (ross.burton) +- tests: add aarch64 and mips64 as a valid 64-bit machines (ross.burton) +- libparted: Add swap flag to msdos disklabel (bcl) +- Move Exception Option values into enum (bcl) + * Tue Aug 03 2021 Brian C. Lane - 3.4-6 - spec: Use the %%gpgverify macro for the signature check - tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests (bcl) From 152bd148e9e8fce7226de7dd6553eff98832052a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 25 Aug 2021 15:36:37 -0700 Subject: [PATCH 24/60] - parted: Add --json cmdline switch to output JSON (aschnell) - parted: Allow empty string for partition name (aschnell) - libparted: Check devpath before passing to strlen (bcl) --- ...eck-devpath-before-passing-to-strlen.patch | 26 + ...llow-empty-string-for-partition-name.patch | 125 +++ ...d-json-cmdline-switch-to-output-JSON.patch | 917 ++++++++++++++++++ parted.spec | 11 +- 4 files changed, 1077 insertions(+), 2 deletions(-) create mode 100644 0032-libparted-Check-devpath-before-passing-to-strlen.patch create mode 100644 0033-parted-Allow-empty-string-for-partition-name.patch create mode 100644 0034-parted-Add-json-cmdline-switch-to-output-JSON.patch diff --git a/0032-libparted-Check-devpath-before-passing-to-strlen.patch b/0032-libparted-Check-devpath-before-passing-to-strlen.patch new file mode 100644 index 0000000..c48f653 --- /dev/null +++ b/0032-libparted-Check-devpath-before-passing-to-strlen.patch @@ -0,0 +1,26 @@ +From 74636ce7f34081e92c5680f34588217978306488 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 19 Aug 2021 13:56:31 -0700 +Subject: [PATCH 32/34] libparted: Check devpath before passing to strlen + +--- + libparted/arch/linux.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 758d36a..430d02e 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2453,6 +2453,9 @@ _device_get_part_path (PedDevice const *dev, int num) + #else + devpath = dev->path; + #endif ++ if (!devpath) ++ return NULL; ++ + path_len = strlen (devpath); + /* Check for devfs-style /disc => /partN transformation + unconditionally; the system might be using udev with devfs rules, +-- +2.31.1 + diff --git a/0033-parted-Allow-empty-string-for-partition-name.patch b/0033-parted-Allow-empty-string-for-partition-name.patch new file mode 100644 index 0000000..23b605b --- /dev/null +++ b/0033-parted-Allow-empty-string-for-partition-name.patch @@ -0,0 +1,125 @@ +From 72faef8673b5b1d00059608f0729e93cb21a7664 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Fri, 13 Aug 2021 13:02:27 +0000 +Subject: [PATCH 33/34] parted: Allow empty string for partition name + +This makes it possible to pass an empty string in script mode e.g. to +set no partition name (on GPT): + +parted -s ./disk.img mklabel gpt mkpart '""' ext2 1 100M + +Includes a new test for this feature. + +Signed-off-by: Brian C. Lane +--- + parted/ui.c | 9 +++++++-- + tests/Makefile.am | 1 + + tests/t0290-gpt-name.sh | 41 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 49 insertions(+), 2 deletions(-) + create mode 100755 tests/t0290-gpt-name.sh + +diff --git a/parted/ui.c b/parted/ui.c +index b5948d3..25ad4f1 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -16,7 +16,6 @@ + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +-#include + + #include + +@@ -727,6 +726,7 @@ void + command_line_push_line (const char* line, int multi_word) + { + int quoted = 0; ++ int quotes_empty = 0; + char quote_char = 0; + char this_word [256]; + int i; +@@ -754,6 +754,9 @@ command_line_push_line (const char* line, int multi_word) + + if (quoted && *line == quote_char) { + quoted = 0; ++ /* allow empty partition name in script mode */ ++ if (!i) ++ quotes_empty = 1; + continue; + } + +@@ -761,9 +764,11 @@ command_line_push_line (const char* line, int multi_word) + if (quoted && line[0] == '\\' && line[1]) + line++; + ++ quotes_empty = 0; + this_word [i++] = *line; + } +- if (i || !multi_word) { ++ if (i || !multi_word || quotes_empty) { ++ quotes_empty = 0; + this_word [i] = 0; + command_line_push_word (this_word); + } +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 3473e6b..9c4a79d 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -33,6 +33,7 @@ TESTS = \ + t0281-gpt-grow.sh \ + t0282-gpt-move-backup.sh \ + t0283-overlap-partitions.sh \ ++ t0290-gpt-name.sh \ + t0300-dos-on-gpt.sh \ + t0301-overwrite-gpt-pmbr.sh \ + t0350-mac-PT-increases-sector-size.sh \ +diff --git a/tests/t0290-gpt-name.sh b/tests/t0290-gpt-name.sh +new file mode 100755 +index 0000000..26041b6 +--- /dev/null ++++ b/tests/t0290-gpt-name.sh +@@ -0,0 +1,41 @@ ++#!/bin/sh ++ ++# Test setting empty GPT partition name in non-interactive mode ++ ++# Copyright (C) 2021 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++dev=loop-file ++ ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create partition with empty name ++parted --script "$dev" mklabel gpt mkpart '""' ext4 1MiB 49MiB > out 2>&1 || fail=1 ++parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 ++grep 'MiB:::;' out || fail=1 ++ ++# set a non-empty name ++parted --script "$dev" name 1 "test" > out 2>&1 || fail=1 ++parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 ++grep 'MiB::test:;' out || fail=1 ++ ++# set empty name ++parted --script "$dev" name 1 "''" > out 2>&1 || fail=1 ++parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 ++grep 'MiB:::;' out || fail=1 ++ ++Exit $fail +-- +2.31.1 + diff --git a/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch b/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch new file mode 100644 index 0000000..c9611e3 --- /dev/null +++ b/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch @@ -0,0 +1,917 @@ +From 36d16c57d4ff6cf9903bfe65671c7f90879e004f Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Tue, 17 Aug 2021 11:05:38 +0000 +Subject: [PATCH 34/34] parted: Add --json cmdline switch to output JSON + +This outputs the disk's details as a JSON object. eg. a disk image with +a single partition from 1M to 100M: + +{ + "disk": { + "path": "/root/disk1.img", + "size": "2097152s", + "model": "", + "transport": "file", + "logical-sector-size": 512, + "physical-sector-size": 512, + "label": "gpt", + "max-partitions": 128, + "partitions": [ + { + "number": 0, + "start": "34s", + "end": "2047s", + "size": "2014s", + "type": "free" + },{ + "number": 1, + "start": "2048s", + "end": "200703s", + "size": "198656s", + "type": "primary", + "name": "root" + },{ + "number": 0, + "start": "200704s", + "end": "2097118s", + "size": "1896415s", + "type": "free" + } + ] + } +} + +Signed-off-by: Brian C. Lane +--- + doc/C/parted.8 | 3 + + doc/parted.texi | 8 ++ + parted/Makefile.am | 2 + + parted/jsonwrt.c | 225 ++++++++++++++++++++++++++++++++++++++ + parted/jsonwrt.h | 46 ++++++++ + parted/parted.c | 170 ++++++++++++++++++++++++++-- + tests/Makefile.am | 2 + + tests/t0800-json-gpt.sh | 94 ++++++++++++++++ + tests/t0801-json-msdos.sh | 86 +++++++++++++++ + 9 files changed, 624 insertions(+), 12 deletions(-) + create mode 100644 parted/jsonwrt.c + create mode 100644 parted/jsonwrt.h + create mode 100755 tests/t0800-json-gpt.sh + create mode 100755 tests/t0801-json-msdos.sh + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index d8e556e..46b30ad 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -24,6 +24,9 @@ lists partition layout on all block devices + .B -m, --machine + displays machine parseable output + .TP ++.B -m, --json ++displays JSON output ++.TP + .B -s, --script + never prompts for user intervention + .TP +diff --git a/doc/parted.texi b/doc/parted.texi +index 0da68e9..57ceb55 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -402,6 +402,14 @@ Options: + @itemx --help + display a help message + ++@item -m ++@itemx --machine ++display output in machine parseable format ++ ++@item -j ++@itemx --json ++display output in JSON format ++ + @item -s + @itemx --script + never prompt the user +diff --git a/parted/Makefile.am b/parted/Makefile.am +index e7bba2e..e5f3288 100644 +--- a/parted/Makefile.am ++++ b/parted/Makefile.am +@@ -13,6 +13,8 @@ parted_SOURCES = command.c \ + strlist.h \ + ui.c \ + ui.h \ ++ jsonwrt.c \ ++ jsonwrt.h \ + table.c \ + table.h + +diff --git a/parted/jsonwrt.c b/parted/jsonwrt.c +new file mode 100644 +index 0000000..1560224 +--- /dev/null ++++ b/parted/jsonwrt.c +@@ -0,0 +1,225 @@ ++/* ++ * JSON output formatting functions. ++ * ++ * No copyright is claimed. This code is in the public domain; do with ++ * it what you wish. ++ * ++ * Written by Karel Zak ++ */ ++ ++#include "config.h" ++#include ++#include ++#include ++#include ++#include ++#include "jsonwrt.h" ++ ++/* ++ * Requirements enumerated via testing (V8, Firefox, IE11): ++ * ++ * var charsToEscape = []; ++ * for (var i = 0; i < 65535; i += 1) { ++ * try { ++ * JSON.parse('{"sample": "' + String.fromCodePoint(i) + '"}'); ++ * } catch (e) { ++ * charsToEscape.push(i); ++ * } ++ * } ++ */ ++static void fputs_quoted_case_json(const char *data, FILE *out, int dir) ++{ ++ const char *p; ++ ++ fputc('"', out); ++ for (p = data; p && *p; p++) { ++ ++ const unsigned int c = (unsigned int) *p; ++ ++ /* From http://www.json.org ++ * ++ * The double-quote and backslashes would break out a string or ++ * init an escape sequence if not escaped. ++ * ++ * Note that single-quotes and forward slashes, while they're ++ * in the JSON spec, don't break double-quoted strings. ++ */ ++ if (c == '"' || c == '\\') { ++ fputc('\\', out); ++ fputc(c, out); ++ continue; ++ } ++ ++ /* All non-control characters OK; do the case swap as required. */ ++ if (c >= 0x20) { ++ /* ++ * Don't use locale sensitive ctype.h functions for regular ++ * ASCII chars, because for example with Turkish locale ++ * (aka LANG=tr_TR.UTF-8) toupper('I') returns 'I'. ++ */ ++ if (c <= 127) ++ fputc(dir == 1 ? c_toupper(c) : ++ dir == -1 ? c_tolower(c) : *p, out); ++ else ++ fputc(dir == 1 ? toupper(c) : ++ dir == -1 ? tolower(c) : *p, out); ++ continue; ++ } ++ ++ /* In addition, all chars under ' ' break Node's/V8/Chrome's, and ++ * Firefox's JSON.parse function ++ */ ++ switch (c) { ++ /* Handle short-hand cases to reduce output size. C ++ * has most of the same stuff here, so if there's an ++ * "Escape for C" function somewhere in the STL, we ++ * should probably be using it. ++ */ ++ case '\b': ++ fputs("\\b", out); ++ break; ++ case '\t': ++ fputs("\\t", out); ++ break; ++ case '\n': ++ fputs("\\n", out); ++ break; ++ case '\f': ++ fputs("\\f", out); ++ break; ++ case '\r': ++ fputs("\\r", out); ++ break; ++ default: ++ /* Other assorted control characters */ ++ fprintf(out, "\\u00%02x", c); ++ break; ++ } ++ } ++ fputc('"', out); ++} ++ ++#define fputs_quoted_json(_d, _o) fputs_quoted_case_json(_d, _o, 0) ++#define fputs_quoted_json_upper(_d, _o) fputs_quoted_case_json(_d, _o, 1) ++#define fputs_quoted_json_lower(_d, _o) fputs_quoted_case_json(_d, _o, -1) ++ ++void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent) ++{ ++ fmt->out = out; ++ fmt->indent = indent; ++ fmt->after_close = 0; ++} ++ ++void ul_jsonwrt_indent(struct ul_jsonwrt *fmt) ++{ ++ int i; ++ ++ for (i = 0; i < fmt->indent; i++) ++ fputs(" ", fmt->out); ++} ++ ++void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type) ++{ ++ if (name) { ++ if (fmt->after_close) ++ fputs(",\n", fmt->out); ++ ul_jsonwrt_indent(fmt); ++ fputs_quoted_json_lower(name, fmt->out); ++ } else { ++ if (fmt->after_close) ++ fputs(",", fmt->out); ++ else ++ ul_jsonwrt_indent(fmt); ++ } ++ ++ switch (type) { ++ case UL_JSON_OBJECT: ++ fputs(name ? ": {\n" : "{\n", fmt->out); ++ fmt->indent++; ++ break; ++ case UL_JSON_ARRAY: ++ fputs(name ? ": [\n" : "[\n", fmt->out); ++ fmt->indent++; ++ break; ++ case UL_JSON_VALUE: ++ fputs(name ? ": " : " ", fmt->out); ++ break; ++ } ++ fmt->after_close = 0; ++} ++ ++void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type) ++{ ++ if (fmt->indent == 1) { ++ fputs("\n}\n", fmt->out); ++ fmt->indent--; ++ fmt->after_close = 1; ++ return; ++ } ++ assert(fmt->indent > 0); ++ ++ switch (type) { ++ case UL_JSON_OBJECT: ++ fmt->indent--; ++ fputc('\n', fmt->out); ++ ul_jsonwrt_indent(fmt); ++ fputs("}", fmt->out); ++ break; ++ case UL_JSON_ARRAY: ++ fmt->indent--; ++ fputc('\n', fmt->out); ++ ul_jsonwrt_indent(fmt); ++ fputs("]", fmt->out); ++ break; ++ case UL_JSON_VALUE: ++ break; ++ } ++ ++ fmt->after_close = 1; ++} ++ ++void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt, ++ const char *name, const char *data) ++{ ++ ul_jsonwrt_value_open(fmt, name); ++ if (data && *data) ++ fputs(data, fmt->out); ++ else ++ fputs("null", fmt->out); ++ ul_jsonwrt_value_close(fmt); ++} ++ ++void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt, ++ const char *name, const char *data) ++{ ++ ul_jsonwrt_value_open(fmt, name); ++ if (data) ++ fputs_quoted_json(data, fmt->out); ++ else ++ fputs("null", fmt->out); ++ ul_jsonwrt_value_close(fmt); ++} ++ ++void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt, ++ const char *name, uint64_t data) ++{ ++ ul_jsonwrt_value_open(fmt, name); ++ fprintf(fmt->out, "%"PRIu64, data); ++ ul_jsonwrt_value_close(fmt); ++} ++ ++void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt, ++ const char *name, int data) ++{ ++ ul_jsonwrt_value_open(fmt, name); ++ fputs(data ? "true" : "false", fmt->out); ++ ul_jsonwrt_value_close(fmt); ++} ++ ++void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt, ++ const char *name) ++{ ++ ul_jsonwrt_value_open(fmt, name); ++ fputs("null", fmt->out); ++ ul_jsonwrt_value_close(fmt); ++} +diff --git a/parted/jsonwrt.h b/parted/jsonwrt.h +new file mode 100644 +index 0000000..4587b60 +--- /dev/null ++++ b/parted/jsonwrt.h +@@ -0,0 +1,46 @@ ++#ifndef UTIL_LINUX_JSONWRT_H ++#define UTIL_LINUX_JSONWRT_H ++ ++enum { ++ UL_JSON_OBJECT, ++ UL_JSON_ARRAY, ++ UL_JSON_VALUE ++}; ++ ++struct ul_jsonwrt { ++ FILE *out; ++ int indent; ++ ++ unsigned int after_close :1; ++}; ++ ++void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent); ++void ul_jsonwrt_indent(struct ul_jsonwrt *fmt); ++void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type); ++void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type); ++ ++#define ul_jsonwrt_root_open(_f) ul_jsonwrt_open(_f, NULL, UL_JSON_OBJECT) ++#define ul_jsonwrt_root_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT) ++ ++#define ul_jsonwrt_array_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_ARRAY) ++#define ul_jsonwrt_array_close(_f) ul_jsonwrt_close(_f, UL_JSON_ARRAY) ++ ++#define ul_jsonwrt_object_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_OBJECT) ++#define ul_jsonwrt_object_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT) ++ ++#define ul_jsonwrt_value_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_VALUE) ++#define ul_jsonwrt_value_close(_f) ul_jsonwrt_close(_f, UL_JSON_VALUE) ++ ++ ++void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt, ++ const char *name, const char *data); ++void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt, ++ const char *name, const char *data); ++void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt, ++ const char *name, uint64_t data); ++void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt, ++ const char *name, int data); ++void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt, ++ const char *name); ++ ++#endif /* UTIL_LINUX_JSONWRT_H */ +diff --git a/parted/parted.c b/parted/parted.c +index 65b5ab2..975700c 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -57,6 +57,7 @@ + #include "c-ctype.h" + #include "c-strcase.h" + #include "xalloc.h" ++#include "jsonwrt.h" + + #ifdef ENABLE_MTRACE + #include +@@ -79,6 +80,14 @@ enum + PRETEND_INPUT_TTY = CHAR_MAX + 1, + }; + ++/* Output modes */ ++enum ++{ ++ HUMAN, ++ MACHINE, ++ JSON ++}; ++ + enum + { + ALIGNMENT_NONE = 2, +@@ -115,6 +124,7 @@ static struct option const options[] = { + {"help", 0, NULL, 'h'}, + {"list", 0, NULL, 'l'}, + {"machine", 0, NULL, 'm'}, ++ {"json", 0, NULL, 'j'}, + {"script", 0, NULL, 's'}, + {"fix", 0, NULL, 'f'}, + {"version", 0, NULL, 'v'}, +@@ -127,6 +137,7 @@ static const char *const options_help [][2] = { + {"help", N_("displays this help message")}, + {"list", N_("lists partition layout on all block devices")}, + {"machine", N_("displays machine parseable output")}, ++ {"json", N_("displays JSON output")}, + {"script", N_("never prompts for user intervention")}, + {"fix", N_("in script mode, fix instead of abort when asked")}, + {"version", N_("displays the version")}, +@@ -137,7 +148,7 @@ static const char *const options_help [][2] = { + int opt_script_mode = 0; + int opt_fix_mode = 0; + int pretend_input_tty = 0; +-int opt_machine_mode = 0; ++int opt_output_mode = HUMAN; + int disk_is_modified = 0; + int is_toggle_mode = 0; + int alignment = ALIGNMENT_OPTIMAL; +@@ -184,6 +195,8 @@ static Command* commands [256] = {NULL}; + static PedTimer* g_timer; + static TimerContext timer_context; + ++static struct ul_jsonwrt json; ++ + static int _print_list (); + static void _done (PedDevice* dev, PedDisk *diskp); + static bool partition_align_check (PedDisk const *disk, +@@ -931,6 +944,32 @@ partition_print_flags (PedPartition const *part) + return res; + } + ++static void ++partition_print_flags_json (PedPartition const *part) ++{ ++ if (!part) ++ return; ++ ++ int did_open_array = 0; ++ ++ PedPartitionFlag flag; ++ for (flag = ped_partition_flag_next (0); flag; ++ flag = ped_partition_flag_next (flag)) ++ { ++ if (ped_partition_get_flag (part, flag)) ++ { ++ if (!did_open_array) ++ ul_jsonwrt_array_open (&json, "flags"); ++ did_open_array = 1; ++ ++ ul_jsonwrt_value_s (&json, NULL, ped_partition_flag_get_name (flag)); ++ } ++ } ++ ++ if (did_open_array) ++ ul_jsonwrt_array_close (&json); ++} ++ + static int + partition_print (PedPartition* part) + { +@@ -964,6 +1003,32 @@ disk_print_flags (PedDisk const *disk) + return res; + } + ++static void ++disk_print_flags_json (PedDisk const *disk) ++{ ++ if (!disk) ++ return; ++ ++ int did_open_array = 0; ++ ++ PedDiskFlag flag; ++ for (flag = ped_disk_flag_next (0); flag; ++ flag = ped_disk_flag_next (flag)) ++ { ++ if (ped_disk_get_flag (disk, flag)) ++ { ++ if (!did_open_array) ++ ul_jsonwrt_array_open (&json, "flags"); ++ did_open_array = 1; ++ ++ ul_jsonwrt_value_s (&json, NULL, ped_disk_flag_get_name (flag)); ++ } ++ } ++ ++ if (did_open_array) ++ ul_jsonwrt_array_close (&json); ++} ++ + static void + _print_disk_geometry (const PedDevice *dev) + { +@@ -973,9 +1038,14 @@ _print_disk_geometry (const PedDevice *dev) + chs->heads * chs->sectors, + PED_UNIT_KILOBYTE); + +- if (opt_machine_mode) { ++ if (opt_output_mode == MACHINE) { + printf ("%d:%d:%d:%s;\n", + chs->cylinders, chs->heads, chs->sectors, cyl_size); ++ } else if (opt_output_mode == JSON) { ++ char* tmp = ped_malloc (128); ++ snprintf (tmp, 128, "%d,%d,%d %s", chs->cylinders, chs->heads, chs->sectors, cyl_size); ++ ul_jsonwrt_value_s (&json, "geometry", tmp); ++ free (tmp); + } else { + printf (_("BIOS cylinder,head,sector geometry: %d,%d,%d. " + "Each cylinder is %s.\n"), +@@ -1030,7 +1100,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + const char* pt_name = diskp ? diskp->type->name : "unknown"; + char *disk_flags = disk_print_flags (diskp); + +- if (opt_machine_mode) { ++ if (opt_output_mode == MACHINE) { + char *escaped_path = _escape_machine_string (dev->path); + char *escaped_model = _escape_machine_string (dev->model); + +@@ -1049,6 +1119,20 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + pt_name, escaped_model, disk_flags); + free (escaped_path); + free (escaped_model); ++ } else if (opt_output_mode == JSON) { ++ ul_jsonwrt_value_s (&json, "path", dev->path); ++ ul_jsonwrt_value_s (&json, "size", end); ++ ul_jsonwrt_value_s (&json, "model", dev->model); ++ ul_jsonwrt_value_s (&json, "transport", transport[dev->type]); ++ ul_jsonwrt_value_u64 (&json, "logical-sector-size", dev->sector_size); ++ ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); ++ ul_jsonwrt_value_s (&json, "label", pt_name); ++ if (diskp) { ++ if (diskp->type->ops->get_max_primary_partition_count) ++ ul_jsonwrt_value_u64 (&json, "max-partitions", ++ diskp->type->ops->get_max_primary_partition_count(diskp)); ++ disk_print_flags_json (diskp); ++ } + } else { + printf (_("Model: %s (%s)\n"), + dev->model, transport[dev->type]); +@@ -1064,7 +1148,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + || ped_unit_get_default () == PED_UNIT_CYLINDER) + _print_disk_geometry (dev); + +- if (!opt_machine_mode) { ++ if (opt_output_mode == HUMAN) { + printf (_("Partition Table: %s\n"), pt_name); + printf (_("Disk Flags: %s\n"), disk_flags); + } +@@ -1170,10 +1254,16 @@ do_print (PedDevice** dev, PedDisk** diskp) + return status; + } + ++ if (opt_output_mode == JSON) { ++ ul_jsonwrt_init (&json, stdout, 0); ++ ul_jsonwrt_root_open (&json); ++ ul_jsonwrt_object_open (&json, "disk"); ++ } ++ + _print_disk_info (*dev, *diskp); + if (!*diskp) + goto nopt; +- if (!opt_machine_mode) ++ if (opt_output_mode == HUMAN) + putchar ('\n'); + + has_extended = ped_disk_type_check_feature ((*diskp)->type, +@@ -1182,7 +1272,7 @@ do_print (PedDevice** dev, PedDisk** diskp) + PED_DISK_TYPE_PARTITION_NAME); + + PedPartition* part; +- if (!opt_machine_mode) { ++ if (opt_output_mode == HUMAN) { + StrList *row1; + + if (ped_unit_get_default() == PED_UNIT_CHS) { +@@ -1283,6 +1373,57 @@ do_print (PedDevice** dev, PedDisk** diskp) + table_destroy (table); + str_list_destroy (row1); + ++ } else if (opt_output_mode == JSON) { ++ ++ ul_jsonwrt_array_open (&json, "partitions"); ++ ++ for (part = ped_disk_next_partition (*diskp, NULL); part; ++ part = ped_disk_next_partition (*diskp, part)) { ++ ++ if ((!has_free_arg && !ped_partition_is_active(part)) || ++ part->type & PED_PARTITION_METADATA) ++ continue; ++ ++ ul_jsonwrt_object_open (&json, NULL); ++ ++ ul_jsonwrt_value_u64 (&json, "number", part->num >= 0 ? part->num : 0); ++ ++ tmp = ped_unit_format (*dev, part->geom.start); ++ ul_jsonwrt_value_s (&json, "start", tmp); ++ free (tmp); ++ ++ tmp = ped_unit_format_byte (*dev, (part->geom.end + 1) * (*dev)->sector_size - 1); ++ ul_jsonwrt_value_s (&json, "end", tmp); ++ free (tmp); ++ ++ if (ped_unit_get_default() != PED_UNIT_CHS) { ++ tmp = ped_unit_format (*dev, part->geom.length); ++ ul_jsonwrt_value_s (&json, "size", tmp); ++ free (tmp); ++ } ++ ++ name = ped_partition_type_get_name (part->type); ++ ul_jsonwrt_value_s (&json, "type", name); ++ ++ if (!(part->type & PED_PARTITION_FREESPACE)) { ++ ++ if (has_name) { ++ name = ped_partition_get_name (part); ++ if (strcmp (name, "") != 0) ++ ul_jsonwrt_value_s (&json, "name", ped_partition_get_name (part)); ++ } ++ ++ if (part->fs_type) ++ ul_jsonwrt_value_s (&json, "filesystem", part->fs_type->name); ++ ++ partition_print_flags_json (part); ++ } ++ ++ ul_jsonwrt_object_close (&json); ++ } ++ ++ ul_jsonwrt_array_close (&json); ++ + } else { + + for (part = ped_disk_next_partition (*diskp, NULL); part; +@@ -1337,9 +1478,13 @@ do_print (PedDevice** dev, PedDisk** diskp) + } + } + +- return ok; +- + nopt: ++ ++ if (opt_output_mode == JSON) { ++ ul_jsonwrt_object_close (&json); ++ ul_jsonwrt_root_close (&json); ++ } ++ + return ok; + } + +@@ -2232,7 +2377,7 @@ int opt, help = 0, list = 0, version = 0, wrong = 0; + + while (1) + { +- opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsfva:", ++ opt = getopt_long (*argc_ptr, *argv_ptr, "hlmjsfva:", + options, NULL); + if (opt == -1) + break; +@@ -2240,7 +2385,8 @@ while (1) + switch (opt) { + case 'h': help = 1; break; + case 'l': list = 1; break; +- case 'm': opt_machine_mode = 1; break; ++ case 'm': opt_output_mode = MACHINE; break; ++ case 'j': opt_output_mode = JSON; break; + case 's': opt_script_mode = 1; break; + case 'f': opt_fix_mode = 1; break; + case 'v': version = 1; break; +@@ -2289,7 +2435,7 @@ _choose_device (int* argc_ptr, char*** argv_ptr) + { + PedDevice* dev; + +-/* specified on comand line? */ ++/* specified on command line? */ + if (*argc_ptr) { + dev = ped_device_get ((*argv_ptr) [0]); + if (!dev) +@@ -2377,7 +2523,7 @@ _done (PedDevice* dev, PedDisk* diskp) + "rebooting. Read section 4 of the Parted User " + "documentation for more information.")); + } +- if (!opt_script_mode && !opt_machine_mode && disk_is_modified) { ++ if (!opt_script_mode && opt_output_mode == HUMAN && disk_is_modified) { + ped_exception_throw ( + PED_EXCEPTION_INFORMATION, PED_EXCEPTION_OK, + _("You may need to update /etc/fstab.\n")); +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 9c4a79d..f9340aa 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -40,6 +40,8 @@ TESTS = \ + t0400-loop-clobber-infloop.sh \ + t0500-dup-clobber.sh \ + t0501-duplicate.sh \ ++ t0800-json-gpt.sh \ ++ t0801-json-msdos.sh \ + t1100-busy-label.sh \ + t1101-busy-partition.sh \ + t1102-loop-label.sh \ +diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh +new file mode 100755 +index 0000000..8dd1862 +--- /dev/null ++++ b/tests/t0800-json-gpt.sh +@@ -0,0 +1,94 @@ ++#!/bin/sh ++ ++# Test JSON output with GPT label ++ ++# Copyright (C) 2021 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create gpt label and some partitions ++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 ++parted --script "$dev" disk_set pmbr_boot on > out 2>&1 || fail=1 ++parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1 ++parted --script "$dev" mkpart "test2" xfs 20% 60% > out 2>&1 || fail=1 ++parted --script "$dev" set 2 raid on > out 2>&1 || fail=1 ++ ++# print with json format ++parted --script --json "$dev" unit s print free > out 2>&1 || fail=1 ++ ++cat < exp || fail=1 ++{ ++ "disk": { ++ "path": "loop-file", ++ "size": "102400s", ++ "model": "", ++ "transport": "file", ++ "logical-sector-size": 512, ++ "physical-sector-size": 512, ++ "label": "gpt", ++ "max-partitions": 128, ++ "flags": [ ++ "pmbr_boot" ++ ], ++ "partitions": [ ++ { ++ "number": 0, ++ "start": "34s", ++ "end": "10239s", ++ "size": "10206s", ++ "type": "free" ++ },{ ++ "number": 1, ++ "start": "10240s", ++ "end": "20479s", ++ "size": "10240s", ++ "type": "primary", ++ "name": "test1" ++ },{ ++ "number": 2, ++ "start": "20480s", ++ "end": "61439s", ++ "size": "40960s", ++ "type": "primary", ++ "name": "test2", ++ "flags": [ ++ "raid" ++ ] ++ },{ ++ "number": 0, ++ "start": "61440s", ++ "end": "102366s", ++ "size": "40927s", ++ "type": "free" ++ } ++ ] ++ } ++} ++EOF ++ ++# remove full path of device from actual output ++mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 ++ ++# check for expected output ++compare exp out || fail=1 ++ ++Exit $fail +diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh +new file mode 100755 +index 0000000..a14a5af +--- /dev/null ++++ b/tests/t0801-json-msdos.sh +@@ -0,0 +1,86 @@ ++#!/bin/sh ++ ++# Test JSON output with MS-DOS label ++ ++# Copyright (C) 2021 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create msdos label and some partitions ++parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 ++parted --script "$dev" mkpart primary ext4 10% 20% > out 2>&1 || fail=1 ++parted --script "$dev" mkpart extended 20% 60% > out 2>&1 || fail=1 ++parted --script "$dev" mkpart logical ext4 20% 40% > out 2>&1 || fail=1 ++parted --script "$dev" set 5 lvm on > out 2>&1 || fail=1 ++ ++# print with json format ++parted --script --json "$dev" unit MiB print > out 2>&1 || fail=1 ++ ++cat < exp || fail=1 ++{ ++ "disk": { ++ "path": "loop-file", ++ "size": "50.0MiB", ++ "model": "", ++ "transport": "file", ++ "logical-sector-size": 512, ++ "physical-sector-size": 512, ++ "label": "msdos", ++ "max-partitions": 4, ++ "partitions": [ ++ { ++ "number": 1, ++ "start": "5.00MiB", ++ "end": "10.0MiB", ++ "size": "5.00MiB", ++ "type": "primary" ++ },{ ++ "number": 2, ++ "start": "10.0MiB", ++ "end": "30.0MiB", ++ "size": "20.0MiB", ++ "type": "extended", ++ "flags": [ ++ "lba" ++ ] ++ },{ ++ "number": 5, ++ "start": "10.0MiB", ++ "end": "20.0MiB", ++ "size": "10.0MiB", ++ "type": "logical", ++ "flags": [ ++ "lvm" ++ ] ++ } ++ ] ++ } ++} ++EOF ++ ++# remove full path of device from actual output ++mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 ++ ++# check for expected output ++compare exp out || fail=1 ++ ++Exit $fail +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 3813d29..0cf7d08 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -41,8 +41,10 @@ Patch0027: 0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch Patch0028: 0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch Patch0029: 0029-tests-check-for-vfat-kernel-support-and-tools.patch Patch0030: 0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch -# Fixes rhbz#1980697 but not yet upstream Patch0031: 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch +Patch0032: 0032-libparted-Check-devpath-before-passing-to-strlen.patch +Patch0033: 0033-parted-Allow-empty-string-for-partition-name.patch +Patch0034: 0034-parted-Add-json-cmdline-switch-to-output-JSON.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -146,6 +148,11 @@ make check %changelog +* Wed Aug 25 2021 Brian C. Lane - 3.4-8 +- parted: Add --json cmdline switch to output JSON (aschnell) +- parted: Allow empty string for partition name (aschnell) +- libparted: Check devpath before passing to strlen (bcl) + * Tue Aug 10 2021 Brian C. Lane - 3.4-7 - libparted: Tell libdevmapper to retry remove when BUSY (bcl) Resolves: rhbz#1980697 From e3d368e543cd32c7a39febc5f18a9d2068a93f64 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 23 Sep 2021 16:31:49 -0700 Subject: [PATCH 25/60] - keep GUID specific attributes (aschnell) - hurd: Implement partition table rereading (cjwatson) - hurd: Support rumpdisk-based device names (samuel.thibault) - hurd: Fix partition paths (cjwatson) --- 0035-hurd-Fix-partition-paths.patch | 29 ++ ...-Support-rumpdisk-based-device-names.patch | 33 ++ ...-Implement-partition-table-rereading.patch | 135 +++++++++ 0038-keep-GUID-specific-attributes.patch | 283 ++++++++++++++++++ parted.spec | 10 + 5 files changed, 490 insertions(+) create mode 100644 0035-hurd-Fix-partition-paths.patch create mode 100644 0036-hurd-Support-rumpdisk-based-device-names.patch create mode 100644 0037-hurd-Implement-partition-table-rereading.patch create mode 100644 0038-keep-GUID-specific-attributes.patch diff --git a/0035-hurd-Fix-partition-paths.patch b/0035-hurd-Fix-partition-paths.patch new file mode 100644 index 0000000..80a6ecb --- /dev/null +++ b/0035-hurd-Fix-partition-paths.patch @@ -0,0 +1,29 @@ +From dde6702f20b7c34b091b25580ab19009c9d91b30 Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Thu, 26 Nov 2020 21:59:39 +0100 +Subject: [PATCH 35/38] hurd: Fix partition paths + +We have always had an 's' to separate drive number from partition +number. + +Signed-off-by: Brian C. Lane +--- + libparted/arch/gnu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c +index d7204cc..507a5ff 100644 +--- a/libparted/arch/gnu.c ++++ b/libparted/arch/gnu.c +@@ -805,7 +805,7 @@ gnu_partition_get_path (const PedPartition* part) + result = (char*) ped_malloc (result_len); + if (!result) + return NULL; +- snprintf (result, result_len, "%s%d", dev_path, part->num); ++ snprintf (result, result_len, "%ss%d", dev_path, part->num); + return result; + } + +-- +2.31.1 + diff --git a/0036-hurd-Support-rumpdisk-based-device-names.patch b/0036-hurd-Support-rumpdisk-based-device-names.patch new file mode 100644 index 0000000..6b14e30 --- /dev/null +++ b/0036-hurd-Support-rumpdisk-based-device-names.patch @@ -0,0 +1,33 @@ +From e0a83f3bdf6cfb4b2b6d3631a5ab157291bfbdfa Mon Sep 17 00:00:00 2001 +From: Samuel Thibault +Date: Sun, 29 Nov 2020 23:20:17 +0100 +Subject: [PATCH 36/38] hurd: Support rumpdisk-based device names + +Signed-off-by: Brian C. Lane +--- + libparted/arch/gnu.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c +index 507a5ff..0797115 100644 +--- a/libparted/arch/gnu.c ++++ b/libparted/arch/gnu.c +@@ -786,6 +786,15 @@ probe_standard_devices () + _ped_device_probe ("/dev/hd6"); + _ped_device_probe ("/dev/hd7"); + ++ _ped_device_probe ("/dev/wd0"); ++ _ped_device_probe ("/dev/wd1"); ++ _ped_device_probe ("/dev/wd2"); ++ _ped_device_probe ("/dev/wd3"); ++ _ped_device_probe ("/dev/wd4"); ++ _ped_device_probe ("/dev/wd5"); ++ _ped_device_probe ("/dev/wd6"); ++ _ped_device_probe ("/dev/wd7"); ++ + return 1; + } + +-- +2.31.1 + diff --git a/0037-hurd-Implement-partition-table-rereading.patch b/0037-hurd-Implement-partition-table-rereading.patch new file mode 100644 index 0000000..ccb756e --- /dev/null +++ b/0037-hurd-Implement-partition-table-rereading.patch @@ -0,0 +1,135 @@ +From c16cb23bf91cf3255e2cf8ea596fe5e1b4ea1ad5 Mon Sep 17 00:00:00 2001 +From: Colin Watson +Date: Sun, 29 Nov 2020 23:19:23 +0100 +Subject: [PATCH 37/38] hurd: Implement partition table rereading + +We have to tell both the device for the drive itself, it case it +implements the partitioned devices, and tell the partition devices +to go away, in case they are implemented on their own by using parted. + +Signed-off-by: Brian C. Lane +--- + libparted/arch/gnu.c | 84 ++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 78 insertions(+), 6 deletions(-) + +diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c +index 0797115..b040c45 100644 +--- a/libparted/arch/gnu.c ++++ b/libparted/arch/gnu.c +@@ -185,7 +185,7 @@ _init_device (const char *path) + if (!dev->arch_specific) + goto error_free_path; + +- dev->type = PED_DEVICE_FILE; /* FIXME? */ ++ dev->type = PED_DEVICE_UNKNOWN; /* It's deprecated anyway */ + dev->open_count = 0; + dev->read_only = 0; + dev->external_mode = 0; +@@ -204,11 +204,83 @@ error: + return NULL; + } + ++/* Ask the kernel and translators to reload the partition table. ++ XXX: Will probably be replaced by some RPC to partfs when it's finished. In ++ the meantime, gnumach's glue layer will pass BLKRRPART to the Linux drivers. ++ */ ++#define BLKRRPART 0x125F + static int +-_kernel_reread_part_table (PedDevice* dev) ++_reread_part_table (PedDevice* dev) + { +- /* XXX: We must wait for partfs to be finished. */ +- return 1; ++ struct store *store = GNU_SPECIFIC (dev)->store; ++ int retry_count = 9; ++ int len = strlen (dev->path); ++ char path[len + 3 + 1]; ++ int i; ++ int done = 1; ++ ++ sync (); ++ ++ if(strcmp (store->class->name, "device") == 0) { ++ while (device_set_status (store->port, BLKRRPART, NULL, 0)) { ++ retry_count--; ++ sync (); ++ if (retry_count == 3) ++ sleep (1); /* Pause to allow system to settle */ ++ ++ if (!retry_count) { ++ ped_exception_throw ( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_IGNORE, ++ _("WARNING: the kernel failed to re-read the " ++ "partition table on %s (%s). As a result, " ++ "it may not reflect all of your changes " ++ "until after reboot."), ++ dev->path, strerror (errno)); ++ return 0; ++ } ++ } ++ } ++ ++ i = 1; ++ while (1) { ++ file_t node; ++ error_t err; ++ ++ /* Throw away all active parted-based translators */ ++ snprintf (path, sizeof (path), "%ss%u", dev->path, i); ++ node = file_name_lookup (path, O_NOTRANS, 0666); ++ if (node == MACH_PORT_NULL) { ++ if (errno == ENOENT) ++ /* Finished looping over them */ ++ break; ++ ++ ped_exception_throw ( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_IGNORE, ++ _("Warning: unable to open %s (%s). As a " ++ "result, it may not reflect all of your " ++ "changes until after reboot."), ++ path, strerror (errno)); ++ done = 0; ++ } ++ ++ err = file_set_translator (node, 0, FS_TRANS_SET, ++ 0, 0, 0, MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND); ++ if (err) { ++ ped_exception_throw ( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_IGNORE, ++ _("Warning: failed to make translator go away " ++ "on %s (%s). As a result, it may not reflect " ++ "all of your changes until after reboot."), ++ dev->path, strerror (errno)); ++ done = 0; ++ } ++ i++; ++ } ++ ++ return done; + } + + /* Free the memory associated with a PedDevice structure. */ +@@ -355,7 +427,7 @@ gnu_close (PedDevice* dev) + _flush_cache (dev); + + if (dev->dirty && dev->type != PED_DEVICE_FILE) { +- if (_kernel_reread_part_table (dev)) ++ if (_reread_part_table (dev)) + dev->dirty = 0; + } + +@@ -827,7 +899,7 @@ gnu_partition_is_busy (const PedPartition* part) + static int + gnu_disk_commit (PedDisk* disk) + { +- return 1; ++ return _reread_part_table (disk->dev); + } + + static PedDeviceArchOps gnu_dev_ops = { +-- +2.31.1 + diff --git a/0038-keep-GUID-specific-attributes.patch b/0038-keep-GUID-specific-attributes.patch new file mode 100644 index 0000000..617868e --- /dev/null +++ b/0038-keep-GUID-specific-attributes.patch @@ -0,0 +1,283 @@ +From 9d1ac5015340aa7a4cc71cb7f63bae8c1718b8ee Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Thu, 23 Sep 2021 16:31:42 +0000 +Subject: [PATCH 38/38] keep GUID specific attributes + +Keep GUID specific attributes when writing GPT. + +Signed-off-by: Brian C. Lane +--- + libparted/labels/gpt.c | 30 +++++------------ + tests/Makefile.am | 3 +- + tests/gpt-attrs | 72 ++++++++++++++++++++++++++++++++++++++++ + tests/t0215-gpt-attrs.sh | 46 +++++++++++++++++++++++++ + 4 files changed, 129 insertions(+), 22 deletions(-) + create mode 100755 tests/gpt-attrs + create mode 100644 tests/t0215-gpt-attrs.sh + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 9b987c1..ba9a71a 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -297,18 +297,17 @@ typedef struct _GPTPartitionData + efi_guid_t uuid; + efi_char16_t name[37]; + char *translated_name; ++ GuidPartitionEntryAttributes_t attributes; + int lvm; + int swap; + int raid; + int boot; + int bios_grub; + int hp_service; +- int hidden; + int msftres; + int msftdata; + int atvrecv; + int msftrecv; +- int legacy_boot; + int prep; + int irst; + int chromeos_kernel; +@@ -826,25 +825,20 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + gpt_part_data->name[i] = (efi_char16_t) pte->PartitionName[i]; + gpt_part_data->name[i] = 0; + gpt_part_data->translated_name = 0; ++ gpt_part_data->attributes = pte->Attributes; + + gpt_part_data->lvm = gpt_part_data->swap + = gpt_part_data->raid + = gpt_part_data->boot = gpt_part_data->hp_service +- = gpt_part_data->hidden = gpt_part_data->msftres ++ = gpt_part_data->msftres + = gpt_part_data->msftdata + = gpt_part_data->msftrecv +- = gpt_part_data->legacy_boot + = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->chromeos_kernel + = gpt_part_data->bls_boot + = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; + +- if (pte->Attributes.RequiredToFunction & 0x1) +- gpt_part_data->hidden = 1; +- if (pte->Attributes.LegacyBIOSBootable & 0x1) +- gpt_part_data->legacy_boot = 1; +- + if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID)) + gpt_part_data->boot = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID)) +@@ -1241,12 +1235,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) + pte->UniquePartitionGuid = gpt_part_data->uuid; + pte->StartingLBA = PED_CPU_TO_LE64 (part->geom.start); + pte->EndingLBA = PED_CPU_TO_LE64 (part->geom.end); +- memset (&pte->Attributes, 0, sizeof (GuidPartitionEntryAttributes_t)); +- +- if (gpt_part_data->hidden) +- pte->Attributes.RequiredToFunction = 1; +- if (gpt_part_data->legacy_boot) +- pte->Attributes.LegacyBIOSBootable = 1; ++ pte->Attributes = gpt_part_data->attributes; + + for (i = 0; i < 36; i++) + pte->PartitionName[i] = gpt_part_data->name[i]; +@@ -1388,12 +1377,10 @@ gpt_partition_new (const PedDisk *disk, + gpt_part_data->boot = 0; + gpt_part_data->bios_grub = 0; + gpt_part_data->hp_service = 0; +- gpt_part_data->hidden = 0; + gpt_part_data->msftres = 0; + gpt_part_data->msftdata = 0; + gpt_part_data->msftrecv = 0; + gpt_part_data->atvrecv = 0; +- gpt_part_data->legacy_boot = 0; + gpt_part_data->prep = 0; + gpt_part_data->translated_name = 0; + gpt_part_data->irst = 0; +@@ -1402,6 +1389,7 @@ gpt_partition_new (const PedDisk *disk, + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid (&gpt_part_data->uuid); + memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); ++ memset (&gpt_part_data->attributes, 0, sizeof gpt_part_data->attributes); + return part; + + error_free_part: +@@ -1911,10 +1899,10 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: +- gpt_part_data->hidden = state; ++ gpt_part_data->attributes.RequiredToFunction = state; + return 1; + case PED_PARTITION_LEGACY_BOOT: +- gpt_part_data->legacy_boot = state; ++ gpt_part_data->attributes.LegacyBIOSBootable = state; + return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: +@@ -1953,9 +1941,9 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + case PED_PARTITION_APPLE_TV_RECOVERY: + return gpt_part_data->atvrecv; + case PED_PARTITION_HIDDEN: +- return gpt_part_data->hidden; ++ return gpt_part_data->attributes.RequiredToFunction; + case PED_PARTITION_LEGACY_BOOT: +- return gpt_part_data->legacy_boot; ++ return gpt_part_data->attributes.LegacyBIOSBootable; + case PED_PARTITION_PREP: + return gpt_part_data->prep; + case PED_PARTITION_IRST: +diff --git a/tests/Makefile.am b/tests/Makefile.am +index f9340aa..3dc6e72 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -26,6 +26,7 @@ TESTS = \ + t0211-gpt-rewrite-header.sh \ + t0212-gpt-many-partitions.sh \ + t0213-mkpart-start-negative.sh \ ++ t0215-gpt-attrs.sh \ + t0220-gpt-msftres.sh \ + t0250-gpt.sh \ + t0251-gpt-unicode.sh \ +@@ -98,7 +99,7 @@ TESTS = \ + EXTRA_DIST = \ + $(TESTS) t-local.sh t-lvm.sh \ + init.cfg init.sh t-lib-helpers.sh gpt-header-munge \ +- gpt-header-move msdos-overlap ++ gpt-header-move msdos-overlap gpt-attrs + + check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \ + fs-resize +diff --git a/tests/gpt-attrs b/tests/gpt-attrs +new file mode 100755 +index 0000000..0a01447 +--- /dev/null ++++ b/tests/gpt-attrs +@@ -0,0 +1,72 @@ ++#!/usr/bin/python3 ++ ++# Copyright (C) 2021 SUSE LLC ++ ++# program to show gpt partition attributes or set attributes of ++# partition 1 ++ ++# only works with 512 sectors and standard GPT header layout (128 ++# partition entires with 128 bytes each, secondary header at end of ++# device) ++ ++ ++from struct import unpack_from, pack_into ++from zipfile import crc32 ++import array ++import sys ++ ++ ++class Gpt: ++ ++ # Calculate and insert the CRCs of the partition entires and the ++ # header. ++ def calc_crcs(self, header, entries): ++ # compute crc of partition entries ++ crc2 = crc32(entries) & 0xFFFFFFFF ++ pack_into('. ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create gpt label and one partitions ++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 ++parted --script "$dev" mkpart "test1" ext4 0% 10% > out 2>&1 || fail=1 ++ ++# set guid specific bit ++gpt-attrs "$dev" set 0x100000000000000 || fail=1 ++ ++# create additional partition ++parted --script "$dev" mkpart "test2" ext4 10% 20% > out 2>&1 || fail=1 ++ ++cat < exp || fail=1 ++0x100000000000000 ++EOF ++ ++# check guid specific bit ++gpt-attrs "$dev" show > out || fail=1 ++compare exp out || fail=1 ++ ++Exit $fail +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 0cf7d08..18bb61a 100644 --- a/parted.spec +++ b/parted.spec @@ -45,6 +45,10 @@ Patch0031: 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch Patch0032: 0032-libparted-Check-devpath-before-passing-to-strlen.patch Patch0033: 0033-parted-Allow-empty-string-for-partition-name.patch Patch0034: 0034-parted-Add-json-cmdline-switch-to-output-JSON.patch +Patch0035: 0035-hurd-Fix-partition-paths.patch +Patch0036: 0036-hurd-Support-rumpdisk-based-device-names.patch +Patch0037: 0037-hurd-Implement-partition-table-rereading.patch +Patch0038: 0038-keep-GUID-specific-attributes.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -148,6 +152,12 @@ make check %changelog +* Thu Sep 23 2021 Brian C. Lane - 3.4-8 +- keep GUID specific attributes (aschnell) +- hurd: Implement partition table rereading (cjwatson) +- hurd: Support rumpdisk-based device names (samuel.thibault) +- hurd: Fix partition paths (cjwatson) + * Wed Aug 25 2021 Brian C. Lane - 3.4-8 - parted: Add --json cmdline switch to output JSON (aschnell) - parted: Allow empty string for partition name (aschnell) From 27d77ddc17da2463ed07b12ec0f1b11654b496fa Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 23 Sep 2021 16:42:24 -0700 Subject: [PATCH 26/60] Forgot to bump release to -9 --- parted.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parted.spec b/parted.spec index 18bb61a..55d6617 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -152,7 +152,7 @@ make check %changelog -* Thu Sep 23 2021 Brian C. Lane - 3.4-8 +* Thu Sep 23 2021 Brian C. Lane - 3.4-9 - keep GUID specific attributes (aschnell) - hurd: Implement partition table rereading (cjwatson) - hurd: Support rumpdisk-based device names (samuel.thibault) From fb6ff33ba97bc666cf2c43e7d8f366697e0a6183 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 6 Oct 2021 15:30:12 -0700 Subject: [PATCH 27/60] - gpt: Revert to filesystem GUID when setting flag to off (bcl) - tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) - doc: Document gpt linux-home flag (bcl) - gpt: Add linux-home flag (aschnell) - gpt: Map PED_PARTITON_ flags to GUID values (aschnell) --- ...p-PED_PARTITON_-flags-to-GUID-values.patch | 566 ++++++++++++++++++ 0040-gpt-Add-linux-home-flag.patch | 72 +++ 0041-doc-Document-gpt-linux-home-flag.patch | 42 ++ ...-to-make-sure-GPT-GUIDs-default-to-f.patch | 144 +++++ ...lesystem-GUID-when-setting-flag-to-o.patch | 25 + parted.spec | 15 +- 6 files changed, 863 insertions(+), 1 deletion(-) create mode 100644 0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch create mode 100644 0040-gpt-Add-linux-home-flag.patch create mode 100644 0041-doc-Document-gpt-linux-home-flag.patch create mode 100644 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch create mode 100644 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch diff --git a/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch b/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch new file mode 100644 index 0000000..ff6c3a3 --- /dev/null +++ b/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch @@ -0,0 +1,566 @@ +From 15c49ec04f7eaff014d2e1eddd0aecf4150db63d Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Mon, 27 Sep 2021 08:35:31 +0000 +Subject: [PATCH 39/43] gpt: Map PED_PARTITON_ flags to GUID values + +Drop the 14 flags from _GPTPartitionData that correspond to a +partition type/uuid. Use the type/uuid directly instead. + +Signed-off-by: Brian C. Lane +--- + libparted/labels/gpt.c | 477 +++++------------------------------------ + 1 file changed, 54 insertions(+), 423 deletions(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index ba9a71a..3ba3cee 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -165,6 +165,43 @@ typedef struct + PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ + { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) + ++struct flag_uuid_mapping_t ++{ ++ enum _PedPartitionFlag flag; ++ efi_guid_t type_uuid; ++}; ++ ++static const struct flag_uuid_mapping_t flag_uuid_mapping[] = ++{ ++ { PED_PARTITION_APPLE_TV_RECOVERY, PARTITION_APPLE_TV_RECOVERY_GUID }, ++ { PED_PARTITION_BIOS_GRUB, PARTITION_BIOS_GRUB_GUID }, ++ { PED_PARTITION_BLS_BOOT, PARTITION_BLS_BOOT_GUID }, ++ { PED_PARTITION_BOOT, PARTITION_SYSTEM_GUID }, ++ { PED_PARTITION_CHROMEOS_KERNEL, PARTITION_CHROMEOS_KERNEL_GUID }, ++ { PED_PARTITION_DIAG, PARTITION_MSFT_RECOVERY }, ++ { PED_PARTITION_ESP, PARTITION_SYSTEM_GUID }, ++ { PED_PARTITION_HPSERVICE, PARTITION_HPSERVICE_GUID }, ++ { PED_PARTITION_IRST, PARTITION_IRST_GUID }, ++ { PED_PARTITION_LVM, PARTITION_LVM_GUID }, ++ { PED_PARTITION_MSFT_DATA, PARTITION_BASIC_DATA_GUID }, ++ { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RESERVED_GUID }, ++ { PED_PARTITION_PREP, PARTITION_PREP_GUID }, ++ { PED_PARTITION_RAID, PARTITION_RAID_GUID }, ++ { PED_PARTITION_SWAP, PARTITION_SWAP_GUID }, ++}; ++ ++static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST ++gpt_find_flag_uuid_mapping (PedPartitionFlag flag) ++{ ++ int n = sizeof(flag_uuid_mapping) / sizeof(flag_uuid_mapping[0]); ++ ++ for (int i = 0; i < n; ++i) ++ if (flag_uuid_mapping[i].flag == flag) ++ return &flag_uuid_mapping[i]; ++ ++ return NULL; ++} ++ + struct __attribute__ ((packed)) _GuidPartitionTableHeader_t + { + uint64_t Signature; +@@ -298,20 +335,6 @@ typedef struct _GPTPartitionData + efi_char16_t name[37]; + char *translated_name; + GuidPartitionEntryAttributes_t attributes; +- int lvm; +- int swap; +- int raid; +- int boot; +- int bios_grub; +- int hp_service; +- int msftres; +- int msftdata; +- int atvrecv; +- int msftrecv; +- int prep; +- int irst; +- int chromeos_kernel; +- int bls_boot; + } GPTPartitionData; + + static PedDiskType gpt_disk_type; +@@ -827,47 +850,6 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) + gpt_part_data->translated_name = 0; + gpt_part_data->attributes = pte->Attributes; + +- gpt_part_data->lvm = gpt_part_data->swap +- = gpt_part_data->raid +- = gpt_part_data->boot = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; +- +- if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID)) +- gpt_part_data->boot = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID)) +- gpt_part_data->bios_grub = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_RAID_GUID)) +- gpt_part_data->raid = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID)) +- gpt_part_data->lvm = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_SWAP_GUID)) +- gpt_part_data->swap = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID)) +- gpt_part_data->hp_service = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID)) +- gpt_part_data->msftres = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_BASIC_DATA_GUID)) +- gpt_part_data->msftdata = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY)) +- gpt_part_data->msftrecv = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) +- gpt_part_data->atvrecv = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID)) +- gpt_part_data->prep = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) +- gpt_part_data->irst = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) +- gpt_part_data->chromeos_kernel = 1; +- else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID)) +- gpt_part_data->bls_boot = 1; +- + return part; + } + +@@ -1371,21 +1353,7 @@ gpt_partition_new (const PedDisk *disk, + goto error_free_part; + + gpt_part_data->type = PARTITION_LINUX_DATA_GUID; +- gpt_part_data->lvm = 0; +- gpt_part_data->swap = 0; +- gpt_part_data->raid = 0; +- gpt_part_data->boot = 0; +- gpt_part_data->bios_grub = 0; +- gpt_part_data->hp_service = 0; +- gpt_part_data->msftres = 0; +- gpt_part_data->msftdata = 0; +- gpt_part_data->msftrecv = 0; +- gpt_part_data->atvrecv = 0; +- gpt_part_data->prep = 0; + gpt_part_data->translated_name = 0; +- gpt_part_data->irst = 0; +- gpt_part_data->chromeos_kernel = 0; +- gpt_part_data->bls_boot = 0; + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid (&gpt_part_data->uuid); + memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); +@@ -1457,77 +1425,6 @@ gpt_partition_set_system (PedPartition *part, + + part->fs_type = fs_type; + +- if (gpt_part_data->lvm) +- { +- gpt_part_data->type = PARTITION_LVM_GUID; +- return 1; +- } +- if (gpt_part_data->swap) +- { +- gpt_part_data->type = PARTITION_SWAP_GUID; +- return 1; +- } +- if (gpt_part_data->raid) +- { +- gpt_part_data->type = PARTITION_RAID_GUID; +- return 1; +- } +- if (gpt_part_data->prep) +- { +- gpt_part_data->type = PARTITION_PREP_GUID; +- return 1; +- } +- if (gpt_part_data->boot) +- { +- gpt_part_data->type = PARTITION_SYSTEM_GUID; +- return 1; +- } +- if (gpt_part_data->bios_grub) +- { +- gpt_part_data->type = PARTITION_BIOS_GRUB_GUID; +- return 1; +- } +- if (gpt_part_data->hp_service) +- { +- gpt_part_data->type = PARTITION_HPSERVICE_GUID; +- return 1; +- } +- if (gpt_part_data->msftres) +- { +- gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; +- return 1; +- } +- if (gpt_part_data->msftdata) +- { +- gpt_part_data->type = PARTITION_BASIC_DATA_GUID; +- return 1; +- } +- if (gpt_part_data->msftrecv) +- { +- gpt_part_data->type = PARTITION_MSFT_RECOVERY; +- return 1; +- } +- if (gpt_part_data->atvrecv) +- { +- gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; +- return 1; +- } +- if (gpt_part_data->irst) +- { +- gpt_part_data->type = PARTITION_IRST_GUID; +- return 1; +- } +- if (gpt_part_data->chromeos_kernel) +- { +- gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; +- return 1; +- } +- if (gpt_part_data->bls_boot) +- { +- gpt_part_data->type = PARTITION_BLS_BOOT_GUID; +- return 1; +- } +- + if (fs_type) + { + if (strncmp (fs_type->name, "fat", 3) == 0 +@@ -1657,247 +1554,18 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + PED_ASSERT (part->disk_specific != NULL); + gpt_part_data = part->disk_specific; + ++ const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); ++ if (p) ++ { ++ if (state) ++ gpt_part_data->type = p->type_uuid; ++ else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) ++ gpt_part_data->type = PARTITION_LINUX_DATA_GUID; ++ return 1; ++ } ++ + switch (flag) + { +- case PED_PARTITION_ESP: +- case PED_PARTITION_BOOT: +- gpt_part_data->boot = state; +- if (state) +- gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_BIOS_GRUB: +- gpt_part_data->bios_grub = state; +- if (state) +- gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->boot +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_RAID: +- gpt_part_data->raid = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_LVM: +- gpt_part_data->lvm = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->swap +- = gpt_part_data->raid +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_SWAP: +- gpt_part_data->swap = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->lvm +- = gpt_part_data->raid +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_HPSERVICE: +- gpt_part_data->hp_service = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_MSFT_RESERVED: +- gpt_part_data->msftres = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_MSFT_DATA: +- gpt_part_data->msftres = state; +- if (state) { +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- gpt_part_data->msftdata = 1; +- } else { +- gpt_part_data->msftdata = 0; +- } +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_DIAG: +- gpt_part_data->msftrecv = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftdata +- = gpt_part_data->msftres +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_APPLE_TV_RECOVERY: +- gpt_part_data->atvrecv = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->prep +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->msftrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_PREP: +- gpt_part_data->prep = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->irst +- = gpt_part_data->atvrecv +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->msftrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_IRST: +- gpt_part_data->irst = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->bls_boot +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_CHROMEOS_KERNEL: +- gpt_part_data->chromeos_kernel = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->bios_grub +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->atvrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->bls_boot = 0; +- return gpt_partition_set_system (part, part->fs_type); +- case PED_PARTITION_BLS_BOOT: +- gpt_part_data->bls_boot = state; +- if (state) +- gpt_part_data->boot +- = gpt_part_data->raid +- = gpt_part_data->lvm +- = gpt_part_data->swap +- = gpt_part_data->bios_grub +- = gpt_part_data->hp_service +- = gpt_part_data->msftres +- = gpt_part_data->msftdata +- = gpt_part_data->msftrecv +- = gpt_part_data->prep +- = gpt_part_data->irst +- = gpt_part_data->chromeos_kernel +- = gpt_part_data->atvrecv = 0; +- return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: + gpt_part_data->attributes.RequiredToFunction = state; + return 1; +@@ -1919,41 +1587,16 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + PED_ASSERT (part->disk_specific != NULL); + gpt_part_data = part->disk_specific; + ++ const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); ++ if (p) ++ return guid_cmp (gpt_part_data->type, p->type_uuid) == 0; ++ + switch (flag) + { +- case PED_PARTITION_RAID: +- return gpt_part_data->raid; +- case PED_PARTITION_LVM: +- return gpt_part_data->lvm; +- case PED_PARTITION_ESP: +- case PED_PARTITION_BOOT: +- return gpt_part_data->boot; +- case PED_PARTITION_BIOS_GRUB: +- return gpt_part_data->bios_grub; +- case PED_PARTITION_HPSERVICE: +- return gpt_part_data->hp_service; +- case PED_PARTITION_MSFT_RESERVED: +- return gpt_part_data->msftres; +- case PED_PARTITION_MSFT_DATA: +- return gpt_part_data->msftdata; +- case PED_PARTITION_DIAG: +- return gpt_part_data->msftrecv; +- case PED_PARTITION_APPLE_TV_RECOVERY: +- return gpt_part_data->atvrecv; + case PED_PARTITION_HIDDEN: + return gpt_part_data->attributes.RequiredToFunction; + case PED_PARTITION_LEGACY_BOOT: + return gpt_part_data->attributes.LegacyBIOSBootable; +- case PED_PARTITION_PREP: +- return gpt_part_data->prep; +- case PED_PARTITION_IRST: +- return gpt_part_data->irst; +- case PED_PARTITION_BLS_BOOT: +- return gpt_part_data->bls_boot; +- case PED_PARTITION_SWAP: +- return gpt_part_data->swap; +- case PED_PARTITION_CHROMEOS_KERNEL: +- return gpt_part_data->chromeos_kernel; + case PED_PARTITION_LBA: + case PED_PARTITION_ROOT: + default: +@@ -1966,25 +1609,13 @@ static int + gpt_partition_is_flag_available (const PedPartition *part, + PedPartitionFlag flag) + { ++ if (gpt_find_flag_uuid_mapping (flag)) ++ return 1; ++ + switch (flag) + { +- case PED_PARTITION_RAID: +- case PED_PARTITION_LVM: +- case PED_PARTITION_SWAP: +- case PED_PARTITION_BOOT: +- case PED_PARTITION_BIOS_GRUB: +- case PED_PARTITION_HPSERVICE: +- case PED_PARTITION_MSFT_RESERVED: +- case PED_PARTITION_MSFT_DATA: +- case PED_PARTITION_DIAG: +- case PED_PARTITION_APPLE_TV_RECOVERY: + case PED_PARTITION_HIDDEN: + case PED_PARTITION_LEGACY_BOOT: +- case PED_PARTITION_PREP: +- case PED_PARTITION_IRST: +- case PED_PARTITION_ESP: +- case PED_PARTITION_CHROMEOS_KERNEL: +- case PED_PARTITION_BLS_BOOT: + return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: +-- +2.31.1 + diff --git a/0040-gpt-Add-linux-home-flag.patch b/0040-gpt-Add-linux-home-flag.patch new file mode 100644 index 0000000..ba1c391 --- /dev/null +++ b/0040-gpt-Add-linux-home-flag.patch @@ -0,0 +1,72 @@ +From 6ef2f88d014f267157d9e9300b31c5f1ab4d5e42 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Thu, 30 Sep 2021 13:49:30 -0700 +Subject: [PATCH 40/43] gpt: Add linux-home flag + +This sets the partition GUID to the linux home type: +933AC7E1-2EB4-4F13-B844-0E14E2AEF915 + +Signed-off-by: Brian C. Lane +--- + include/parted/disk.in.h | 5 +++-- + libparted/disk.c | 2 ++ + libparted/labels/gpt.c | 5 +++++ + 3 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index 7ca6453..303f59c 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -84,10 +84,11 @@ enum _PedPartitionFlag { + PED_PARTITION_IRST=17, + PED_PARTITION_ESP=18, + PED_PARTITION_CHROMEOS_KERNEL=19, +- PED_PARTITION_BLS_BOOT=20 ++ PED_PARTITION_BLS_BOOT=20, ++ PED_PARTITION_LINUX_HOME=21, + }; + #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT ++#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +diff --git a/libparted/disk.c b/libparted/disk.c +index 345b9e7..8496fc0 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -2411,6 +2411,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) + return N_("chromeos_kernel"); + case PED_PARTITION_BLS_BOOT: + return N_("bls_boot"); ++ case PED_PARTITION_LINUX_HOME: ++ return N_("linux-home"); + + default: + ped_exception_throw ( +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 3ba3cee..8b345d5 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -164,6 +164,10 @@ typedef struct + ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \ + PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ + { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) ++#define PARTITION_LINUX_HOME_GUID \ ++ ((efi_guid_t) { PED_CPU_TO_LE32 (0x933ac7e1), PED_CPU_TO_LE16 (0x2eb4), \ ++ PED_CPU_TO_LE16 (0x4f13), 0xb8, 0x44, \ ++ { 0x0e, 0x14, 0xe2, 0xae, 0xf9, 0x15 }}) + + struct flag_uuid_mapping_t + { +@@ -182,6 +186,7 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] = + { PED_PARTITION_ESP, PARTITION_SYSTEM_GUID }, + { PED_PARTITION_HPSERVICE, PARTITION_HPSERVICE_GUID }, + { PED_PARTITION_IRST, PARTITION_IRST_GUID }, ++ { PED_PARTITION_LINUX_HOME, PARTITION_LINUX_HOME_GUID }, + { PED_PARTITION_LVM, PARTITION_LVM_GUID }, + { PED_PARTITION_MSFT_DATA, PARTITION_BASIC_DATA_GUID }, + { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RESERVED_GUID }, +-- +2.31.1 + diff --git a/0041-doc-Document-gpt-linux-home-flag.patch b/0041-doc-Document-gpt-linux-home-flag.patch new file mode 100644 index 0000000..762872a --- /dev/null +++ b/0041-doc-Document-gpt-linux-home-flag.patch @@ -0,0 +1,42 @@ +From 87d78ee78ca8d09de0d4850280cfd0ea9d9662fd Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 30 Sep 2021 13:46:40 -0700 +Subject: [PATCH 41/43] doc: Document gpt linux-home flag + +--- + doc/C/parted.8 | 3 ++- + doc/parted.texi | 4 ++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 46b30ad..afca9f2 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -118,7 +118,8 @@ or an LVM logical volume if necessary. + .B set \fIpartition\fP \fIflag\fP \fIstate\fP + Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. + Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", +-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo". ++"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home", ++and "palo". + \fIstate\fP should be either "on" or "off". + .TP + .B unit \fIunit\fP +diff --git a/doc/parted.texi b/doc/parted.texi +index 57ceb55..4344328 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -904,6 +904,10 @@ MS Windows ME based operating systems to use Linear (LBA) mode. + (Mac) - this flag should be enabled if the partition is the root device + to be used by Linux. + ++@item linux-home ++(GPT) - Enable this to indicate that the selected partition is a ++Linux /home partition. ++ + @item swap + (MS-DOS, GPT, Mac) - this flag should be enabled if the partition is the + swap device to be used by Linux. +-- +2.31.1 + diff --git a/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch b/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch new file mode 100644 index 0000000..cd4f652 --- /dev/null +++ b/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch @@ -0,0 +1,144 @@ +From 10ad2aac0453f10b2e355a0df03618e0ebc593be Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 29 Sep 2021 15:57:50 -0700 +Subject: [PATCH 42/43] tests: Add a test to make sure GPT GUIDs default to + filesystem + +When no flag is set on a GPT partition the GUID should fall back to the +filesystem type for fat32, swap, and hfs+ and if no filesystem is found +it should default to linux filesystem data type, showing no filesystem +and no flags. +--- + tests/Makefile.am | 1 + + tests/t3210-gpt-type-change.sh | 107 +++++++++++++++++++++++++++++++++ + 2 files changed, 108 insertions(+) + create mode 100755 tests/t3210-gpt-type-change.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 3dc6e72..5cb7aa3 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -60,6 +60,7 @@ TESTS = \ + t3000-resize-fs.sh \ + t3200-resize-partition.sh \ + t3200-type-change.sh \ ++ t3210-gpt-type-change.sh \ + t3300-palo-prep.sh \ + t3310-flags.sh \ + t3400-whole-disk-FAT-partition.sh \ +diff --git a/tests/t3210-gpt-type-change.sh b/tests/t3210-gpt-type-change.sh +new file mode 100755 +index 0000000..57000d9 +--- /dev/null ++++ b/tests/t3210-gpt-type-change.sh +@@ -0,0 +1,107 @@ ++#!/bin/sh ++# Ensure parted changes GUID back to match its FS. ++ ++# Copyright (C) 2021 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++require_scsi_debug_module_ ++ ++grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || ++ skip_ 'this system lacks a new-enough libblkid' ++ ++# What filesystem tools are present? ++FSTYPES="" ++ ++# Is mkfs.hfsplus available? ++mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+" ++ ++# Is mkfs.vfat available? ++mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32" ++ ++# Is mkswap available? ++mkswap -V 2>&1 | grep '^mkswap' && FSTYPES="$FSTYPES linux-swap" ++ ++[ -n "$FSTYPES" ] || skip_ "No supported filesystem tools (vfat, hfs+, swap) installed" ++ ++ ++# create memory-backed device ++scsi_debug_setup_ dev_size_mb=25 > dev-name || ++ skip_ 'failed to create scsi_debug device' ++scsi_dev=$(cat dev-name) ++ ++# Create a formatted partition. ++# Set a different partition type on it, eg. lvm, then unset it. ++# The partition flag should return to the detected filesystem type. ++ ++for fs_type in $FSTYPES; do ++ echo "fs_type=$fs_type" ++ ++ ++ parted -s $scsi_dev mklabel gpt mkpart first $fs_type 1MB 25MB > out 2>&1 || fail=1 ++ # expect no output ++ compare /dev/null out || fail=1 ++ ++ p1=${scsi_dev}1 ++ wait_for_dev_to_appear_ $p1 || fail=1 ++ ++ case $fs_type in ++ fat32) mkfs.vfat $p1 || fail=1 ;; ++ hfs*) mkfs.hfsplus $p1 || fail=1;; ++ linux-swap) mkswap $p1 || fail=1;; ++ *) error "internal error: unhandled fs type: $fs_type";; ++ esac ++ ++ # Confirm the filesystem and flags are as expected ++ parted -s $scsi_dev u s p > out || fail=1 ++ case $fs_type in ++ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;; ++ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;; ++ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;; ++ *) error "internal error: unhandled fs type: $fs_type";; ++ esac ++ ++ # Set the lvm GUID on the partition ++ parted -s $scsi_dev set 1 lvm on > out 2>&1 || fail=1 ++ # expect no output ++ compare /dev/null out || fail=1 ++ ++ # Confirm filesystem probe is the same, but flags are now lvm ++ parted -s $scsi_dev u s p > out || fail=1 ++ case $fs_type in ++ fat32) grep 'fat16.*lvm$' out || { fail=1; cat out; } ;; ++ hfs*) grep 'hfs+.*lvm$' out || { fail=1; cat out; } ;; ++ linux-swap) grep 'linux-swap.*lvm$' out || { fail=1; cat out; } ;; ++ *) error "internal error: unhandled fs type: $fs_type";; ++ esac ++ ++ # Unset the lvm GUID on both partitions ++ parted -s $scsi_dev set 1 lvm off > out 2>&1 || fail=1 ++ # expect no output ++ compare /dev/null out || fail=1 ++ ++ # Confirm the filesystem and flags are as expected ++ parted -s $scsi_dev u s p > out || fail=1 ++ case $fs_type in ++ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;; ++ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;; ++ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;; ++ *) error "internal error: unhandled fs type: $fs_type";; ++ esac ++done ++ ++Exit $fail +-- +2.31.1 + diff --git a/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch b/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch new file mode 100644 index 0000000..756de73 --- /dev/null +++ b/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch @@ -0,0 +1,25 @@ +From a1f8bcde22bbd97ef7abae3c83ede77fc25a301c Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 30 Sep 2021 13:16:12 -0700 +Subject: [PATCH 43/43] gpt: Revert to filesystem GUID when setting flag to off + +--- + libparted/labels/gpt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 8b345d5..c5d7bb3 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -1565,7 +1565,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + if (state) + gpt_part_data->type = p->type_uuid; + else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) +- gpt_part_data->type = PARTITION_LINUX_DATA_GUID; ++ return gpt_partition_set_system (part, part->fs_type); + return 1; + } + +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 55d6617..2e49bf8 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -49,6 +49,12 @@ Patch0035: 0035-hurd-Fix-partition-paths.patch Patch0036: 0036-hurd-Support-rumpdisk-based-device-names.patch Patch0037: 0037-hurd-Implement-partition-table-rereading.patch Patch0038: 0038-keep-GUID-specific-attributes.patch +Patch0039: 0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch +Patch0040: 0040-gpt-Add-linux-home-flag.patch +Patch0041: 0041-doc-Document-gpt-linux-home-flag.patch +Patch0042: 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch +Patch0043: 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -152,6 +158,13 @@ make check %changelog +* Wed Oct 06 2021 Brian C. Lane - 3.4-10 +- gpt: Revert to filesystem GUID when setting flag to off (bcl) +- tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) +- doc: Document gpt linux-home flag (bcl) +- gpt: Add linux-home flag (aschnell) +- gpt: Map PED_PARTITON_ flags to GUID values (aschnell) + * Thu Sep 23 2021 Brian C. Lane - 3.4-9 - keep GUID specific attributes (aschnell) - hurd: Implement partition table rereading (cjwatson) From ece299beb7c2c999b3d04eeec2b5f9cf45683050 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 6 Oct 2021 15:55:47 -0700 Subject: [PATCH 28/60] - docs: Update documentation to be consistent --- ...pdate-documentation-to-be-consistent.patch | 459 ++++++++++++++++++ parted.spec | 4 + 2 files changed, 463 insertions(+) create mode 100644 0044-docs-Update-documentation-to-be-consistent.patch diff --git a/0044-docs-Update-documentation-to-be-consistent.patch b/0044-docs-Update-documentation-to-be-consistent.patch new file mode 100644 index 0000000..0a8e87d --- /dev/null +++ b/0044-docs-Update-documentation-to-be-consistent.patch @@ -0,0 +1,459 @@ +From b20227adf5756617076c9e2ec267ee6794a21e22 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 28 Sep 2021 16:37:43 -0700 +Subject: [PATCH] docs: Update documentation to be consistent + +This fixes some missing commands in the parted.texi file used to +generate the web manual and info document. It also removes documentation +for the never-implemented 'print NUMBER' command which only returns 1. + +The parted manpage has been updated to document the available print +options, disk_set, and disk_toggle commands. +--- + doc/C/parted.8 | 16 ++++- + doc/parted.texi | 185 +++++++++++++++++++++++++++++++++++------------- + parted/parted.c | 4 +- + 3 files changed, 149 insertions(+), 56 deletions(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index afca9f2..c742154 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -1,4 +1,4 @@ +-.TH PARTED 8 "2007 March 29" parted "GNU Parted Manual" ++.TH PARTED 8 "2021 September 28" parted "GNU Parted Manual" + .SH NAME + parted \- a partition manipulation program + .SH SYNOPSIS +@@ -24,7 +24,7 @@ lists partition layout on all block devices + .B -m, --machine + displays machine parseable output + .TP +-.B -m, --json ++.B -j, --json + displays JSON output + .TP + .B -s, --script +@@ -92,8 +92,9 @@ PC98, and GPT disklabels. The name can be placed in double quotes, if necessary. + And depending on the shell may need to also be wrapped in single quotes so that + the shell doesn't strip off the double quotes. + .TP +-.B print ++.B print \fIprint-type\fP + Display the partition table. ++\fIprint-type\fP is optional, and can be one of devices, free, list, or all. + .TP + .B quit + Exit from \fBparted\fP. +@@ -133,6 +134,15 @@ human-friendly form for output). + .B toggle \fIpartition\fP \fIflag\fP + Toggle the state of \fIflag\fP on \fIpartition\fP. + .TP ++.B disk_set \fIflag\fP \fIstate\fP ++Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off". ++Some or all of these flags will be available, depending on what disk label you ++are using. Supported flags are: "pmbr_boot" on GPT to enable the boot flag on the ++GPT's protective MBR partition. ++.TP ++.B disk_toggle \fIflag\fP ++Toggle the state of the disk \fIflag\fP. ++.TP + .B version + Display version information and a copyright message. + .RE +diff --git a/doc/parted.texi b/doc/parted.texi +index 4344328..bc981de 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -14,7 +14,7 @@ and manipulating partition tables. + @ifnottex @c texi2pdf don't understand copying and insertcopying ??? + @c modifications must also be done in the titlepage + @copying +-Copyright @copyright{} 1999--2014, 2019--2021 Free Software Foundation, Inc. ++Copyright @copyright{} 1999--2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 or +@@ -46,7 +46,7 @@ Free Documentation License''. + @c @vskip 0pt plus 1filll + + @c modifications must also be done in the copying block +-Copyright @copyright{} 1999-2011 Free Software Foundation, Inc. ++Copyright @copyright{} 1999-2021 Free Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 or +@@ -117,9 +117,9 @@ power failure) and performs many safety checks. However, there could + be bugs in GNU Parted, so you should back up your important files before + running Parted. + +-The GNU Parted homepage is @uref{http://www.gnu.org/software/parted}. The ++The GNU Parted homepage is @uref{https://www.gnu.org/software/parted}. The + library and frontend themselves can be downloaded from +-@uref{ftp://ftp.gnu.org/gnu/parted}. ++@uref{https://ftp.gnu.org/gnu/parted}. + You can also find a listing of mailing lists, notes for contributing and + more useful information on the web site. + +@@ -129,7 +129,7 @@ Please include the output from these commands (for disk @file{/dev/hda}): + + @example + @group +-# @kbd{parted /dev/hda print unit s print unit chs print} ++# @kbd{parted /dev/hda unit s print free} + @end group + @end example + +@@ -157,6 +157,14 @@ installed: + + @itemize @bullet + ++@item GNU parted source is available either as a source tarball: ++ ++ @uref{https://git.savannah.gnu.org/gitweb/?p=parted.git} ++ ++or using git (See the README-hacking instructions): ++ ++ @uref{https://git.savannah.gnu.org/gitweb/?p=parted.git} ++ + @item libuuid, part of the e2fsprogs package. If you don't have this, + you can get it from: + +@@ -167,7 +175,7 @@ If you want to compile Parted and e2fsprogs, note that you will need to + + @item GNU Readline (optional), available from + +- @uref{ftp://ftp.gnu.org/gnu/readline} ++ @uref{https://ftp.gnu.org/gnu/readline} + + If you are compiling Parted, and you don't have readline, you can + disable Parted's readline support with the @kbd{--disable-readline} +@@ -176,7 +184,7 @@ option for @command{configure}. + @item GNU gettext (or compatible software) for compilation, if + internationalisation support is desired. + +- @uref{ftp://ftp.gnu.org/gnu/gettext} ++ @uref{https://ftp.gnu.org/gnu/gettext} + + @end itemize + +@@ -259,7 +267,7 @@ disable writing (for debugging) + @subsection Introduction + If you want to run GNU Parted on a machine without GNU/Linux installed, + or you want to modify a root or boot partition, use GParted Live: +-@uref{http://gparted.sourceforge.net/livecd.php}. ++@uref{https://gparted.org/livecd.php}. + + @node Using Parted + @chapter Using Parted +@@ -402,6 +410,10 @@ Options: + @itemx --help + display a help message + ++@item -l ++@itemx --list ++lists partition layout on all block devices ++ + @item -m + @itemx --machine + display output in machine parseable format +@@ -416,7 +428,7 @@ never prompt the user + + @item -f + @itemx --fix +-automatically answer exceptions with "fix" in script mode, whcih is useful for: ++automatically answer exceptions with "fix" in script mode, which is useful for: + GPT header not including full disk size; moving the backup GPT table to the end of the disk; + MAC fix missing partition map entry; etc. + +@@ -441,6 +453,7 @@ GNU Parted provides the following commands: + @menu + * align-check:: + * disk_set:: ++* disk_toggle:: + * help:: + * mklabel:: + * mkpart:: +@@ -452,6 +465,7 @@ GNU Parted provides the following commands: + * rm:: + * select:: + * set:: ++* toggle:: + * unit:: + @end menu + +@@ -515,6 +529,16 @@ in machine mode. + Set the PMBR's boot flag. + @end deffn + ++@node disk_toggle ++@subsection disk_toggle ++@cindex disk_toggle, command description ++@cindex command description, disk_toggle ++ ++@deffn Command disk_toggle @var{flag} ++ ++Toggle the state of the disk flag. ++@end deffn ++ + @node help + @subsection help + @cindex help, command description +@@ -551,9 +575,12 @@ thing: partition table, partition map.} + + @var{label-type} must be one of these supported disk labels: + @itemize @bullet ++@item aix ++@item amiga + @item bsd +-@item loop (raw disk access) ++@item dvh + @item gpt ++@item loop (raw disk access) + @item mac + @item msdos + @item pc98 +@@ -594,14 +621,19 @@ partition table. + + @var{fs-type} must be one of these supported file systems: + @itemize @bullet +-@item ext2 ++@item btrfs ++@item ext2, ext3, ext4 + @item fat16, fat32 + @item hfs, hfs+, hfsx +-@item linux-swap +-@item NTFS ++@item hp-ufs ++@item jfs ++@item linux-swap, linux-swap(new,old,v0,v1) ++@item nilfs2 ++@item ntfs + @item reiserfs ++@item sun-ufs + @item ufs +-@item btrfs ++@item xfs + @end itemize + + For example, the following creates a logical partition that will contain +@@ -671,29 +703,56 @@ Set the name of partition 2 to `Secret Documents'. + @cindex print, command description + @cindex command description, print + +-@deffn Command print [@var{number}] ++@deffn Command print [@var{print-type}] + + Displays the partition table on the device parted is editing, or + detailed information about a particular partition. + ++@var{print-type} is optional, and can be one of @samp{devices}, ++@samp{free}, @samp{list}, or @samp{all}. ++ ++@table @code ++ ++@item devices ++display all active block devices ++ ++@item free ++display information about free unpartitioned space on the current block device ++ ++@item list, all ++display the partition tables of all active block devices ++ ++@end table ++ + Example: + + @example + @group + (parted) @kbd{print} +-Disk geometry for /dev/hda: 0.000-2445.679 megabytes +-Disk label type: msdos +-Minor Start End Type Filesystem Flags +-1 0.031 945.000 primary fat32 boot, lba +-2 945.000 2358.562 primary ext2 +-3 2358.562 2445.187 primary linux-swap +-(parted) @kbd{print 1} +-Minor: 1 +-Flags: boot, lba +-File System: fat32 +-Size: 945.000Mb (0%) +-Minimum size: 84.361Mb (0%) +-Maximum size: 2445.679Mb (100%) ++Model: ATA Samsung SSD 850 (scsi) ++Disk /dev/sda: 2684MB ++Sector size (logical/physical): 512B/512B ++Partition Table: msdos ++Disk Flags: ++ ++Number Start End Size Type File system Flags ++ 1 1049kB 1000MB 999MB primary boot, lba ++ 2 1000MB 2300MB 1299MB primary ext2 lba ++ 3 2300MB 2500MB 200MB primary linux-swap(v1) lba ++(parted) @kbd{print free} ++Model: ATA Samsung SSD 850 (scsi) ++Disk /dev/sda: 2684MB ++Sector size (logical/physical): 512B/512B ++Partition Table: msdos ++Disk Flags: ++ ++Number Start End Size Type File system Flags ++ 16.4kB 1049kB 1032kB Free Space ++ 1 1049kB 1000MB 999MB primary boot, lba ++ 2 1000MB 2300MB 1299MB primary ext2 lba ++ 3 2300MB 2500MB 200MB primary linux-swap(v1) lba ++ 2500MB 2684MB 185MB Free Space ++ + @end group + @end example + @end deffn +@@ -728,43 +787,58 @@ may delay this. + Rescue a lost partition that used to be located approximately between + @var{start} and @var{end}. If such a partition is found, Parted will + ask you if you want to create a partition for it. This is useful if you +-accidently deleted a partition with parted's rm command, for example. ++accidentally deleted a partition with parted's rm command, for example. + + Example: + + @example + (parted) @kbd{print} + @group +-Disk geometry for /dev/hdc: 0.000-8063.507 megabytes +-Disk label type: msdos +-Minor Start End Type Filesystem Flags +-1 0.031 8056.032 primary ext3 ++Model: ATA Samsung SSD 850 (scsi) ++Disk /dev/sda: 2684MB ++Sector size (logical/physical): 512B/512B ++Partition Table: msdos ++Disk Flags: ++ ++Number Start End Size Type File system Flags ++ 1 1049kB 1000MB 999MB primary boot, lba ++ 2 1000MB 2300MB 1299MB primary ext4 lba + @end group + (parted) @kbd{rm} +-Partition number? 1 ++Partition number? 2 + (parted) @kbd{print} + @group +-Disk geometry for /dev/hdc: 0.000-8063.507 megabytes +-Disk label type: msdos +-Minor Start End Type Filesystem Flags ++Model: ATA Samsung SSD 850 (scsi) ++Disk /dev/sda: 2684MB ++Sector size (logical/physical): 512B/512B ++Partition Table: msdos ++Disk Flags: ++ ++Number Start End Size Type File system Flags ++ 1 1049kB 1000MB 999MB primary boot, lba + @end group + @end example + +-OUCH! We deleted our ext3 partition!!! Parted comes to the rescue... ++OUCH! We deleted our ext4 partition!!! Parted comes to the rescue... + + @example + (parted) @kbd{rescue} +-Start? 0 +-End? 8056 +-Information: A ext3 primary partition was found at 0.031MB -> +-8056.030MB. Do you want to add it to the partition table? ++Start? 1000 ++End? 2684 ++Information: A ext4 primary partition was found at 1000MB -> ++2300MB. Do you want to add it to the partition table? + Yes/No/Cancel? @kbd{y} + (parted) @kbd{print} + @group +-Disk geometry for /dev/hdc: 0.000-8063.507 megabytes +-Disk label type: msdos +-Minor Start End Type Filesystem Flags +-1 0.031 8056.032 primary ext3 ++Model: ATA Samsung SSD 850 (scsi) ++Disk /dev/sda: 2684MB ++Sector size (logical/physical): 512B/512B ++Partition Table: msdos ++Disk Flags: ++ ++Number Start End Size Type File system Flags ++ 1 1049kB 1000MB 999MB primary boot, lba ++ 2 1000MB 2300MB 1299MB primary ext4 lba + @end group + @end example + +@@ -795,7 +869,7 @@ but when shrinking, you need to shrink the filesystem before the partition. + + @deffn Command rm @var{number} + +-Removes the partition with number @var{number}. If you accidently delete ++Removes the partition with number @var{number}. If you accidentally delete + a partition with this command, use mkpart to + recover it. Also, you can use the gpart program (@pxref{Related information}) + to recover damaged disk labels. +@@ -824,8 +898,8 @@ Remove partition 3. + @deffn Command select @var{device} + + Selects the device, @var{device}, for Parted to edit. The device can +-be a Linux hard disk device, a partition, a software RAID device or +-LVM logical volume. ++be a Linux hard disk device, a partition, a software RAID device, ++LVM logical volume, or disk image file. + + Example: + +@@ -949,6 +1023,17 @@ Example: + Set the @samp{boot} flag on partition 1. + @end deffn + ++@node toggle ++@subsection toggle ++@cindex toggle, command description ++@cindex command description, toggle ++ ++@deffn Command toggle @var{number} @var{flag} ++ ++Toggle the state of @var{flag} on partition @var{number}. ++ ++@end deffn ++ + @node unit + @subsection unit + @cindex unit, command description +@@ -1121,7 +1206,7 @@ software + + This manual was based on the file @kbd{USER} included in GNU Parted version + 1.4.22 source distribution. The GNU Parted source distribution is +-available at @uref{ftp.gnu.org/gnu/parted}. ++available at @uref{https://ftp.gnu.org/gnu/parted}. + + Initial Texinfo formatting by Richard M. Kreuter, 2002. + +diff --git a/parted/parted.c b/parted/parted.c +index 975700c..310f011 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -2222,7 +2222,7 @@ command_register (commands, command_create ( + str_list_create_unique ("print", _("print"), NULL), + do_print, + str_list_create ( +-_("print [devices|free|list,all|NUMBER] display the partition table, " ++_("print [devices|free|list,all] display the partition table, " + "available devices, free space, all found partitions, or a particular " + "partition"), + NULL), +@@ -2233,8 +2233,6 @@ _(" devices : display all active block devices\n"), + _(" free : display information about free unpartitioned space on the " + "current block device\n"), + _(" list, all : display the partition tables of all active block devices\n"), +-_(" NUMBER : display more detailed information about this particular " +- "partition\n"), + NULL), 1)); + + command_register (commands, command_create ( +-- +2.31.1 + diff --git a/parted.spec b/parted.spec index 2e49bf8..478bc3f 100644 --- a/parted.spec +++ b/parted.spec @@ -54,6 +54,7 @@ Patch0040: 0040-gpt-Add-linux-home-flag.patch Patch0041: 0041-doc-Document-gpt-linux-home-flag.patch Patch0042: 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch Patch0043: 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch +Patch0044: 0044-docs-Update-documentation-to-be-consistent.patch BuildRequires: gcc @@ -158,6 +159,9 @@ make check %changelog +* Wed Oct 06 2021 Brian C. Lane - 3.4-11 +- docs: Update documentation to be consistent + * Wed Oct 06 2021 Brian C. Lane - 3.4-10 - gpt: Revert to filesystem GUID when setting flag to off (bcl) - tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) From 514b0689bd16a2b0df067c3efe4d30c489a5c875 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jan 2022 22:56:40 +0000 Subject: [PATCH 29/60] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 478bc3f..fa9f9de 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -159,6 +159,9 @@ make check %changelog +* Thu Jan 20 2022 Fedora Release Engineering - 3.4-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Wed Oct 06 2021 Brian C. Lane - 3.4-11 - docs: Update documentation to be consistent From e78da4c42ab1ef0c6e018792b4107959d2df7f6e Mon Sep 17 00:00:00 2001 From: Jay W Date: Fri, 11 Feb 2022 07:45:56 +0000 Subject: [PATCH 30/60] Update parted.spec to allow flatpak builds --- parted.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parted.spec b/parted.spec index fa9f9de..4035c12 100644 --- a/parted.spec +++ b/parted.spec @@ -141,13 +141,13 @@ make check %license COPYING %{_sbindir}/parted %{_sbindir}/partprobe -%{_mandir}/man8/parted.8.gz -%{_mandir}/man8/partprobe.8.gz +%{_mandir}/man8/parted.8* +%{_mandir}/man8/partprobe.8* %{_libdir}/libparted.so.2 %{_libdir}/libparted.so.2.0.3 %{_libdir}/libparted-fs-resize.so.0 %{_libdir}/libparted-fs-resize.so.0.0.3 -%{_infodir}/parted.info.* +%{_infodir}/parted.info* %files devel %doc TODO doc/API doc/FAT From e0dc6bb4b80d4c38608c7f03dc036b96f569206c Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 17 Feb 2022 15:46:48 -0800 Subject: [PATCH 31/60] - gnulib: Use newer cdefs.h from gnulib (bcl) - Update parted.spec to allow flatpak builds --- ...gnulib-Use-newer-cdefs.h-from-gnulib.patch | 542 ++++++++++++++++++ parted.spec | 7 +- 2 files changed, 548 insertions(+), 1 deletion(-) create mode 100644 0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch diff --git a/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch b/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch new file mode 100644 index 0000000..e8b9a2b --- /dev/null +++ b/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch @@ -0,0 +1,542 @@ +From f6b9e09e7207f54a491de827640bb08501d91f91 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 17 Feb 2022 15:34:41 -0800 +Subject: [PATCH] gnulib: Use newer cdefs.h from gnulib + +This uses the one from gnulib commit 9f48fb992a3d7e96 on 2022-02-14 + +This is a temporary workaround for gcc 12 problems on ppc64le, the build +will be filled with errors that look like: + +/usr/include/bits/stdio-ldbl.h:86:1: error: storage class specified for parameter '__sprintf_chk' + 86 | __LDBL_REDIR2_DECL (sprintf_chk) + +without it. +--- + lib/cdefs.h | 307 +++++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 232 insertions(+), 75 deletions(-) + +diff --git a/lib/cdefs.h b/lib/cdefs.h +index 1a2805d..44d3826 100644 +--- a/lib/cdefs.h ++++ b/lib/cdefs.h +@@ -1,17 +1,18 @@ +-/* Copyright (C) 1992-2020 Free Software Foundation, Inc. ++/* Copyright (C) 1992-2022 Free Software Foundation, Inc. ++ Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or +- modify it under the terms of the GNU General Public ++ modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either +- version 3 of the License, or (at your option) any later version. ++ version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- General Public License for more details. ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public ++ You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +@@ -25,7 +26,7 @@ + + /* The GNU libc does not support any K&R compilers or the traditional mode + of ISO C compilers anymore. Check for some of the combinations not +- anymore supported. */ ++ supported anymore. */ + #if defined __GNUC__ && !defined __STDC__ + # error "You need a ISO C conforming compiler to use the glibc headers" + #endif +@@ -34,31 +35,26 @@ + #undef __P + #undef __PMT + +-/* Compilers that are not clang may object to +- #if defined __clang__ && __has_attribute(...) +- even though they do not need to evaluate the right-hand side of the &&. */ +-#if defined __clang__ && defined __has_attribute +-# define __glibc_clang_has_attribute(name) __has_attribute (name) ++/* Compilers that lack __has_attribute may object to ++ #if defined __has_attribute && __has_attribute (...) ++ even though they do not need to evaluate the right-hand side of the &&. ++ Similarly for __has_builtin, etc. */ ++#if (defined __has_attribute \ ++ && (!defined __clang_minor__ \ ++ || 3 < __clang_major__ + (5 <= __clang_minor__))) ++# define __glibc_has_attribute(attr) __has_attribute (attr) + #else +-# define __glibc_clang_has_attribute(name) 0 ++# define __glibc_has_attribute(attr) 0 + #endif +- +-/* Compilers that are not clang may object to +- #if defined __clang__ && __has_builtin(...) +- even though they do not need to evaluate the right-hand side of the &&. */ +-#if defined __clang__ && defined __has_builtin +-# define __glibc_clang_has_builtin(name) __has_builtin (name) ++#ifdef __has_builtin ++# define __glibc_has_builtin(name) __has_builtin (name) + #else +-# define __glibc_clang_has_builtin(name) 0 ++# define __glibc_has_builtin(name) 0 + #endif +- +-/* Compilers that are not clang may object to +- #if defined __clang__ && __has_extension(...) +- even though they do not need to evaluate the right-hand side of the &&. */ +-#if defined __clang__ && defined __has_extension +-# define __glibc_clang_has_extension(ext) __has_extension (ext) ++#ifdef __has_extension ++# define __glibc_has_extension(ext) __has_extension (ext) + #else +-# define __glibc_clang_has_extension(ext) 0 ++# define __glibc_has_extension(ext) 0 + #endif + + #if defined __GNUC__ || defined __clang__ +@@ -74,22 +70,26 @@ + # endif + + /* GCC can always grok prototypes. For C++ programs we add throw() +- to help it optimize the function calls. But this works only with ++ to help it optimize the function calls. But this only works with + gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions + as non-throwing using a function attribute since programs can use + the -fexceptions options for C code as well. */ + # if !defined __cplusplus \ +- && (__GNUC_PREREQ (3, 4) || __glibc_clang_has_attribute (__nothrow__)) ++ && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) + # define __THROW __attribute__ ((__nothrow__ __LEAF)) + # define __THROWNL __attribute__ ((__nothrow__)) + # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct + # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct + # else + # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) +-# define __THROW throw () +-# define __THROWNL throw () +-# define __NTH(fct) __LEAF_ATTR fct throw () +-# define __NTHNL(fct) fct throw () ++# if __cplusplus >= 201103L ++# define __THROW noexcept (true) ++# else ++# define __THROW throw () ++# endif ++# define __THROWNL __THROW ++# define __NTH(fct) __LEAF_ATTR fct __THROW ++# define __NTHNL(fct) fct __THROW + # else + # define __THROW + # define __THROWNL +@@ -142,24 +142,68 @@ + #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) + #define __bos0(ptr) __builtin_object_size (ptr, 0) + ++/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ ++#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ ++ || __GNUC_PREREQ (12, 0)) ++# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) ++# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) ++#else ++# define __glibc_objsize0(__o) __bos0 (__o) ++# define __glibc_objsize(__o) __bos (__o) ++#endif ++ ++/* Compile time conditions to choose between the regular, _chk and _chk_warn ++ variants. These conditions should get evaluated to constant and optimized ++ away. */ ++ ++#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) ++#define __glibc_unsigned_or_positive(__l) \ ++ ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ ++ || (__builtin_constant_p (__l) && (__l) > 0)) ++ ++/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ ++ condition can be folded to a constant and if it is true. The -1 check is ++ redundant because since it implies that __glibc_safe_len_cond is true. */ ++#define __glibc_safe_or_unknown_len(__l, __s, __osz) \ ++ (__glibc_unsigned_or_positive (__l) \ ++ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ ++ __s, __osz)) \ ++ && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) ++ ++/* Conversely, we know at compile time that the length is unsafe if the ++ __L * __S <= __OBJSZ condition can be folded to a constant and if it is ++ false. */ ++#define __glibc_unsafe_len(__l, __s, __osz) \ ++ (__glibc_unsigned_or_positive (__l) \ ++ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ ++ __s, __osz)) \ ++ && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) ++ ++/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be ++ declared. */ ++ ++#define __glibc_fortify(f, __l, __s, __osz, ...) \ ++ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ++ ? __ ## f ## _alias (__VA_ARGS__) \ ++ : (__glibc_unsafe_len (__l, __s, __osz) \ ++ ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ ++ : __ ## f ## _chk (__VA_ARGS__, __osz))) \ ++ ++/* Fortify function f, where object size argument passed to f is the number of ++ elements and not total size. */ ++ ++#define __glibc_fortify_n(f, __l, __s, __osz, ...) \ ++ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ ++ ? __ ## f ## _alias (__VA_ARGS__) \ ++ : (__glibc_unsafe_len (__l, __s, __osz) \ ++ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ ++ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ ++ + #if __GNUC_PREREQ (4,3) +-# define __warndecl(name, msg) \ +- extern void name (void) __attribute__((__warning__ (msg))) + # define __warnattr(msg) __attribute__((__warning__ (msg))) + # define __errordecl(name, msg) \ + extern void name (void) __attribute__((__error__ (msg))) +-#elif __glibc_clang_has_attribute (__diagnose_if__) && 0 +-/* These definitions are not enabled, because they produce bogus warnings +- in the glibc Fortify functions. These functions are written in a style +- that works with GCC. In order to work with clang, these functions would +- need to be modified. */ +-# define __warndecl(name, msg) \ +- extern void name (void) __attribute__((__diagnose_if__ (1, msg, "warning"))) +-# define __warnattr(msg) __attribute__((__diagnose_if__ (1, msg, "warning"))) +-# define __errordecl(name, msg) \ +- extern void name (void) __attribute__((__diagnose_if__ (1, msg, "error"))) + #else +-# define __warndecl(name, msg) extern void name (void) + # define __warnattr(msg) + # define __errordecl(name, msg) extern void name (void) + #endif +@@ -233,7 +277,7 @@ + /* At some point during the gcc 2.96 development the `malloc' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +-#if __GNUC_PREREQ (2,96) || __glibc_clang_has_attribute (__malloc__) ++#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) + # define __attribute_malloc__ __attribute__ ((__malloc__)) + #else + # define __attribute_malloc__ /* Ignore */ +@@ -248,26 +292,41 @@ + # define __attribute_alloc_size__(params) /* Ignore. */ + #endif + ++/* Tell the compiler which argument to an allocation function ++ indicates the alignment of the allocation. */ ++#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__) ++# define __attribute_alloc_align__(param) \ ++ __attribute__ ((__alloc_align__ param)) ++#else ++# define __attribute_alloc_align__(param) /* Ignore. */ ++#endif ++ + /* At some point during the gcc 2.96 development the `pure' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +-#if __GNUC_PREREQ (2,96) || __glibc_clang_has_attribute (__pure__) ++#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) + # define __attribute_pure__ __attribute__ ((__pure__)) + #else + # define __attribute_pure__ /* Ignore */ + #endif + + /* This declaration tells the compiler that the value is constant. */ +-#if __GNUC_PREREQ (2,5) || __glibc_clang_has_attribute (__const__) ++#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) + # define __attribute_const__ __attribute__ ((__const__)) + #else + # define __attribute_const__ /* Ignore */ + #endif + ++#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) ++# define __attribute_maybe_unused__ __attribute__ ((__unused__)) ++#else ++# define __attribute_maybe_unused__ /* Ignore */ ++#endif ++ + /* At some point during the gcc 3.1 development the `used' attribute + for functions was introduced. We don't want to use it unconditionally + (although this would be possible) since it generates warnings. */ +-#if __GNUC_PREREQ (3,1) || __glibc_clang_has_attribute (__used__) ++#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) + # define __attribute_used__ __attribute__ ((__used__)) + # define __attribute_noinline__ __attribute__ ((__noinline__)) + #else +@@ -276,7 +335,7 @@ + #endif + + /* Since version 3.2, gcc allows marking deprecated functions. */ +-#if __GNUC_PREREQ (3,2) || __glibc_clang_has_attribute (__deprecated__) ++#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) + # define __attribute_deprecated__ __attribute__ ((__deprecated__)) + #else + # define __attribute_deprecated__ /* Ignore */ +@@ -285,8 +344,8 @@ + /* Since version 4.5, gcc also allows one to specify the message printed + when a deprecated function is used. clang claims to be gcc 4.2, but + may also support this feature. */ +-#if __GNUC_PREREQ (4,5) || \ +- __glibc_clang_has_extension (__attribute_deprecated_with_message__) ++#if __GNUC_PREREQ (4,5) \ ++ || __glibc_has_extension (__attribute_deprecated_with_message__) + # define __attribute_deprecated_msg__(msg) \ + __attribute__ ((__deprecated__ (msg))) + #else +@@ -299,7 +358,7 @@ + If several `format_arg' attributes are given for the same function, in + gcc-3.0 and older, all but the last one are ignored. In newer gccs, + all designated arguments are considered. */ +-#if __GNUC_PREREQ (2,8) || __glibc_clang_has_attribute (__format_arg__) ++#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) + # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) + #else + # define __attribute_format_arg__(x) /* Ignore */ +@@ -309,7 +368,7 @@ + attribute for functions was introduced. We don't want to use it + unconditionally (although this would be possible) since it + generates warnings. */ +-#if __GNUC_PREREQ (2,97) || __glibc_clang_has_attribute (__format__) ++#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) + # define __attribute_format_strfmon__(a,b) \ + __attribute__ ((__format__ (__strfmon__, a, b))) + #else +@@ -317,19 +376,33 @@ + #endif + + /* The nonnull function attribute marks pointer parameters that +- must not be NULL. Do not define __nonnull if it is already defined, +- for portability when this file is used in Gnulib. */ ++ must not be NULL. This has the name __nonnull in glibc, ++ and __attribute_nonnull__ in files shared with Gnulib to avoid ++ collision with a different __nonnull in DragonFlyBSD 5.9. */ ++#ifndef __attribute_nonnull__ ++# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) ++# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) ++# else ++# define __attribute_nonnull__(params) ++# endif ++#endif + #ifndef __nonnull +-# if __GNUC_PREREQ (3,3) || __glibc_clang_has_attribute (__nonnull__) +-# define __nonnull(params) __attribute__ ((__nonnull__ params)) ++# define __nonnull(params) __attribute_nonnull__ (params) ++#endif ++ ++/* The returns_nonnull function attribute marks the return type of the function ++ as always being non-null. */ ++#ifndef __returns_nonnull ++# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) ++# define __returns_nonnull __attribute__ ((__returns_nonnull__)) + # else +-# define __nonnull(params) ++# define __returns_nonnull + # endif + #endif + + /* If fortification mode, we warn about unused results of certain + function calls which can lead to problems. */ +-#if __GNUC_PREREQ (3,4) || __glibc_clang_has_attribute (__warn_unused_result__) ++#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) + # define __attribute_warn_unused_result__ \ + __attribute__ ((__warn_unused_result__)) + # if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 +@@ -343,7 +416,7 @@ + #endif + + /* Forces a function to be always inlined. */ +-#if __GNUC_PREREQ (3,2) || __glibc_clang_has_attribute (__always_inline__) ++#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) + /* The Linux kernel defines __always_inline in stddef.h (283d7573), and + it conflicts with this definition. Therefore undefine it first to + allow either header to be included first. */ +@@ -356,7 +429,7 @@ + + /* Associate error messages with the source location of the call site rather + than with the source location inside the function. */ +-#if __GNUC_PREREQ (4,3) || __glibc_clang_has_attribute (__artificial__) ++#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) + # define __attribute_artificial__ __attribute__ ((__artificial__)) + #else + # define __attribute_artificial__ /* Ignore */ +@@ -433,7 +506,7 @@ + # endif + #endif + +-#if (__GNUC__ >= 3) || __glibc_clang_has_builtin (__builtin_expect) ++#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) + # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) + # define __glibc_likely(cond) __builtin_expect ((cond), 1) + #else +@@ -441,12 +514,6 @@ + # define __glibc_likely(cond) (cond) + #endif + +-#ifdef __has_attribute +-# define __glibc_has_attribute(attr) __has_attribute (attr) +-#else +-# define __glibc_has_attribute(attr) 0 +-#endif +- + #if (!defined _Noreturn \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && !(__GNUC_PREREQ (4,7) \ +@@ -467,6 +534,16 @@ + # define __attribute_nonstring__ + #endif + ++/* Undefine (also defined in libc-symbols.h). */ ++#undef __attribute_copy__ ++#if __GNUC_PREREQ (9, 0) ++/* Copies attributes from the declaration or type referenced by ++ the argument. */ ++# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) ++#else ++# define __attribute_copy__(arg) ++#endif ++ + #if (!defined _Static_assert && !defined __cplusplus \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ + && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ +@@ -476,14 +553,44 @@ + [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] + #endif + +-/* The #ifndef lets Gnulib avoid including these on non-glibc +- platforms, where the includes typically do not exist. */ +-#ifndef __WORDSIZE ++/* Gnulib avoids including these, as they don't work on non-glibc or ++ older glibc platforms. */ ++#ifndef __GNULIB_CDEFS + # include + # include + #endif + +-#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH ++#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 ++# ifdef __REDIRECT ++ ++/* Alias name defined automatically. */ ++# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir ++# define __LDBL_REDIR_DECL(name) \ ++ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); ++ ++/* Alias name defined automatically, with leading underscores. */ ++# define __LDBL_REDIR2_DECL(name) \ ++ extern __typeof (__##name) __##name \ ++ __asm (__ASMNAME ("__" #name "ieee128")); ++ ++/* Alias name defined manually. */ ++# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 ++# define __LDBL_REDIR1_DECL(name, alias) \ ++ extern __typeof (name) name __asm (__ASMNAME (#alias)); ++ ++# define __LDBL_REDIR1_NTH(name, proto, alias) \ ++ __REDIRECT_NTH (name, proto, alias) ++# define __REDIRECT_NTH_LDBL(name, proto, alias) \ ++ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) ++ ++/* Unused. */ ++# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl ++# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth ++ ++# else ++_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); ++# endif ++#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH + # define __LDBL_COMPAT 1 + # ifdef __REDIRECT + # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) +@@ -492,6 +599,8 @@ + # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) + # define __LDBL_REDIR_NTH(name, proto) \ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) ++# define __LDBL_REDIR2_DECL(name) \ ++ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); + # define __LDBL_REDIR1_DECL(name, alias) \ + extern __typeof (name) name __asm (__ASMNAME (#alias)); + # define __LDBL_REDIR_DECL(name) \ +@@ -502,11 +611,13 @@ + __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) + # endif + #endif +-#if !defined __LDBL_COMPAT || !defined __REDIRECT ++#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ ++ || !defined __REDIRECT + # define __LDBL_REDIR1(name, proto, alias) name proto + # define __LDBL_REDIR(name, proto) name proto + # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW + # define __LDBL_REDIR_NTH(name, proto) name proto __THROW ++# define __LDBL_REDIR2_DECL(name) + # define __LDBL_REDIR_DECL(name) + # ifdef __REDIRECT + # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) +@@ -537,7 +648,7 @@ + check is required to enable the use of generic selection. */ + #if !defined __cplusplus \ + && (__GNUC_PREREQ (4, 9) \ +- || __glibc_clang_has_extension (c_generic_selections) \ ++ || __glibc_has_extension (c_generic_selections) \ + || (!defined __GNUC__ && defined __STDC_VERSION__ \ + && __STDC_VERSION__ >= 201112L)) + # define __HAVE_GENERIC_SELECTION 1 +@@ -545,4 +656,50 @@ + # define __HAVE_GENERIC_SELECTION 0 + #endif + ++#if __GNUC_PREREQ (10, 0) ++/* Designates a 1-based positional argument ref-index of pointer type ++ that can be used to access size-index elements of the pointed-to ++ array according to access mode, or at least one element when ++ size-index is not provided: ++ access (access-mode, [, ]) */ ++# define __attr_access(x) __attribute__ ((__access__ x)) ++/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may ++ use the access attribute to get object sizes from function definition ++ arguments, so we can't use them on functions we fortify. Drop the object ++ size hints for such functions. */ ++# if __USE_FORTIFY_LEVEL == 3 ++# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o))) ++# else ++# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s)) ++# endif ++# if __GNUC_PREREQ (11, 0) ++# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) ++# else ++# define __attr_access_none(argno) ++# endif ++#else ++# define __fortified_attr_access(a, o, s) ++# define __attr_access(x) ++# define __attr_access_none(argno) ++#endif ++ ++#if __GNUC_PREREQ (11, 0) ++/* Designates dealloc as a function to call to deallocate objects ++ allocated by the declared function. */ ++# define __attr_dealloc(dealloc, argno) \ ++ __attribute__ ((__malloc__ (dealloc, argno))) ++# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) ++#else ++# define __attr_dealloc(dealloc, argno) ++# define __attr_dealloc_free ++#endif ++ ++/* Specify that a function such as setjmp or vfork may return ++ twice. */ ++#if __GNUC_PREREQ (4, 1) ++# define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) ++#else ++# define __attribute_returns_twice__ /* Ignore. */ ++#endif ++ + #endif /* sys/cdefs.h */ +-- +2.34.1 + diff --git a/parted.spec b/parted.spec index 4035c12..8320add 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.4 -Release: 11%{?dist} +Release: 12%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -55,6 +55,7 @@ Patch0041: 0041-doc-Document-gpt-linux-home-flag.patch Patch0042: 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch Patch0043: 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch Patch0044: 0044-docs-Update-documentation-to-be-consistent.patch +Patch0045: 0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch BuildRequires: gcc @@ -159,6 +160,10 @@ make check %changelog +* Thu Feb 17 2022 Brian C. Lane - 3.4-12 +- gnulib: Use newer cdefs.h from gnulib (bcl) +- Update parted.spec to allow flatpak builds + * Thu Jan 20 2022 Fedora Release Engineering - 3.4-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From dc62f3b119a7734a73414ec4a19c27e4502b03af Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 30 Mar 2022 10:26:37 -0700 Subject: [PATCH 32/60] - Upstream 3.4.64 Alpha release - Dropped all patches included in new upstream release - Bumped minor version on libparted.so and libparted-fs-resize.so --- .gitignore | 2 + ...parted-add-fix-to-fix-in-script-mode.patch | 123 --- 0002-doc-Document-fix-flag.patch | 47 - 0003-tests-Add-tests-for-fix.patch | 135 --- 0004-tests-Fix-test-t1700-probe-fs.patch | 35 - ...041-undetected-in-use-16th-partition.patch | 33 - ...bparted-Fix-fd-check-in-_flush_cache.patch | 26 - ...tential-memory-leak-in-sdmmc_get_pro.patch | 38 - ...copy-paste-error-in-HFS-journal-code.patch | 34 - ...rted-Fix-end_input-leak-in-do_mkpart.patch | 53 - ...arted-Free-tmp-usage-inside-do_print.patch | 25 - ...ed-Fix-memory-leaks-in-do_resizepart.patch | 43 - ...rning-about-buffer-size-in-Atari-lab.patch | 57 -- ...x-potential-memory-leak-in-gpt_write.patch | 44 - ...-around-a-mkswap-bug-by-using-dev-ze.patch | 34 - ...dev-zero-for-temporary-file-and-mksw.patch | 46 - ...tests-t1100-Change-dev_size_mb-to-10.patch | 41 - ...tests-t1101-Change-dev_size_mb-to-10.patch | 40 - ...tests-t1102-Change-dev_size_mb-to-10.patch | 43 - ...tests-t1701-Change-dev_size_mb-to-10.patch | 36 - ...ests-t3000-Change-dev_size_mb-to-267.patch | 32 - ...tests-t3200-Change-dev_size_mb-to-10.patch | 36 - ...tests-t6006-Change-dev_size_mb-to-10.patch | 48 - ...k-for-hfs-and-vfat-support-separatel.patch | 54 -- ...mkfs.hfsplus-and-fsck.hfsplus-for-re.patch | 43 - ...ve-Exception-Option-values-into-enum.patch | 77 -- ...ted-Add-swap-flag-to-msdos-disklabel.patch | 133 --- ...4-and-mips64-as-a-valid-64-bit-machi.patch | 31 - ...er-to-check-the-kernel-knows-about-a.patch | 43 - ...ck-for-vfat-kernel-support-and-tools.patch | 46 - ...lons-and-backslashes-in-machine-outp.patch | 91 -- ...ibdevmapper-to-retry-remove-when-BUS.patch | 32 - ...eck-devpath-before-passing-to-strlen.patch | 26 - ...llow-empty-string-for-partition-name.patch | 125 --- ...d-json-cmdline-switch-to-output-JSON.patch | 917 ------------------ 0035-hurd-Fix-partition-paths.patch | 29 - ...-Support-rumpdisk-based-device-names.patch | 33 - ...-Implement-partition-table-rereading.patch | 135 --- 0038-keep-GUID-specific-attributes.patch | 283 ------ ...p-PED_PARTITON_-flags-to-GUID-values.patch | 566 ----------- 0040-gpt-Add-linux-home-flag.patch | 72 -- 0041-doc-Document-gpt-linux-home-flag.patch | 42 - ...-to-make-sure-GPT-GUIDs-default-to-f.patch | 144 --- ...lesystem-GUID-when-setting-flag-to-o.patch | 25 - ...pdate-documentation-to-be-consistent.patch | 459 --------- ...gnulib-Use-newer-cdefs.h-from-gnulib.patch | 542 ----------- parted.spec | 64 +- sources | 4 +- 48 files changed, 16 insertions(+), 5051 deletions(-) delete mode 100644 0001-parted-add-fix-to-fix-in-script-mode.patch delete mode 100644 0002-doc-Document-fix-flag.patch delete mode 100644 0003-tests-Add-tests-for-fix.patch delete mode 100644 0004-tests-Fix-test-t1700-probe-fs.patch delete mode 100644 0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch delete mode 100644 0006-libparted-Fix-fd-check-in-_flush_cache.patch delete mode 100644 0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch delete mode 100644 0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch delete mode 100644 0009-parted-Fix-end_input-leak-in-do_mkpart.patch delete mode 100644 0010-parted-Free-tmp-usage-inside-do_print.patch delete mode 100644 0011-parted-Fix-memory-leaks-in-do_resizepart.patch delete mode 100644 0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch delete mode 100644 0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch delete mode 100644 0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch delete mode 100644 0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch delete mode 100644 0016-tests-t1100-Change-dev_size_mb-to-10.patch delete mode 100644 0017-tests-t1101-Change-dev_size_mb-to-10.patch delete mode 100644 0018-tests-t1102-Change-dev_size_mb-to-10.patch delete mode 100644 0019-tests-t1701-Change-dev_size_mb-to-10.patch delete mode 100644 0020-tests-t3000-Change-dev_size_mb-to-267.patch delete mode 100644 0021-tests-t3200-Change-dev_size_mb-to-10.patch delete mode 100644 0022-tests-t6006-Change-dev_size_mb-to-10.patch delete mode 100644 0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch delete mode 100644 0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch delete mode 100644 0025-Move-Exception-Option-values-into-enum.patch delete mode 100644 0026-libparted-Add-swap-flag-to-msdos-disklabel.patch delete mode 100644 0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch delete mode 100644 0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch delete mode 100644 0029-tests-check-for-vfat-kernel-support-and-tools.patch delete mode 100644 0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch delete mode 100644 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch delete mode 100644 0032-libparted-Check-devpath-before-passing-to-strlen.patch delete mode 100644 0033-parted-Allow-empty-string-for-partition-name.patch delete mode 100644 0034-parted-Add-json-cmdline-switch-to-output-JSON.patch delete mode 100644 0035-hurd-Fix-partition-paths.patch delete mode 100644 0036-hurd-Support-rumpdisk-based-device-names.patch delete mode 100644 0037-hurd-Implement-partition-table-rereading.patch delete mode 100644 0038-keep-GUID-specific-attributes.patch delete mode 100644 0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch delete mode 100644 0040-gpt-Add-linux-home-flag.patch delete mode 100644 0041-doc-Document-gpt-linux-home-flag.patch delete mode 100644 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch delete mode 100644 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch delete mode 100644 0044-docs-Update-documentation-to-be-consistent.patch delete mode 100644 0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch diff --git a/.gitignore b/.gitignore index b06228a..01022d0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ clog /parted-3.3.52.tar.xz.sig /parted-3.4.tar.xz /parted-3.4.tar.xz.sig +/parted-3.4.64.tar.xz +/parted-3.4.64.tar.xz.sig diff --git a/0001-parted-add-fix-to-fix-in-script-mode.patch b/0001-parted-add-fix-to-fix-in-script-mode.patch deleted file mode 100644 index be907eb..0000000 --- a/0001-parted-add-fix-to-fix-in-script-mode.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 7c9a96209af2b84e1eec98ad3527f82ddd966cdf Mon Sep 17 00:00:00 2001 -From: Cristian Klein -Date: Fri, 11 Dec 2020 22:19:22 +0100 -Subject: [PATCH 1/5] parted: add --fix to "fix" in script mode - -Use-case: VMs are booted from images that are smaller than their virtual -disk. This means that -- almost by definition -- the secondary GPT -header will be "misplaced", i.e., not at the end of the virtual disk. - -Without this patch, parted cannot be used for custom/exotic partitioning -when the VM boots (e.g., in cloud-init's `bootcmd`). Specifically, it -will fail as follows: - -``` -$ sudo parted --script /dev/vda "mkpart 2 10GB -1" -Warning: Not all of the space available to /dev/vda appears to be used, -you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? -Error: Unable to satisfy all constraints on the partition. -``` - -This happens because, in script mode, exceptions are usually not -resolved. - -This patch adds `--fix`. This allows exceptions to be automatically -resolved with Fix. As a result, the following command will work: - -``` -$ sudo parted --fix --script /dev/vda "mkpart 2 10GB -1" -``` - -Signed-off-by: Brian C. Lane ---- - parted/parted.c | 8 ++++++-- - parted/ui.c | 7 +++++++ - parted/ui.h | 1 + - 3 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index e84e66d..41edb7f 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -116,6 +116,7 @@ static struct option const options[] = { - {"list", 0, NULL, 'l'}, - {"machine", 0, NULL, 'm'}, - {"script", 0, NULL, 's'}, -+ {"fix", 0, NULL, 'f'}, - {"version", 0, NULL, 'v'}, - {"align", required_argument, NULL, 'a'}, - {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY}, -@@ -127,12 +128,14 @@ static const char *const options_help [][2] = { - {"list", N_("lists partition layout on all block devices")}, - {"machine", N_("displays machine parseable output")}, - {"script", N_("never prompts for user intervention")}, -+ {"fix", N_("in script mode, fix instead of abort when asked")}, - {"version", N_("displays the version")}, - {"align=[none|cyl|min|opt]", N_("alignment for new partitions")}, - {NULL, NULL} - }; - - int opt_script_mode = 0; -+int opt_fix_mode = 0; - int pretend_input_tty = 0; - int opt_machine_mode = 0; - int disk_is_modified = 0; -@@ -2191,7 +2194,7 @@ int opt, help = 0, list = 0, version = 0, wrong = 0; - - while (1) - { -- opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsva:", -+ opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsfva:", - options, NULL); - if (opt == -1) - break; -@@ -2201,6 +2204,7 @@ while (1) - case 'l': list = 1; break; - case 'm': opt_machine_mode = 1; break; - case 's': opt_script_mode = 1; break; -+ case 'f': opt_fix_mode = 1; break; - case 'v': version = 1; break; - case 'a': - alignment = XARGMATCH ("--align", optarg, -@@ -2217,7 +2221,7 @@ while (1) - - if (wrong == 1) { - fprintf (stderr, -- _("Usage: %s [-hlmsv] [-a] [DEVICE [COMMAND [PARAMETERS]]...]\n"), -+ _("Usage: %s [-hlmsfv] [-a] [DEVICE [COMMAND [PARAMETERS]]...]\n"), - program_name); - return 0; - } -diff --git a/parted/ui.c b/parted/ui.c -index 973bd26..b5948d3 100644 ---- a/parted/ui.c -+++ b/parted/ui.c -@@ -644,6 +644,13 @@ exception_handler (PedException* ex) - if (!option_get_next (ex->options, opt)) - return opt; - -+ /* script-mode and fix? */ -+ int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX); -+ if (opt_script_mode && opt_fix_mode && fix_is_an_option) { -+ printf ("Fixing, due to --fix\n"); -+ return PED_EXCEPTION_FIX; -+ } -+ - /* script-mode: don't handle the exception */ - if (opt_script_mode || (!isatty (0) && !pretend_input_tty)) - return PED_EXCEPTION_UNHANDLED; -diff --git a/parted/ui.h b/parted/ui.h -index 3b07782..e4e88b6 100644 ---- a/parted/ui.h -+++ b/parted/ui.h -@@ -89,6 +89,7 @@ extern void print_using_dev (PedDevice* dev); - - /* in parted.c */ - extern int opt_script_mode; -+extern int opt_fix_mode; - extern int pretend_input_tty; - - extern void print_options_help (); --- -2.26.2 - diff --git a/0002-doc-Document-fix-flag.patch b/0002-doc-Document-fix-flag.patch deleted file mode 100644 index 0961dda..0000000 --- a/0002-doc-Document-fix-flag.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 8aa569aa60c37526a8c37b06e88a833745a7a6ef Mon Sep 17 00:00:00 2001 -From: Cristian Klein -Date: Fri, 11 Dec 2020 22:19:23 +0100 -Subject: [PATCH 2/5] doc: Document --fix flag - -Also fix copyright year, to please `make syntax-check`. - -Signed-off-by: Brian C. Lane ---- - doc/C/parted.8 | 3 +++ - doc/parted.texi | 6 ++++++ - 2 files changed, 9 insertions(+) - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index 297c39a..d8e556e 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -27,6 +27,9 @@ displays machine parseable output - .B -s, --script - never prompts for user intervention - .TP -+.B -f, --fix -+automatically answer "fix" to exceptions in script mode -+.TP - .B -v, --version - displays the version - .TP -diff --git a/doc/parted.texi b/doc/parted.texi -index d89d74d..33212f0 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -406,6 +406,12 @@ display a help message - @itemx --script - never prompt the user - -+@item -f -+@itemx --fix -+automatically answer exceptions with "fix" in script mode, whcih is useful for: -+GPT header not including full disk size; moving the backup GPT table to the end of the disk; -+MAC fix missing partition map entry; etc. -+ - @item -a alignment-type - @itemx --align alignment-type - Set alignment for newly created partitions, valid alignment types are: --- -2.26.2 - diff --git a/0003-tests-Add-tests-for-fix.patch b/0003-tests-Add-tests-for-fix.patch deleted file mode 100644 index 4fe4ef9..0000000 --- a/0003-tests-Add-tests-for-fix.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 6b2c8806b42a7214d726cc2b3dac6b96013a6cce Mon Sep 17 00:00:00 2001 -From: Cristian Klein -Date: Fri, 11 Dec 2020 22:19:24 +0100 -Subject: [PATCH 3/5] tests: Add tests for --fix - -Signed-off-by: Brian C. Lane ---- - tests/Makefile.am | 3 +- - tests/t9060-gpt-grow-script-fix.sh | 100 +++++++++++++++++++++++++++++ - 2 files changed, 102 insertions(+), 1 deletion(-) - create mode 100755 tests/t9060-gpt-grow-script-fix.sh - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 0d7c022..3473e6b 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -89,7 +89,8 @@ TESTS = \ - t9040-many-partitions.sh \ - t9041-undetected-in-use-16th-partition.sh \ - t9042-dos-partition-limit.sh \ -- t9050-partition-table-types.sh -+ t9050-partition-table-types.sh \ -+ t9060-gpt-grow-script-fix.sh - - EXTRA_DIST = \ - $(TESTS) t-local.sh t-lvm.sh \ -diff --git a/tests/t9060-gpt-grow-script-fix.sh b/tests/t9060-gpt-grow-script-fix.sh -new file mode 100755 -index 0000000..4a3a8a9 ---- /dev/null -+++ b/tests/t9060-gpt-grow-script-fix.sh -@@ -0,0 +1,100 @@ -+#!/bin/sh -+# grow a gpt disk, ensure that parted offers to update the gpt size -+# do this in script mode with fix -+ -+# Copyright (C) 2009-2012, 2014, 2019 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+dev=loop-file -+ -+ss=$sector_size_ -+n_sectors=5000 -+ -+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 -+ -+# create gpt label -+parted -s $dev mklabel gpt > empty 2>&1 || fail=1 -+compare /dev/null empty || fail=1 -+ -+# print the empty table -+parted -m -s $dev unit s print > t 2>&1 || fail=1 -+sed "s,.*/$dev:,$dev:," t > out || fail=1 -+ -+# check for expected output -+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \ -+ > exp || fail=1 -+compare exp out || fail=1 -+ -+# grow disk -+n_sectors=5500 -+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 -+ -+# printing must warn, but not fix in script mode -+parted -s $dev print > out 2>&1 || fail=1 -+ -+# Transform the actual output, to avoid spurious differences when -+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity. -+# normalize the actual output -+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \ -+ -e "s,^.*/lt-parted: ,parted: ," o2 > out -+ -+# check for expected diagnostic -+cat < exp || fail=1 -+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? -+Model: (file) -+Disk DEVICE: 2816kB -+Sector size (logical/physical): 512B/512B -+Partition Table: gpt -+Disk Flags: -+ -+Number Start End Size File system Name Flags -+ -+EOF -+compare exp out || fail=1 -+ -+# now we fix -+parted --script --fix $dev print > out 2>&1 || fail=1 -+ -+# Transform the actual output, to avoid spurious differences when -+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity. -+# normalize the actual output -+mv out o2 && sed -e "s,/.*/$dev,DEVICE,;s, * ,,g;s, $,," \ -+ -e "s,^.*/lt-parted: ,parted: ," o2 > out -+ -+# check for expected diagnostic -+cat < exp || fail=1 -+Warning: Not all of the space available to DEVICE appears to be used, you can fix the GPT to use all of the space (an extra 500 blocks) or continue with the current setting? -+Fixing, due to --fix -+Model: (file) -+Disk DEVICE: 2816kB -+Sector size (logical/physical): 512B/512B -+Partition Table: gpt -+Disk Flags: -+ -+Number Start End Size File system Name Flags -+ -+EOF -+compare exp out || fail=1 -+ -+ -+# Now should not warn -+ -+parted -s $dev print > err 2>&1 || fail=1 -+grep Warning: err > k ; mv k err -+compare /dev/null err || fail=1 -+ -+Exit $fail --- -2.26.2 - diff --git a/0004-tests-Fix-test-t1700-probe-fs.patch b/0004-tests-Fix-test-t1700-probe-fs.patch deleted file mode 100644 index d96b771..0000000 --- a/0004-tests-Fix-test-t1700-probe-fs.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 9bb4afe61426419c8bb83a25aa9822e00611c8f3 Mon Sep 17 00:00:00 2001 -From: Cristian Klein -Date: Fri, 11 Dec 2020 22:19:25 +0100 -Subject: [PATCH 4/5] tests: Fix test t1700-probe-fs - -mkfs.ext3 (see version below) was complaining that the filesystem is too small -for a journal, which made the test fail. - -``` -$ mkfs.ext3 -V -mke2fs 1.45.5 (07-Jan-2020) - Using EXT2FS Library version 1.45.5 -``` - -Signed-off-by: Brian C. Lane ---- - tests/t1700-probe-fs.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh -index 848d3e3..5c08e97 100755 ---- a/tests/t1700-probe-fs.sh -+++ b/tests/t1700-probe-fs.sh -@@ -57,7 +57,7 @@ done - # Some features should indicate ext4 by themselves. - for feature in uninit_bg flex_bg; do - # create an ext3 file system -- dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || skip_ "dd failed" -+ dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed" - mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed" - - # set the feature --- -2.26.2 - diff --git a/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch b/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch deleted file mode 100644 index a998543..0000000 --- a/0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 6ed9c9e82ea6cfbee93a47e82e92a90abdb82343 Mon Sep 17 00:00:00 2001 -From: Cristian Klein -Date: Fri, 11 Dec 2020 22:19:26 +0100 -Subject: [PATCH 5/5] tests: Fix t9041-undetected-in-use-16th-partition - -Sometimes fails with: -``` -+ mkfs.ext3 /dev/sda15 -mke2fs 1.45.5 (07-Jan-2020) -/dev/sda15: Not enough space to build proposed filesystem while setting up superblock -``` - -Signed-off-by: Brian C. Lane ---- - tests/t9041-undetected-in-use-16th-partition.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh -index a4a3020..129bf15 100644 ---- a/tests/t9041-undetected-in-use-16th-partition.sh -+++ b/tests/t9041-undetected-in-use-16th-partition.sh -@@ -25,7 +25,7 @@ grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || - skip_ 'this system lacks a new-enough libblkid' - - ss=$sector_size_ --partition_sectors=256 # sectors per partition -+partition_sectors=512 # sectors per partition - n_partitions=17 # how many partitions to create - start=2048 # start sector for the first partition - gpt_slop=34 # sectors at end of disk reserved for GPT --- -2.26.2 - diff --git a/0006-libparted-Fix-fd-check-in-_flush_cache.patch b/0006-libparted-Fix-fd-check-in-_flush_cache.patch deleted file mode 100644 index ab81467..0000000 --- a/0006-libparted-Fix-fd-check-in-_flush_cache.patch +++ /dev/null @@ -1,26 +0,0 @@ -From dacdfc20957d92eff7a3c9fd72baa849b45485e3 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:39:04 -0700 -Subject: [PATCH 06/13] libparted: Fix fd check in _flush_cache - -In theory open() could return 0 so the correct error value is -1. ---- - libparted/arch/linux.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index 94ea176..9dc90b5 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -1678,7 +1678,7 @@ _flush_cache (PedDevice* dev) - break; - if (!_partition_is_mounted_by_path (name)) { - fd = open (name, WR_MODE, 0); -- if (fd > 0) { -+ if (fd > -1) { - ioctl (fd, BLKFLSBUF); - retry: - if (fsync (fd) < 0 || close (fd) < 0) --- -2.31.1 - diff --git a/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch b/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch deleted file mode 100644 index 4da211b..0000000 --- a/0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 8e6976661409d7c87b1f0a80ebdddc450b4db2dd Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:41:33 -0700 -Subject: [PATCH 07/13] libparted: Fix potential memory leak in - sdmmc_get_product_info - ---- - libparted/arch/linux.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index 9dc90b5..aacc94f 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -1399,13 +1399,19 @@ static int - init_sdmmc (PedDevice* dev) - { - char id[128]; -- char *type, *name; -+ char *type = NULL; -+ char *name = NULL; - - if (sdmmc_get_product_info (dev, &type, &name)) { - snprintf (id, sizeof(id) - 1, "%s %s", type, name); - free (type); - free (name); - } else { -+ // One or the other may have been allocated, free it -+ if (type) -+ free(type); -+ if (name) -+ free(name); - snprintf (id, sizeof(id) - 1, "%s", - _("Generic SD/MMC Storage Card")); - } --- -2.31.1 - diff --git a/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch b/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch deleted file mode 100644 index 3965a91..0000000 --- a/0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch +++ /dev/null @@ -1,34 +0,0 @@ -From acb5300bfc37f8b8c217758e83a31b7ecca84f4a Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:45:57 -0700 -Subject: [PATCH 08/13] fs: Fix copy-paste error in HFS journal code - ---- - libparted/fs/r/hfs/journal.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/libparted/fs/r/hfs/journal.c b/libparted/fs/r/hfs/journal.c -index 862d3d3..c7cd009 100644 ---- a/libparted/fs/r/hfs/journal.c -+++ b/libparted/fs/r/hfs/journal.c -@@ -337,12 +337,14 @@ hfsj_replay_journal(PedFileSystem* fs) - } - jh->checksum = HFS_CPU_TO_32(cksum, is_le); - -- /* The 2 following test are in the XNU Darwin source code */ -- /* so I assume they're needed */ -+ /* https://github.com/apple-opensource/hfs/blob/master/core/hfs_journal.c#L1167 -+ * indicates that this is: -+ * wrap the start ptr if it points to the very end of the journal -+ */ - if (jh->start == jh->size) - jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); - if (jh->end == jh->size) -- jh->start = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); -+ jh->end = HFS_CPU_TO_64(PED_SECTOR_SIZE_DEFAULT, is_le); - - if (jh->start == jh->end) - return 1; --- -2.31.1 - diff --git a/0009-parted-Fix-end_input-leak-in-do_mkpart.patch b/0009-parted-Fix-end_input-leak-in-do_mkpart.patch deleted file mode 100644 index 9df39be..0000000 --- a/0009-parted-Fix-end_input-leak-in-do_mkpart.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 3a7f644f21703afcf7088a5994be1a6dff19f679 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:51:12 -0700 -Subject: [PATCH 09/13] parted: Fix end_input leak in do_mkpart - ---- - parted/parted.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index 41edb7f..e9aa240 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -645,6 +645,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) - char* part_name = NULL; - char *start_usr = NULL, *end_usr = NULL; - char *start_sol = NULL, *end_sol = NULL; -+ char *end_input = NULL; - - if (*diskp) - disk = *diskp; -@@ -698,12 +699,10 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) - - if (!command_line_get_sector (_("Start?"), *dev, &start, &range_start, NULL)) - goto error; -- char *end_input; - if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) - goto error; - - _adjust_end_if_iec(&start, &end, range_end, end_input); -- free(end_input); - - /* processing starts here */ - part = ped_partition_new (disk, part_type, fs_type, start, end); -@@ -839,6 +838,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) - free (end_usr); - free (start_sol); - free (end_sol); -+ free(end_input); - - if ((*dev)->type != PED_DEVICE_FILE) - disk_is_modified = 1; -@@ -860,6 +860,7 @@ error: - free (end_usr); - free (start_sol); - free (end_sol); -+ free(end_input); - - return 0; - } --- -2.31.1 - diff --git a/0010-parted-Free-tmp-usage-inside-do_print.patch b/0010-parted-Free-tmp-usage-inside-do_print.patch deleted file mode 100644 index d243374..0000000 --- a/0010-parted-Free-tmp-usage-inside-do_print.patch +++ /dev/null @@ -1,25 +0,0 @@ -From fbd83d9df7bf5fd0c830935decb9bbc482bf95f4 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:52:28 -0700 -Subject: [PATCH 10/13] parted: Free tmp usage inside do_print - -str_list_create calls gettext_to_wchar which makes a copy of it. ---- - parted/parted.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/parted/parted.c b/parted/parted.c -index e9aa240..ba152c3 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1192,6 +1192,7 @@ do_print (PedDevice** dev, PedDisk** diskp) - sprintf (tmp, "%2s ", ""); - - StrList *row = str_list_create (tmp, NULL); -+ free(tmp); - - start = ped_unit_format (*dev, part->geom.start); - end = ped_unit_format_byte ( --- -2.31.1 - diff --git a/0011-parted-Fix-memory-leaks-in-do_resizepart.patch b/0011-parted-Fix-memory-leaks-in-do_resizepart.patch deleted file mode 100644 index 24ef01f..0000000 --- a/0011-parted-Fix-memory-leaks-in-do_resizepart.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 10 Jun 2021 15:55:59 -0700 -Subject: [PATCH 11/13] parted: Fix memory leaks in do_resizepart - ---- - parted/parted.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index ba152c3..22b5818 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1582,7 +1582,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - /* Push the End value back onto the command_line, if it exists */ - if (end_size) { - command_line_push_word(end_size); -- free(end_size); - } - - start = part->geom.start; -@@ -1590,7 +1589,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp) - if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input)) - goto error; - _adjust_end_if_iec(&start, &end, range_end, end_input); -- free(end_input); -+ - /* Do not move start of the partition */ - constraint = constraint_from_start_end_fixed_start (*dev, start, range_end); - if (!ped_disk_set_partition_geom (disk, part, constraint, -@@ -1616,6 +1615,9 @@ error_destroy_constraint: - error: - if (range_end != NULL) - ped_geometry_destroy (range_end); -+ free(end_input); -+ free(end_size); -+ - return rc; - } - --- -2.31.1 - diff --git a/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch b/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch deleted file mode 100644 index b7cd8e3..0000000 --- a/0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 86594612f8ae4dbc416e3cd1bc8bb05445df09e5 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 11 Jun 2021 12:05:22 -0700 -Subject: [PATCH 12/13] libparted: Fix warning about buffer size in Atari label - -When the Atari table is empty it copies 'PARTEDATARI' into the id, and -the start and size bytes. This can be confusion, so turn it into a -union of the string and the non-empty values. ---- - libparted/labels/atari.c | 17 +++++++++++------ - 1 file changed, 11 insertions(+), 6 deletions(-) - -diff --git a/libparted/labels/atari.c b/libparted/labels/atari.c -index 7923487..2ac03d2 100644 ---- a/libparted/labels/atari.c -+++ b/libparted/labels/atari.c -@@ -137,9 +137,14 @@ static AtariFS2PartId atr_fs2pid[] = { - - struct __attribute__ ((packed)) _AtariRawPartition { - uint8_t flag; /* bit 0: active; bit 7: bootable */ -- uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */ -- uint32_t start; /* start of partition */ -- uint32_t size; /* length of partition */ -+ union { -+ uint8_t empty[11]; /* Empty table */ -+ struct __attribute__ ((packed)) { -+ uint8_t id[3]; /* "GEM", "BGM", "XGM", ... */ -+ uint32_t start; /* start of partition */ -+ uint32_t size; /* length of partition */ -+ }; -+ }; - }; - typedef struct _AtariRawPartition AtariRawPartition; - -@@ -241,8 +246,8 @@ static int - atr_is_signature_entry (AtariRawPartition* part) - { - return part->flag == 0 -- && !memcmp (part->id, SIGNATURE_EMPTY_TABLE, -- SIGNATURE_EMPTY_SIZE ); -+ && !memcmp (part->empty, SIGNATURE_EMPTY_TABLE, -+ SIGNATURE_EMPTY_SIZE ); - } - - /* Set Parted signature in an AHDI entry */ -@@ -250,7 +255,7 @@ static void - atr_put_signature_entry (AtariRawPartition* part) - { - part->flag = 0; -- memcpy (part->id, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE); -+ memcpy (part->empty, SIGNATURE_EMPTY_TABLE, SIGNATURE_EMPTY_SIZE); - } - - #define atr_part_known(part, pid_list) (atr_pid_known ((part)->id, pid_list)) --- -2.31.1 - diff --git a/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch b/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch deleted file mode 100644 index 1164a27..0000000 --- a/0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 16751493376db612abcceae5ae81fd798c0a4d18 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 11 Jun 2021 13:43:02 -0700 -Subject: [PATCH 13/13] libparted: Fix potential memory leak in gpt_write - -_generate_header() can return with 1 after allocating gpt so it needs to -be freed in the error path. ---- - libparted/labels/gpt.c | 12 ++++++++---- - 1 file changed, 8 insertions(+), 4 deletions(-) - -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 93f7add..9b987c1 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -1292,8 +1292,10 @@ gpt_write (const PedDisk *disk) - - /* Write PTH and PTEs */ - /* FIXME: Caution: this code is nearly identical to what's just below. */ -- if (_generate_header (disk, 0, ptes_crc, &gpt) != 0) -- goto error_free_ptes; -+ if (_generate_header (disk, 0, ptes_crc, &gpt) != 0) { -+ pth_free(gpt); -+ goto error_free_ptes; -+ } - pth_raw = pth_get_raw (disk->dev, gpt); - pth_free (gpt); - if (pth_raw == NULL) -@@ -1307,8 +1309,10 @@ gpt_write (const PedDisk *disk) - - /* Write Alternate PTH & PTEs */ - /* FIXME: Caution: this code is nearly identical to what's just above. */ -- if (_generate_header (disk, 1, ptes_crc, &gpt) != 0) -- goto error_free_ptes; -+ if (_generate_header (disk, 1, ptes_crc, &gpt) != 0) { -+ pth_free(gpt); -+ goto error_free_ptes; -+ } - pth_raw = pth_get_raw (disk->dev, gpt); - pth_free (gpt); - if (pth_raw == NULL) --- -2.31.1 - diff --git a/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch b/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch deleted file mode 100644 index cc4a682..0000000 --- a/0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch +++ /dev/null @@ -1,34 +0,0 @@ -From f801496427db11cc468065dcd77d1c610c0a1047 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 14 Jun 2021 14:23:46 -0700 -Subject: [PATCH 14/15] tests: t0400 - Work around a mkswap bug by using - /dev/zero - -mkswap gets stuck, in some situations, when operating on a file full of -holes (see https://bugzilla.redhat.com/show_bug.cgi?id=1971877) so work -around that by using /dev/zero instead of /dev/null ---- - tests/t0400-loop-clobber-infloop.sh | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/tests/t0400-loop-clobber-infloop.sh b/tests/t0400-loop-clobber-infloop.sh -index 2d2190d..d05a8e0 100644 ---- a/tests/t0400-loop-clobber-infloop.sh -+++ b/tests/t0400-loop-clobber-infloop.sh -@@ -22,7 +22,12 @@ - - N=1M - dev=loop-file --dd if=/dev/null of=$dev bs=1 seek=$N || fail=1 -+ -+cleanup_() { -+ rm -f $dev; -+} -+ -+dd if=/dev/zero of=$dev bs=$N count=1 || fail=1 - - mkswap $dev || fail=1 - --- -2.31.1 - diff --git a/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch b/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch deleted file mode 100644 index 06e058e..0000000 --- a/0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ea1a97b57d4e84005c66bc9c05f2e7c9244b5118 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 14 Jun 2021 15:04:05 -0700 -Subject: [PATCH 15/15] tests: t9050 Use /dev/zero for temporary file and - mkswap - -and clean up the usage a little bit by giving it a proper name and -removing the file when finished. ---- - tests/t9050-partition-table-types.sh | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/tests/t9050-partition-table-types.sh b/tests/t9050-partition-table-types.sh -index 57e004a..d63fa80 100755 ---- a/tests/t9050-partition-table-types.sh -+++ b/tests/t9050-partition-table-types.sh -@@ -35,16 +35,22 @@ pc98 - sun - mkswap - ' -+N=1M -+dev=loop-file - --dd if=/dev/null of=f bs=1 seek=30M || framework_failure_ -+cleanup_() { -+ rm -f $dev; -+} -+ -+dd if=/dev/zero of=$dev bs=$N count=30 || framework_failure_ - - for i in $types; do - for j in $types; do - echo $i:$j -- case $i in mkswap) mkswap f || fail=1;; -- *) parted -s f mklabel $i || fail=1;; esac -+ case $i in mkswap) mkswap $dev || fail=1;; -+ *) parted -s $dev mklabel $i || fail=1;; esac - case $j in mkswap) continue;; esac -- parted -s f mklabel $j || fail=1 -+ parted -s $dev mklabel $j || fail=1 - done - done - --- -2.31.1 - diff --git a/0016-tests-t1100-Change-dev_size_mb-to-10.patch b/0016-tests-t1100-Change-dev_size_mb-to-10.patch deleted file mode 100644 index 3e66727..0000000 --- a/0016-tests-t1100-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4a053e111beacbeabeddc20c71d0215aedf219fb Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:26:36 -0700 -Subject: [PATCH 16/24] tests/t1100: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t1100-busy-label.sh | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh -index f1a13df..71b847c 100755 ---- a/tests/t1100-busy-label.sh -+++ b/tests/t1100-busy-label.sh -@@ -21,11 +21,11 @@ require_root_ - require_scsi_debug_module_ - ss=$sector_size_ - --scsi_debug_setup_ sector_size=$ss dev_size_mb=90 > dev-name || -+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || - skip_ 'failed to create scsi_debug device' - dev=$(cat dev-name) - --parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1 -+parted -s "$dev" mklabel msdos mkpart primary fat32 1 4 > out 2>&1 || fail=1 - compare /dev/null out || fail=1 - wait_for_dev_to_appear_ ${dev}1 || fail=1 - mkfs.vfat ${dev}1 || fail=1 -@@ -48,7 +48,7 @@ compare exp out || fail=1 - - # Adding a partition must succeed, even though another - # on this same device is mounted (active). --parted -s "$dev" mkpart primary fat32 41 85 > out 2>&1 || fail=1 -+parted -s "$dev" mkpart primary fat32 5 10 > out 2>&1 || fail=1 - compare /dev/null out || fail=1 - parted -s "$dev" u s print - --- -2.31.1 - diff --git a/0017-tests-t1101-Change-dev_size_mb-to-10.patch b/0017-tests-t1101-Change-dev_size_mb-to-10.patch deleted file mode 100644 index e01bdaa..0000000 --- a/0017-tests-t1101-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,40 +0,0 @@ -From f1c0f474670612b79a30d70863b4351c5883b5f6 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:27:30 -0700 -Subject: [PATCH 17/24] tests/t1101: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t1101-busy-partition.sh | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh -index e35e6f0..5e37814 100755 ---- a/tests/t1101-busy-partition.sh -+++ b/tests/t1101-busy-partition.sh -@@ -24,7 +24,7 @@ require_root_ - require_scsi_debug_module_ - - # create memory-backed device --scsi_debug_setup_ dev_size_mb=80 > dev-name || -+scsi_debug_setup_ dev_size_mb=10 > dev-name || - skip_ 'failed to create scsi_debug device' - dev=$(cat dev-name) - -@@ -37,10 +37,10 @@ parted -s "$dev" mklabel msdos > out 2>&1 || fail=1 - # expect no output - compare /dev/null out || fail=1 - --parted -s "$dev" mkpart primary fat32 1 40 > out 2>&1 || fail=1 -+parted -s "$dev" mkpart primary fat32 1 4 > out 2>&1 || fail=1 - compare /dev/null out || fail=1 - --parted -s "$dev" mkpart primary fat32 40 80 > out 2>&1 || fail=1 -+parted -s "$dev" mkpart primary fat32 4 10 > out 2>&1 || fail=1 - compare /dev/null out || fail=1 - - # wait for new partition device to appear --- -2.31.1 - diff --git a/0018-tests-t1102-Change-dev_size_mb-to-10.patch b/0018-tests-t1102-Change-dev_size_mb-to-10.patch deleted file mode 100644 index d47b442..0000000 --- a/0018-tests-t1102-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 29cf5841f7c046e149e3554a0f92a96169681bec Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:28:33 -0700 -Subject: [PATCH 18/24] tests/t1102: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t1102-loop-label.sh | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/tests/t1102-loop-label.sh b/tests/t1102-loop-label.sh -index 091227b..0a120b9 100644 ---- a/tests/t1102-loop-label.sh -+++ b/tests/t1102-loop-label.sh -@@ -23,7 +23,7 @@ require_root_ - require_scsi_debug_module_ - ss=$sector_size_ - --scsi_debug_setup_ sector_size=$ss dev_size_mb=90 > dev-name || -+scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || - skip_ 'failed to create scsi_debug device' - dev=$(cat dev-name) - -@@ -31,13 +31,13 @@ mke2fs -F $dev - parted -s "$dev" print > out 2>&1 || fail=1 - cat < exp - Model: Linux scsi_debug (scsi) --Disk DEVICE: 94.4MB -+Disk DEVICE: 10.5MB - Sector size (logical/physical): ${ss}B/${ss}B - Partition Table: loop - Disk Flags: - - Number Start End Size File system Flags -- 1 0.00B 94.4MB 94.4MB ext2 -+ 1 0.00B 10.5MB 10.5MB ext2 - - EOF - mv out o2 && sed -e "s,$dev,DEVICE,;s/ *$//" o2 > out --- -2.31.1 - diff --git a/0019-tests-t1701-Change-dev_size_mb-to-10.patch b/0019-tests-t1701-Change-dev_size_mb-to-10.patch deleted file mode 100644 index 5c20d02..0000000 --- a/0019-tests-t1701-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 843a800098705c71698dabb3c2e549912b17606a Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:29:03 -0700 -Subject: [PATCH 19/24] tests/t1701: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t1701-rescue-fs.sh | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/t1701-rescue-fs.sh b/tests/t1701-rescue-fs.sh -index 050c064..71d545d 100644 ---- a/tests/t1701-rescue-fs.sh -+++ b/tests/t1701-rescue-fs.sh -@@ -22,7 +22,7 @@ require_root_ - require_scsi_debug_module_ - - # create memory-backed device --scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=32 > dev-name || -+scsi_debug_setup_ sector_size=$sector_size_ dev_size_mb=10 > dev-name || - skip_ 'failed to create scsi_debug device' - scsi_dev=$(cat dev-name) - -@@ -39,7 +39,7 @@ parted -s $scsi_dev rm 1 || fail=1 - # rescue the partition - echo yes | parted ---pretend-input-tty $scsi_dev rescue 1m 100% > out 2>&1 - cat > exp < 33.6MB. Do you want to add it to the partition table? -+Information: A ext4 primary partition was found at 1049kB -> 10.5MB. Do you want to add it to the partition table? - Yes/No/Cancel? yes - Information: You may need to update /etc/fstab. - EOF --- -2.31.1 - diff --git a/0020-tests-t3000-Change-dev_size_mb-to-267.patch b/0020-tests-t3000-Change-dev_size_mb-to-267.patch deleted file mode 100644 index 4a1f35d..0000000 --- a/0020-tests-t3000-Change-dev_size_mb-to-267.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e72dc01c85fb6baa8e065660bda6ec92e21bee49 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:29:29 -0700 -Subject: [PATCH 20/24] tests/t3000: Change dev_size_mb to 267 - -FAT32 needs a minimum partition size of 256MB so this is as small as we -can make it. - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t3000-resize-fs.sh | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh -index 64b038d..1f2e46e 100755 ---- a/tests/t3000-resize-fs.sh -+++ b/tests/t3000-resize-fs.sh -@@ -29,8 +29,8 @@ start=63s - default_end=546147s - new_end=530144s - --# create memory-backed device --scsi_debug_setup_ dev_size_mb=550 > dev-name || -+# create memory-backed device. Must be > 256MB+8MB -+scsi_debug_setup_ dev_size_mb=267 > dev-name || - skip_ 'failed to create scsi_debug device' - dev=$(cat dev-name) - --- -2.31.1 - diff --git a/0021-tests-t3200-Change-dev_size_mb-to-10.patch b/0021-tests-t3200-Change-dev_size_mb-to-10.patch deleted file mode 100644 index 415c9f4..0000000 --- a/0021-tests-t3200-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 18556277b93ebb7dd88da5d4928189386c0eb132 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:29:59 -0700 -Subject: [PATCH 21/24] tests/t3200: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t3200-type-change.sh | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh -index 39904e0..3ad8604 100755 ---- a/tests/t3200-type-change.sh -+++ b/tests/t3200-type-change.sh -@@ -25,7 +25,7 @@ grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || - skip_ 'this system lacks a new-enough libblkid' - - # create memory-backed device --scsi_debug_setup_ dev_size_mb=550 > dev-name || -+scsi_debug_setup_ dev_size_mb=10 > dev-name || - skip_ 'failed to create scsi_debug device' - scsi_dev=$(cat dev-name) - -@@ -34,7 +34,7 @@ scsi_dev=$(cat dev-name) - # partition and ensure that parted doesn't "helpfully" change the partition - # type to match the newly-detected FS type. - --parted -s $scsi_dev mklabel msdos mkpart primary fat32 64s 80000s || fail=1 -+parted -s $scsi_dev mklabel msdos mkpart primary fat32 1MiB 100% || fail=1 - - parted -s $scsi_dev u s p - --- -2.31.1 - diff --git a/0022-tests-t6006-Change-dev_size_mb-to-10.patch b/0022-tests-t6006-Change-dev_size_mb-to-10.patch deleted file mode 100644 index 909bbe6..0000000 --- a/0022-tests-t6006-Change-dev_size_mb-to-10.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0caf2d7f1363b9c4b3b63cf7d3a1260eb5a72f34 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 12 Jul 2021 15:30:45 -0700 -Subject: [PATCH 22/24] tests/t6006: Change dev_size_mb to 10 - -This is backed by memory, so using more than is needed limits the size -of the system it can run on. ---- - tests/t6006-dm-512b-sectors.sh | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh -index 2460c49..83bf3b1 100644 ---- a/tests/t6006-dm-512b-sectors.sh -+++ b/tests/t6006-dm-512b-sectors.sh -@@ -46,9 +46,9 @@ cleanup_fn_() { - udevadm settle - } - --# Create a 500M device -+# Create a 10M device - ss=$sector_size_ --scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name || -+scsi_debug_setup_ sector_size=$ss dev_size_mb=11 > dev-name || - skip_ 'failed to create scsi_debug device' - scsi_dev=$(cat dev-name) - -@@ -58,13 +58,13 @@ scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure - dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure - dev="/dev/mapper/$linear_" - --# Create msdos partition table with a partition from 1MiB to 100MiB --parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 -+# Create msdos partition table with a partition from 1MiB to 10MiB -+parted -s $dev mklabel msdos mkpart primary ext2 1MiB 100% > out 2>&1 || fail=1 - compare /dev/null out || fail=1 - wait_for_dev_to_appear_ ${dev}1 || fail=1 - --# The size of the partition should be 100MiB, or 204800 512b sectors -+# The size of the partition should be 10MiB, or 20480 512b sectors - p1_size=$(blockdev --getsz ${dev}1) || framework_failure --[ $p1_size == 204800 ] || fail=1 -+[ $p1_size == 20480 ] || fail=1 - - Exit $fail --- -2.31.1 - diff --git a/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch b/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch deleted file mode 100644 index 751a5ed..0000000 --- a/0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 262a9242f5ad121ddcb42edaacadbc2e6a650333 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 15 Jul 2021 08:27:00 -0700 -Subject: [PATCH 23/24] tests/t3000: Check for hfs and vfat support separately - -Previously the whole test would be skipped if either mkfs.hfs or -mkfs.vfat were not installed, leading to missing test coverage. This -change checks for them individually so that the test will run with -either or both of them installed ---- - 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 1f2e46e..282b6fc 100755 ---- a/tests/t3000-resize-fs.sh -+++ b/tests/t3000-resize-fs.sh -@@ -17,12 +17,22 @@ - # along with this program. If not, see . - - . "${srcdir=.}/init.sh"; path_prepend_ ../parted . --require_hfs_ --require_fat_ - require_root_ - require_scsi_debug_module_ - require_512_byte_sector_size_ - -+ -+FSTYPES="" -+ -+# Is mkfs.hfs available? -+mkfs.hfs 2>&1 | grep '^usage:' && FSTYPES="hfs+" -+ -+# Is mkfs.vfat available? -+mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16" -+ -+[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfs nor mkfs.vfat installed" -+ -+ - ss=$sector_size_ - - start=63s -@@ -53,7 +63,7 @@ mkdir "$mount_point" || fail=1 - # be sure to unmount upon interrupt, failure, etc. - cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } - --for fs_type in hfs+ fat32 fat16; do -+for fs_type in $FSTYPES; do - echo "fs_type=$fs_type" - - # create an empty $fs_type partition, cylinder aligned, size > 256 MB --- -2.31.1 - diff --git a/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch b/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch deleted file mode 100644 index 0892734..0000000 --- a/0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 964bc37f6c95308a64aa96534b29412ce55835fd Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 29 Jul 2021 11:19:15 -0700 -Subject: [PATCH 24/24] tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for - resize tests - ---- - tests/t3000-resize-fs.sh | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tests/t3000-resize-fs.sh b/tests/t3000-resize-fs.sh -index 282b6fc..cf46c81 100755 ---- a/tests/t3000-resize-fs.sh -+++ b/tests/t3000-resize-fs.sh -@@ -24,13 +24,13 @@ require_512_byte_sector_size_ - - FSTYPES="" - --# Is mkfs.hfs available? --mkfs.hfs 2>&1 | grep '^usage:' && FSTYPES="hfs+" -+# Is mkfs.hfsplus available? -+mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+" - - # Is mkfs.vfat available? - mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32 fat16" - --[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfs nor mkfs.vfat installed" -+[ -n "$FSTYPES" ] || skip_ "Neither mkfs.hfsplus nor mkfs.vfat installed" - - - ss=$sector_size_ -@@ -79,7 +79,7 @@ for fs_type in $FSTYPES; do - 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;; -+ hfs*) mkfs_cmd='mkfs.hfsplus'; fsck=fsck.hfsplus;; - *) error "internal error: unhandled fs type: $fs_type";; - esac - --- -2.31.1 - diff --git a/0025-Move-Exception-Option-values-into-enum.patch b/0025-Move-Exception-Option-values-into-enum.patch deleted file mode 100644 index 44d5310..0000000 --- a/0025-Move-Exception-Option-values-into-enum.patch +++ /dev/null @@ -1,77 +0,0 @@ -From fabd4e35427ab156d1e0b28745c926d0253a72cd Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Aug 2021 09:40:28 -0700 -Subject: [PATCH 25/30] Move Exception Option values into enum -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Adding enums together doesn't create a new enum value, so when compiling -with warnings you will get warnings like: - -warning: case value ‘96’ not in enumerated type - -for PED_EXCEPTION_IGNORE_CANCEL - -This moved the defines into the enum as new values so that they are -recognized as valid members of the enum with the values staying the -same. - -NOTE: PED_EXCEPTION_OPTION_LAST *MUST* be the last of the individual -options, not the combined options. - -Thanks to D. Hugh Redelmeier for this patch. ---- - include/parted/exception.in.h | 27 ++++++++++++++++----------- - 1 file changed, 16 insertions(+), 11 deletions(-) - -diff --git a/include/parted/exception.in.h b/include/parted/exception.in.h -index 20abb08..3b131fe 100644 ---- a/include/parted/exception.in.h -+++ b/include/parted/exception.in.h -@@ -46,6 +46,7 @@ typedef enum _PedExceptionType PedExceptionType; - * Option for resolving the exception - */ - enum _PedExceptionOption { -+ /* individual options */ - PED_EXCEPTION_UNHANDLED=0, - PED_EXCEPTION_FIX=1, - PED_EXCEPTION_YES=2, -@@ -54,19 +55,23 @@ enum _PedExceptionOption { - PED_EXCEPTION_RETRY=16, - PED_EXCEPTION_IGNORE=32, - PED_EXCEPTION_CANCEL=64, -+ -+ /* combinations of individual options */ -+ PED_EXCEPTION_OK_CANCEL = PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL, -+ PED_EXCEPTION_YES_NO = PED_EXCEPTION_YES + PED_EXCEPTION_NO, -+ PED_EXCEPTION_YES_NO_CANCEL = -+ PED_EXCEPTION_YES_NO + PED_EXCEPTION_CANCEL, -+ PED_EXCEPTION_IGNORE_CANCEL = -+ PED_EXCEPTION_IGNORE + PED_EXCEPTION_CANCEL, -+ PED_EXCEPTION_RETRY_CANCEL = PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL, -+ PED_EXCEPTION_RETRY_IGNORE_CANCEL = -+ PED_EXCEPTION_RETRY + PED_EXCEPTION_IGNORE_CANCEL, - }; --typedef enum _PedExceptionOption PedExceptionOption; --#define PED_EXCEPTION_OK_CANCEL (PED_EXCEPTION_OK + PED_EXCEPTION_CANCEL) --#define PED_EXCEPTION_YES_NO (PED_EXCEPTION_YES + PED_EXCEPTION_NO) --#define PED_EXCEPTION_YES_NO_CANCEL (PED_EXCEPTION_YES_NO \ -- + PED_EXCEPTION_CANCEL) --#define PED_EXCEPTION_IGNORE_CANCEL (PED_EXCEPTION_IGNORE \ -- + PED_EXCEPTION_CANCEL) --#define PED_EXCEPTION_RETRY_CANCEL (PED_EXCEPTION_RETRY + PED_EXCEPTION_CANCEL) --#define PED_EXCEPTION_RETRY_IGNORE_CANCEL (PED_EXCEPTION_RETRY \ -- + PED_EXCEPTION_IGNORE_CANCEL) -+ - #define PED_EXCEPTION_OPTION_FIRST PED_EXCEPTION_FIX --#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL -+#define PED_EXCEPTION_OPTION_LAST PED_EXCEPTION_CANCEL /* last individual option */ -+ -+typedef enum _PedExceptionOption PedExceptionOption; - - /** - * Structure with information about exception --- -2.31.1 - diff --git a/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch b/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch deleted file mode 100644 index 4f0c713..0000000 --- a/0026-libparted-Add-swap-flag-to-msdos-disklabel.patch +++ /dev/null @@ -1,133 +0,0 @@ -From f8dd8c2c255a3c5c398a62ffdc1bcf5468becccd Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Aug 2021 13:14:26 -0700 -Subject: [PATCH 26/30] libparted: Add swap flag to msdos disklabel - -Previously you had to set the filesystem type to one of the linux-swap -options at creation time. With this change you can now toggle the -partition swap type using the 'swap' partition flag in the same way that -you can on gpt disklabels. - -Thanks to Arvin Schnell for this patch. ---- - doc/parted.texi | 4 ++-- - libparted/labels/dos.c | 24 ++++++++++++++++++++++-- - 2 files changed, 24 insertions(+), 4 deletions(-) - -diff --git a/doc/parted.texi b/doc/parted.texi -index 33212f0..0da68e9 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -897,8 +897,8 @@ MS Windows ME based operating systems to use Linear (LBA) mode. - to be used by Linux. - - @item swap --(Mac) - this flag should be enabled if the partition is the swap --device to be used by Linux. -+(MS-DOS, GPT, Mac) - this flag should be enabled if the partition is the -+swap device to be used by Linux. - - @item hidden - (MS-DOS, PC98) - this flag can be enabled to hide partitions from -diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c -index e2aa5e0..b44ccaf 100644 ---- a/libparted/labels/dos.c -+++ b/libparted/labels/dos.c -@@ -160,6 +160,7 @@ typedef struct { - int msftres; - int raid; - int lvm; -+ int swap; - int lba; - int palo; - int prep; -@@ -958,6 +959,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, - dos_data->raid = raw_part->type == PARTITION_LINUX_RAID; - dos_data->lvm = raw_part->type == PARTITION_LINUX_LVM_OLD - || raw_part->type == PARTITION_LINUX_LVM; -+ dos_data->swap = raw_part->type == PARTITION_LINUX_SWAP; - dos_data->lba = raw_part_is_lba (raw_part); - dos_data->palo = raw_part->type == PARTITION_PALO; - dos_data->prep = raw_part->type == PARTITION_PREP; -@@ -1380,6 +1382,7 @@ msdos_partition_duplicate (const PedPartition* part) - new_dos_data->msftres = old_dos_data->msftres; - new_dos_data->raid = old_dos_data->raid; - new_dos_data->lvm = old_dos_data->lvm; -+ new_dos_data->swap = old_dos_data->swap; - new_dos_data->lba = old_dos_data->lba; - new_dos_data->palo = old_dos_data->palo; - new_dos_data->prep = old_dos_data->prep; -@@ -1437,6 +1440,7 @@ msdos_partition_set_system (PedPartition* part, - dos_data->diag = 0; - dos_data->raid = 0; - dos_data->lvm = 0; -+ dos_data->swap = 0; - dos_data->palo = 0; - dos_data->prep = 0; - dos_data->irst = 0; -@@ -1464,6 +1468,10 @@ msdos_partition_set_system (PedPartition* part, - dos_data->system = PARTITION_LINUX_LVM; - return 1; - } -+ if (dos_data->swap) { -+ dos_data->system = PARTITION_LINUX_SWAP; -+ return 1; -+ } - if (dos_data->raid) { - dos_data->system = PARTITION_LINUX_RAID; - return 1; -@@ -1510,9 +1518,10 @@ msdos_partition_set_system (PedPartition* part, - dos_data->system = PARTITION_UDF; - else if (!strcmp (fs_type->name, "sun-ufs")) - dos_data->system = PARTITION_SUN_UFS; -- else if (is_linux_swap (fs_type->name)) -+ else if (is_linux_swap (fs_type->name)) { - dos_data->system = PARTITION_LINUX_SWAP; -- else -+ dos_data->swap = 1; -+ } else - dos_data->system = PARTITION_LINUX; - - return 1; -@@ -1525,6 +1534,7 @@ clear_flags (DosPartitionData *dos_data) - dos_data->hidden = 0; - dos_data->msftres = 0; - dos_data->lvm = 0; -+ dos_data->swap = 0; - dos_data->palo = 0; - dos_data->prep = 0; - dos_data->irst = 0; -@@ -1604,6 +1614,12 @@ msdos_partition_set_flag (PedPartition* part, - dos_data->lvm = state; - return ped_partition_set_system (part, part->fs_type); - -+ case PED_PARTITION_SWAP: -+ if (state) -+ clear_flags (dos_data); -+ dos_data->swap = state; -+ return ped_partition_set_system (part, part->fs_type); -+ - case PED_PARTITION_LBA: - dos_data->lba = state; - return ped_partition_set_system (part, part->fs_type); -@@ -1677,6 +1693,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) - case PED_PARTITION_LVM: - return dos_data->lvm; - -+ case PED_PARTITION_SWAP: -+ return dos_data->swap; -+ - case PED_PARTITION_LBA: - return dos_data->lba; - -@@ -1720,6 +1739,7 @@ msdos_partition_is_flag_available (const PedPartition* part, - case PED_PARTITION_BOOT: - case PED_PARTITION_RAID: - case PED_PARTITION_LVM: -+ case PED_PARTITION_SWAP: - case PED_PARTITION_LBA: - case PED_PARTITION_PALO: - case PED_PARTITION_PREP: --- -2.31.1 - diff --git a/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch b/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch deleted file mode 100644 index a75a1a9..0000000 --- a/0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch +++ /dev/null @@ -1,31 +0,0 @@ -From b5e17a613d2ea9894fcc090499dcc73e3ea07f61 Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Mon, 9 Aug 2021 15:25:50 +0100 -Subject: [PATCH 27/30] tests: add aarch64 and mips64 as a valid 64-bit - machines - -require_64_bit_ in t-lib-helpers.sh has a hard-coded list of uname -machines that are 64-bit, so add aarch64 and mips64 to cover the major -architectures. - -Signed-off-by: Brian C. Lane ---- - tests/t-lib-helpers.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh -index 9312343..dddb44e 100644 ---- a/tests/t-lib-helpers.sh -+++ b/tests/t-lib-helpers.sh -@@ -411,7 +411,7 @@ device_mapper_required_() - require_64bit_() - { - case $(uname -m) in -- x86_64|ppc64) -+ aarch64|mips64|ppc64|x86_64) - return 0;; - *) - skip_ "This test requires a 64 bit system" --- -2.31.1 - diff --git a/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch b/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch deleted file mode 100644 index c12abc1..0000000 --- a/0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8e97e5f7ad7cc8a1e6233306a45fcdbf08c959bd Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Mon, 9 Aug 2021 15:25:51 +0100 -Subject: [PATCH 28/30] tests: add a helper to check the kernel knows about a - file system - -Some tests need both the file system tools (eg mkfs.vfat) and kernel -support (eg vfat kernel module) to pass. - -There are already helpers such as require_fat_ which check for mkfs.vfat, -but if the kernel doesn't support the filesystem then mounting the disk -image will fail. - -Add require_filesystem_, which checks for either the filesystem name in -/proc/filesystems (so it's built-in, or already loaded) or if the name -is a valid module (so can be loaded on demand). - -Signed-off-by: Brian C. Lane ---- - tests/t-lib-helpers.sh | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh -index dddb44e..33151bb 100644 ---- a/tests/t-lib-helpers.sh -+++ b/tests/t-lib-helpers.sh -@@ -418,3 +418,13 @@ require_64bit_() - ;; - esac - } -+ -+# Check if the specified filesystem is either built into the kernel, or can be loaded -+# as a module -+# Usage: has_filesystem vfat -+# Ruturns 0 if the filesystem is available, otherwise skips the test -+require_filesystem_() -+{ -+ grep -q $1 /proc/filesystems && return 0 -+ modprobe --quiet --dry-run $1 || skip_ "this test requires kernel support for $1" -+} --- -2.31.1 - diff --git a/0029-tests-check-for-vfat-kernel-support-and-tools.patch b/0029-tests-check-for-vfat-kernel-support-and-tools.patch deleted file mode 100644 index 80b6c33..0000000 --- a/0029-tests-check-for-vfat-kernel-support-and-tools.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 231a1e1d3ab525272b44bd20f703f9253fd1ed5c Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Mon, 9 Aug 2021 15:25:52 +0100 -Subject: [PATCH 29/30] tests: check for vfat kernel support and tools - -t1100-busy-label.sh and t1101-busy-partition.sh create and mount VFAT -partitions, so check for both the tools and the kernel support. - -Fixes bug#49594. - -Signed-off-by: Brian C. Lane ---- - tests/t1100-busy-label.sh | 3 +++ - tests/t1101-busy-partition.sh | 2 ++ - 2 files changed, 5 insertions(+) - -diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh -index 71b847c..a77a70f 100755 ---- a/tests/t1100-busy-label.sh -+++ b/tests/t1100-busy-label.sh -@@ -19,6 +19,9 @@ - . "${srcdir=.}/init.sh"; path_prepend_ ../parted - require_root_ - require_scsi_debug_module_ -+require_fat_ -+require_filesystem_ vfat -+ - ss=$sector_size_ - - scsi_debug_setup_ sector_size=$ss dev_size_mb=10 > dev-name || -diff --git a/tests/t1101-busy-partition.sh b/tests/t1101-busy-partition.sh -index 5e37814..c936718 100755 ---- a/tests/t1101-busy-partition.sh -+++ b/tests/t1101-busy-partition.sh -@@ -22,6 +22,8 @@ test "$VERBOSE" = yes && parted --version - - require_root_ - require_scsi_debug_module_ -+require_fat_ -+require_filesystem_ vfat - - # create memory-backed device - scsi_debug_setup_ dev_size_mb=10 > dev-name || --- -2.31.1 - diff --git a/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch b/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch deleted file mode 100644 index 0a7f8e1..0000000 --- a/0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 33f7bb2f9967856afac2411831ef16dcf95746ab Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 Aug 2021 15:49:48 -0700 -Subject: [PATCH 30/30] parted: Escape colons and backslashes in machine output - -The device path, device model, and partition name could all contain -colons or backslashes. This escapes all of these with a backslash. - -Thanks to Arvin Schnell for the patch. ---- - parted/parted.c | 42 ++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 38 insertions(+), 4 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index 22b5818..65b5ab2 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -985,6 +985,32 @@ _print_disk_geometry (const PedDevice *dev) - free (cyl_size); - } - -+static char * -+_escape_machine_string (const char *str) -+{ -+ size_t i, j; -+ char *dest; -+ -+ dest = ped_malloc (2 * strlen(str) + 1); -+ if (!dest) -+ return NULL; -+ -+ for (i = 0, j = 0; str[i] != '\0'; i++, j++) { -+ switch (str[i]) { -+ case ':': -+ case '\\': -+ dest[j++] = '\\'; -+ /* fallthrough */ -+ default: -+ dest[j] = str[i]; -+ break; -+ } -+ } -+ dest[j] = '\0'; -+ -+ return dest; -+} -+ - static void - _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - { -@@ -1005,6 +1031,9 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - char *disk_flags = disk_print_flags (diskp); - - if (opt_machine_mode) { -+ char *escaped_path = _escape_machine_string (dev->path); -+ char *escaped_model = _escape_machine_string (dev->model); -+ - switch (default_unit) { - case PED_UNIT_CHS: puts ("CHS;"); - break; -@@ -1015,9 +1044,11 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - - } - printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n", -- dev->path, end, transport[dev->type], -+ escaped_path, end, transport[dev->type], - dev->sector_size, dev->phys_sector_size, -- pt_name, dev->model, disk_flags); -+ pt_name, escaped_model, disk_flags); -+ free (escaped_path); -+ free (escaped_model); - } else { - printf (_("Model: %s (%s)\n"), - dev->model, transport[dev->type]); -@@ -1289,8 +1320,11 @@ do_print (PedDevice** dev, PedDisk** diskp) - putchar (':'); - - if (has_name) -- printf ("%s:", ped_partition_get_name (part)); -- else -+ { -+ char *escaped_name = _escape_machine_string (ped_partition_get_name (part)); -+ printf ("%s:", escaped_name); -+ free (escaped_name); -+ } else - putchar (':'); - - char *flags = partition_print_flags (part); --- -2.31.1 - diff --git a/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch b/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch deleted file mode 100644 index b640be6..0000000 --- a/0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 9e194581edf31ddd2474e7be5393578542b4ef8d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 9 Jul 2021 10:54:51 -0700 -Subject: [PATCH] libparted: Tell libdevmapper to retry remove when BUSY - -This sets the libdevmapper retry remove flag, which will retry a remove -command if it is BUSY. - -parted already has it's own BUSY retry code, but when run with -device-mapper an error can be printed by libdevmapper which can be -confusing to the user. - -Resolves: rhbz#1980697 ---- - libparted/arch/linux.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index aacc94f..758d36a 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -2855,6 +2855,7 @@ _dm_remove_partition(PedDisk* disk, int partno) - if (!task) - goto err; - dm_task_set_name (task, part_name); -+ dm_task_retry_remove(task); - if (!dm_task_set_cookie (task, &cookie, 0)) - goto err; - rc = _dm_task_run_wait (task, cookie); --- -2.31.1 - diff --git a/0032-libparted-Check-devpath-before-passing-to-strlen.patch b/0032-libparted-Check-devpath-before-passing-to-strlen.patch deleted file mode 100644 index c48f653..0000000 --- a/0032-libparted-Check-devpath-before-passing-to-strlen.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 74636ce7f34081e92c5680f34588217978306488 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 19 Aug 2021 13:56:31 -0700 -Subject: [PATCH 32/34] libparted: Check devpath before passing to strlen - ---- - libparted/arch/linux.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c -index 758d36a..430d02e 100644 ---- a/libparted/arch/linux.c -+++ b/libparted/arch/linux.c -@@ -2453,6 +2453,9 @@ _device_get_part_path (PedDevice const *dev, int num) - #else - devpath = dev->path; - #endif -+ if (!devpath) -+ return NULL; -+ - path_len = strlen (devpath); - /* Check for devfs-style /disc => /partN transformation - unconditionally; the system might be using udev with devfs rules, --- -2.31.1 - diff --git a/0033-parted-Allow-empty-string-for-partition-name.patch b/0033-parted-Allow-empty-string-for-partition-name.patch deleted file mode 100644 index 23b605b..0000000 --- a/0033-parted-Allow-empty-string-for-partition-name.patch +++ /dev/null @@ -1,125 +0,0 @@ -From 72faef8673b5b1d00059608f0729e93cb21a7664 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Fri, 13 Aug 2021 13:02:27 +0000 -Subject: [PATCH 33/34] parted: Allow empty string for partition name - -This makes it possible to pass an empty string in script mode e.g. to -set no partition name (on GPT): - -parted -s ./disk.img mklabel gpt mkpart '""' ext2 1 100M - -Includes a new test for this feature. - -Signed-off-by: Brian C. Lane ---- - parted/ui.c | 9 +++++++-- - tests/Makefile.am | 1 + - tests/t0290-gpt-name.sh | 41 +++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 49 insertions(+), 2 deletions(-) - create mode 100755 tests/t0290-gpt-name.sh - -diff --git a/parted/ui.c b/parted/ui.c -index b5948d3..25ad4f1 100644 ---- a/parted/ui.c -+++ b/parted/ui.c -@@ -16,7 +16,6 @@ - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ --#include - - #include - -@@ -727,6 +726,7 @@ void - command_line_push_line (const char* line, int multi_word) - { - int quoted = 0; -+ int quotes_empty = 0; - char quote_char = 0; - char this_word [256]; - int i; -@@ -754,6 +754,9 @@ command_line_push_line (const char* line, int multi_word) - - if (quoted && *line == quote_char) { - quoted = 0; -+ /* allow empty partition name in script mode */ -+ if (!i) -+ quotes_empty = 1; - continue; - } - -@@ -761,9 +764,11 @@ command_line_push_line (const char* line, int multi_word) - if (quoted && line[0] == '\\' && line[1]) - line++; - -+ quotes_empty = 0; - this_word [i++] = *line; - } -- if (i || !multi_word) { -+ if (i || !multi_word || quotes_empty) { -+ quotes_empty = 0; - this_word [i] = 0; - command_line_push_word (this_word); - } -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 3473e6b..9c4a79d 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -33,6 +33,7 @@ TESTS = \ - t0281-gpt-grow.sh \ - t0282-gpt-move-backup.sh \ - t0283-overlap-partitions.sh \ -+ t0290-gpt-name.sh \ - t0300-dos-on-gpt.sh \ - t0301-overwrite-gpt-pmbr.sh \ - t0350-mac-PT-increases-sector-size.sh \ -diff --git a/tests/t0290-gpt-name.sh b/tests/t0290-gpt-name.sh -new file mode 100755 -index 0000000..26041b6 ---- /dev/null -+++ b/tests/t0290-gpt-name.sh -@@ -0,0 +1,41 @@ -+#!/bin/sh -+ -+# Test setting empty GPT partition name in non-interactive mode -+ -+# Copyright (C) 2021 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+ -+dev=loop-file -+ -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create partition with empty name -+parted --script "$dev" mklabel gpt mkpart '""' ext4 1MiB 49MiB > out 2>&1 || fail=1 -+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 -+grep 'MiB:::;' out || fail=1 -+ -+# set a non-empty name -+parted --script "$dev" name 1 "test" > out 2>&1 || fail=1 -+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 -+grep 'MiB::test:;' out || fail=1 -+ -+# set empty name -+parted --script "$dev" name 1 "''" > out 2>&1 || fail=1 -+parted --script --machine "$dev" unit MiB print > out 2>&1 || fail=1 -+grep 'MiB:::;' out || fail=1 -+ -+Exit $fail --- -2.31.1 - diff --git a/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch b/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch deleted file mode 100644 index c9611e3..0000000 --- a/0034-parted-Add-json-cmdline-switch-to-output-JSON.patch +++ /dev/null @@ -1,917 +0,0 @@ -From 36d16c57d4ff6cf9903bfe65671c7f90879e004f Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Tue, 17 Aug 2021 11:05:38 +0000 -Subject: [PATCH 34/34] parted: Add --json cmdline switch to output JSON - -This outputs the disk's details as a JSON object. eg. a disk image with -a single partition from 1M to 100M: - -{ - "disk": { - "path": "/root/disk1.img", - "size": "2097152s", - "model": "", - "transport": "file", - "logical-sector-size": 512, - "physical-sector-size": 512, - "label": "gpt", - "max-partitions": 128, - "partitions": [ - { - "number": 0, - "start": "34s", - "end": "2047s", - "size": "2014s", - "type": "free" - },{ - "number": 1, - "start": "2048s", - "end": "200703s", - "size": "198656s", - "type": "primary", - "name": "root" - },{ - "number": 0, - "start": "200704s", - "end": "2097118s", - "size": "1896415s", - "type": "free" - } - ] - } -} - -Signed-off-by: Brian C. Lane ---- - doc/C/parted.8 | 3 + - doc/parted.texi | 8 ++ - parted/Makefile.am | 2 + - parted/jsonwrt.c | 225 ++++++++++++++++++++++++++++++++++++++ - parted/jsonwrt.h | 46 ++++++++ - parted/parted.c | 170 ++++++++++++++++++++++++++-- - tests/Makefile.am | 2 + - tests/t0800-json-gpt.sh | 94 ++++++++++++++++ - tests/t0801-json-msdos.sh | 86 +++++++++++++++ - 9 files changed, 624 insertions(+), 12 deletions(-) - create mode 100644 parted/jsonwrt.c - create mode 100644 parted/jsonwrt.h - create mode 100755 tests/t0800-json-gpt.sh - create mode 100755 tests/t0801-json-msdos.sh - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index d8e556e..46b30ad 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -24,6 +24,9 @@ lists partition layout on all block devices - .B -m, --machine - displays machine parseable output - .TP -+.B -m, --json -+displays JSON output -+.TP - .B -s, --script - never prompts for user intervention - .TP -diff --git a/doc/parted.texi b/doc/parted.texi -index 0da68e9..57ceb55 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -402,6 +402,14 @@ Options: - @itemx --help - display a help message - -+@item -m -+@itemx --machine -+display output in machine parseable format -+ -+@item -j -+@itemx --json -+display output in JSON format -+ - @item -s - @itemx --script - never prompt the user -diff --git a/parted/Makefile.am b/parted/Makefile.am -index e7bba2e..e5f3288 100644 ---- a/parted/Makefile.am -+++ b/parted/Makefile.am -@@ -13,6 +13,8 @@ parted_SOURCES = command.c \ - strlist.h \ - ui.c \ - ui.h \ -+ jsonwrt.c \ -+ jsonwrt.h \ - table.c \ - table.h - -diff --git a/parted/jsonwrt.c b/parted/jsonwrt.c -new file mode 100644 -index 0000000..1560224 ---- /dev/null -+++ b/parted/jsonwrt.c -@@ -0,0 +1,225 @@ -+/* -+ * JSON output formatting functions. -+ * -+ * No copyright is claimed. This code is in the public domain; do with -+ * it what you wish. -+ * -+ * Written by Karel Zak -+ */ -+ -+#include "config.h" -+#include -+#include -+#include -+#include -+#include -+#include "jsonwrt.h" -+ -+/* -+ * Requirements enumerated via testing (V8, Firefox, IE11): -+ * -+ * var charsToEscape = []; -+ * for (var i = 0; i < 65535; i += 1) { -+ * try { -+ * JSON.parse('{"sample": "' + String.fromCodePoint(i) + '"}'); -+ * } catch (e) { -+ * charsToEscape.push(i); -+ * } -+ * } -+ */ -+static void fputs_quoted_case_json(const char *data, FILE *out, int dir) -+{ -+ const char *p; -+ -+ fputc('"', out); -+ for (p = data; p && *p; p++) { -+ -+ const unsigned int c = (unsigned int) *p; -+ -+ /* From http://www.json.org -+ * -+ * The double-quote and backslashes would break out a string or -+ * init an escape sequence if not escaped. -+ * -+ * Note that single-quotes and forward slashes, while they're -+ * in the JSON spec, don't break double-quoted strings. -+ */ -+ if (c == '"' || c == '\\') { -+ fputc('\\', out); -+ fputc(c, out); -+ continue; -+ } -+ -+ /* All non-control characters OK; do the case swap as required. */ -+ if (c >= 0x20) { -+ /* -+ * Don't use locale sensitive ctype.h functions for regular -+ * ASCII chars, because for example with Turkish locale -+ * (aka LANG=tr_TR.UTF-8) toupper('I') returns 'I'. -+ */ -+ if (c <= 127) -+ fputc(dir == 1 ? c_toupper(c) : -+ dir == -1 ? c_tolower(c) : *p, out); -+ else -+ fputc(dir == 1 ? toupper(c) : -+ dir == -1 ? tolower(c) : *p, out); -+ continue; -+ } -+ -+ /* In addition, all chars under ' ' break Node's/V8/Chrome's, and -+ * Firefox's JSON.parse function -+ */ -+ switch (c) { -+ /* Handle short-hand cases to reduce output size. C -+ * has most of the same stuff here, so if there's an -+ * "Escape for C" function somewhere in the STL, we -+ * should probably be using it. -+ */ -+ case '\b': -+ fputs("\\b", out); -+ break; -+ case '\t': -+ fputs("\\t", out); -+ break; -+ case '\n': -+ fputs("\\n", out); -+ break; -+ case '\f': -+ fputs("\\f", out); -+ break; -+ case '\r': -+ fputs("\\r", out); -+ break; -+ default: -+ /* Other assorted control characters */ -+ fprintf(out, "\\u00%02x", c); -+ break; -+ } -+ } -+ fputc('"', out); -+} -+ -+#define fputs_quoted_json(_d, _o) fputs_quoted_case_json(_d, _o, 0) -+#define fputs_quoted_json_upper(_d, _o) fputs_quoted_case_json(_d, _o, 1) -+#define fputs_quoted_json_lower(_d, _o) fputs_quoted_case_json(_d, _o, -1) -+ -+void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent) -+{ -+ fmt->out = out; -+ fmt->indent = indent; -+ fmt->after_close = 0; -+} -+ -+void ul_jsonwrt_indent(struct ul_jsonwrt *fmt) -+{ -+ int i; -+ -+ for (i = 0; i < fmt->indent; i++) -+ fputs(" ", fmt->out); -+} -+ -+void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type) -+{ -+ if (name) { -+ if (fmt->after_close) -+ fputs(",\n", fmt->out); -+ ul_jsonwrt_indent(fmt); -+ fputs_quoted_json_lower(name, fmt->out); -+ } else { -+ if (fmt->after_close) -+ fputs(",", fmt->out); -+ else -+ ul_jsonwrt_indent(fmt); -+ } -+ -+ switch (type) { -+ case UL_JSON_OBJECT: -+ fputs(name ? ": {\n" : "{\n", fmt->out); -+ fmt->indent++; -+ break; -+ case UL_JSON_ARRAY: -+ fputs(name ? ": [\n" : "[\n", fmt->out); -+ fmt->indent++; -+ break; -+ case UL_JSON_VALUE: -+ fputs(name ? ": " : " ", fmt->out); -+ break; -+ } -+ fmt->after_close = 0; -+} -+ -+void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type) -+{ -+ if (fmt->indent == 1) { -+ fputs("\n}\n", fmt->out); -+ fmt->indent--; -+ fmt->after_close = 1; -+ return; -+ } -+ assert(fmt->indent > 0); -+ -+ switch (type) { -+ case UL_JSON_OBJECT: -+ fmt->indent--; -+ fputc('\n', fmt->out); -+ ul_jsonwrt_indent(fmt); -+ fputs("}", fmt->out); -+ break; -+ case UL_JSON_ARRAY: -+ fmt->indent--; -+ fputc('\n', fmt->out); -+ ul_jsonwrt_indent(fmt); -+ fputs("]", fmt->out); -+ break; -+ case UL_JSON_VALUE: -+ break; -+ } -+ -+ fmt->after_close = 1; -+} -+ -+void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt, -+ const char *name, const char *data) -+{ -+ ul_jsonwrt_value_open(fmt, name); -+ if (data && *data) -+ fputs(data, fmt->out); -+ else -+ fputs("null", fmt->out); -+ ul_jsonwrt_value_close(fmt); -+} -+ -+void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt, -+ const char *name, const char *data) -+{ -+ ul_jsonwrt_value_open(fmt, name); -+ if (data) -+ fputs_quoted_json(data, fmt->out); -+ else -+ fputs("null", fmt->out); -+ ul_jsonwrt_value_close(fmt); -+} -+ -+void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt, -+ const char *name, uint64_t data) -+{ -+ ul_jsonwrt_value_open(fmt, name); -+ fprintf(fmt->out, "%"PRIu64, data); -+ ul_jsonwrt_value_close(fmt); -+} -+ -+void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt, -+ const char *name, int data) -+{ -+ ul_jsonwrt_value_open(fmt, name); -+ fputs(data ? "true" : "false", fmt->out); -+ ul_jsonwrt_value_close(fmt); -+} -+ -+void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt, -+ const char *name) -+{ -+ ul_jsonwrt_value_open(fmt, name); -+ fputs("null", fmt->out); -+ ul_jsonwrt_value_close(fmt); -+} -diff --git a/parted/jsonwrt.h b/parted/jsonwrt.h -new file mode 100644 -index 0000000..4587b60 ---- /dev/null -+++ b/parted/jsonwrt.h -@@ -0,0 +1,46 @@ -+#ifndef UTIL_LINUX_JSONWRT_H -+#define UTIL_LINUX_JSONWRT_H -+ -+enum { -+ UL_JSON_OBJECT, -+ UL_JSON_ARRAY, -+ UL_JSON_VALUE -+}; -+ -+struct ul_jsonwrt { -+ FILE *out; -+ int indent; -+ -+ unsigned int after_close :1; -+}; -+ -+void ul_jsonwrt_init(struct ul_jsonwrt *fmt, FILE *out, int indent); -+void ul_jsonwrt_indent(struct ul_jsonwrt *fmt); -+void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type); -+void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type); -+ -+#define ul_jsonwrt_root_open(_f) ul_jsonwrt_open(_f, NULL, UL_JSON_OBJECT) -+#define ul_jsonwrt_root_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT) -+ -+#define ul_jsonwrt_array_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_ARRAY) -+#define ul_jsonwrt_array_close(_f) ul_jsonwrt_close(_f, UL_JSON_ARRAY) -+ -+#define ul_jsonwrt_object_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_OBJECT) -+#define ul_jsonwrt_object_close(_f) ul_jsonwrt_close(_f, UL_JSON_OBJECT) -+ -+#define ul_jsonwrt_value_open(_f, _n) ul_jsonwrt_open(_f, _n, UL_JSON_VALUE) -+#define ul_jsonwrt_value_close(_f) ul_jsonwrt_close(_f, UL_JSON_VALUE) -+ -+ -+void ul_jsonwrt_value_raw(struct ul_jsonwrt *fmt, -+ const char *name, const char *data); -+void ul_jsonwrt_value_s(struct ul_jsonwrt *fmt, -+ const char *name, const char *data); -+void ul_jsonwrt_value_u64(struct ul_jsonwrt *fmt, -+ const char *name, uint64_t data); -+void ul_jsonwrt_value_boolean(struct ul_jsonwrt *fmt, -+ const char *name, int data); -+void ul_jsonwrt_value_null(struct ul_jsonwrt *fmt, -+ const char *name); -+ -+#endif /* UTIL_LINUX_JSONWRT_H */ -diff --git a/parted/parted.c b/parted/parted.c -index 65b5ab2..975700c 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -57,6 +57,7 @@ - #include "c-ctype.h" - #include "c-strcase.h" - #include "xalloc.h" -+#include "jsonwrt.h" - - #ifdef ENABLE_MTRACE - #include -@@ -79,6 +80,14 @@ enum - PRETEND_INPUT_TTY = CHAR_MAX + 1, - }; - -+/* Output modes */ -+enum -+{ -+ HUMAN, -+ MACHINE, -+ JSON -+}; -+ - enum - { - ALIGNMENT_NONE = 2, -@@ -115,6 +124,7 @@ static struct option const options[] = { - {"help", 0, NULL, 'h'}, - {"list", 0, NULL, 'l'}, - {"machine", 0, NULL, 'm'}, -+ {"json", 0, NULL, 'j'}, - {"script", 0, NULL, 's'}, - {"fix", 0, NULL, 'f'}, - {"version", 0, NULL, 'v'}, -@@ -127,6 +137,7 @@ static const char *const options_help [][2] = { - {"help", N_("displays this help message")}, - {"list", N_("lists partition layout on all block devices")}, - {"machine", N_("displays machine parseable output")}, -+ {"json", N_("displays JSON output")}, - {"script", N_("never prompts for user intervention")}, - {"fix", N_("in script mode, fix instead of abort when asked")}, - {"version", N_("displays the version")}, -@@ -137,7 +148,7 @@ static const char *const options_help [][2] = { - int opt_script_mode = 0; - int opt_fix_mode = 0; - int pretend_input_tty = 0; --int opt_machine_mode = 0; -+int opt_output_mode = HUMAN; - int disk_is_modified = 0; - int is_toggle_mode = 0; - int alignment = ALIGNMENT_OPTIMAL; -@@ -184,6 +195,8 @@ static Command* commands [256] = {NULL}; - static PedTimer* g_timer; - static TimerContext timer_context; - -+static struct ul_jsonwrt json; -+ - static int _print_list (); - static void _done (PedDevice* dev, PedDisk *diskp); - static bool partition_align_check (PedDisk const *disk, -@@ -931,6 +944,32 @@ partition_print_flags (PedPartition const *part) - return res; - } - -+static void -+partition_print_flags_json (PedPartition const *part) -+{ -+ if (!part) -+ return; -+ -+ int did_open_array = 0; -+ -+ PedPartitionFlag flag; -+ for (flag = ped_partition_flag_next (0); flag; -+ flag = ped_partition_flag_next (flag)) -+ { -+ if (ped_partition_get_flag (part, flag)) -+ { -+ if (!did_open_array) -+ ul_jsonwrt_array_open (&json, "flags"); -+ did_open_array = 1; -+ -+ ul_jsonwrt_value_s (&json, NULL, ped_partition_flag_get_name (flag)); -+ } -+ } -+ -+ if (did_open_array) -+ ul_jsonwrt_array_close (&json); -+} -+ - static int - partition_print (PedPartition* part) - { -@@ -964,6 +1003,32 @@ disk_print_flags (PedDisk const *disk) - return res; - } - -+static void -+disk_print_flags_json (PedDisk const *disk) -+{ -+ if (!disk) -+ return; -+ -+ int did_open_array = 0; -+ -+ PedDiskFlag flag; -+ for (flag = ped_disk_flag_next (0); flag; -+ flag = ped_disk_flag_next (flag)) -+ { -+ if (ped_disk_get_flag (disk, flag)) -+ { -+ if (!did_open_array) -+ ul_jsonwrt_array_open (&json, "flags"); -+ did_open_array = 1; -+ -+ ul_jsonwrt_value_s (&json, NULL, ped_disk_flag_get_name (flag)); -+ } -+ } -+ -+ if (did_open_array) -+ ul_jsonwrt_array_close (&json); -+} -+ - static void - _print_disk_geometry (const PedDevice *dev) - { -@@ -973,9 +1038,14 @@ _print_disk_geometry (const PedDevice *dev) - chs->heads * chs->sectors, - PED_UNIT_KILOBYTE); - -- if (opt_machine_mode) { -+ if (opt_output_mode == MACHINE) { - printf ("%d:%d:%d:%s;\n", - chs->cylinders, chs->heads, chs->sectors, cyl_size); -+ } else if (opt_output_mode == JSON) { -+ char* tmp = ped_malloc (128); -+ snprintf (tmp, 128, "%d,%d,%d %s", chs->cylinders, chs->heads, chs->sectors, cyl_size); -+ ul_jsonwrt_value_s (&json, "geometry", tmp); -+ free (tmp); - } else { - printf (_("BIOS cylinder,head,sector geometry: %d,%d,%d. " - "Each cylinder is %s.\n"), -@@ -1030,7 +1100,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - const char* pt_name = diskp ? diskp->type->name : "unknown"; - char *disk_flags = disk_print_flags (diskp); - -- if (opt_machine_mode) { -+ if (opt_output_mode == MACHINE) { - char *escaped_path = _escape_machine_string (dev->path); - char *escaped_model = _escape_machine_string (dev->model); - -@@ -1049,6 +1119,20 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - pt_name, escaped_model, disk_flags); - free (escaped_path); - free (escaped_model); -+ } else if (opt_output_mode == JSON) { -+ ul_jsonwrt_value_s (&json, "path", dev->path); -+ ul_jsonwrt_value_s (&json, "size", end); -+ ul_jsonwrt_value_s (&json, "model", dev->model); -+ ul_jsonwrt_value_s (&json, "transport", transport[dev->type]); -+ ul_jsonwrt_value_u64 (&json, "logical-sector-size", dev->sector_size); -+ ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); -+ ul_jsonwrt_value_s (&json, "label", pt_name); -+ if (diskp) { -+ if (diskp->type->ops->get_max_primary_partition_count) -+ ul_jsonwrt_value_u64 (&json, "max-partitions", -+ diskp->type->ops->get_max_primary_partition_count(diskp)); -+ disk_print_flags_json (diskp); -+ } - } else { - printf (_("Model: %s (%s)\n"), - dev->model, transport[dev->type]); -@@ -1064,7 +1148,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - || ped_unit_get_default () == PED_UNIT_CYLINDER) - _print_disk_geometry (dev); - -- if (!opt_machine_mode) { -+ if (opt_output_mode == HUMAN) { - printf (_("Partition Table: %s\n"), pt_name); - printf (_("Disk Flags: %s\n"), disk_flags); - } -@@ -1170,10 +1254,16 @@ do_print (PedDevice** dev, PedDisk** diskp) - return status; - } - -+ if (opt_output_mode == JSON) { -+ ul_jsonwrt_init (&json, stdout, 0); -+ ul_jsonwrt_root_open (&json); -+ ul_jsonwrt_object_open (&json, "disk"); -+ } -+ - _print_disk_info (*dev, *diskp); - if (!*diskp) - goto nopt; -- if (!opt_machine_mode) -+ if (opt_output_mode == HUMAN) - putchar ('\n'); - - has_extended = ped_disk_type_check_feature ((*diskp)->type, -@@ -1182,7 +1272,7 @@ do_print (PedDevice** dev, PedDisk** diskp) - PED_DISK_TYPE_PARTITION_NAME); - - PedPartition* part; -- if (!opt_machine_mode) { -+ if (opt_output_mode == HUMAN) { - StrList *row1; - - if (ped_unit_get_default() == PED_UNIT_CHS) { -@@ -1283,6 +1373,57 @@ do_print (PedDevice** dev, PedDisk** diskp) - table_destroy (table); - str_list_destroy (row1); - -+ } else if (opt_output_mode == JSON) { -+ -+ ul_jsonwrt_array_open (&json, "partitions"); -+ -+ for (part = ped_disk_next_partition (*diskp, NULL); part; -+ part = ped_disk_next_partition (*diskp, part)) { -+ -+ if ((!has_free_arg && !ped_partition_is_active(part)) || -+ part->type & PED_PARTITION_METADATA) -+ continue; -+ -+ ul_jsonwrt_object_open (&json, NULL); -+ -+ ul_jsonwrt_value_u64 (&json, "number", part->num >= 0 ? part->num : 0); -+ -+ tmp = ped_unit_format (*dev, part->geom.start); -+ ul_jsonwrt_value_s (&json, "start", tmp); -+ free (tmp); -+ -+ tmp = ped_unit_format_byte (*dev, (part->geom.end + 1) * (*dev)->sector_size - 1); -+ ul_jsonwrt_value_s (&json, "end", tmp); -+ free (tmp); -+ -+ if (ped_unit_get_default() != PED_UNIT_CHS) { -+ tmp = ped_unit_format (*dev, part->geom.length); -+ ul_jsonwrt_value_s (&json, "size", tmp); -+ free (tmp); -+ } -+ -+ name = ped_partition_type_get_name (part->type); -+ ul_jsonwrt_value_s (&json, "type", name); -+ -+ if (!(part->type & PED_PARTITION_FREESPACE)) { -+ -+ if (has_name) { -+ name = ped_partition_get_name (part); -+ if (strcmp (name, "") != 0) -+ ul_jsonwrt_value_s (&json, "name", ped_partition_get_name (part)); -+ } -+ -+ if (part->fs_type) -+ ul_jsonwrt_value_s (&json, "filesystem", part->fs_type->name); -+ -+ partition_print_flags_json (part); -+ } -+ -+ ul_jsonwrt_object_close (&json); -+ } -+ -+ ul_jsonwrt_array_close (&json); -+ - } else { - - for (part = ped_disk_next_partition (*diskp, NULL); part; -@@ -1337,9 +1478,13 @@ do_print (PedDevice** dev, PedDisk** diskp) - } - } - -- return ok; -- - nopt: -+ -+ if (opt_output_mode == JSON) { -+ ul_jsonwrt_object_close (&json); -+ ul_jsonwrt_root_close (&json); -+ } -+ - return ok; - } - -@@ -2232,7 +2377,7 @@ int opt, help = 0, list = 0, version = 0, wrong = 0; - - while (1) - { -- opt = getopt_long (*argc_ptr, *argv_ptr, "hlmsfva:", -+ opt = getopt_long (*argc_ptr, *argv_ptr, "hlmjsfva:", - options, NULL); - if (opt == -1) - break; -@@ -2240,7 +2385,8 @@ while (1) - switch (opt) { - case 'h': help = 1; break; - case 'l': list = 1; break; -- case 'm': opt_machine_mode = 1; break; -+ case 'm': opt_output_mode = MACHINE; break; -+ case 'j': opt_output_mode = JSON; break; - case 's': opt_script_mode = 1; break; - case 'f': opt_fix_mode = 1; break; - case 'v': version = 1; break; -@@ -2289,7 +2435,7 @@ _choose_device (int* argc_ptr, char*** argv_ptr) - { - PedDevice* dev; - --/* specified on comand line? */ -+/* specified on command line? */ - if (*argc_ptr) { - dev = ped_device_get ((*argv_ptr) [0]); - if (!dev) -@@ -2377,7 +2523,7 @@ _done (PedDevice* dev, PedDisk* diskp) - "rebooting. Read section 4 of the Parted User " - "documentation for more information.")); - } -- if (!opt_script_mode && !opt_machine_mode && disk_is_modified) { -+ if (!opt_script_mode && opt_output_mode == HUMAN && disk_is_modified) { - ped_exception_throw ( - PED_EXCEPTION_INFORMATION, PED_EXCEPTION_OK, - _("You may need to update /etc/fstab.\n")); -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 9c4a79d..f9340aa 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -40,6 +40,8 @@ TESTS = \ - t0400-loop-clobber-infloop.sh \ - t0500-dup-clobber.sh \ - t0501-duplicate.sh \ -+ t0800-json-gpt.sh \ -+ t0801-json-msdos.sh \ - t1100-busy-label.sh \ - t1101-busy-partition.sh \ - t1102-loop-label.sh \ -diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh -new file mode 100755 -index 0000000..8dd1862 ---- /dev/null -+++ b/tests/t0800-json-gpt.sh -@@ -0,0 +1,94 @@ -+#!/bin/sh -+ -+# Test JSON output with GPT label -+ -+# Copyright (C) 2021 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create gpt label and some partitions -+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 -+parted --script "$dev" disk_set pmbr_boot on > out 2>&1 || fail=1 -+parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1 -+parted --script "$dev" mkpart "test2" xfs 20% 60% > out 2>&1 || fail=1 -+parted --script "$dev" set 2 raid on > out 2>&1 || fail=1 -+ -+# print with json format -+parted --script --json "$dev" unit s print free > out 2>&1 || fail=1 -+ -+cat < exp || fail=1 -+{ -+ "disk": { -+ "path": "loop-file", -+ "size": "102400s", -+ "model": "", -+ "transport": "file", -+ "logical-sector-size": 512, -+ "physical-sector-size": 512, -+ "label": "gpt", -+ "max-partitions": 128, -+ "flags": [ -+ "pmbr_boot" -+ ], -+ "partitions": [ -+ { -+ "number": 0, -+ "start": "34s", -+ "end": "10239s", -+ "size": "10206s", -+ "type": "free" -+ },{ -+ "number": 1, -+ "start": "10240s", -+ "end": "20479s", -+ "size": "10240s", -+ "type": "primary", -+ "name": "test1" -+ },{ -+ "number": 2, -+ "start": "20480s", -+ "end": "61439s", -+ "size": "40960s", -+ "type": "primary", -+ "name": "test2", -+ "flags": [ -+ "raid" -+ ] -+ },{ -+ "number": 0, -+ "start": "61440s", -+ "end": "102366s", -+ "size": "40927s", -+ "type": "free" -+ } -+ ] -+ } -+} -+EOF -+ -+# remove full path of device from actual output -+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 -+ -+# check for expected output -+compare exp out || fail=1 -+ -+Exit $fail -diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh -new file mode 100755 -index 0000000..a14a5af ---- /dev/null -+++ b/tests/t0801-json-msdos.sh -@@ -0,0 +1,86 @@ -+#!/bin/sh -+ -+# Test JSON output with MS-DOS label -+ -+# Copyright (C) 2021 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create msdos label and some partitions -+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 -+parted --script "$dev" mkpart primary ext4 10% 20% > out 2>&1 || fail=1 -+parted --script "$dev" mkpart extended 20% 60% > out 2>&1 || fail=1 -+parted --script "$dev" mkpart logical ext4 20% 40% > out 2>&1 || fail=1 -+parted --script "$dev" set 5 lvm on > out 2>&1 || fail=1 -+ -+# print with json format -+parted --script --json "$dev" unit MiB print > out 2>&1 || fail=1 -+ -+cat < exp || fail=1 -+{ -+ "disk": { -+ "path": "loop-file", -+ "size": "50.0MiB", -+ "model": "", -+ "transport": "file", -+ "logical-sector-size": 512, -+ "physical-sector-size": 512, -+ "label": "msdos", -+ "max-partitions": 4, -+ "partitions": [ -+ { -+ "number": 1, -+ "start": "5.00MiB", -+ "end": "10.0MiB", -+ "size": "5.00MiB", -+ "type": "primary" -+ },{ -+ "number": 2, -+ "start": "10.0MiB", -+ "end": "30.0MiB", -+ "size": "20.0MiB", -+ "type": "extended", -+ "flags": [ -+ "lba" -+ ] -+ },{ -+ "number": 5, -+ "start": "10.0MiB", -+ "end": "20.0MiB", -+ "size": "10.0MiB", -+ "type": "logical", -+ "flags": [ -+ "lvm" -+ ] -+ } -+ ] -+ } -+} -+EOF -+ -+# remove full path of device from actual output -+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 -+ -+# check for expected output -+compare exp out || fail=1 -+ -+Exit $fail --- -2.31.1 - diff --git a/0035-hurd-Fix-partition-paths.patch b/0035-hurd-Fix-partition-paths.patch deleted file mode 100644 index 80a6ecb..0000000 --- a/0035-hurd-Fix-partition-paths.patch +++ /dev/null @@ -1,29 +0,0 @@ -From dde6702f20b7c34b091b25580ab19009c9d91b30 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Thu, 26 Nov 2020 21:59:39 +0100 -Subject: [PATCH 35/38] hurd: Fix partition paths - -We have always had an 's' to separate drive number from partition -number. - -Signed-off-by: Brian C. Lane ---- - libparted/arch/gnu.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c -index d7204cc..507a5ff 100644 ---- a/libparted/arch/gnu.c -+++ b/libparted/arch/gnu.c -@@ -805,7 +805,7 @@ gnu_partition_get_path (const PedPartition* part) - result = (char*) ped_malloc (result_len); - if (!result) - return NULL; -- snprintf (result, result_len, "%s%d", dev_path, part->num); -+ snprintf (result, result_len, "%ss%d", dev_path, part->num); - return result; - } - --- -2.31.1 - diff --git a/0036-hurd-Support-rumpdisk-based-device-names.patch b/0036-hurd-Support-rumpdisk-based-device-names.patch deleted file mode 100644 index 6b14e30..0000000 --- a/0036-hurd-Support-rumpdisk-based-device-names.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e0a83f3bdf6cfb4b2b6d3631a5ab157291bfbdfa Mon Sep 17 00:00:00 2001 -From: Samuel Thibault -Date: Sun, 29 Nov 2020 23:20:17 +0100 -Subject: [PATCH 36/38] hurd: Support rumpdisk-based device names - -Signed-off-by: Brian C. Lane ---- - libparted/arch/gnu.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c -index 507a5ff..0797115 100644 ---- a/libparted/arch/gnu.c -+++ b/libparted/arch/gnu.c -@@ -786,6 +786,15 @@ probe_standard_devices () - _ped_device_probe ("/dev/hd6"); - _ped_device_probe ("/dev/hd7"); - -+ _ped_device_probe ("/dev/wd0"); -+ _ped_device_probe ("/dev/wd1"); -+ _ped_device_probe ("/dev/wd2"); -+ _ped_device_probe ("/dev/wd3"); -+ _ped_device_probe ("/dev/wd4"); -+ _ped_device_probe ("/dev/wd5"); -+ _ped_device_probe ("/dev/wd6"); -+ _ped_device_probe ("/dev/wd7"); -+ - return 1; - } - --- -2.31.1 - diff --git a/0037-hurd-Implement-partition-table-rereading.patch b/0037-hurd-Implement-partition-table-rereading.patch deleted file mode 100644 index ccb756e..0000000 --- a/0037-hurd-Implement-partition-table-rereading.patch +++ /dev/null @@ -1,135 +0,0 @@ -From c16cb23bf91cf3255e2cf8ea596fe5e1b4ea1ad5 Mon Sep 17 00:00:00 2001 -From: Colin Watson -Date: Sun, 29 Nov 2020 23:19:23 +0100 -Subject: [PATCH 37/38] hurd: Implement partition table rereading - -We have to tell both the device for the drive itself, it case it -implements the partitioned devices, and tell the partition devices -to go away, in case they are implemented on their own by using parted. - -Signed-off-by: Brian C. Lane ---- - libparted/arch/gnu.c | 84 ++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 78 insertions(+), 6 deletions(-) - -diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c -index 0797115..b040c45 100644 ---- a/libparted/arch/gnu.c -+++ b/libparted/arch/gnu.c -@@ -185,7 +185,7 @@ _init_device (const char *path) - if (!dev->arch_specific) - goto error_free_path; - -- dev->type = PED_DEVICE_FILE; /* FIXME? */ -+ dev->type = PED_DEVICE_UNKNOWN; /* It's deprecated anyway */ - dev->open_count = 0; - dev->read_only = 0; - dev->external_mode = 0; -@@ -204,11 +204,83 @@ error: - return NULL; - } - -+/* Ask the kernel and translators to reload the partition table. -+ XXX: Will probably be replaced by some RPC to partfs when it's finished. In -+ the meantime, gnumach's glue layer will pass BLKRRPART to the Linux drivers. -+ */ -+#define BLKRRPART 0x125F - static int --_kernel_reread_part_table (PedDevice* dev) -+_reread_part_table (PedDevice* dev) - { -- /* XXX: We must wait for partfs to be finished. */ -- return 1; -+ struct store *store = GNU_SPECIFIC (dev)->store; -+ int retry_count = 9; -+ int len = strlen (dev->path); -+ char path[len + 3 + 1]; -+ int i; -+ int done = 1; -+ -+ sync (); -+ -+ if(strcmp (store->class->name, "device") == 0) { -+ while (device_set_status (store->port, BLKRRPART, NULL, 0)) { -+ retry_count--; -+ sync (); -+ if (retry_count == 3) -+ sleep (1); /* Pause to allow system to settle */ -+ -+ if (!retry_count) { -+ ped_exception_throw ( -+ PED_EXCEPTION_WARNING, -+ PED_EXCEPTION_IGNORE, -+ _("WARNING: the kernel failed to re-read the " -+ "partition table on %s (%s). As a result, " -+ "it may not reflect all of your changes " -+ "until after reboot."), -+ dev->path, strerror (errno)); -+ return 0; -+ } -+ } -+ } -+ -+ i = 1; -+ while (1) { -+ file_t node; -+ error_t err; -+ -+ /* Throw away all active parted-based translators */ -+ snprintf (path, sizeof (path), "%ss%u", dev->path, i); -+ node = file_name_lookup (path, O_NOTRANS, 0666); -+ if (node == MACH_PORT_NULL) { -+ if (errno == ENOENT) -+ /* Finished looping over them */ -+ break; -+ -+ ped_exception_throw ( -+ PED_EXCEPTION_WARNING, -+ PED_EXCEPTION_IGNORE, -+ _("Warning: unable to open %s (%s). As a " -+ "result, it may not reflect all of your " -+ "changes until after reboot."), -+ path, strerror (errno)); -+ done = 0; -+ } -+ -+ err = file_set_translator (node, 0, FS_TRANS_SET, -+ 0, 0, 0, MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND); -+ if (err) { -+ ped_exception_throw ( -+ PED_EXCEPTION_WARNING, -+ PED_EXCEPTION_IGNORE, -+ _("Warning: failed to make translator go away " -+ "on %s (%s). As a result, it may not reflect " -+ "all of your changes until after reboot."), -+ dev->path, strerror (errno)); -+ done = 0; -+ } -+ i++; -+ } -+ -+ return done; - } - - /* Free the memory associated with a PedDevice structure. */ -@@ -355,7 +427,7 @@ gnu_close (PedDevice* dev) - _flush_cache (dev); - - if (dev->dirty && dev->type != PED_DEVICE_FILE) { -- if (_kernel_reread_part_table (dev)) -+ if (_reread_part_table (dev)) - dev->dirty = 0; - } - -@@ -827,7 +899,7 @@ gnu_partition_is_busy (const PedPartition* part) - static int - gnu_disk_commit (PedDisk* disk) - { -- return 1; -+ return _reread_part_table (disk->dev); - } - - static PedDeviceArchOps gnu_dev_ops = { --- -2.31.1 - diff --git a/0038-keep-GUID-specific-attributes.patch b/0038-keep-GUID-specific-attributes.patch deleted file mode 100644 index 617868e..0000000 --- a/0038-keep-GUID-specific-attributes.patch +++ /dev/null @@ -1,283 +0,0 @@ -From 9d1ac5015340aa7a4cc71cb7f63bae8c1718b8ee Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Thu, 23 Sep 2021 16:31:42 +0000 -Subject: [PATCH 38/38] keep GUID specific attributes - -Keep GUID specific attributes when writing GPT. - -Signed-off-by: Brian C. Lane ---- - libparted/labels/gpt.c | 30 +++++------------ - tests/Makefile.am | 3 +- - tests/gpt-attrs | 72 ++++++++++++++++++++++++++++++++++++++++ - tests/t0215-gpt-attrs.sh | 46 +++++++++++++++++++++++++ - 4 files changed, 129 insertions(+), 22 deletions(-) - create mode 100755 tests/gpt-attrs - create mode 100644 tests/t0215-gpt-attrs.sh - -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 9b987c1..ba9a71a 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -297,18 +297,17 @@ typedef struct _GPTPartitionData - efi_guid_t uuid; - efi_char16_t name[37]; - char *translated_name; -+ GuidPartitionEntryAttributes_t attributes; - int lvm; - int swap; - int raid; - int boot; - int bios_grub; - int hp_service; -- int hidden; - int msftres; - int msftdata; - int atvrecv; - int msftrecv; -- int legacy_boot; - int prep; - int irst; - int chromeos_kernel; -@@ -826,25 +825,20 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - gpt_part_data->name[i] = (efi_char16_t) pte->PartitionName[i]; - gpt_part_data->name[i] = 0; - gpt_part_data->translated_name = 0; -+ gpt_part_data->attributes = pte->Attributes; - - gpt_part_data->lvm = gpt_part_data->swap - = gpt_part_data->raid - = gpt_part_data->boot = gpt_part_data->hp_service -- = gpt_part_data->hidden = gpt_part_data->msftres -+ = gpt_part_data->msftres - = gpt_part_data->msftdata - = gpt_part_data->msftrecv -- = gpt_part_data->legacy_boot - = gpt_part_data->prep - = gpt_part_data->irst - = gpt_part_data->chromeos_kernel - = gpt_part_data->bls_boot - = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; - -- if (pte->Attributes.RequiredToFunction & 0x1) -- gpt_part_data->hidden = 1; -- if (pte->Attributes.LegacyBIOSBootable & 0x1) -- gpt_part_data->legacy_boot = 1; -- - if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID)) - gpt_part_data->boot = 1; - else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID)) -@@ -1241,12 +1235,7 @@ _partition_generate_part_entry (PedPartition *part, GuidPartitionEntry_t *pte) - pte->UniquePartitionGuid = gpt_part_data->uuid; - pte->StartingLBA = PED_CPU_TO_LE64 (part->geom.start); - pte->EndingLBA = PED_CPU_TO_LE64 (part->geom.end); -- memset (&pte->Attributes, 0, sizeof (GuidPartitionEntryAttributes_t)); -- -- if (gpt_part_data->hidden) -- pte->Attributes.RequiredToFunction = 1; -- if (gpt_part_data->legacy_boot) -- pte->Attributes.LegacyBIOSBootable = 1; -+ pte->Attributes = gpt_part_data->attributes; - - for (i = 0; i < 36; i++) - pte->PartitionName[i] = gpt_part_data->name[i]; -@@ -1388,12 +1377,10 @@ gpt_partition_new (const PedDisk *disk, - gpt_part_data->boot = 0; - gpt_part_data->bios_grub = 0; - gpt_part_data->hp_service = 0; -- gpt_part_data->hidden = 0; - gpt_part_data->msftres = 0; - gpt_part_data->msftdata = 0; - gpt_part_data->msftrecv = 0; - gpt_part_data->atvrecv = 0; -- gpt_part_data->legacy_boot = 0; - gpt_part_data->prep = 0; - gpt_part_data->translated_name = 0; - gpt_part_data->irst = 0; -@@ -1402,6 +1389,7 @@ gpt_partition_new (const PedDisk *disk, - uuid_generate ((unsigned char *) &gpt_part_data->uuid); - swap_uuid_and_efi_guid (&gpt_part_data->uuid); - memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); -+ memset (&gpt_part_data->attributes, 0, sizeof gpt_part_data->attributes); - return part; - - error_free_part: -@@ -1911,10 +1899,10 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HIDDEN: -- gpt_part_data->hidden = state; -+ gpt_part_data->attributes.RequiredToFunction = state; - return 1; - case PED_PARTITION_LEGACY_BOOT: -- gpt_part_data->legacy_boot = state; -+ gpt_part_data->attributes.LegacyBIOSBootable = state; - return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: -@@ -1953,9 +1941,9 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) - case PED_PARTITION_APPLE_TV_RECOVERY: - return gpt_part_data->atvrecv; - case PED_PARTITION_HIDDEN: -- return gpt_part_data->hidden; -+ return gpt_part_data->attributes.RequiredToFunction; - case PED_PARTITION_LEGACY_BOOT: -- return gpt_part_data->legacy_boot; -+ return gpt_part_data->attributes.LegacyBIOSBootable; - case PED_PARTITION_PREP: - return gpt_part_data->prep; - case PED_PARTITION_IRST: -diff --git a/tests/Makefile.am b/tests/Makefile.am -index f9340aa..3dc6e72 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -26,6 +26,7 @@ TESTS = \ - t0211-gpt-rewrite-header.sh \ - t0212-gpt-many-partitions.sh \ - t0213-mkpart-start-negative.sh \ -+ t0215-gpt-attrs.sh \ - t0220-gpt-msftres.sh \ - t0250-gpt.sh \ - t0251-gpt-unicode.sh \ -@@ -98,7 +99,7 @@ TESTS = \ - EXTRA_DIST = \ - $(TESTS) t-local.sh t-lvm.sh \ - init.cfg init.sh t-lib-helpers.sh gpt-header-munge \ -- gpt-header-move msdos-overlap -+ gpt-header-move msdos-overlap gpt-attrs - - check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \ - fs-resize -diff --git a/tests/gpt-attrs b/tests/gpt-attrs -new file mode 100755 -index 0000000..0a01447 ---- /dev/null -+++ b/tests/gpt-attrs -@@ -0,0 +1,72 @@ -+#!/usr/bin/python3 -+ -+# Copyright (C) 2021 SUSE LLC -+ -+# program to show gpt partition attributes or set attributes of -+# partition 1 -+ -+# only works with 512 sectors and standard GPT header layout (128 -+# partition entires with 128 bytes each, secondary header at end of -+# device) -+ -+ -+from struct import unpack_from, pack_into -+from zipfile import crc32 -+import array -+import sys -+ -+ -+class Gpt: -+ -+ # Calculate and insert the CRCs of the partition entires and the -+ # header. -+ def calc_crcs(self, header, entries): -+ # compute crc of partition entries -+ crc2 = crc32(entries) & 0xFFFFFFFF -+ pack_into('. -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create gpt label and one partitions -+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 -+parted --script "$dev" mkpart "test1" ext4 0% 10% > out 2>&1 || fail=1 -+ -+# set guid specific bit -+gpt-attrs "$dev" set 0x100000000000000 || fail=1 -+ -+# create additional partition -+parted --script "$dev" mkpart "test2" ext4 10% 20% > out 2>&1 || fail=1 -+ -+cat < exp || fail=1 -+0x100000000000000 -+EOF -+ -+# check guid specific bit -+gpt-attrs "$dev" show > out || fail=1 -+compare exp out || fail=1 -+ -+Exit $fail --- -2.31.1 - diff --git a/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch b/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch deleted file mode 100644 index ff6c3a3..0000000 --- a/0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch +++ /dev/null @@ -1,566 +0,0 @@ -From 15c49ec04f7eaff014d2e1eddd0aecf4150db63d Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Mon, 27 Sep 2021 08:35:31 +0000 -Subject: [PATCH 39/43] gpt: Map PED_PARTITON_ flags to GUID values - -Drop the 14 flags from _GPTPartitionData that correspond to a -partition type/uuid. Use the type/uuid directly instead. - -Signed-off-by: Brian C. Lane ---- - libparted/labels/gpt.c | 477 +++++------------------------------------ - 1 file changed, 54 insertions(+), 423 deletions(-) - -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index ba9a71a..3ba3cee 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -165,6 +165,43 @@ typedef struct - PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ - { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) - -+struct flag_uuid_mapping_t -+{ -+ enum _PedPartitionFlag flag; -+ efi_guid_t type_uuid; -+}; -+ -+static const struct flag_uuid_mapping_t flag_uuid_mapping[] = -+{ -+ { PED_PARTITION_APPLE_TV_RECOVERY, PARTITION_APPLE_TV_RECOVERY_GUID }, -+ { PED_PARTITION_BIOS_GRUB, PARTITION_BIOS_GRUB_GUID }, -+ { PED_PARTITION_BLS_BOOT, PARTITION_BLS_BOOT_GUID }, -+ { PED_PARTITION_BOOT, PARTITION_SYSTEM_GUID }, -+ { PED_PARTITION_CHROMEOS_KERNEL, PARTITION_CHROMEOS_KERNEL_GUID }, -+ { PED_PARTITION_DIAG, PARTITION_MSFT_RECOVERY }, -+ { PED_PARTITION_ESP, PARTITION_SYSTEM_GUID }, -+ { PED_PARTITION_HPSERVICE, PARTITION_HPSERVICE_GUID }, -+ { PED_PARTITION_IRST, PARTITION_IRST_GUID }, -+ { PED_PARTITION_LVM, PARTITION_LVM_GUID }, -+ { PED_PARTITION_MSFT_DATA, PARTITION_BASIC_DATA_GUID }, -+ { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RESERVED_GUID }, -+ { PED_PARTITION_PREP, PARTITION_PREP_GUID }, -+ { PED_PARTITION_RAID, PARTITION_RAID_GUID }, -+ { PED_PARTITION_SWAP, PARTITION_SWAP_GUID }, -+}; -+ -+static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST -+gpt_find_flag_uuid_mapping (PedPartitionFlag flag) -+{ -+ int n = sizeof(flag_uuid_mapping) / sizeof(flag_uuid_mapping[0]); -+ -+ for (int i = 0; i < n; ++i) -+ if (flag_uuid_mapping[i].flag == flag) -+ return &flag_uuid_mapping[i]; -+ -+ return NULL; -+} -+ - struct __attribute__ ((packed)) _GuidPartitionTableHeader_t - { - uint64_t Signature; -@@ -298,20 +335,6 @@ typedef struct _GPTPartitionData - efi_char16_t name[37]; - char *translated_name; - GuidPartitionEntryAttributes_t attributes; -- int lvm; -- int swap; -- int raid; -- int boot; -- int bios_grub; -- int hp_service; -- int msftres; -- int msftdata; -- int atvrecv; -- int msftrecv; -- int prep; -- int irst; -- int chromeos_kernel; -- int bls_boot; - } GPTPartitionData; - - static PedDiskType gpt_disk_type; -@@ -827,47 +850,6 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) - gpt_part_data->translated_name = 0; - gpt_part_data->attributes = pte->Attributes; - -- gpt_part_data->lvm = gpt_part_data->swap -- = gpt_part_data->raid -- = gpt_part_data->boot = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; -- -- if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID)) -- gpt_part_data->boot = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID)) -- gpt_part_data->bios_grub = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_RAID_GUID)) -- gpt_part_data->raid = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID)) -- gpt_part_data->lvm = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_SWAP_GUID)) -- gpt_part_data->swap = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID)) -- gpt_part_data->hp_service = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID)) -- gpt_part_data->msftres = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_BASIC_DATA_GUID)) -- gpt_part_data->msftdata = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY)) -- gpt_part_data->msftrecv = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) -- gpt_part_data->atvrecv = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID)) -- gpt_part_data->prep = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) -- gpt_part_data->irst = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID)) -- gpt_part_data->chromeos_kernel = 1; -- else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID)) -- gpt_part_data->bls_boot = 1; -- - return part; - } - -@@ -1371,21 +1353,7 @@ gpt_partition_new (const PedDisk *disk, - goto error_free_part; - - gpt_part_data->type = PARTITION_LINUX_DATA_GUID; -- gpt_part_data->lvm = 0; -- gpt_part_data->swap = 0; -- gpt_part_data->raid = 0; -- gpt_part_data->boot = 0; -- gpt_part_data->bios_grub = 0; -- gpt_part_data->hp_service = 0; -- gpt_part_data->msftres = 0; -- gpt_part_data->msftdata = 0; -- gpt_part_data->msftrecv = 0; -- gpt_part_data->atvrecv = 0; -- gpt_part_data->prep = 0; - gpt_part_data->translated_name = 0; -- gpt_part_data->irst = 0; -- gpt_part_data->chromeos_kernel = 0; -- gpt_part_data->bls_boot = 0; - uuid_generate ((unsigned char *) &gpt_part_data->uuid); - swap_uuid_and_efi_guid (&gpt_part_data->uuid); - memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); -@@ -1457,77 +1425,6 @@ gpt_partition_set_system (PedPartition *part, - - part->fs_type = fs_type; - -- if (gpt_part_data->lvm) -- { -- gpt_part_data->type = PARTITION_LVM_GUID; -- return 1; -- } -- if (gpt_part_data->swap) -- { -- gpt_part_data->type = PARTITION_SWAP_GUID; -- return 1; -- } -- if (gpt_part_data->raid) -- { -- gpt_part_data->type = PARTITION_RAID_GUID; -- return 1; -- } -- if (gpt_part_data->prep) -- { -- gpt_part_data->type = PARTITION_PREP_GUID; -- return 1; -- } -- if (gpt_part_data->boot) -- { -- gpt_part_data->type = PARTITION_SYSTEM_GUID; -- return 1; -- } -- if (gpt_part_data->bios_grub) -- { -- gpt_part_data->type = PARTITION_BIOS_GRUB_GUID; -- return 1; -- } -- if (gpt_part_data->hp_service) -- { -- gpt_part_data->type = PARTITION_HPSERVICE_GUID; -- return 1; -- } -- if (gpt_part_data->msftres) -- { -- gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; -- return 1; -- } -- if (gpt_part_data->msftdata) -- { -- gpt_part_data->type = PARTITION_BASIC_DATA_GUID; -- return 1; -- } -- if (gpt_part_data->msftrecv) -- { -- gpt_part_data->type = PARTITION_MSFT_RECOVERY; -- return 1; -- } -- if (gpt_part_data->atvrecv) -- { -- gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; -- return 1; -- } -- if (gpt_part_data->irst) -- { -- gpt_part_data->type = PARTITION_IRST_GUID; -- return 1; -- } -- if (gpt_part_data->chromeos_kernel) -- { -- gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID; -- return 1; -- } -- if (gpt_part_data->bls_boot) -- { -- gpt_part_data->type = PARTITION_BLS_BOOT_GUID; -- return 1; -- } -- - if (fs_type) - { - if (strncmp (fs_type->name, "fat", 3) == 0 -@@ -1657,247 +1554,18 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - PED_ASSERT (part->disk_specific != NULL); - gpt_part_data = part->disk_specific; - -+ const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); -+ if (p) -+ { -+ if (state) -+ gpt_part_data->type = p->type_uuid; -+ else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) -+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID; -+ return 1; -+ } -+ - switch (flag) - { -- case PED_PARTITION_ESP: -- case PED_PARTITION_BOOT: -- gpt_part_data->boot = state; -- if (state) -- gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_BIOS_GRUB: -- gpt_part_data->bios_grub = state; -- if (state) -- gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->boot -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_RAID: -- gpt_part_data->raid = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_LVM: -- gpt_part_data->lvm = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->swap -- = gpt_part_data->raid -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_SWAP: -- gpt_part_data->swap = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->lvm -- = gpt_part_data->raid -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_HPSERVICE: -- gpt_part_data->hp_service = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_MSFT_RESERVED: -- gpt_part_data->msftres = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_MSFT_DATA: -- gpt_part_data->msftres = state; -- if (state) { -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- gpt_part_data->msftdata = 1; -- } else { -- gpt_part_data->msftdata = 0; -- } -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_DIAG: -- gpt_part_data->msftrecv = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftdata -- = gpt_part_data->msftres -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_APPLE_TV_RECOVERY: -- gpt_part_data->atvrecv = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->prep -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->msftrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_PREP: -- gpt_part_data->prep = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->irst -- = gpt_part_data->atvrecv -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->msftrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_IRST: -- gpt_part_data->irst = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->bls_boot -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_CHROMEOS_KERNEL: -- gpt_part_data->chromeos_kernel = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->bios_grub -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->atvrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->bls_boot = 0; -- return gpt_partition_set_system (part, part->fs_type); -- case PED_PARTITION_BLS_BOOT: -- gpt_part_data->bls_boot = state; -- if (state) -- gpt_part_data->boot -- = gpt_part_data->raid -- = gpt_part_data->lvm -- = gpt_part_data->swap -- = gpt_part_data->bios_grub -- = gpt_part_data->hp_service -- = gpt_part_data->msftres -- = gpt_part_data->msftdata -- = gpt_part_data->msftrecv -- = gpt_part_data->prep -- = gpt_part_data->irst -- = gpt_part_data->chromeos_kernel -- = gpt_part_data->atvrecv = 0; -- return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HIDDEN: - gpt_part_data->attributes.RequiredToFunction = state; - return 1; -@@ -1919,41 +1587,16 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) - PED_ASSERT (part->disk_specific != NULL); - gpt_part_data = part->disk_specific; - -+ const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); -+ if (p) -+ return guid_cmp (gpt_part_data->type, p->type_uuid) == 0; -+ - switch (flag) - { -- case PED_PARTITION_RAID: -- return gpt_part_data->raid; -- case PED_PARTITION_LVM: -- return gpt_part_data->lvm; -- case PED_PARTITION_ESP: -- case PED_PARTITION_BOOT: -- return gpt_part_data->boot; -- case PED_PARTITION_BIOS_GRUB: -- return gpt_part_data->bios_grub; -- case PED_PARTITION_HPSERVICE: -- return gpt_part_data->hp_service; -- case PED_PARTITION_MSFT_RESERVED: -- return gpt_part_data->msftres; -- case PED_PARTITION_MSFT_DATA: -- return gpt_part_data->msftdata; -- case PED_PARTITION_DIAG: -- return gpt_part_data->msftrecv; -- case PED_PARTITION_APPLE_TV_RECOVERY: -- return gpt_part_data->atvrecv; - case PED_PARTITION_HIDDEN: - return gpt_part_data->attributes.RequiredToFunction; - case PED_PARTITION_LEGACY_BOOT: - return gpt_part_data->attributes.LegacyBIOSBootable; -- case PED_PARTITION_PREP: -- return gpt_part_data->prep; -- case PED_PARTITION_IRST: -- return gpt_part_data->irst; -- case PED_PARTITION_BLS_BOOT: -- return gpt_part_data->bls_boot; -- case PED_PARTITION_SWAP: -- return gpt_part_data->swap; -- case PED_PARTITION_CHROMEOS_KERNEL: -- return gpt_part_data->chromeos_kernel; - case PED_PARTITION_LBA: - case PED_PARTITION_ROOT: - default: -@@ -1966,25 +1609,13 @@ static int - gpt_partition_is_flag_available (const PedPartition *part, - PedPartitionFlag flag) - { -+ if (gpt_find_flag_uuid_mapping (flag)) -+ return 1; -+ - switch (flag) - { -- case PED_PARTITION_RAID: -- case PED_PARTITION_LVM: -- case PED_PARTITION_SWAP: -- case PED_PARTITION_BOOT: -- case PED_PARTITION_BIOS_GRUB: -- case PED_PARTITION_HPSERVICE: -- case PED_PARTITION_MSFT_RESERVED: -- case PED_PARTITION_MSFT_DATA: -- case PED_PARTITION_DIAG: -- case PED_PARTITION_APPLE_TV_RECOVERY: - case PED_PARTITION_HIDDEN: - case PED_PARTITION_LEGACY_BOOT: -- case PED_PARTITION_PREP: -- case PED_PARTITION_IRST: -- case PED_PARTITION_ESP: -- case PED_PARTITION_CHROMEOS_KERNEL: -- case PED_PARTITION_BLS_BOOT: - return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: --- -2.31.1 - diff --git a/0040-gpt-Add-linux-home-flag.patch b/0040-gpt-Add-linux-home-flag.patch deleted file mode 100644 index ba1c391..0000000 --- a/0040-gpt-Add-linux-home-flag.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 6ef2f88d014f267157d9e9300b31c5f1ab4d5e42 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Thu, 30 Sep 2021 13:49:30 -0700 -Subject: [PATCH 40/43] gpt: Add linux-home flag - -This sets the partition GUID to the linux home type: -933AC7E1-2EB4-4F13-B844-0E14E2AEF915 - -Signed-off-by: Brian C. Lane ---- - include/parted/disk.in.h | 5 +++-- - libparted/disk.c | 2 ++ - libparted/labels/gpt.c | 5 +++++ - 3 files changed, 10 insertions(+), 2 deletions(-) - -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index 7ca6453..303f59c 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -84,10 +84,11 @@ enum _PedPartitionFlag { - PED_PARTITION_IRST=17, - PED_PARTITION_ESP=18, - PED_PARTITION_CHROMEOS_KERNEL=19, -- PED_PARTITION_BLS_BOOT=20 -+ PED_PARTITION_BLS_BOOT=20, -+ PED_PARTITION_LINUX_HOME=21, - }; - #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT -+#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -diff --git a/libparted/disk.c b/libparted/disk.c -index 345b9e7..8496fc0 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -2411,6 +2411,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) - return N_("chromeos_kernel"); - case PED_PARTITION_BLS_BOOT: - return N_("bls_boot"); -+ case PED_PARTITION_LINUX_HOME: -+ return N_("linux-home"); - - default: - ped_exception_throw ( -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 3ba3cee..8b345d5 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -164,6 +164,10 @@ typedef struct - ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \ - PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \ - { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }}) -+#define PARTITION_LINUX_HOME_GUID \ -+ ((efi_guid_t) { PED_CPU_TO_LE32 (0x933ac7e1), PED_CPU_TO_LE16 (0x2eb4), \ -+ PED_CPU_TO_LE16 (0x4f13), 0xb8, 0x44, \ -+ { 0x0e, 0x14, 0xe2, 0xae, 0xf9, 0x15 }}) - - struct flag_uuid_mapping_t - { -@@ -182,6 +186,7 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] = - { PED_PARTITION_ESP, PARTITION_SYSTEM_GUID }, - { PED_PARTITION_HPSERVICE, PARTITION_HPSERVICE_GUID }, - { PED_PARTITION_IRST, PARTITION_IRST_GUID }, -+ { PED_PARTITION_LINUX_HOME, PARTITION_LINUX_HOME_GUID }, - { PED_PARTITION_LVM, PARTITION_LVM_GUID }, - { PED_PARTITION_MSFT_DATA, PARTITION_BASIC_DATA_GUID }, - { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RESERVED_GUID }, --- -2.31.1 - diff --git a/0041-doc-Document-gpt-linux-home-flag.patch b/0041-doc-Document-gpt-linux-home-flag.patch deleted file mode 100644 index 762872a..0000000 --- a/0041-doc-Document-gpt-linux-home-flag.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 87d78ee78ca8d09de0d4850280cfd0ea9d9662fd Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 30 Sep 2021 13:46:40 -0700 -Subject: [PATCH 41/43] doc: Document gpt linux-home flag - ---- - doc/C/parted.8 | 3 ++- - doc/parted.texi | 4 ++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index 46b30ad..afca9f2 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -118,7 +118,8 @@ or an LVM logical volume if necessary. - .B set \fIpartition\fP \fIflag\fP \fIstate\fP - Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. - Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", --"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo". -+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home", -+and "palo". - \fIstate\fP should be either "on" or "off". - .TP - .B unit \fIunit\fP -diff --git a/doc/parted.texi b/doc/parted.texi -index 57ceb55..4344328 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -904,6 +904,10 @@ MS Windows ME based operating systems to use Linear (LBA) mode. - (Mac) - this flag should be enabled if the partition is the root device - to be used by Linux. - -+@item linux-home -+(GPT) - Enable this to indicate that the selected partition is a -+Linux /home partition. -+ - @item swap - (MS-DOS, GPT, Mac) - this flag should be enabled if the partition is the - swap device to be used by Linux. --- -2.31.1 - diff --git a/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch b/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch deleted file mode 100644 index cd4f652..0000000 --- a/0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 10ad2aac0453f10b2e355a0df03618e0ebc593be Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 29 Sep 2021 15:57:50 -0700 -Subject: [PATCH 42/43] tests: Add a test to make sure GPT GUIDs default to - filesystem - -When no flag is set on a GPT partition the GUID should fall back to the -filesystem type for fat32, swap, and hfs+ and if no filesystem is found -it should default to linux filesystem data type, showing no filesystem -and no flags. ---- - tests/Makefile.am | 1 + - tests/t3210-gpt-type-change.sh | 107 +++++++++++++++++++++++++++++++++ - 2 files changed, 108 insertions(+) - create mode 100755 tests/t3210-gpt-type-change.sh - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 3dc6e72..5cb7aa3 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -60,6 +60,7 @@ TESTS = \ - t3000-resize-fs.sh \ - t3200-resize-partition.sh \ - t3200-type-change.sh \ -+ t3210-gpt-type-change.sh \ - t3300-palo-prep.sh \ - t3310-flags.sh \ - t3400-whole-disk-FAT-partition.sh \ -diff --git a/tests/t3210-gpt-type-change.sh b/tests/t3210-gpt-type-change.sh -new file mode 100755 -index 0000000..57000d9 ---- /dev/null -+++ b/tests/t3210-gpt-type-change.sh -@@ -0,0 +1,107 @@ -+#!/bin/sh -+# Ensure parted changes GUID back to match its FS. -+ -+# Copyright (C) 2021 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+ -+require_root_ -+require_scsi_debug_module_ -+ -+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || -+ skip_ 'this system lacks a new-enough libblkid' -+ -+# What filesystem tools are present? -+FSTYPES="" -+ -+# Is mkfs.hfsplus available? -+mkfs.hfsplus 2>&1 | grep '^usage:' && FSTYPES="hfs+" -+ -+# Is mkfs.vfat available? -+mkfs.vfat 2>&1 | grep '^Usage:' && FSTYPES="$FSTYPES fat32" -+ -+# Is mkswap available? -+mkswap -V 2>&1 | grep '^mkswap' && FSTYPES="$FSTYPES linux-swap" -+ -+[ -n "$FSTYPES" ] || skip_ "No supported filesystem tools (vfat, hfs+, swap) installed" -+ -+ -+# create memory-backed device -+scsi_debug_setup_ dev_size_mb=25 > dev-name || -+ skip_ 'failed to create scsi_debug device' -+scsi_dev=$(cat dev-name) -+ -+# Create a formatted partition. -+# Set a different partition type on it, eg. lvm, then unset it. -+# The partition flag should return to the detected filesystem type. -+ -+for fs_type in $FSTYPES; do -+ echo "fs_type=$fs_type" -+ -+ -+ parted -s $scsi_dev mklabel gpt mkpart first $fs_type 1MB 25MB > out 2>&1 || fail=1 -+ # expect no output -+ compare /dev/null out || fail=1 -+ -+ p1=${scsi_dev}1 -+ wait_for_dev_to_appear_ $p1 || fail=1 -+ -+ case $fs_type in -+ fat32) mkfs.vfat $p1 || fail=1 ;; -+ hfs*) mkfs.hfsplus $p1 || fail=1;; -+ linux-swap) mkswap $p1 || fail=1;; -+ *) error "internal error: unhandled fs type: $fs_type";; -+ esac -+ -+ # Confirm the filesystem and flags are as expected -+ parted -s $scsi_dev u s p > out || fail=1 -+ case $fs_type in -+ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;; -+ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;; -+ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;; -+ *) error "internal error: unhandled fs type: $fs_type";; -+ esac -+ -+ # Set the lvm GUID on the partition -+ parted -s $scsi_dev set 1 lvm on > out 2>&1 || fail=1 -+ # expect no output -+ compare /dev/null out || fail=1 -+ -+ # Confirm filesystem probe is the same, but flags are now lvm -+ parted -s $scsi_dev u s p > out || fail=1 -+ case $fs_type in -+ fat32) grep 'fat16.*lvm$' out || { fail=1; cat out; } ;; -+ hfs*) grep 'hfs+.*lvm$' out || { fail=1; cat out; } ;; -+ linux-swap) grep 'linux-swap.*lvm$' out || { fail=1; cat out; } ;; -+ *) error "internal error: unhandled fs type: $fs_type";; -+ esac -+ -+ # Unset the lvm GUID on both partitions -+ parted -s $scsi_dev set 1 lvm off > out 2>&1 || fail=1 -+ # expect no output -+ compare /dev/null out || fail=1 -+ -+ # Confirm the filesystem and flags are as expected -+ parted -s $scsi_dev u s p > out || fail=1 -+ case $fs_type in -+ fat32) grep 'fat16.*msftdata$' out || { fail=1; cat out; } ;; -+ hfs*) grep 'hfs+.*first$' out || { fail=1; cat out; } ;; -+ linux-swap) grep 'linux-swap.*swap$' out || { fail=1; cat out; } ;; -+ *) error "internal error: unhandled fs type: $fs_type";; -+ esac -+done -+ -+Exit $fail --- -2.31.1 - diff --git a/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch b/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch deleted file mode 100644 index 756de73..0000000 --- a/0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a1f8bcde22bbd97ef7abae3c83ede77fc25a301c Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 30 Sep 2021 13:16:12 -0700 -Subject: [PATCH 43/43] gpt: Revert to filesystem GUID when setting flag to off - ---- - libparted/labels/gpt.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 8b345d5..c5d7bb3 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -1565,7 +1565,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - if (state) - gpt_part_data->type = p->type_uuid; - else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) -- gpt_part_data->type = PARTITION_LINUX_DATA_GUID; -+ return gpt_partition_set_system (part, part->fs_type); - return 1; - } - --- -2.31.1 - diff --git a/0044-docs-Update-documentation-to-be-consistent.patch b/0044-docs-Update-documentation-to-be-consistent.patch deleted file mode 100644 index 0a8e87d..0000000 --- a/0044-docs-Update-documentation-to-be-consistent.patch +++ /dev/null @@ -1,459 +0,0 @@ -From b20227adf5756617076c9e2ec267ee6794a21e22 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 28 Sep 2021 16:37:43 -0700 -Subject: [PATCH] docs: Update documentation to be consistent - -This fixes some missing commands in the parted.texi file used to -generate the web manual and info document. It also removes documentation -for the never-implemented 'print NUMBER' command which only returns 1. - -The parted manpage has been updated to document the available print -options, disk_set, and disk_toggle commands. ---- - doc/C/parted.8 | 16 ++++- - doc/parted.texi | 185 +++++++++++++++++++++++++++++++++++------------- - parted/parted.c | 4 +- - 3 files changed, 149 insertions(+), 56 deletions(-) - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index afca9f2..c742154 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -1,4 +1,4 @@ --.TH PARTED 8 "2007 March 29" parted "GNU Parted Manual" -+.TH PARTED 8 "2021 September 28" parted "GNU Parted Manual" - .SH NAME - parted \- a partition manipulation program - .SH SYNOPSIS -@@ -24,7 +24,7 @@ lists partition layout on all block devices - .B -m, --machine - displays machine parseable output - .TP --.B -m, --json -+.B -j, --json - displays JSON output - .TP - .B -s, --script -@@ -92,8 +92,9 @@ PC98, and GPT disklabels. The name can be placed in double quotes, if necessary. - And depending on the shell may need to also be wrapped in single quotes so that - the shell doesn't strip off the double quotes. - .TP --.B print -+.B print \fIprint-type\fP - Display the partition table. -+\fIprint-type\fP is optional, and can be one of devices, free, list, or all. - .TP - .B quit - Exit from \fBparted\fP. -@@ -133,6 +134,15 @@ human-friendly form for output). - .B toggle \fIpartition\fP \fIflag\fP - Toggle the state of \fIflag\fP on \fIpartition\fP. - .TP -+.B disk_set \fIflag\fP \fIstate\fP -+Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off". -+Some or all of these flags will be available, depending on what disk label you -+are using. Supported flags are: "pmbr_boot" on GPT to enable the boot flag on the -+GPT's protective MBR partition. -+.TP -+.B disk_toggle \fIflag\fP -+Toggle the state of the disk \fIflag\fP. -+.TP - .B version - Display version information and a copyright message. - .RE -diff --git a/doc/parted.texi b/doc/parted.texi -index 4344328..bc981de 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -14,7 +14,7 @@ and manipulating partition tables. - @ifnottex @c texi2pdf don't understand copying and insertcopying ??? - @c modifications must also be done in the titlepage - @copying --Copyright @copyright{} 1999--2014, 2019--2021 Free Software Foundation, Inc. -+Copyright @copyright{} 1999--2021 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 or -@@ -46,7 +46,7 @@ Free Documentation License''. - @c @vskip 0pt plus 1filll - - @c modifications must also be done in the copying block --Copyright @copyright{} 1999-2011 Free Software Foundation, Inc. -+Copyright @copyright{} 1999-2021 Free Software Foundation, Inc. - - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 or -@@ -117,9 +117,9 @@ power failure) and performs many safety checks. However, there could - be bugs in GNU Parted, so you should back up your important files before - running Parted. - --The GNU Parted homepage is @uref{http://www.gnu.org/software/parted}. The -+The GNU Parted homepage is @uref{https://www.gnu.org/software/parted}. The - library and frontend themselves can be downloaded from --@uref{ftp://ftp.gnu.org/gnu/parted}. -+@uref{https://ftp.gnu.org/gnu/parted}. - You can also find a listing of mailing lists, notes for contributing and - more useful information on the web site. - -@@ -129,7 +129,7 @@ Please include the output from these commands (for disk @file{/dev/hda}): - - @example - @group --# @kbd{parted /dev/hda print unit s print unit chs print} -+# @kbd{parted /dev/hda unit s print free} - @end group - @end example - -@@ -157,6 +157,14 @@ installed: - - @itemize @bullet - -+@item GNU parted source is available either as a source tarball: -+ -+ @uref{https://git.savannah.gnu.org/gitweb/?p=parted.git} -+ -+or using git (See the README-hacking instructions): -+ -+ @uref{https://git.savannah.gnu.org/gitweb/?p=parted.git} -+ - @item libuuid, part of the e2fsprogs package. If you don't have this, - you can get it from: - -@@ -167,7 +175,7 @@ If you want to compile Parted and e2fsprogs, note that you will need to - - @item GNU Readline (optional), available from - -- @uref{ftp://ftp.gnu.org/gnu/readline} -+ @uref{https://ftp.gnu.org/gnu/readline} - - If you are compiling Parted, and you don't have readline, you can - disable Parted's readline support with the @kbd{--disable-readline} -@@ -176,7 +184,7 @@ option for @command{configure}. - @item GNU gettext (or compatible software) for compilation, if - internationalisation support is desired. - -- @uref{ftp://ftp.gnu.org/gnu/gettext} -+ @uref{https://ftp.gnu.org/gnu/gettext} - - @end itemize - -@@ -259,7 +267,7 @@ disable writing (for debugging) - @subsection Introduction - If you want to run GNU Parted on a machine without GNU/Linux installed, - or you want to modify a root or boot partition, use GParted Live: --@uref{http://gparted.sourceforge.net/livecd.php}. -+@uref{https://gparted.org/livecd.php}. - - @node Using Parted - @chapter Using Parted -@@ -402,6 +410,10 @@ Options: - @itemx --help - display a help message - -+@item -l -+@itemx --list -+lists partition layout on all block devices -+ - @item -m - @itemx --machine - display output in machine parseable format -@@ -416,7 +428,7 @@ never prompt the user - - @item -f - @itemx --fix --automatically answer exceptions with "fix" in script mode, whcih is useful for: -+automatically answer exceptions with "fix" in script mode, which is useful for: - GPT header not including full disk size; moving the backup GPT table to the end of the disk; - MAC fix missing partition map entry; etc. - -@@ -441,6 +453,7 @@ GNU Parted provides the following commands: - @menu - * align-check:: - * disk_set:: -+* disk_toggle:: - * help:: - * mklabel:: - * mkpart:: -@@ -452,6 +465,7 @@ GNU Parted provides the following commands: - * rm:: - * select:: - * set:: -+* toggle:: - * unit:: - @end menu - -@@ -515,6 +529,16 @@ in machine mode. - Set the PMBR's boot flag. - @end deffn - -+@node disk_toggle -+@subsection disk_toggle -+@cindex disk_toggle, command description -+@cindex command description, disk_toggle -+ -+@deffn Command disk_toggle @var{flag} -+ -+Toggle the state of the disk flag. -+@end deffn -+ - @node help - @subsection help - @cindex help, command description -@@ -551,9 +575,12 @@ thing: partition table, partition map.} - - @var{label-type} must be one of these supported disk labels: - @itemize @bullet -+@item aix -+@item amiga - @item bsd --@item loop (raw disk access) -+@item dvh - @item gpt -+@item loop (raw disk access) - @item mac - @item msdos - @item pc98 -@@ -594,14 +621,19 @@ partition table. - - @var{fs-type} must be one of these supported file systems: - @itemize @bullet --@item ext2 -+@item btrfs -+@item ext2, ext3, ext4 - @item fat16, fat32 - @item hfs, hfs+, hfsx --@item linux-swap --@item NTFS -+@item hp-ufs -+@item jfs -+@item linux-swap, linux-swap(new,old,v0,v1) -+@item nilfs2 -+@item ntfs - @item reiserfs -+@item sun-ufs - @item ufs --@item btrfs -+@item xfs - @end itemize - - For example, the following creates a logical partition that will contain -@@ -671,29 +703,56 @@ Set the name of partition 2 to `Secret Documents'. - @cindex print, command description - @cindex command description, print - --@deffn Command print [@var{number}] -+@deffn Command print [@var{print-type}] - - Displays the partition table on the device parted is editing, or - detailed information about a particular partition. - -+@var{print-type} is optional, and can be one of @samp{devices}, -+@samp{free}, @samp{list}, or @samp{all}. -+ -+@table @code -+ -+@item devices -+display all active block devices -+ -+@item free -+display information about free unpartitioned space on the current block device -+ -+@item list, all -+display the partition tables of all active block devices -+ -+@end table -+ - Example: - - @example - @group - (parted) @kbd{print} --Disk geometry for /dev/hda: 0.000-2445.679 megabytes --Disk label type: msdos --Minor Start End Type Filesystem Flags --1 0.031 945.000 primary fat32 boot, lba --2 945.000 2358.562 primary ext2 --3 2358.562 2445.187 primary linux-swap --(parted) @kbd{print 1} --Minor: 1 --Flags: boot, lba --File System: fat32 --Size: 945.000Mb (0%) --Minimum size: 84.361Mb (0%) --Maximum size: 2445.679Mb (100%) -+Model: ATA Samsung SSD 850 (scsi) -+Disk /dev/sda: 2684MB -+Sector size (logical/physical): 512B/512B -+Partition Table: msdos -+Disk Flags: -+ -+Number Start End Size Type File system Flags -+ 1 1049kB 1000MB 999MB primary boot, lba -+ 2 1000MB 2300MB 1299MB primary ext2 lba -+ 3 2300MB 2500MB 200MB primary linux-swap(v1) lba -+(parted) @kbd{print free} -+Model: ATA Samsung SSD 850 (scsi) -+Disk /dev/sda: 2684MB -+Sector size (logical/physical): 512B/512B -+Partition Table: msdos -+Disk Flags: -+ -+Number Start End Size Type File system Flags -+ 16.4kB 1049kB 1032kB Free Space -+ 1 1049kB 1000MB 999MB primary boot, lba -+ 2 1000MB 2300MB 1299MB primary ext2 lba -+ 3 2300MB 2500MB 200MB primary linux-swap(v1) lba -+ 2500MB 2684MB 185MB Free Space -+ - @end group - @end example - @end deffn -@@ -728,43 +787,58 @@ may delay this. - Rescue a lost partition that used to be located approximately between - @var{start} and @var{end}. If such a partition is found, Parted will - ask you if you want to create a partition for it. This is useful if you --accidently deleted a partition with parted's rm command, for example. -+accidentally deleted a partition with parted's rm command, for example. - - Example: - - @example - (parted) @kbd{print} - @group --Disk geometry for /dev/hdc: 0.000-8063.507 megabytes --Disk label type: msdos --Minor Start End Type Filesystem Flags --1 0.031 8056.032 primary ext3 -+Model: ATA Samsung SSD 850 (scsi) -+Disk /dev/sda: 2684MB -+Sector size (logical/physical): 512B/512B -+Partition Table: msdos -+Disk Flags: -+ -+Number Start End Size Type File system Flags -+ 1 1049kB 1000MB 999MB primary boot, lba -+ 2 1000MB 2300MB 1299MB primary ext4 lba - @end group - (parted) @kbd{rm} --Partition number? 1 -+Partition number? 2 - (parted) @kbd{print} - @group --Disk geometry for /dev/hdc: 0.000-8063.507 megabytes --Disk label type: msdos --Minor Start End Type Filesystem Flags -+Model: ATA Samsung SSD 850 (scsi) -+Disk /dev/sda: 2684MB -+Sector size (logical/physical): 512B/512B -+Partition Table: msdos -+Disk Flags: -+ -+Number Start End Size Type File system Flags -+ 1 1049kB 1000MB 999MB primary boot, lba - @end group - @end example - --OUCH! We deleted our ext3 partition!!! Parted comes to the rescue... -+OUCH! We deleted our ext4 partition!!! Parted comes to the rescue... - - @example - (parted) @kbd{rescue} --Start? 0 --End? 8056 --Information: A ext3 primary partition was found at 0.031MB -> --8056.030MB. Do you want to add it to the partition table? -+Start? 1000 -+End? 2684 -+Information: A ext4 primary partition was found at 1000MB -> -+2300MB. Do you want to add it to the partition table? - Yes/No/Cancel? @kbd{y} - (parted) @kbd{print} - @group --Disk geometry for /dev/hdc: 0.000-8063.507 megabytes --Disk label type: msdos --Minor Start End Type Filesystem Flags --1 0.031 8056.032 primary ext3 -+Model: ATA Samsung SSD 850 (scsi) -+Disk /dev/sda: 2684MB -+Sector size (logical/physical): 512B/512B -+Partition Table: msdos -+Disk Flags: -+ -+Number Start End Size Type File system Flags -+ 1 1049kB 1000MB 999MB primary boot, lba -+ 2 1000MB 2300MB 1299MB primary ext4 lba - @end group - @end example - -@@ -795,7 +869,7 @@ but when shrinking, you need to shrink the filesystem before the partition. - - @deffn Command rm @var{number} - --Removes the partition with number @var{number}. If you accidently delete -+Removes the partition with number @var{number}. If you accidentally delete - a partition with this command, use mkpart to - recover it. Also, you can use the gpart program (@pxref{Related information}) - to recover damaged disk labels. -@@ -824,8 +898,8 @@ Remove partition 3. - @deffn Command select @var{device} - - Selects the device, @var{device}, for Parted to edit. The device can --be a Linux hard disk device, a partition, a software RAID device or --LVM logical volume. -+be a Linux hard disk device, a partition, a software RAID device, -+LVM logical volume, or disk image file. - - Example: - -@@ -949,6 +1023,17 @@ Example: - Set the @samp{boot} flag on partition 1. - @end deffn - -+@node toggle -+@subsection toggle -+@cindex toggle, command description -+@cindex command description, toggle -+ -+@deffn Command toggle @var{number} @var{flag} -+ -+Toggle the state of @var{flag} on partition @var{number}. -+ -+@end deffn -+ - @node unit - @subsection unit - @cindex unit, command description -@@ -1121,7 +1206,7 @@ software - - This manual was based on the file @kbd{USER} included in GNU Parted version - 1.4.22 source distribution. The GNU Parted source distribution is --available at @uref{ftp.gnu.org/gnu/parted}. -+available at @uref{https://ftp.gnu.org/gnu/parted}. - - Initial Texinfo formatting by Richard M. Kreuter, 2002. - -diff --git a/parted/parted.c b/parted/parted.c -index 975700c..310f011 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -2222,7 +2222,7 @@ command_register (commands, command_create ( - str_list_create_unique ("print", _("print"), NULL), - do_print, - str_list_create ( --_("print [devices|free|list,all|NUMBER] display the partition table, " -+_("print [devices|free|list,all] display the partition table, " - "available devices, free space, all found partitions, or a particular " - "partition"), - NULL), -@@ -2233,8 +2233,6 @@ _(" devices : display all active block devices\n"), - _(" free : display information about free unpartitioned space on the " - "current block device\n"), - _(" list, all : display the partition tables of all active block devices\n"), --_(" NUMBER : display more detailed information about this particular " -- "partition\n"), - NULL), 1)); - - command_register (commands, command_create ( --- -2.31.1 - diff --git a/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch b/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch deleted file mode 100644 index e8b9a2b..0000000 --- a/0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch +++ /dev/null @@ -1,542 +0,0 @@ -From f6b9e09e7207f54a491de827640bb08501d91f91 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Thu, 17 Feb 2022 15:34:41 -0800 -Subject: [PATCH] gnulib: Use newer cdefs.h from gnulib - -This uses the one from gnulib commit 9f48fb992a3d7e96 on 2022-02-14 - -This is a temporary workaround for gcc 12 problems on ppc64le, the build -will be filled with errors that look like: - -/usr/include/bits/stdio-ldbl.h:86:1: error: storage class specified for parameter '__sprintf_chk' - 86 | __LDBL_REDIR2_DECL (sprintf_chk) - -without it. ---- - lib/cdefs.h | 307 +++++++++++++++++++++++++++++++++++++++------------- - 1 file changed, 232 insertions(+), 75 deletions(-) - -diff --git a/lib/cdefs.h b/lib/cdefs.h -index 1a2805d..44d3826 100644 ---- a/lib/cdefs.h -+++ b/lib/cdefs.h -@@ -1,17 +1,18 @@ --/* Copyright (C) 1992-2020 Free Software Foundation, Inc. -+/* Copyright (C) 1992-2022 Free Software Foundation, Inc. -+ Copyright The GNU Toolchain Authors. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public -+ modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either -- version 3 of the License, or (at your option) any later version. -+ version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -+ Lesser General Public License for more details. - -- You should have received a copy of the GNU General Public -+ You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -@@ -25,7 +26,7 @@ - - /* The GNU libc does not support any K&R compilers or the traditional mode - of ISO C compilers anymore. Check for some of the combinations not -- anymore supported. */ -+ supported anymore. */ - #if defined __GNUC__ && !defined __STDC__ - # error "You need a ISO C conforming compiler to use the glibc headers" - #endif -@@ -34,31 +35,26 @@ - #undef __P - #undef __PMT - --/* Compilers that are not clang may object to -- #if defined __clang__ && __has_attribute(...) -- even though they do not need to evaluate the right-hand side of the &&. */ --#if defined __clang__ && defined __has_attribute --# define __glibc_clang_has_attribute(name) __has_attribute (name) -+/* Compilers that lack __has_attribute may object to -+ #if defined __has_attribute && __has_attribute (...) -+ even though they do not need to evaluate the right-hand side of the &&. -+ Similarly for __has_builtin, etc. */ -+#if (defined __has_attribute \ -+ && (!defined __clang_minor__ \ -+ || 3 < __clang_major__ + (5 <= __clang_minor__))) -+# define __glibc_has_attribute(attr) __has_attribute (attr) - #else --# define __glibc_clang_has_attribute(name) 0 -+# define __glibc_has_attribute(attr) 0 - #endif -- --/* Compilers that are not clang may object to -- #if defined __clang__ && __has_builtin(...) -- even though they do not need to evaluate the right-hand side of the &&. */ --#if defined __clang__ && defined __has_builtin --# define __glibc_clang_has_builtin(name) __has_builtin (name) -+#ifdef __has_builtin -+# define __glibc_has_builtin(name) __has_builtin (name) - #else --# define __glibc_clang_has_builtin(name) 0 -+# define __glibc_has_builtin(name) 0 - #endif -- --/* Compilers that are not clang may object to -- #if defined __clang__ && __has_extension(...) -- even though they do not need to evaluate the right-hand side of the &&. */ --#if defined __clang__ && defined __has_extension --# define __glibc_clang_has_extension(ext) __has_extension (ext) -+#ifdef __has_extension -+# define __glibc_has_extension(ext) __has_extension (ext) - #else --# define __glibc_clang_has_extension(ext) 0 -+# define __glibc_has_extension(ext) 0 - #endif - - #if defined __GNUC__ || defined __clang__ -@@ -74,22 +70,26 @@ - # endif - - /* GCC can always grok prototypes. For C++ programs we add throw() -- to help it optimize the function calls. But this works only with -+ to help it optimize the function calls. But this only works with - gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions - as non-throwing using a function attribute since programs can use - the -fexceptions options for C code as well. */ - # if !defined __cplusplus \ -- && (__GNUC_PREREQ (3, 4) || __glibc_clang_has_attribute (__nothrow__)) -+ && (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__)) - # define __THROW __attribute__ ((__nothrow__ __LEAF)) - # define __THROWNL __attribute__ ((__nothrow__)) - # define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct - # define __NTHNL(fct) __attribute__ ((__nothrow__)) fct - # else - # if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major >= 4) --# define __THROW throw () --# define __THROWNL throw () --# define __NTH(fct) __LEAF_ATTR fct throw () --# define __NTHNL(fct) fct throw () -+# if __cplusplus >= 201103L -+# define __THROW noexcept (true) -+# else -+# define __THROW throw () -+# endif -+# define __THROWNL __THROW -+# define __NTH(fct) __LEAF_ATTR fct __THROW -+# define __NTHNL(fct) fct __THROW - # else - # define __THROW - # define __THROWNL -@@ -142,24 +142,68 @@ - #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1) - #define __bos0(ptr) __builtin_object_size (ptr, 0) - -+/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */ -+#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \ -+ || __GNUC_PREREQ (12, 0)) -+# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0) -+# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1) -+#else -+# define __glibc_objsize0(__o) __bos0 (__o) -+# define __glibc_objsize(__o) __bos (__o) -+#endif -+ -+/* Compile time conditions to choose between the regular, _chk and _chk_warn -+ variants. These conditions should get evaluated to constant and optimized -+ away. */ -+ -+#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s)) -+#define __glibc_unsigned_or_positive(__l) \ -+ ((__typeof (__l)) 0 < (__typeof (__l)) -1 \ -+ || (__builtin_constant_p (__l) && (__l) > 0)) -+ -+/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ -+ condition can be folded to a constant and if it is true. The -1 check is -+ redundant because since it implies that __glibc_safe_len_cond is true. */ -+#define __glibc_safe_or_unknown_len(__l, __s, __osz) \ -+ (__glibc_unsigned_or_positive (__l) \ -+ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ -+ __s, __osz)) \ -+ && __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) -+ -+/* Conversely, we know at compile time that the length is unsafe if the -+ __L * __S <= __OBJSZ condition can be folded to a constant and if it is -+ false. */ -+#define __glibc_unsafe_len(__l, __s, __osz) \ -+ (__glibc_unsigned_or_positive (__l) \ -+ && __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \ -+ __s, __osz)) \ -+ && !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz)) -+ -+/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be -+ declared. */ -+ -+#define __glibc_fortify(f, __l, __s, __osz, ...) \ -+ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ -+ ? __ ## f ## _alias (__VA_ARGS__) \ -+ : (__glibc_unsafe_len (__l, __s, __osz) \ -+ ? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \ -+ : __ ## f ## _chk (__VA_ARGS__, __osz))) \ -+ -+/* Fortify function f, where object size argument passed to f is the number of -+ elements and not total size. */ -+ -+#define __glibc_fortify_n(f, __l, __s, __osz, ...) \ -+ (__glibc_safe_or_unknown_len (__l, __s, __osz) \ -+ ? __ ## f ## _alias (__VA_ARGS__) \ -+ : (__glibc_unsafe_len (__l, __s, __osz) \ -+ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \ -+ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \ -+ - #if __GNUC_PREREQ (4,3) --# define __warndecl(name, msg) \ -- extern void name (void) __attribute__((__warning__ (msg))) - # define __warnattr(msg) __attribute__((__warning__ (msg))) - # define __errordecl(name, msg) \ - extern void name (void) __attribute__((__error__ (msg))) --#elif __glibc_clang_has_attribute (__diagnose_if__) && 0 --/* These definitions are not enabled, because they produce bogus warnings -- in the glibc Fortify functions. These functions are written in a style -- that works with GCC. In order to work with clang, these functions would -- need to be modified. */ --# define __warndecl(name, msg) \ -- extern void name (void) __attribute__((__diagnose_if__ (1, msg, "warning"))) --# define __warnattr(msg) __attribute__((__diagnose_if__ (1, msg, "warning"))) --# define __errordecl(name, msg) \ -- extern void name (void) __attribute__((__diagnose_if__ (1, msg, "error"))) - #else --# define __warndecl(name, msg) extern void name (void) - # define __warnattr(msg) - # define __errordecl(name, msg) extern void name (void) - #endif -@@ -233,7 +277,7 @@ - /* At some point during the gcc 2.96 development the `malloc' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ --#if __GNUC_PREREQ (2,96) || __glibc_clang_has_attribute (__malloc__) -+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__) - # define __attribute_malloc__ __attribute__ ((__malloc__)) - #else - # define __attribute_malloc__ /* Ignore */ -@@ -248,26 +292,41 @@ - # define __attribute_alloc_size__(params) /* Ignore. */ - #endif - -+/* Tell the compiler which argument to an allocation function -+ indicates the alignment of the allocation. */ -+#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__) -+# define __attribute_alloc_align__(param) \ -+ __attribute__ ((__alloc_align__ param)) -+#else -+# define __attribute_alloc_align__(param) /* Ignore. */ -+#endif -+ - /* At some point during the gcc 2.96 development the `pure' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ --#if __GNUC_PREREQ (2,96) || __glibc_clang_has_attribute (__pure__) -+#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__) - # define __attribute_pure__ __attribute__ ((__pure__)) - #else - # define __attribute_pure__ /* Ignore */ - #endif - - /* This declaration tells the compiler that the value is constant. */ --#if __GNUC_PREREQ (2,5) || __glibc_clang_has_attribute (__const__) -+#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__) - # define __attribute_const__ __attribute__ ((__const__)) - #else - # define __attribute_const__ /* Ignore */ - #endif - -+#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__) -+# define __attribute_maybe_unused__ __attribute__ ((__unused__)) -+#else -+# define __attribute_maybe_unused__ /* Ignore */ -+#endif -+ - /* At some point during the gcc 3.1 development the `used' attribute - for functions was introduced. We don't want to use it unconditionally - (although this would be possible) since it generates warnings. */ --#if __GNUC_PREREQ (3,1) || __glibc_clang_has_attribute (__used__) -+#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__) - # define __attribute_used__ __attribute__ ((__used__)) - # define __attribute_noinline__ __attribute__ ((__noinline__)) - #else -@@ -276,7 +335,7 @@ - #endif - - /* Since version 3.2, gcc allows marking deprecated functions. */ --#if __GNUC_PREREQ (3,2) || __glibc_clang_has_attribute (__deprecated__) -+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__) - # define __attribute_deprecated__ __attribute__ ((__deprecated__)) - #else - # define __attribute_deprecated__ /* Ignore */ -@@ -285,8 +344,8 @@ - /* Since version 4.5, gcc also allows one to specify the message printed - when a deprecated function is used. clang claims to be gcc 4.2, but - may also support this feature. */ --#if __GNUC_PREREQ (4,5) || \ -- __glibc_clang_has_extension (__attribute_deprecated_with_message__) -+#if __GNUC_PREREQ (4,5) \ -+ || __glibc_has_extension (__attribute_deprecated_with_message__) - # define __attribute_deprecated_msg__(msg) \ - __attribute__ ((__deprecated__ (msg))) - #else -@@ -299,7 +358,7 @@ - If several `format_arg' attributes are given for the same function, in - gcc-3.0 and older, all but the last one are ignored. In newer gccs, - all designated arguments are considered. */ --#if __GNUC_PREREQ (2,8) || __glibc_clang_has_attribute (__format_arg__) -+#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__) - # define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x))) - #else - # define __attribute_format_arg__(x) /* Ignore */ -@@ -309,7 +368,7 @@ - attribute for functions was introduced. We don't want to use it - unconditionally (although this would be possible) since it - generates warnings. */ --#if __GNUC_PREREQ (2,97) || __glibc_clang_has_attribute (__format__) -+#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__) - # define __attribute_format_strfmon__(a,b) \ - __attribute__ ((__format__ (__strfmon__, a, b))) - #else -@@ -317,19 +376,33 @@ - #endif - - /* The nonnull function attribute marks pointer parameters that -- must not be NULL. Do not define __nonnull if it is already defined, -- for portability when this file is used in Gnulib. */ -+ must not be NULL. This has the name __nonnull in glibc, -+ and __attribute_nonnull__ in files shared with Gnulib to avoid -+ collision with a different __nonnull in DragonFlyBSD 5.9. */ -+#ifndef __attribute_nonnull__ -+# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__) -+# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params)) -+# else -+# define __attribute_nonnull__(params) -+# endif -+#endif - #ifndef __nonnull --# if __GNUC_PREREQ (3,3) || __glibc_clang_has_attribute (__nonnull__) --# define __nonnull(params) __attribute__ ((__nonnull__ params)) -+# define __nonnull(params) __attribute_nonnull__ (params) -+#endif -+ -+/* The returns_nonnull function attribute marks the return type of the function -+ as always being non-null. */ -+#ifndef __returns_nonnull -+# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__) -+# define __returns_nonnull __attribute__ ((__returns_nonnull__)) - # else --# define __nonnull(params) -+# define __returns_nonnull - # endif - #endif - - /* If fortification mode, we warn about unused results of certain - function calls which can lead to problems. */ --#if __GNUC_PREREQ (3,4) || __glibc_clang_has_attribute (__warn_unused_result__) -+#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__) - # define __attribute_warn_unused_result__ \ - __attribute__ ((__warn_unused_result__)) - # if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0 -@@ -343,7 +416,7 @@ - #endif - - /* Forces a function to be always inlined. */ --#if __GNUC_PREREQ (3,2) || __glibc_clang_has_attribute (__always_inline__) -+#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__) - /* The Linux kernel defines __always_inline in stddef.h (283d7573), and - it conflicts with this definition. Therefore undefine it first to - allow either header to be included first. */ -@@ -356,7 +429,7 @@ - - /* Associate error messages with the source location of the call site rather - than with the source location inside the function. */ --#if __GNUC_PREREQ (4,3) || __glibc_clang_has_attribute (__artificial__) -+#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__) - # define __attribute_artificial__ __attribute__ ((__artificial__)) - #else - # define __attribute_artificial__ /* Ignore */ -@@ -433,7 +506,7 @@ - # endif - #endif - --#if (__GNUC__ >= 3) || __glibc_clang_has_builtin (__builtin_expect) -+#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect) - # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) - # define __glibc_likely(cond) __builtin_expect ((cond), 1) - #else -@@ -441,12 +514,6 @@ - # define __glibc_likely(cond) (cond) - #endif - --#ifdef __has_attribute --# define __glibc_has_attribute(attr) __has_attribute (attr) --#else --# define __glibc_has_attribute(attr) 0 --#endif -- - #if (!defined _Noreturn \ - && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && !(__GNUC_PREREQ (4,7) \ -@@ -467,6 +534,16 @@ - # define __attribute_nonstring__ - #endif - -+/* Undefine (also defined in libc-symbols.h). */ -+#undef __attribute_copy__ -+#if __GNUC_PREREQ (9, 0) -+/* Copies attributes from the declaration or type referenced by -+ the argument. */ -+# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg))) -+#else -+# define __attribute_copy__(arg) -+#endif -+ - #if (!defined _Static_assert && !defined __cplusplus \ - && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \ - && (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \ -@@ -476,14 +553,44 @@ - [!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })] - #endif - --/* The #ifndef lets Gnulib avoid including these on non-glibc -- platforms, where the includes typically do not exist. */ --#ifndef __WORDSIZE -+/* Gnulib avoids including these, as they don't work on non-glibc or -+ older glibc platforms. */ -+#ifndef __GNULIB_CDEFS - # include - # include - #endif - --#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH -+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 -+# ifdef __REDIRECT -+ -+/* Alias name defined automatically. */ -+# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir -+# define __LDBL_REDIR_DECL(name) \ -+ extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128")); -+ -+/* Alias name defined automatically, with leading underscores. */ -+# define __LDBL_REDIR2_DECL(name) \ -+ extern __typeof (__##name) __##name \ -+ __asm (__ASMNAME ("__" #name "ieee128")); -+ -+/* Alias name defined manually. */ -+# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1 -+# define __LDBL_REDIR1_DECL(name, alias) \ -+ extern __typeof (name) name __asm (__ASMNAME (#alias)); -+ -+# define __LDBL_REDIR1_NTH(name, proto, alias) \ -+ __REDIRECT_NTH (name, proto, alias) -+# define __REDIRECT_NTH_LDBL(name, proto, alias) \ -+ __LDBL_REDIR1_NTH (name, proto, __##alias##ieee128) -+ -+/* Unused. */ -+# define __REDIRECT_LDBL(name, proto, alias) ... unused__redirect_ldbl -+# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth -+ -+# else -+_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform"); -+# endif -+#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH - # define __LDBL_COMPAT 1 - # ifdef __REDIRECT - # define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias) -@@ -492,6 +599,8 @@ - # define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias) - # define __LDBL_REDIR_NTH(name, proto) \ - __LDBL_REDIR1_NTH (name, proto, __nldbl_##name) -+# define __LDBL_REDIR2_DECL(name) \ -+ extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name)); - # define __LDBL_REDIR1_DECL(name, alias) \ - extern __typeof (name) name __asm (__ASMNAME (#alias)); - # define __LDBL_REDIR_DECL(name) \ -@@ -502,11 +611,13 @@ - __LDBL_REDIR1_NTH (name, proto, __nldbl_##alias) - # endif - #endif --#if !defined __LDBL_COMPAT || !defined __REDIRECT -+#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \ -+ || !defined __REDIRECT - # define __LDBL_REDIR1(name, proto, alias) name proto - # define __LDBL_REDIR(name, proto) name proto - # define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW - # define __LDBL_REDIR_NTH(name, proto) name proto __THROW -+# define __LDBL_REDIR2_DECL(name) - # define __LDBL_REDIR_DECL(name) - # ifdef __REDIRECT - # define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias) -@@ -537,7 +648,7 @@ - check is required to enable the use of generic selection. */ - #if !defined __cplusplus \ - && (__GNUC_PREREQ (4, 9) \ -- || __glibc_clang_has_extension (c_generic_selections) \ -+ || __glibc_has_extension (c_generic_selections) \ - || (!defined __GNUC__ && defined __STDC_VERSION__ \ - && __STDC_VERSION__ >= 201112L)) - # define __HAVE_GENERIC_SELECTION 1 -@@ -545,4 +656,50 @@ - # define __HAVE_GENERIC_SELECTION 0 - #endif - -+#if __GNUC_PREREQ (10, 0) -+/* Designates a 1-based positional argument ref-index of pointer type -+ that can be used to access size-index elements of the pointed-to -+ array according to access mode, or at least one element when -+ size-index is not provided: -+ access (access-mode, [, ]) */ -+# define __attr_access(x) __attribute__ ((__access__ x)) -+/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may -+ use the access attribute to get object sizes from function definition -+ arguments, so we can't use them on functions we fortify. Drop the object -+ size hints for such functions. */ -+# if __USE_FORTIFY_LEVEL == 3 -+# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o))) -+# else -+# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s)) -+# endif -+# if __GNUC_PREREQ (11, 0) -+# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno))) -+# else -+# define __attr_access_none(argno) -+# endif -+#else -+# define __fortified_attr_access(a, o, s) -+# define __attr_access(x) -+# define __attr_access_none(argno) -+#endif -+ -+#if __GNUC_PREREQ (11, 0) -+/* Designates dealloc as a function to call to deallocate objects -+ allocated by the declared function. */ -+# define __attr_dealloc(dealloc, argno) \ -+ __attribute__ ((__malloc__ (dealloc, argno))) -+# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1) -+#else -+# define __attr_dealloc(dealloc, argno) -+# define __attr_dealloc_free -+#endif -+ -+/* Specify that a function such as setjmp or vfork may return -+ twice. */ -+#if __GNUC_PREREQ (4, 1) -+# define __attribute_returns_twice__ __attribute__ ((__returns_twice__)) -+#else -+# define __attribute_returns_twice__ /* Ignore. */ -+#endif -+ - #endif /* sys/cdefs.h */ --- -2.34.1 - diff --git a/parted.spec b/parted.spec index 8320add..a82616e 100644 --- a/parted.spec +++ b/parted.spec @@ -1,61 +1,16 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.4 -Release: 12%{?dist} +Version: 3.4.64 +Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted -Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz -Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig +Source0: https://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Source1: https://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane -# Upstream patches since v3.4 release -Patch0001: 0001-parted-add-fix-to-fix-in-script-mode.patch -Patch0002: 0002-doc-Document-fix-flag.patch -Patch0003: 0003-tests-Add-tests-for-fix.patch -Patch0004: 0004-tests-Fix-test-t1700-probe-fs.patch -Patch0005: 0005-tests-Fix-t9041-undetected-in-use-16th-partition.patch -Patch0006: 0006-libparted-Fix-fd-check-in-_flush_cache.patch -Patch0007: 0007-libparted-Fix-potential-memory-leak-in-sdmmc_get_pro.patch -Patch0008: 0008-fs-Fix-copy-paste-error-in-HFS-journal-code.patch -Patch0009: 0009-parted-Fix-end_input-leak-in-do_mkpart.patch -Patch0010: 0010-parted-Free-tmp-usage-inside-do_print.patch -Patch0011: 0011-parted-Fix-memory-leaks-in-do_resizepart.patch -Patch0012: 0012-libparted-Fix-warning-about-buffer-size-in-Atari-lab.patch -Patch0013: 0013-libparted-Fix-potential-memory-leak-in-gpt_write.patch -Patch0014: 0014-tests-t0400-Work-around-a-mkswap-bug-by-using-dev-ze.patch -Patch0015: 0015-tests-t9050-Use-dev-zero-for-temporary-file-and-mksw.patch -Patch0016: 0016-tests-t1100-Change-dev_size_mb-to-10.patch -Patch0017: 0017-tests-t1101-Change-dev_size_mb-to-10.patch -Patch0018: 0018-tests-t1102-Change-dev_size_mb-to-10.patch -Patch0019: 0019-tests-t1701-Change-dev_size_mb-to-10.patch -Patch0020: 0020-tests-t3000-Change-dev_size_mb-to-267.patch -Patch0021: 0021-tests-t3200-Change-dev_size_mb-to-10.patch -Patch0022: 0022-tests-t6006-Change-dev_size_mb-to-10.patch -Patch0023: 0023-tests-t3000-Check-for-hfs-and-vfat-support-separatel.patch -Patch0024: 0024-tests-t3000-Use-mkfs.hfsplus-and-fsck.hfsplus-for-re.patch -Patch0025: 0025-Move-Exception-Option-values-into-enum.patch -Patch0026: 0026-libparted-Add-swap-flag-to-msdos-disklabel.patch -Patch0027: 0027-tests-add-aarch64-and-mips64-as-a-valid-64-bit-machi.patch -Patch0028: 0028-tests-add-a-helper-to-check-the-kernel-knows-about-a.patch -Patch0029: 0029-tests-check-for-vfat-kernel-support-and-tools.patch -Patch0030: 0030-parted-Escape-colons-and-backslashes-in-machine-outp.patch -Patch0031: 0031-libparted-Tell-libdevmapper-to-retry-remove-when-BUS.patch -Patch0032: 0032-libparted-Check-devpath-before-passing-to-strlen.patch -Patch0033: 0033-parted-Allow-empty-string-for-partition-name.patch -Patch0034: 0034-parted-Add-json-cmdline-switch-to-output-JSON.patch -Patch0035: 0035-hurd-Fix-partition-paths.patch -Patch0036: 0036-hurd-Support-rumpdisk-based-device-names.patch -Patch0037: 0037-hurd-Implement-partition-table-rereading.patch -Patch0038: 0038-keep-GUID-specific-attributes.patch -Patch0039: 0039-gpt-Map-PED_PARTITON_-flags-to-GUID-values.patch -Patch0040: 0040-gpt-Add-linux-home-flag.patch -Patch0041: 0041-doc-Document-gpt-linux-home-flag.patch -Patch0042: 0042-tests-Add-a-test-to-make-sure-GPT-GUIDs-default-to-f.patch -Patch0043: 0043-gpt-Revert-to-filesystem-GUID-when-setting-flag-to-o.patch -Patch0044: 0044-docs-Update-documentation-to-be-consistent.patch -Patch0045: 0045-gnulib-Use-newer-cdefs.h-from-gnulib.patch +# Upstream patches since v3.5 release BuildRequires: gcc @@ -145,9 +100,9 @@ make check %{_mandir}/man8/parted.8* %{_mandir}/man8/partprobe.8* %{_libdir}/libparted.so.2 -%{_libdir}/libparted.so.2.0.3 +%{_libdir}/libparted.so.2.0.4 %{_libdir}/libparted-fs-resize.so.0 -%{_libdir}/libparted-fs-resize.so.0.0.3 +%{_libdir}/libparted-fs-resize.so.0.0.4 %{_infodir}/parted.info* %files devel @@ -160,6 +115,11 @@ make check %changelog +* Wed Mar 30 2022 Brian C. Lane - 3.4.64-1 +- Upstream 3.4.64 Alpha release +- Dropped all patches included in new upstream release +- Bumped minor version on libparted.so and libparted-fs-resize.so + * Thu Feb 17 2022 Brian C. Lane - 3.4-12 - gnulib: Use newer cdefs.h from gnulib (bcl) - Update parted.spec to allow flatpak builds diff --git a/sources b/sources index ea881f9..88f17f6 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.4.tar.xz) = e69bd1b610778e980d4595d04892f2ea1faf4ae9bfc98cd62abfc70066423f08ddaa396f9461c7beb1330d023232274606b6b26091a0458aeedd0f3f57536690 -SHA512 (parted-3.4.tar.xz.sig) = 6b11812267e66470ba2908ee1cc78b232b0bc2519787f5a17b92cd5f8ba904b1a836833f19c5244b23d4c7810437eeb26fbbd68fac819391b342709682345472 +SHA512 (parted-3.4.64.tar.xz) = db5fd8a7f3aa253b1c934837d519f561603c4af72c9fc273fecd2fd79ec6cac3dd5a318fcd99dee762d984df73a5316a392d77cc310818a60e426890d9d3c4c9 +SHA512 (parted-3.4.64.tar.xz.sig) = ae48682796dc6a03d61097514773eb7f48e25092f5d2a56800f02de0ac44b00f325b977899be49f83e6d74d728209328bbfff2979cec043c98ffbdc8f32a8a20 From 4cce40f55c5e3340ec01894c9ba561910c356faa Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 18 Apr 2022 13:29:03 -0700 Subject: [PATCH 33/60] - Upstream 3.5 stable release --- .gitignore | 2 ++ parted.spec | 9 ++++++--- sources | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 01022d0..c6404f5 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ clog /parted-3.4.tar.xz.sig /parted-3.4.64.tar.xz /parted-3.4.64.tar.xz.sig +/parted-3.5.tar.xz +/parted-3.5.tar.xz.sig diff --git a/parted.spec b/parted.spec index a82616e..dc01f56 100644 --- a/parted.spec +++ b/parted.spec @@ -1,12 +1,12 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.4.64 +Version: 3.5 Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted -Source0: https://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz -Source1: https://alpha.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig +Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane @@ -115,6 +115,9 @@ make check %changelog +* Mon Apr 18 2022 Brian C. Lane - 3.5-1 +- Upstream 3.5 stable release + * Wed Mar 30 2022 Brian C. Lane - 3.4.64-1 - Upstream 3.4.64 Alpha release - Dropped all patches included in new upstream release diff --git a/sources b/sources index 88f17f6..eaab8bf 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.4.64.tar.xz) = db5fd8a7f3aa253b1c934837d519f561603c4af72c9fc273fecd2fd79ec6cac3dd5a318fcd99dee762d984df73a5316a392d77cc310818a60e426890d9d3c4c9 -SHA512 (parted-3.4.64.tar.xz.sig) = ae48682796dc6a03d61097514773eb7f48e25092f5d2a56800f02de0ac44b00f325b977899be49f83e6d74d728209328bbfff2979cec043c98ffbdc8f32a8a20 +SHA512 (parted-3.5.tar.xz) = 87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a +SHA512 (parted-3.5.tar.xz.sig) = 2ea1209325595416aa9ee27a0e85ca38bce50ca885d3b52ab1c1fb1b68b78d7887386ea3120274648056d2f1d9dca00b77236991765d84ad226c1b1f5a3f5c62 From 953543a358a7a404ed9730fc99eb3389f6b9af92 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 17 May 2022 16:23:46 -0700 Subject: [PATCH 34/60] - tests: t3200-type-change now passes (bcl) - parted: Reset the filesystem type when changing the id/uuid (bcl) - libparted: add swap flag for DASD label (aschnell) - parted: add type command (aschnell) - maint: post-release administrivia (bcl) --- 0001-maint-post-release-administrivia.patch | 50 + 0002-parted-add-type-command.patch | 1636 +++++++++++++++++ ...bparted-add-swap-flag-for-DASD-label.patch | 228 +++ ...-filesystem-type-when-changing-the-i.patch | 30 + 0005-tests-t3200-type-change-now-passes.patch | 23 + parted.spec | 14 +- 6 files changed, 1980 insertions(+), 1 deletion(-) create mode 100644 0001-maint-post-release-administrivia.patch create mode 100644 0002-parted-add-type-command.patch create mode 100644 0003-libparted-add-swap-flag-for-DASD-label.patch create mode 100644 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch create mode 100644 0005-tests-t3200-type-change-now-passes.patch diff --git a/0001-maint-post-release-administrivia.patch b/0001-maint-post-release-administrivia.patch new file mode 100644 index 0000000..c32732c --- /dev/null +++ b/0001-maint-post-release-administrivia.patch @@ -0,0 +1,50 @@ +From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 18 Apr 2022 15:10:06 -0400 +Subject: [PATCH 1/5] 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 e917998..5a95802 100644 +--- a/.prev-version ++++ b/.prev-version +@@ -1 +1 @@ +-3.4.64.2 ++3.5 +diff --git a/NEWS b/NEWS +index 68a164a..2bd161f 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,8 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes in release ?.? (????-??-??) [?] ++ ++ + * Noteworthy changes in release 3.5 (2022-04-18) [stable] + + ** New Features +diff --git a/cfg.mk b/cfg.mk +index d5fdd80..11fa51b 100644 +--- a/cfg.mk ++++ b/cfg.mk +@@ -45,7 +45,7 @@ local-checks-to-skip = \ + export VERBOSE = yes + + # Hash of lines 42-208 for release 3.2 +-old_NEWS_hash = 64a8f4d9ec1a5c256f3cc792450dc257 ++old_NEWS_hash = 81f624d1d62a34f24e1286bd3cf5c736 + + include $(srcdir)/dist-check.mk + +-- +2.35.3 + diff --git a/0002-parted-add-type-command.patch b/0002-parted-add-type-command.patch new file mode 100644 index 0000000..8472a6b --- /dev/null +++ b/0002-parted-add-type-command.patch @@ -0,0 +1,1636 @@ +From 61b3a9733c0e0a79ccc43096642d378c8706add6 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Wed, 11 May 2022 14:02:21 +0000 +Subject: [PATCH 2/5] parted: add type command + +Include the partition type-id and type-uuid in the JSON +output. Also add the the command 'type' to set them. Remove +redundant flags from DosPartitionData and use only the system +variable. + +Signed-off-by: Brian C. Lane +--- + NEWS | 3 + + doc/C/parted.8 | 5 + + doc/parted.texi | 20 + + include/parted/disk.in.h | 23 +- + libparted/disk.c | 102 +++++ + libparted/labels/dasd.c | 4 + + libparted/labels/dos.c | 621 ++++++++++++-------------- + libparted/labels/gpt.c | 44 +- + parted/parted.c | 113 ++++- + tests/Makefile.am | 4 + + tests/t0800-json-gpt.sh | 2 + + tests/t0801-json-msdos.sh | 5 +- + tests/t0900-type-gpt.sh | 69 +++ + tests/t0901-type-gpt-invalid.sh | 35 ++ + tests/t0910-type-dos.sh | 69 +++ + tests/t0911-type-dos-invalid.sh | 35 ++ + tests/t2400-dos-hfs-partition-type.sh | 2 +- + tests/t3300-palo-prep.sh | 8 +- + tests/t3310-flags.sh | 4 + + 19 files changed, 825 insertions(+), 343 deletions(-) + create mode 100755 tests/t0900-type-gpt.sh + create mode 100755 tests/t0901-type-gpt-invalid.sh + create mode 100755 tests/t0910-type-dos.sh + create mode 100755 tests/t0911-type-dos-invalid.sh + +diff --git a/NEWS b/NEWS +index 2bd161f..099f8bd 100644 +--- a/NEWS ++++ b/NEWS +@@ -2,6 +2,9 @@ GNU parted NEWS -*- outline -*- + + * Noteworthy changes in release ?.? (????-??-??) [?] + ++** New Features ++ ++ Add type commands to set type-id on MS-DOS and type-uuid on GPT. + + * Noteworthy changes in release 3.5 (2022-04-18) [stable] + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 7895440..ab34be7 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -134,6 +134,11 @@ human-friendly form for output). + .B toggle \fIpartition\fP \fIflag\fP + Toggle the state of \fIflag\fP on \fIpartition\fP. + .TP ++.B type \fIpartition\fP \fIid\fP or \fIuuid\fP ++On MS-DOS set the type aka. partition id of \fIpartition\fP to ++\fIid\fP. The \fIid\fP is a value between "0x01" and "0xff". On GPT ++the type-uuid of \fIpartition\fP to \fIuuid\fP. ++.TP + .B disk_set \fIflag\fP \fIstate\fP + Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off". + Some or all of these flags will be available, depending on what disk label you +diff --git a/doc/parted.texi b/doc/parted.texi +index 8a3978a..9c9d282 100644 +--- a/doc/parted.texi ++++ b/doc/parted.texi +@@ -466,6 +466,7 @@ GNU Parted provides the following commands: + * select:: + * set:: + * toggle:: ++* type:: + * unit:: + @end menu + +@@ -1034,6 +1035,25 @@ Toggle the state of @var{flag} on partition @var{number}. + + @end deffn + ++@node type ++@subsection type ++@cindex type, command description ++@cindex command description, type ++ ++@deffn Command type @var{number} @var{id} or @var{uuid} ++ ++On MS-DOS set the type-id aka partition id to @var{id} on partition ++@var{number}. The id is a value between 0x01 and 0xff, e.g. the ID for ++Linux is 0x83. A list with some IDs is available at ++@uref{https://en.wikipedia.org/wiki/Partition_type}. ++ ++On GPT set the type-uuid to @var{uuid} on partition ++@var{number}. E.g. the UUID for Linux is ++0fc63daf-8483-4772-8e79-3d69d8477de4. A list with some UUIDs is availabe ++at @uref{https://en.wikipedia.org/wiki/GUID_Partition_Table}. ++ ++@end deffn ++ + @node unit + @subsection unit + @cindex unit, command description +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index 38e869d..672c4ee 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -32,6 +32,7 @@ + */ + #include + #include ++#include + + /** + * Disk flags +@@ -91,11 +92,13 @@ enum _PedPartitionFlag { + #define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME + + enum _PedDiskTypeFeature { +- PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */ ++ PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ ++ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ ++ PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ ++ PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ + }; + #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED +-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME ++#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID + + struct _PedDisk; + struct _PedPartition; +@@ -247,6 +250,13 @@ struct _PedDiskOps { + PedPartitionFlag flag); + void (*partition_set_name) (PedPartition* part, const char* name); + const char* (*partition_get_name) (const PedPartition* part); ++ ++ int (*partition_set_type_id) (PedPartition* part, uint8_t id); ++ uint8_t (*partition_get_type_id) (const PedPartition* part); ++ ++ int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid); ++ uint8_t* (*partition_get_type_uuid) (const PedPartition* part); ++ + int (*partition_align) (PedPartition* part, + const PedConstraint* constraint); + int (*partition_enumerate) (PedPartition* part); +@@ -347,6 +357,13 @@ extern int ped_partition_set_system (PedPartition* part, + const PedFileSystemType* fs_type); + extern int ped_partition_set_name (PedPartition* part, const char* name); + extern const char* ped_partition_get_name (const PedPartition* part); ++ ++extern int ped_partition_set_type_id (PedPartition* part, uint8_t id); ++extern uint8_t ped_partition_get_type_id (const PedPartition* part); ++ ++extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid); ++extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part); ++ + extern int ped_partition_is_busy (const PedPartition* part); + extern char* ped_partition_get_path (const PedPartition* part); + +diff --git a/libparted/disk.c b/libparted/disk.c +index 3bf7634..22dff36 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -1458,6 +1458,36 @@ _assert_partition_name_feature (const PedDiskType* disk_type) + return 1; + } + ++static int ++_assert_partition_type_id_feature (const PedDiskType* disk_type) ++{ ++ if (!ped_disk_type_check_feature ( ++ disk_type, PED_DISK_TYPE_PARTITION_TYPE_ID)) { ++ ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_CANCEL, ++ "%s disk labels do not support partition type-ids.", ++ disk_type->name); ++ return 0; ++ } ++ return 1; ++} ++ ++static int ++_assert_partition_type_uuid_feature (const PedDiskType* disk_type) ++{ ++ if (!ped_disk_type_check_feature ( ++ disk_type, PED_DISK_TYPE_PARTITION_TYPE_UUID)) { ++ ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_CANCEL, ++ "%s disk labels do not support partition type-uuids.", ++ disk_type->name); ++ return 0; ++ } ++ return 1; ++} ++ + /** + * Sets the name of a partition. + * +@@ -1510,6 +1540,78 @@ ped_partition_get_name (const PedPartition* part) + return part->disk->type->ops->partition_get_name (part); + } + ++/** ++ * Set the type-id of the partition \p part. This will only work if the disk label ++ * supports it. ++ */ ++int ++ped_partition_set_type_id (PedPartition *part, uint8_t id) ++{ ++ PED_ASSERT (part != NULL); ++ PED_ASSERT (part->disk != NULL); ++ PED_ASSERT (ped_partition_is_active (part)); ++ ++ if (!_assert_partition_type_id_feature (part->disk->type)) ++ return 0; ++ ++ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); ++ return part->disk->type->ops->partition_set_type_id (part, id); ++} ++ ++/** ++ * Get the type-id of the partition \p part. This will only work if the disk label ++ * supports it. ++ */ ++uint8_t ++ped_partition_get_type_id (const PedPartition *part) ++{ ++ PED_ASSERT (part != NULL); ++ PED_ASSERT (part->disk != NULL); ++ PED_ASSERT (ped_partition_is_active (part)); ++ ++ if (!_assert_partition_type_id_feature (part->disk->type)) ++ return 0; ++ ++ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); ++ return part->disk->type->ops->partition_get_type_id (part); ++} ++ ++/** ++ * Set the type-uuid of the partition \p part. This will only work if the disk label ++ * supports it. ++ */ ++int ++ped_partition_set_type_uuid (PedPartition *part, const uint8_t* uuid) ++{ ++ PED_ASSERT (part != NULL); ++ PED_ASSERT (part->disk != NULL); ++ PED_ASSERT (ped_partition_is_active (part)); ++ ++ if (!_assert_partition_type_uuid_feature (part->disk->type)) ++ return 0; ++ ++ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); ++ return part->disk->type->ops->partition_set_type_uuid (part, uuid); ++} ++ ++/** ++ * Get the type-uuid of the partition \p part. This will only work if the disk label ++ * supports it. ++ */ ++uint8_t* ++ped_partition_get_type_uuid (const PedPartition *part) ++{ ++ PED_ASSERT (part != NULL); ++ PED_ASSERT (part->disk != NULL); ++ PED_ASSERT (ped_partition_is_active (part)); ++ ++ if (!_assert_partition_type_uuid_feature (part->disk->type)) ++ return NULL; ++ ++ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); ++ return part->disk->type->ops->partition_get_type_uuid (part); ++} ++ + /** @} */ + + /** +diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c +index 38f2b00..0c00c4f 100644 +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -117,6 +117,10 @@ static PedDiskOps dasd_disk_ops = { + + partition_set_name: NULL, + partition_get_name: NULL, ++ partition_set_type_id: NULL, ++ partition_get_type_id: NULL, ++ partition_set_type_uuid: NULL, ++ partition_get_type_uuid: NULL, + + get_partition_alignment: dasd_get_partition_alignment, + +diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c +index 26d8804..bd7465d 100644 +--- a/libparted/labels/dos.c ++++ b/libparted/labels/dos.c +@@ -100,6 +100,209 @@ static const char MBR_BOOT_CODE[] = { + #define PARTITION_LINUX_RAID 0xfd + #define PARTITION_LINUX_LVM_OLD 0xfe + ++struct flag_id_mapping_t ++{ ++ enum _PedPartitionFlag flag; ++ unsigned char type_id; ++ unsigned char alt_type_id; ++}; ++ ++static const struct flag_id_mapping_t flag_id_mapping[] = ++{ ++ { PED_PARTITION_BLS_BOOT, PARTITION_BLS_BOOT }, ++ { PED_PARTITION_DIAG, PARTITION_COMPAQ_DIAG, PARTITION_DELL_DIAG }, ++ { PED_PARTITION_ESP, PARTITION_ESP }, ++ { PED_PARTITION_IRST, PARTITION_IRST }, ++ { PED_PARTITION_LVM, PARTITION_LINUX_LVM, PARTITION_LINUX_LVM_OLD }, ++ { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RECOVERY }, ++ { PED_PARTITION_PALO, PARTITION_PALO }, ++ { PED_PARTITION_PREP, PARTITION_PREP }, ++ { PED_PARTITION_RAID, PARTITION_LINUX_RAID }, ++ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, ++}; ++ ++static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST ++dos_find_flag_id_mapping (PedPartitionFlag flag) ++{ ++ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]); ++ ++ for (int i = 0; i < n; ++i) ++ if (flag_id_mapping[i].flag == flag) ++ return &flag_id_mapping[i]; ++ ++ return NULL; ++} ++ ++/** ++ * Check whether the type_id supports the hidden flag. Returns true for both hidden and ++ * non-hidden id. ++ */ ++static bool ++dos_type_id_supports_hidden(unsigned char type_id) ++{ ++ switch (type_id) ++ { ++ case PARTITION_DOS_EXT: ++ case PARTITION_DOS_EXT_H: ++ case PARTITION_FAT12: ++ case PARTITION_FAT12_H: ++ case PARTITION_FAT16: ++ case PARTITION_FAT16_H: ++ case PARTITION_FAT16_LBA: ++ case PARTITION_FAT16_LBA_H: ++ case PARTITION_FAT16_SM: ++ case PARTITION_FAT16_SM_H: ++ case PARTITION_FAT32: ++ case PARTITION_FAT32_H: ++ case PARTITION_FAT32_LBA: ++ case PARTITION_FAT32_LBA_H: ++ case PARTITION_NTFS: ++ case PARTITION_NTFS_H: ++ return true; ++ ++ default: ++ return false; ++ } ++} ++ ++/** ++ * Check whether the type_id has the hidden flag set. ++ */ ++static bool ++dos_type_id_is_hidden(unsigned char type_id) ++{ ++ switch (type_id) ++ { ++ case PARTITION_DOS_EXT_H: ++ case PARTITION_FAT12_H: ++ case PARTITION_FAT16_H: ++ case PARTITION_FAT16_LBA_H: ++ case PARTITION_FAT16_SM_H: ++ case PARTITION_FAT32_H: ++ case PARTITION_FAT32_LBA_H: ++ case PARTITION_NTFS_H: ++ return true; ++ ++ default: ++ return false; ++ } ++} ++ ++/** ++ * Sets the hidden flag on type_id. ++ */ ++static bool ++dos_type_id_set_hidden(unsigned char* type_id, bool state) ++{ ++ PED_ASSERT (type_id); ++ ++ if (!dos_type_id_supports_hidden(*type_id)) ++ return false; ++ ++ if (state) ++ *type_id |= PART_FLAG_HIDDEN; ++ else ++ *type_id &= ~PART_FLAG_HIDDEN; ++ ++ return 1; ++} ++ ++/** ++ * Check whether the type_id supports the lba flag. Returns true for both lba and non-lba ++ * id. ++ */ ++static bool ++dos_type_id_supports_lba(unsigned char type_id) ++{ ++ switch (type_id) ++ { ++ case PARTITION_FAT16: ++ case PARTITION_FAT16_H: ++ case PARTITION_FAT16_LBA: ++ case PARTITION_FAT16_LBA_H: ++ case PARTITION_FAT32: ++ case PARTITION_FAT32_H: ++ case PARTITION_FAT32_LBA: ++ case PARTITION_FAT32_LBA_H: ++ case PARTITION_DOS_EXT: ++ case PARTITION_EXT_LBA: ++ return true; ++ ++ default: ++ return false; ++ } ++} ++ ++/** ++ * Check whether the type_id has the lba flag set. ++ */ ++static bool ++dos_type_id_is_lba(unsigned char type_id) ++{ ++ switch (type_id) ++ { ++ case PARTITION_FAT16_LBA: ++ case PARTITION_FAT16_LBA_H: ++ case PARTITION_FAT32_LBA: ++ case PARTITION_FAT32_LBA_H: ++ case PARTITION_EXT_LBA: ++ return true; ++ ++ default: ++ return false; ++ } ++} ++ ++/** ++ * Sets the lba flag on type_id. ++ */ ++static bool ++dos_type_id_set_lba(unsigned char* type_id, bool state) ++{ ++ PED_ASSERT (type_id); ++ ++ if (!dos_type_id_supports_lba(*type_id)) ++ return false; ++ ++ if (state) ++ { ++ switch (*type_id) ++ { ++ case PARTITION_FAT16: ++ *type_id = PARTITION_FAT16_LBA; ++ break; ++ ++ case PARTITION_FAT32: ++ *type_id = PARTITION_FAT32_LBA; ++ break; ++ ++ case PARTITION_DOS_EXT: ++ *type_id = PARTITION_EXT_LBA; ++ break; ++ } ++ } ++ else ++ { ++ switch (*type_id) ++ { ++ case PARTITION_FAT16_LBA: ++ *type_id = PARTITION_FAT16; ++ break; ++ ++ case PARTITION_FAT32_LBA: ++ *type_id = PARTITION_FAT32; ++ break; ++ ++ case PARTITION_EXT_LBA: ++ *type_id = PARTITION_DOS_EXT; ++ break; ++ } ++ } ++ ++ return true; ++} ++ ++ + /* This constant contains the maximum cylinder number that can be represented + * in (C,H,S) notation. Higher cylinder numbers are reserved for + * "too big" indicators (in which case only LBA addressing can be used). +@@ -156,18 +359,6 @@ typedef struct { + typedef struct { + unsigned char system; + int boot; +- int hidden; +- int msftres; +- int raid; +- int lvm; +- int swap; +- int lba; +- int palo; +- int prep; +- int diag; +- int irst; +- int esp; +- int bls_boot; + OrigState* orig; /* used for CHS stuff */ + } DosPartitionData; + +@@ -891,48 +1082,6 @@ raw_part_is_extended (const DosRawPartition* raw_part) + return 0; + } + +-static int _GL_ATTRIBUTE_PURE +-raw_part_is_hidden (const DosRawPartition* raw_part) +-{ +- PED_ASSERT (raw_part != NULL); +- +- switch (raw_part->type) { +- case PARTITION_FAT12_H: +- case PARTITION_FAT16_SM_H: +- case PARTITION_FAT16_H: +- case PARTITION_FAT32_H: +- case PARTITION_NTFS_H: +- case PARTITION_FAT32_LBA_H: +- case PARTITION_FAT16_LBA_H: +- return 1; +- +- default: +- return 0; +- } +- +- return 0; +-} +- +-static int _GL_ATTRIBUTE_PURE +-raw_part_is_lba (const DosRawPartition* raw_part) +-{ +- PED_ASSERT (raw_part != NULL); +- +- switch (raw_part->type) { +- case PARTITION_FAT32_LBA: +- case PARTITION_FAT16_LBA: +- case PARTITION_EXT_LBA: +- case PARTITION_FAT32_LBA_H: +- case PARTITION_FAT16_LBA_H: +- return 1; +- +- default: +- return 0; +- } +- +- return 0; +-} +- + static PedPartition* + raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, + PedSector lba_offset, PedPartitionType type) +@@ -952,20 +1101,6 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, + dos_data = part->disk_specific; + dos_data->system = raw_part->type; + dos_data->boot = raw_part->boot_ind != 0; +- dos_data->diag = raw_part->type == PARTITION_COMPAQ_DIAG || +- raw_part->type == PARTITION_DELL_DIAG; +- dos_data->msftres = raw_part->type == PARTITION_MSFT_RECOVERY; +- dos_data->hidden = raw_part_is_hidden (raw_part); +- dos_data->raid = raw_part->type == PARTITION_LINUX_RAID; +- dos_data->lvm = raw_part->type == PARTITION_LINUX_LVM_OLD +- || raw_part->type == PARTITION_LINUX_LVM; +- dos_data->swap = raw_part->type == PARTITION_LINUX_SWAP; +- dos_data->lba = raw_part_is_lba (raw_part); +- dos_data->palo = raw_part->type == PARTITION_PALO; +- dos_data->prep = raw_part->type == PARTITION_PREP; +- dos_data->irst = raw_part->type == PARTITION_IRST; +- dos_data->esp = raw_part->type == PARTITION_ESP; +- dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT; + dos_data->orig = ped_malloc (sizeof (OrigState)); + if (!dos_data->orig) { + ped_partition_destroy (part); +@@ -1377,18 +1512,6 @@ msdos_partition_duplicate (const PedPartition* part) + new_dos_data = (DosPartitionData*) new_part->disk_specific; + new_dos_data->system = old_dos_data->system; + new_dos_data->boot = old_dos_data->boot; +- new_dos_data->diag = old_dos_data->diag; +- new_dos_data->hidden = old_dos_data->hidden; +- new_dos_data->msftres = old_dos_data->msftres; +- new_dos_data->raid = old_dos_data->raid; +- new_dos_data->lvm = old_dos_data->lvm; +- new_dos_data->swap = old_dos_data->swap; +- new_dos_data->lba = old_dos_data->lba; +- new_dos_data->palo = old_dos_data->palo; +- new_dos_data->prep = old_dos_data->prep; +- new_dos_data->irst = old_dos_data->irst; +- new_dos_data->esp = old_dos_data->esp; +- new_dos_data->bls_boot = old_dos_data->bls_boot; + + if (old_dos_data->orig) { + new_dos_data->orig = ped_malloc (sizeof (OrigState)); +@@ -1425,234 +1548,87 @@ msdos_partition_set_system (PedPartition* part, + + part->fs_type = fs_type; + +- if (dos_data->hidden +- && fs_type +- && strncmp (fs_type->name, "fat", 3) != 0 +- && strcmp (fs_type->name, "ntfs") != 0) +- dos_data->hidden = 0; +- +- if (dos_data->msftres +- && fs_type +- && strcmp (fs_type->name, "ntfs") != 0) +- dos_data->msftres = 0; +- + if (part->type & PED_PARTITION_EXTENDED) { +- dos_data->diag = 0; +- dos_data->raid = 0; +- dos_data->lvm = 0; +- dos_data->swap = 0; +- dos_data->palo = 0; +- dos_data->prep = 0; +- dos_data->irst = 0; +- dos_data->esp = 0; +- if (dos_data->lba) +- dos_data->system = PARTITION_EXT_LBA; +- else +- dos_data->system = PARTITION_DOS_EXT; +- return 1; +- } +- +- if (dos_data->diag) { +- /* Don't change the system if it already is a diag type, +- otherwise use Compaq as almost all vendors use that. */ +- if (dos_data->system != PARTITION_COMPAQ_DIAG && +- dos_data->system != PARTITION_DELL_DIAG) +- dos_data->system = PARTITION_COMPAQ_DIAG; +- return 1; +- } +- if (dos_data->msftres) { +- dos_data->system = PARTITION_MSFT_RECOVERY; +- return 1; +- } +- if (dos_data->lvm) { +- dos_data->system = PARTITION_LINUX_LVM; +- return 1; +- } +- if (dos_data->swap) { +- dos_data->system = PARTITION_LINUX_SWAP; +- return 1; +- } +- if (dos_data->raid) { +- dos_data->system = PARTITION_LINUX_RAID; +- return 1; +- } +- if (dos_data->palo) { +- dos_data->system = PARTITION_PALO; +- return 1; +- } +- if (dos_data->prep) { +- dos_data->system = PARTITION_PREP; +- return 1; +- } +- if (dos_data->irst) { +- dos_data->system = PARTITION_IRST; +- return 1; +- } +- if (dos_data->esp) { +- dos_data->system = PARTITION_ESP; +- return 1; +- } +- if (dos_data->bls_boot) { +- dos_data->system = PARTITION_BLS_BOOT; ++ dos_data->system = PARTITION_EXT_LBA; + return 1; + } + + if (!fs_type) + dos_data->system = PARTITION_LINUX; +- else if (!strcmp (fs_type->name, "fat16")) { +- dos_data->system = dos_data->lba +- ? PARTITION_FAT16_LBA : PARTITION_FAT16; +- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; +- } else if (!strcmp (fs_type->name, "fat32")) { +- dos_data->system = dos_data->lba +- ? PARTITION_FAT32_LBA : PARTITION_FAT32; +- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; +- } else if (!strcmp (fs_type->name, "ntfs") +- || !strcmp (fs_type->name, "hpfs")) { ++ else if (!strcmp (fs_type->name, "fat16")) ++ dos_data->system = PARTITION_FAT16; ++ else if (!strcmp (fs_type->name, "fat32")) ++ dos_data->system = PARTITION_FAT32; ++ else if (!strcmp (fs_type->name, "ntfs") ++ || !strcmp (fs_type->name, "hpfs")) + dos_data->system = PARTITION_NTFS; +- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; +- } else if (!strcmp (fs_type->name, "hfs") ++ else if (!strcmp (fs_type->name, "hfs") + || !strcmp (fs_type->name, "hfs+")) + dos_data->system = PARTITION_HFS; + else if (!strcmp (fs_type->name, "udf")) + dos_data->system = PARTITION_UDF; + else if (!strcmp (fs_type->name, "sun-ufs")) + dos_data->system = PARTITION_SUN_UFS; +- else if (is_linux_swap (fs_type->name)) { ++ else if (is_linux_swap (fs_type->name)) + dos_data->system = PARTITION_LINUX_SWAP; +- dos_data->swap = 1; +- } else ++ else + dos_data->system = PARTITION_LINUX; + + return 1; + } + +-static void +-clear_flags (DosPartitionData *dos_data) +-{ +- dos_data->diag = 0; +- dos_data->hidden = 0; +- dos_data->msftres = 0; +- dos_data->lvm = 0; +- dos_data->swap = 0; +- dos_data->palo = 0; +- dos_data->prep = 0; +- dos_data->irst = 0; +- dos_data->esp = 0; +- dos_data->raid = 0; +- dos_data->bls_boot = 0; +-} +- + static int + msdos_partition_set_flag (PedPartition* part, + PedPartitionFlag flag, int state) + { +- PedDisk* disk; +- PedPartition* walk; +- DosPartitionData* dos_data; +- + PED_ASSERT (part != NULL); + PED_ASSERT (part->disk_specific != NULL); + PED_ASSERT (part->disk != NULL); + +- dos_data = part->disk_specific; +- disk = part->disk; +- +- switch (flag) { +- case PED_PARTITION_HIDDEN: +- if (part->type == PED_PARTITION_EXTENDED) { +- ped_exception_throw ( +- PED_EXCEPTION_ERROR, +- PED_EXCEPTION_CANCEL, +- _("Extended partitions cannot be hidden on " +- "msdos disk labels.")); +- return 0; +- } +- dos_data->hidden = state; +- return ped_partition_set_system (part, part->fs_type); +- +- case PED_PARTITION_MSFT_RESERVED: +- if (part->type == PED_PARTITION_EXTENDED) { +- ped_exception_throw ( +- PED_EXCEPTION_ERROR, +- PED_EXCEPTION_CANCEL, +- _("Extended partitions cannot be recovery partitions on " +- "msdos disk labels.")); +- return 0; +- } +- dos_data->msftres = state; +- return ped_partition_set_system (part, part->fs_type); +- +- case PED_PARTITION_BOOT: +- dos_data->boot = state; +- if (!state) +- return 1; +- +- walk = ped_disk_next_partition (disk, NULL); +- for (; walk; walk = ped_disk_next_partition (disk, walk)) { +- if (walk == part || !ped_partition_is_active (walk)) +- continue; +- msdos_partition_set_flag (walk, PED_PARTITION_BOOT, 0); +- } +- return 1; ++ DosPartitionData* dos_data = part->disk_specific; + +- case PED_PARTITION_DIAG: +- if (state) +- clear_flags (dos_data); +- dos_data->diag = state; +- return ped_partition_set_system (part, part->fs_type); ++ const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); ++ if (p) ++ { ++ if (part->type & PED_PARTITION_EXTENDED) ++ return 0; + +- case PED_PARTITION_RAID: +- if (state) +- clear_flags (dos_data); +- dos_data->raid = state; ++ if (state) ++ dos_data->system = p->type_id; ++ else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) + return ped_partition_set_system (part, part->fs_type); + +- case PED_PARTITION_LVM: +- if (state) +- clear_flags (dos_data); +- dos_data->lvm = state; +- return ped_partition_set_system (part, part->fs_type); ++ return 1; ++ } + +- case PED_PARTITION_SWAP: +- if (state) +- clear_flags (dos_data); +- dos_data->swap = state; +- return ped_partition_set_system (part, part->fs_type); ++ switch (flag) { ++ case PED_PARTITION_HIDDEN: ++ { ++ return dos_type_id_set_hidden(&dos_data->system, state); ++ } + + case PED_PARTITION_LBA: +- dos_data->lba = state; +- return ped_partition_set_system (part, part->fs_type); +- +- case PED_PARTITION_PALO: +- if (state) +- clear_flags (dos_data); +- dos_data->palo = state; +- return ped_partition_set_system (part, part->fs_type); +- +- case PED_PARTITION_PREP: +- if (state) +- clear_flags (dos_data); +- dos_data->prep = state; +- return ped_partition_set_system (part, part->fs_type); ++ { ++ return dos_type_id_set_lba(&dos_data->system, state); ++ } + +- case PED_PARTITION_IRST: +- if (state) +- clear_flags (dos_data); +- dos_data->irst = state; +- return ped_partition_set_system (part, part->fs_type); ++ case PED_PARTITION_BOOT: ++ { ++ dos_data->boot = state; + +- case PED_PARTITION_ESP: + if (state) +- clear_flags (dos_data); +- dos_data->esp = state; +- return ped_partition_set_system (part, part->fs_type); ++ { ++ PedDisk* disk = part->disk; ++ PedPartition* walk = ped_disk_next_partition (disk, NULL); ++ for (; walk; walk = ped_disk_next_partition (disk, walk)) { ++ if (walk == part || !ped_partition_is_active (walk)) ++ continue; ++ msdos_partition_set_flag (walk, PED_PARTITION_BOOT, 0); ++ } ++ } + +- case PED_PARTITION_BLS_BOOT: +- if (state) +- clear_flags (dos_data); +- dos_data->bls_boot = state; +- return ped_partition_set_system (part, part->fs_type); ++ return 1; ++ } + + default: + return 0; +@@ -1662,58 +1638,25 @@ msdos_partition_set_flag (PedPartition* part, + static int _GL_ATTRIBUTE_PURE + msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) + { +- DosPartitionData* dos_data; +- + PED_ASSERT (part != NULL); + PED_ASSERT (part->disk_specific != NULL); + +- dos_data = part->disk_specific; ++ DosPartitionData* dos_data = part->disk_specific; ++ ++ const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); ++ if (p) ++ return dos_data->system == p->type_id || dos_data->system == p->alt_type_id; ++ + switch (flag) { + case PED_PARTITION_HIDDEN: +- if (part->type == PED_PARTITION_EXTENDED) +- return 0; +- else +- return dos_data->hidden; ++ return dos_type_id_is_hidden(dos_data->system); + +- case PED_PARTITION_MSFT_RESERVED: +- if (part->type == PED_PARTITION_EXTENDED) +- return 0; +- else +- return dos_data->msftres; ++ case PED_PARTITION_LBA: ++ return dos_type_id_is_lba(dos_data->system); + + case PED_PARTITION_BOOT: + return dos_data->boot; + +- case PED_PARTITION_DIAG: +- return dos_data->diag; +- +- case PED_PARTITION_RAID: +- return dos_data->raid; +- +- case PED_PARTITION_LVM: +- return dos_data->lvm; +- +- case PED_PARTITION_SWAP: +- return dos_data->swap; +- +- case PED_PARTITION_LBA: +- return dos_data->lba; +- +- case PED_PARTITION_PALO: +- return dos_data->palo; +- +- case PED_PARTITION_PREP: +- return dos_data->prep; +- +- case PED_PARTITION_IRST: +- return dos_data->irst; +- +- case PED_PARTITION_ESP: +- return dos_data->esp; +- +- case PED_PARTITION_BLS_BOOT: +- return dos_data->bls_boot; +- + default: + return 0; + } +@@ -1723,30 +1666,19 @@ static int + msdos_partition_is_flag_available (const PedPartition* part, + PedPartitionFlag flag) + { ++ if (dos_find_flag_id_mapping (flag)) ++ return part->type != PED_PARTITION_EXTENDED; ++ ++ DosPartitionData* dos_data = part->disk_specific; ++ + switch (flag) { + case PED_PARTITION_HIDDEN: +- if (part->type == PED_PARTITION_EXTENDED) +- return 0; +- else +- return 1; ++ return dos_type_id_supports_hidden(dos_data->system); + +- case PED_PARTITION_MSFT_RESERVED: +- if (part->type == PED_PARTITION_EXTENDED) +- return 0; +- else +- return 1; ++ case PED_PARTITION_LBA: ++ return dos_type_id_supports_lba(dos_data->system); + + case PED_PARTITION_BOOT: +- case PED_PARTITION_RAID: +- case PED_PARTITION_LVM: +- case PED_PARTITION_SWAP: +- case PED_PARTITION_LBA: +- case PED_PARTITION_PALO: +- case PED_PARTITION_PREP: +- case PED_PARTITION_IRST: +- case PED_PARTITION_ESP: +- case PED_PARTITION_BLS_BOOT: +- case PED_PARTITION_DIAG: + return 1; + + default: +@@ -1754,6 +1686,27 @@ msdos_partition_is_flag_available (const PedPartition* part, + } + } + ++ ++int ++msdos_partition_set_type_id (PedPartition* part, uint8_t id) ++{ ++ DosPartitionData* dos_data = part->disk_specific; ++ ++ dos_data->system = id; ++ ++ return 1; ++} ++ ++ ++uint8_t _GL_ATTRIBUTE_PURE ++msdos_partition_get_type_id (const PedPartition* part) ++{ ++ const DosPartitionData* dos_data = part->disk_specific; ++ ++ return dos_data->system; ++} ++ ++ + static PedGeometry* + _try_constraint (const PedPartition* part, const PedConstraint* external, + PedConstraint* internal) +@@ -2590,6 +2543,10 @@ static PedDiskOps msdos_disk_ops = { + + partition_set_name: NULL, + partition_get_name: NULL, ++ partition_set_type_id: msdos_partition_set_type_id, ++ partition_get_type_id: msdos_partition_get_type_id, ++ partition_set_type_uuid: NULL, ++ partition_get_type_uuid: NULL, + + PT_op_function_initializers (msdos) + }; +@@ -2598,7 +2555,7 @@ static PedDiskType msdos_disk_type = { + next: NULL, + name: "msdos", + ops: &msdos_disk_ops, +- features: PED_DISK_TYPE_EXTENDED ++ features: PED_DISK_TYPE_EXTENDED | PED_DISK_TYPE_PARTITION_TYPE_ID + }; + + void +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 037d021..0e9e060 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -1686,6 +1686,44 @@ gpt_partition_get_name (const PedPartition *part) + return gpt_part_data->translated_name; + } + ++ ++static int ++gpt_partition_set_type_uuid (PedPartition *part, const uint8_t *uuid) ++{ ++ GPTPartitionData *gpt_part_data = part->disk_specific; ++ ++ efi_guid_t* type_uuid = &gpt_part_data->type; ++ memcpy(type_uuid, uuid, sizeof (efi_guid_t)); ++ ++ /* type_uuid is always LE, while uint8_t is always kind of BE */ ++ ++ type_uuid->time_low = PED_SWAP32(type_uuid->time_low); ++ type_uuid->time_mid = PED_SWAP16(type_uuid->time_mid); ++ type_uuid->time_hi_and_version = PED_SWAP16(type_uuid->time_hi_and_version); ++ ++ return 1; ++} ++ ++ ++static uint8_t* ++gpt_partition_get_type_uuid (const PedPartition *part) ++{ ++ const GPTPartitionData *gpt_part_data = part->disk_specific; ++ ++ efi_guid_t type_uuid = gpt_part_data->type; ++ ++ /* type_uuid is always LE, while uint8_t is always kind of BE */ ++ ++ type_uuid.time_low = PED_SWAP32(type_uuid.time_low); ++ type_uuid.time_mid = PED_SWAP16(type_uuid.time_mid); ++ type_uuid.time_hi_and_version = PED_SWAP16(type_uuid.time_hi_and_version); ++ ++ uint8_t *buf = ped_malloc(sizeof (uuid_t)); ++ memcpy(buf, &type_uuid, sizeof (uuid_t)); ++ return buf; ++} ++ ++ + static int + gpt_get_max_primary_partition_count (const PedDisk *disk) + { +@@ -1781,6 +1819,10 @@ static PedDiskOps gpt_disk_ops = + + partition_set_name: gpt_partition_set_name, + partition_get_name: gpt_partition_get_name, ++ partition_set_type_id: NULL, ++ partition_get_type_id: NULL, ++ partition_set_type_uuid: gpt_partition_set_type_uuid, ++ partition_get_type_uuid: gpt_partition_get_type_uuid, + disk_set_flag: gpt_disk_set_flag, + disk_get_flag: gpt_disk_get_flag, + disk_is_flag_available: gpt_disk_is_flag_available, +@@ -1793,7 +1835,7 @@ static PedDiskType gpt_disk_type = + next: NULL, + name: "gpt", + ops: &gpt_disk_ops, +- features: PED_DISK_TYPE_PARTITION_NAME ++ features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID + }; + + void +diff --git a/parted/parted.c b/parted/parted.c +index 5c7c270..b8a4acf 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -19,6 +19,7 @@ + + #include + #include ++#include + + #include "argmatch.h" + #include "closeout.h" +@@ -174,6 +175,8 @@ static const char* end_msg = N_("END is disk location, such as " + static const char* state_msg = N_("STATE is one of: on, off\n"); + static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n"); + static const char* name_msg = N_("NAME is any word you want\n"); ++static const char* type_msg = N_("TYPE_ID is a value between 0x01 and 0xff, " ++ "TYPE_UUID is a UUID\n"); + + static const char* copyright_msg = N_( + "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n" +@@ -917,6 +920,87 @@ error: + return 0; + } + ++static int ++do_type (PedDevice** dev, PedDisk** diskp) ++{ ++ if (!*diskp) ++ *diskp = ped_disk_new (*dev); ++ if (!*diskp) ++ goto error; ++ ++ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type, ++ PED_DISK_TYPE_PARTITION_TYPE_ID); ++ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, ++ PED_DISK_TYPE_PARTITION_TYPE_UUID); ++ ++ PED_ASSERT (!(has_type_id && has_type_uuid)); ++ ++ if (!has_type_id && !has_type_uuid) { ++ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, ++ _("%s disk labels do not support partition type."), ++ (*diskp)->type->name); ++ goto error; ++ } ++ ++ PedPartition* part = NULL; ++ if (!command_line_get_partition (_("Partition number?"), *diskp, &part)) ++ goto error; ++ ++ char* input = NULL; ++ ++ if (has_type_id) { ++ uint8_t type_id = ped_partition_get_type_id (part); ++ static char buf[8]; ++ snprintf(buf, 8, "0x%02x", type_id); ++ ++ input = command_line_get_word (_("Partition type-id?"), buf, NULL, 0); ++ if (!input) ++ goto error; ++ ++ unsigned int tmp = strtol (input, (char**) NULL, 16); ++ if (tmp < 0x01 || tmp > 0xff) { ++ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, ++ _("Invalid type-id.")); ++ goto error_free_input; ++ } ++ ++ if (!ped_partition_set_type_id (part, tmp)) ++ goto error_free_input; ++ } ++ ++ if (has_type_uuid) { ++ uint8_t* type_uuid = ped_partition_get_type_uuid (part); ++ static char buf[UUID_STR_LEN]; ++ uuid_unparse_lower (type_uuid, buf); ++ free (type_uuid); ++ ++ input = command_line_get_word (_("Partition type-uuid?"), buf, NULL, 0); ++ if (!input) ++ goto error; ++ ++ uuid_t tmp; ++ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) { ++ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, ++ _("Invalid type-uuid.")); ++ goto error_free_input; ++ } ++ ++ if (!ped_partition_set_type_uuid (part, tmp)) ++ goto error_free_input; ++ } ++ ++ free (input); ++ ++ if (!ped_disk_commit (*diskp)) ++ goto error; ++ return 1; ++ ++error_free_input: ++ free (input); ++error: ++ return 0; ++} ++ + static char* + partition_print_flags (PedPartition const *part) + { +@@ -1270,6 +1354,10 @@ do_print (PedDevice** dev, PedDisk** diskp) + PED_DISK_TYPE_EXTENDED); + has_name = ped_disk_type_check_feature ((*diskp)->type, + PED_DISK_TYPE_PARTITION_NAME); ++ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type, ++ PED_DISK_TYPE_PARTITION_TYPE_ID); ++ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, ++ PED_DISK_TYPE_PARTITION_TYPE_UUID); + + PedPartition* part; + if (opt_output_mode == HUMAN) { +@@ -1407,10 +1495,25 @@ do_print (PedDevice** dev, PedDisk** diskp) + + if (!(part->type & PED_PARTITION_FREESPACE)) { + ++ if (has_type_id) { ++ uint8_t type_id = ped_partition_get_type_id (part); ++ static char buf[8]; ++ snprintf(buf, 8, "0x%02x", type_id); ++ ul_jsonwrt_value_s (&json, "type-id", buf); ++ } ++ ++ if (has_type_uuid) { ++ uint8_t* type_uuid = ped_partition_get_type_uuid (part); ++ static char buf[UUID_STR_LEN]; ++ uuid_unparse_lower (type_uuid, buf); ++ ul_jsonwrt_value_s (&json, "type-uuid", buf); ++ free (type_uuid); ++ } ++ + if (has_name) { + name = ped_partition_get_name (part); + if (strcmp (name, "") != 0) +- ul_jsonwrt_value_s (&json, "name", ped_partition_get_name (part)); ++ ul_jsonwrt_value_s (&json, "name", name); + } + + if (part->fs_type) +@@ -2316,6 +2419,14 @@ _("toggle [NUMBER [FLAG]] toggle the state of FLAG on " + NULL), + str_list_create (_(number_msg), flag_msg, NULL), 1)); + ++command_register (commands, command_create ( ++ str_list_create_unique ("type", _("type"), NULL), ++ do_type, ++ str_list_create ( ++_("type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER"), ++NULL), ++ str_list_create (_(number_msg), _(type_msg), NULL), 1)); ++ + command_register (commands, command_create ( + str_list_create_unique ("unit", _("unit"), NULL), + do_unit, +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 5cb7aa3..2da653b 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -43,6 +43,10 @@ TESTS = \ + t0501-duplicate.sh \ + t0800-json-gpt.sh \ + t0801-json-msdos.sh \ ++ t0900-type-gpt.sh \ ++ t0901-type-gpt-invalid.sh \ ++ t0910-type-dos.sh \ ++ t0911-type-dos-invalid.sh \ + t1100-busy-label.sh \ + t1101-busy-partition.sh \ + t1102-loop-label.sh \ +diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh +index 8dd1862..354c0bd 100755 +--- a/tests/t0800-json-gpt.sh ++++ b/tests/t0800-json-gpt.sh +@@ -62,6 +62,7 @@ cat < exp || fail=1 + "end": "20479s", + "size": "10240s", + "type": "primary", ++ "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4", + "name": "test1" + },{ + "number": 2, +@@ -69,6 +70,7 @@ cat < exp || fail=1 + "end": "61439s", + "size": "40960s", + "type": "primary", ++ "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e", + "name": "test2", + "flags": [ + "raid" +diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh +index a14a5af..c5446d8 100755 +--- a/tests/t0801-json-msdos.sh ++++ b/tests/t0801-json-msdos.sh +@@ -52,13 +52,15 @@ cat < exp || fail=1 + "start": "5.00MiB", + "end": "10.0MiB", + "size": "5.00MiB", +- "type": "primary" ++ "type": "primary", ++ "type-id": "0x83" + },{ + "number": 2, + "start": "10.0MiB", + "end": "30.0MiB", + "size": "20.0MiB", + "type": "extended", ++ "type-id": "0x0f", + "flags": [ + "lba" + ] +@@ -68,6 +70,7 @@ cat < exp || fail=1 + "end": "20.0MiB", + "size": "10.0MiB", + "type": "logical", ++ "type-id": "0x8e", + "flags": [ + "lvm" + ] +diff --git a/tests/t0900-type-gpt.sh b/tests/t0900-type-gpt.sh +new file mode 100755 +index 0000000..2014820 +--- /dev/null ++++ b/tests/t0900-type-gpt.sh +@@ -0,0 +1,69 @@ ++#!/bin/sh ++ ++# Test type command with GPT label ++ ++# Copyright (C) 2022 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create gpt label and one partition ++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 ++parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 ++ ++# set type-uuid ++parted --script "$dev" type 1 "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" || fail=1 ++ ++# print with json format ++parted --script --json "$dev" unit s print > out 2>&1 || fail=1 ++ ++cat < exp || fail=1 ++{ ++ "disk": { ++ "path": "loop-file", ++ "size": "102400s", ++ "model": "", ++ "transport": "file", ++ "logical-sector-size": 512, ++ "physical-sector-size": 512, ++ "label": "gpt", ++ "max-partitions": 128, ++ "partitions": [ ++ { ++ "number": 1, ++ "start": "10240s", ++ "end": "20479s", ++ "size": "10240s", ++ "type": "primary", ++ "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" ++ } ++ ] ++ } ++} ++EOF ++ ++# remove full path of device from actual output ++mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 ++ ++# check for expected output ++compare exp out || fail=1 ++ ++Exit $fail +diff --git a/tests/t0901-type-gpt-invalid.sh b/tests/t0901-type-gpt-invalid.sh +new file mode 100755 +index 0000000..681df3a +--- /dev/null ++++ b/tests/t0901-type-gpt-invalid.sh +@@ -0,0 +1,35 @@ ++#!/bin/sh ++ ++# Test type command with GPT label ++ ++# Copyright (C) 2022 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create gpt label and one partition ++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 ++parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 ++ ++# set type-uuid ++parted --script "$dev" type 1 "invalidd-a4ab-43c4-84e5-0933c84b4f4f" && fail=1 ++ ++Exit $fail +diff --git a/tests/t0910-type-dos.sh b/tests/t0910-type-dos.sh +new file mode 100755 +index 0000000..d7cc37f +--- /dev/null ++++ b/tests/t0910-type-dos.sh +@@ -0,0 +1,69 @@ ++#!/bin/sh ++ ++# Test type command with MS-DOS label ++ ++# Copyright (C) 2022 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create msdos label and one partition ++parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 ++parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1 ++ ++# set type-id ++parted --script "$dev" type 1 "0x83" || fail=1 ++ ++# print with json format ++parted --script --json "$dev" unit s print > out 2>&1 || fail=1 ++ ++cat < exp || fail=1 ++{ ++ "disk": { ++ "path": "loop-file", ++ "size": "102400s", ++ "model": "", ++ "transport": "file", ++ "logical-sector-size": 512, ++ "physical-sector-size": 512, ++ "label": "msdos", ++ "max-partitions": 4, ++ "partitions": [ ++ { ++ "number": 1, ++ "start": "10240s", ++ "end": "20479s", ++ "size": "10240s", ++ "type": "primary", ++ "type-id": "0x83" ++ } ++ ] ++ } ++} ++EOF ++ ++# remove full path of device from actual output ++mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 ++ ++# check for expected output ++compare exp out || fail=1 ++ ++Exit $fail +diff --git a/tests/t0911-type-dos-invalid.sh b/tests/t0911-type-dos-invalid.sh +new file mode 100755 +index 0000000..f1036d1 +--- /dev/null ++++ b/tests/t0911-type-dos-invalid.sh +@@ -0,0 +1,35 @@ ++#!/bin/sh ++ ++# Test type command with MS-DOS label ++ ++# Copyright (C) 2022 SUSE LLC ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++require_512_byte_sector_size_ ++ ++dev=loop-file ++ ++# create device ++truncate --size 50MiB "$dev" || fail=1 ++ ++# create msdos label and one partition ++parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 ++parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1 ++ ++# set type-id ++parted --script "$dev" type 1 "0x101" && fail=1 ++ ++Exit $fail +diff --git a/tests/t2400-dos-hfs-partition-type.sh b/tests/t2400-dos-hfs-partition-type.sh +index 6733683..8c54ec4 100644 +--- a/tests/t2400-dos-hfs-partition-type.sh ++++ b/tests/t2400-dos-hfs-partition-type.sh +@@ -24,7 +24,7 @@ n_sectors=8000 + + dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure + +-# create a GPT partition table ++# create a MS-DOS partition table + parted -s $dev mklabel msdos \ + mkpart pri hfs 2048s 4095s \ + mkpart pri hfs+ 4096s 6143s > out 2>&1 || fail=1 +diff --git a/tests/t3300-palo-prep.sh b/tests/t3300-palo-prep.sh +index 5005e0e..efe54db 100755 +--- a/tests/t3300-palo-prep.sh ++++ b/tests/t3300-palo-prep.sh +@@ -20,9 +20,9 @@ + ss=$sector_size_ + + cat > exp < out 2> err || fail=1 + +-grep -E '^1:2048s:4095s:2048s:ext2::lba, p...;$' out > k; mv k out ++grep -E '^1:2048s:4095s:2048s:ext2::p...;$' out > k; mv k out + + compare exp out || fail=1 + +diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh +index f2001c5..b35d443 100644 +--- a/tests/t3310-flags.sh ++++ b/tests/t3310-flags.sh +@@ -91,6 +91,10 @@ for table_type in aix amiga atari bsd dvh gpt mac msdos pc98 sun loop; do + # test to fail. + flags=`echo "$flags" | egrep -v 'lvm|raid'` + ;; ++ msdos) # FIXME: Exclude flags that can only be set in combination ++ # with certain other flags. ++ flags=`echo "$flags" | egrep -v 'hidden|lba'` ++ ;; + esac + + for mode in on_only on_and_off ; do +-- +2.35.3 + diff --git a/0003-libparted-add-swap-flag-for-DASD-label.patch b/0003-libparted-add-swap-flag-for-DASD-label.patch new file mode 100644 index 0000000..a9d7f7e --- /dev/null +++ b/0003-libparted-add-swap-flag-for-DASD-label.patch @@ -0,0 +1,228 @@ +From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Fri, 8 Oct 2021 10:06:24 +0000 +Subject: [PATCH 3/5] libparted: add swap flag for DASD label + +Support the swap flag and fix reading flags from disk. Also +cleanup code by dropping the 2 flags "raid" and "lvm" from +DasdPartitionData and instead use "system" directly. + +Signed-off-by: Brian C. Lane +--- + include/parted/fdasd.in.h | 2 - + libparted/labels/dasd.c | 118 ++++++++++++++++---------------------- + 2 files changed, 50 insertions(+), 70 deletions(-) + +diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h +index 9e5d7d1..e3ba183 100644 +--- a/include/parted/fdasd.in.h ++++ b/include/parted/fdasd.in.h +@@ -28,10 +28,8 @@ + + #define PARTITION_LINUX_SWAP 0x82 + #define PARTITION_LINUX 0x83 +-#define PARTITION_LINUX_EXT 0x85 + #define PARTITION_LINUX_LVM 0x8e + #define PARTITION_LINUX_RAID 0xfd +-#define PARTITION_LINUX_LVM_OLD 0xfe + + #define PART_TYPE_NATIVE "NATIVE" + #define PART_TYPE_SWAP "SWAP " +diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c +index 0c00c4f..27baad0 100644 +--- a/libparted/labels/dasd.c ++++ b/libparted/labels/dasd.c +@@ -53,10 +53,8 @@ + + #define PARTITION_LINUX_SWAP 0x82 + #define PARTITION_LINUX 0x83 +-#define PARTITION_LINUX_EXT 0x85 + #define PARTITION_LINUX_LVM 0x8e + #define PARTITION_LINUX_RAID 0xfd +-#define PARTITION_LINUX_LVM_OLD 0xfe + + extern void ped_disk_dasd_init (); + extern void ped_disk_dasd_done (); +@@ -66,8 +64,6 @@ extern void ped_disk_dasd_done (); + typedef struct { + int type; + int system; +- int raid; +- int lvm; + } DasdPartitionData; + + typedef struct { +@@ -134,6 +130,31 @@ static PedDiskType dasd_disk_type = { + features: 0 + }; + ++struct flag_id_mapping_t ++{ ++ enum _PedPartitionFlag flag; ++ int type_id; ++}; ++ ++static const struct flag_id_mapping_t flag_id_mapping[] = ++{ ++ { PED_PARTITION_LVM, PARTITION_LINUX_LVM }, ++ { PED_PARTITION_RAID, PARTITION_LINUX_RAID }, ++ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, ++}; ++ ++static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST ++dasd_find_flag_id_mapping (PedPartitionFlag flag) ++{ ++ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]); ++ ++ for (int i = 0; i < n; ++i) ++ if (flag_id_mapping[i].flag == flag) ++ return &flag_id_mapping[i]; ++ ++ return NULL; ++} ++ + static PedDisk* + dasd_alloc (const PedDevice* dev) + { +@@ -310,8 +331,6 @@ dasd_read (PedDisk* disk) + part->num = 1; + part->fs_type = ped_file_system_probe (&part->geom); + dasd_data = part->disk_specific; +- dasd_data->raid = 0; +- dasd_data->lvm = 0; + dasd_data->type = 0; + + if (!ped_disk_add_partition (disk, part, NULL)) +@@ -394,8 +413,6 @@ dasd_read (PedDisk* disk) + part->num = 1; + part->fs_type = ped_file_system_probe (&part->geom); + dasd_data = part->disk_specific; +- dasd_data->raid = 0; +- dasd_data->lvm = 0; + dasd_data->type = 0; + + if (!ped_disk_add_partition (disk, part, NULL)) +@@ -452,25 +469,12 @@ dasd_read (PedDisk* disk) + + dasd_data = part->disk_specific; + +- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) && +- (ped_file_system_probe(&part->geom) == NULL)) +- ped_partition_set_flag(part, PED_PARTITION_RAID, 1); +- else +- ped_partition_set_flag(part, PED_PARTITION_RAID, 0); +- +- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) && +- (ped_file_system_probe(&part->geom) == NULL)) +- ped_partition_set_flag(part, PED_PARTITION_LVM, 1); +- else +- ped_partition_set_flag(part, PED_PARTITION_LVM, 0); +- +- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) { +- fs = ped_file_system_probe(&part->geom); +- if (fs && is_linux_swap(fs->name)) { +- dasd_data->system = PARTITION_LINUX_SWAP; +- PDEBUG; +- } +- } ++ if (strncmp(PART_TYPE_RAID, str, 6) == 0) ++ dasd_data->system = PARTITION_LINUX_RAID; ++ else if (strncmp(PART_TYPE_LVM, str, 6) == 0) ++ dasd_data->system = PARTITION_LINUX_LVM; ++ else if (strncmp(PART_TYPE_SWAP, str, 6) == 0) ++ dasd_data->system = PARTITION_LINUX_SWAP; + + vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44); + +@@ -747,20 +751,17 @@ dasd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) + PED_ASSERT(part->disk_specific != NULL); + dasd_data = part->disk_specific; + +- switch (flag) { +- case PED_PARTITION_RAID: +- if (state) +- dasd_data->lvm = 0; +- dasd_data->raid = state; +- return ped_partition_set_system(part, part->fs_type); +- case PED_PARTITION_LVM: +- if (state) +- dasd_data->raid = 0; +- dasd_data->lvm = state; +- return ped_partition_set_system(part, part->fs_type); +- default: +- return 0; ++ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag); ++ if (p) ++ { ++ if (state) ++ dasd_data->system = p->type_id; ++ else if (dasd_data->system == p->type_id) ++ return dasd_partition_set_system (part, part->fs_type); ++ return 1; + } ++ ++ return 0; + } + + static int +@@ -772,14 +773,11 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) + PED_ASSERT (part->disk_specific != NULL); + dasd_data = part->disk_specific; + +- switch (flag) { +- case PED_PARTITION_RAID: +- return dasd_data->raid; +- case PED_PARTITION_LVM: +- return dasd_data->lvm; +- default: +- return 0; +- } ++ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag); ++ if (p) ++ return dasd_data->system == p->type_id; ++ ++ return 0; + } + + /* +@@ -800,14 +798,10 @@ dasd_partition_is_flag_available (const PedPartition* part, + if (disk_specific->format_type == 1) + return 0; + +- switch (flag) { +- case PED_PARTITION_RAID: +- return 1; +- case PED_PARTITION_LVM: +- return 1; +- default: +- return 0; +- } ++ if (dasd_find_flag_id_mapping (flag)) ++ return 1; ++ ++ return 0; + } + + +@@ -938,18 +932,6 @@ dasd_partition_set_system (PedPartition* part, + + part->fs_type = fs_type; + +- if (dasd_data->lvm) { +- dasd_data->system = PARTITION_LINUX_LVM; +- PDEBUG; +- return 1; +- } +- +- if (dasd_data->raid) { +- dasd_data->system = PARTITION_LINUX_RAID; +- PDEBUG; +- return 1; +- } +- + if (!fs_type) { + dasd_data->system = PARTITION_LINUX; + PDEBUG; +-- +2.35.3 + diff --git a/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch b/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch new file mode 100644 index 0000000..66f1a08 --- /dev/null +++ b/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch @@ -0,0 +1,30 @@ +From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 13 May 2022 10:02:06 -0700 +Subject: [PATCH 4/5] parted: Reset the filesystem type when changing the + id/uuid + +Without this the print command keeps showing the type selected with +mkpart, which doesn't match the id/uuid set by the user. So rescan the +partition for a filesystem. +--- + parted/parted.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/parted/parted.c b/parted/parted.c +index b8a4acf..96da30d 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -991,6 +991,9 @@ do_type (PedDevice** dev, PedDisk** diskp) + + free (input); + ++ // Reset the fs_type based on the filesystem, if it exists ++ part->fs_type = ped_file_system_probe (&part->geom); ++ + if (!ped_disk_commit (*diskp)) + goto error; + return 1; +-- +2.35.3 + diff --git a/0005-tests-t3200-type-change-now-passes.patch b/0005-tests-t3200-type-change-now-passes.patch new file mode 100644 index 0000000..2b71270 --- /dev/null +++ b/0005-tests-t3200-type-change-now-passes.patch @@ -0,0 +1,23 @@ +From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 13 May 2022 10:15:41 -0700 +Subject: [PATCH 5/5] tests: t3200-type-change now passes + +--- + tests/Makefile.am | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 2da653b..1d109d7 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -1,6 +1,3 @@ +-XFAIL_TESTS = \ +- t3200-type-change.sh +- + TEST_EXTENSIONS = .sh + SH_LOG_COMPILER = $(SHELL) + +-- +2.35.3 + diff --git a/parted.spec b/parted.spec index dc01f56..e59972c 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -11,6 +11,11 @@ Source2: pubkey.phillip.susi Source3: pubkey.brian.lane # Upstream patches since v3.5 release +Patch0001: 0001-maint-post-release-administrivia.patch +Patch0002: 0002-parted-add-type-command.patch +Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch +Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch +Patch0005: 0005-tests-t3200-type-change-now-passes.patch BuildRequires: gcc @@ -115,6 +120,13 @@ make check %changelog +* Tue May 17 2022 Brian C. Lane - 3.5-2 +- tests: t3200-type-change now passes (bcl) +- parted: Reset the filesystem type when changing the id/uuid (bcl) +- libparted: add swap flag for DASD label (aschnell) +- parted: add type command (aschnell) +- maint: post-release administrivia (bcl) + * Mon Apr 18 2022 Brian C. Lane - 3.5-1 - Upstream 3.5 stable release From 8b0c9ee0a5d7606308bf77192db70f97858d0ae7 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 20 Jun 2022 13:10:26 -0700 Subject: [PATCH 35/60] Set _FIRST_ and _LAST_ macro values directly --- ..._LAST_-macro-values-in-disk.h-direct.patch | 73 +++++++++++++++++++ parted.spec | 10 ++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch diff --git a/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch b/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch new file mode 100644 index 0000000..b206c95 --- /dev/null +++ b/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch @@ -0,0 +1,73 @@ +From 6ce543f4999f21b363865bf845543326ba91406b Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Mon, 20 Jun 2022 12:07:14 -0700 +Subject: [PATCH] Set _FIRST_ and _LAST_ macro values in disk.h directly + +I may be missing something, but it seems impossible to use these +_FIRST_ and _LAST_ macros in practice as they are currently set. +You cannot use them at preprocessor time, because they will +always evaluate to 0 at that time, because the preprocessor does +not handle enums: + +https://stackoverflow.com/questions/34677148 + +and you cannot really use them at build time, because if you do +something like this: + + if (PED_PARTITION_LAST_FLAG > 17) { + PyModule_AddIntConstant(m, "PARTITION_ESP", PED_PARTITION_ESP); + } + +the compiler still throws an undeclared identifier error if you +actually try and build the code against an older parted. + +Unless anyone can suggest a way to use these properly as-is, +this is the best idea I can come up with: we just have to define +the _FIRST_ and _LAST_ values directly, and remember to keep +them in line when adding new entries to the enums. + +Signed-off-by: Adam Williamson +--- + include/parted/disk.in.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index 672c4ee..fedcee9 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -47,8 +47,8 @@ enum _PedDiskFlag { + /* This flag controls whether the boot flag of a GPT PMBR is set */ + PED_DISK_GPT_PMBR_BOOT=2, + }; +-#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT +-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT ++#define PED_DISK_FIRST_FLAG 1 ++#define PED_DISK_LAST_FLAG 2 + + /** + * Partition types +@@ -88,8 +88,8 @@ enum _PedPartitionFlag { + PED_PARTITION_BLS_BOOT=20, + PED_PARTITION_LINUX_HOME=21, + }; +-#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME ++#define PED_PARTITION_FIRST_FLAG 1 ++#define PED_PARTITION_LAST_FLAG 21 + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +@@ -97,8 +97,8 @@ enum _PedDiskTypeFeature { + PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ + PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ + }; +-#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED +-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID ++#define PED_DISK_TYPE_FIRST_FEATURE 1 ++#define PED_DISK_TYPE_LAST_FEATURE 8 + + struct _PedDisk; + struct _PedPartition; +-- +2.36.1 + diff --git a/parted.spec b/parted.spec index e59972c..ccc2a5b 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -17,6 +17,11 @@ Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch Patch0005: 0005-tests-t3200-type-change-now-passes.patch +# Set _FIRST_ and _LAST_ macro values directly (not from an enum +# value) so they work at preprocessor time: +# https://github.com/dcantrell/pyparted/issues/91 +Patch1001: 0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -120,6 +125,9 @@ make check %changelog +* Mon Jun 20 2022 Adam Williamson - 3.5-3 +- Set _FIRST_ and _LAST_ macro values directly + * Tue May 17 2022 Brian C. Lane - 3.5-2 - tests: t3200-type-change now passes (bcl) - parted: Reset the filesystem type when changing the id/uuid (bcl) From 3318fc5238a28ec470e004c07b4027fd351113e3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 22 Jul 2022 02:44:37 +0000 Subject: [PATCH 36/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index ccc2a5b..de7ec52 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -125,6 +125,9 @@ make check %changelog +* Fri Jul 22 2022 Fedora Release Engineering - 3.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Mon Jun 20 2022 Adam Williamson - 3.5-3 - Set _FIRST_ and _LAST_ macro values directly From cc64ab77d51dfce989067c72925f2225ae647a47 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 4 Aug 2022 11:54:17 -0700 Subject: [PATCH 37/60] - Update enum patch description for upstream --- ..._LAST_-macro-values-in-disk.h-direct.patch | 73 ------------------- ...in.h-Remove-use-of-enums-with-define.patch | 59 +++++++++++++++ parted.spec | 12 ++- 3 files changed, 64 insertions(+), 80 deletions(-) delete mode 100644 0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch create mode 100644 0006-disk.in.h-Remove-use-of-enums-with-define.patch diff --git a/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch b/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch deleted file mode 100644 index b206c95..0000000 --- a/0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 6ce543f4999f21b363865bf845543326ba91406b Mon Sep 17 00:00:00 2001 -From: Adam Williamson -Date: Mon, 20 Jun 2022 12:07:14 -0700 -Subject: [PATCH] Set _FIRST_ and _LAST_ macro values in disk.h directly - -I may be missing something, but it seems impossible to use these -_FIRST_ and _LAST_ macros in practice as they are currently set. -You cannot use them at preprocessor time, because they will -always evaluate to 0 at that time, because the preprocessor does -not handle enums: - -https://stackoverflow.com/questions/34677148 - -and you cannot really use them at build time, because if you do -something like this: - - if (PED_PARTITION_LAST_FLAG > 17) { - PyModule_AddIntConstant(m, "PARTITION_ESP", PED_PARTITION_ESP); - } - -the compiler still throws an undeclared identifier error if you -actually try and build the code against an older parted. - -Unless anyone can suggest a way to use these properly as-is, -this is the best idea I can come up with: we just have to define -the _FIRST_ and _LAST_ values directly, and remember to keep -them in line when adding new entries to the enums. - -Signed-off-by: Adam Williamson ---- - include/parted/disk.in.h | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index 672c4ee..fedcee9 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -47,8 +47,8 @@ enum _PedDiskFlag { - /* This flag controls whether the boot flag of a GPT PMBR is set */ - PED_DISK_GPT_PMBR_BOOT=2, - }; --#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT --#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT -+#define PED_DISK_FIRST_FLAG 1 -+#define PED_DISK_LAST_FLAG 2 - - /** - * Partition types -@@ -88,8 +88,8 @@ enum _PedPartitionFlag { - PED_PARTITION_BLS_BOOT=20, - PED_PARTITION_LINUX_HOME=21, - }; --#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME -+#define PED_PARTITION_FIRST_FLAG 1 -+#define PED_PARTITION_LAST_FLAG 21 - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -@@ -97,8 +97,8 @@ enum _PedDiskTypeFeature { - PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ - PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ - }; --#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED --#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID -+#define PED_DISK_TYPE_FIRST_FEATURE 1 -+#define PED_DISK_TYPE_LAST_FEATURE 8 - - struct _PedDisk; - struct _PedPartition; --- -2.36.1 - diff --git a/0006-disk.in.h-Remove-use-of-enums-with-define.patch b/0006-disk.in.h-Remove-use-of-enums-with-define.patch new file mode 100644 index 0000000..335be09 --- /dev/null +++ b/0006-disk.in.h-Remove-use-of-enums-with-define.patch @@ -0,0 +1,59 @@ +From aa690ee275db86d1edb2468bcf31c3d7cf81228e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Thu, 4 Aug 2022 11:39:09 -0700 +Subject: [PATCH] disk.in.h: Remove use of enums with #define + +The preprocessor doesn't evaluate the enum, so it ends up being 0, which +causes problems for library users like pyparted which try to use the _LAST +value to conditionally include support for newer flags. + +Instead just define the int that is the first and last entry in each enum. + +Thanks to adamw and dcantrell for help arriving at a solution. +--- + include/parted/disk.in.h | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index 672c4ee..715637d 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -47,8 +47,9 @@ enum _PedDiskFlag { + /* This flag controls whether the boot flag of a GPT PMBR is set */ + PED_DISK_GPT_PMBR_BOOT=2, + }; +-#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT +-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT ++// NOTE: DO NOT define using enums ++#define PED_DISK_FIRST_FLAG 1 // PED_DISK_CYLINDER_ALIGNMENT ++#define PED_DISK_LAST_FLAG 2 // PED_DISK_GPT_PMBR_BOOT + + /** + * Partition types +@@ -88,8 +89,9 @@ enum _PedPartitionFlag { + PED_PARTITION_BLS_BOOT=20, + PED_PARTITION_LINUX_HOME=21, + }; +-#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME ++// NOTE: DO NOT define using enums ++#define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT ++#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +@@ -97,8 +99,9 @@ enum _PedDiskTypeFeature { + PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ + PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ + }; +-#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED +-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID ++// NOTE: DO NOT define using enums ++#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED ++#define PED_DISK_TYPE_LAST_FEATURE 8 // PED_DISK_TYPE_PARTITION_TYPE_UUID + + struct _PedDisk; + struct _PedPartition; +-- +2.37.1 + diff --git a/parted.spec b/parted.spec index de7ec52..7b49a68 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -16,12 +16,7 @@ Patch0002: 0002-parted-add-type-command.patch Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch Patch0005: 0005-tests-t3200-type-change-now-passes.patch - -# Set _FIRST_ and _LAST_ macro values directly (not from an enum -# value) so they work at preprocessor time: -# https://github.com/dcantrell/pyparted/issues/91 -Patch1001: 0001-Set-_FIRST_-and-_LAST_-macro-values-in-disk.h-direct.patch - +Patch0006: 0006-disk.in.h-Remove-use-of-enums-with-define.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -125,6 +120,9 @@ make check %changelog +* Thu Aug 04 2022 Brian C. Lane - 3.5-5 +- Update enum patch description for upstream + * Fri Jul 22 2022 Fedora Release Engineering - 3.5-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 8298c363a4007b0c740e1e27e5f33618b3e4ddbd Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 9 Aug 2022 10:15:30 -0700 Subject: [PATCH 38/60] - Fix ped_partition_set_system handling of existing flags --- ...-Fix-handling-of-gpt-partition-types.patch | 101 +++++++++++ ...arted-test-for-ped_partition_set_sys.patch | 160 ++++++++++++++++++ ...ix-handling-of-msdos-partition-types.patch | 109 ++++++++++++ ...arted-test-for-ped_partition_set_sys.patch | 75 ++++++++ parted.spec | 13 +- 5 files changed, 456 insertions(+), 2 deletions(-) create mode 100644 0007-libparted-Fix-handling-of-gpt-partition-types.patch create mode 100644 0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch create mode 100644 0009-libparted-Fix-handling-of-msdos-partition-types.patch create mode 100644 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch diff --git a/0007-libparted-Fix-handling-of-gpt-partition-types.patch b/0007-libparted-Fix-handling-of-gpt-partition-types.patch new file mode 100644 index 0000000..1d13342 --- /dev/null +++ b/0007-libparted-Fix-handling-of-gpt-partition-types.patch @@ -0,0 +1,101 @@ +From 717d39a0a16b6fddfac65cf355a895d04995cdff Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 8 Aug 2022 12:04:32 -0700 +Subject: [PATCH 07/10] libparted: Fix handling of gpt partition types + +This restores the previous behavior by testing the GUID against the list +of known types and skipping the filesystem GUID reset. Now the sequence +of: + +ped_partition_new(...) +ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); +ped_partition_set_system(part, ped_file_system_type_get("ext4")); + +Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used +to behave. +--- + libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 43 insertions(+), 2 deletions(-) + +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 0e9e060..8e6a37d 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -196,6 +196,24 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] = + { PED_PARTITION_SWAP, PARTITION_SWAP_GUID }, + }; + ++static const efi_guid_t skip_set_system_guids[] = ++{ ++ PARTITION_LVM_GUID, ++ PARTITION_SWAP_GUID, ++ PARTITION_RAID_GUID, ++ PARTITION_PREP_GUID, ++ PARTITION_SYSTEM_GUID, ++ PARTITION_BIOS_GRUB_GUID, ++ PARTITION_HPSERVICE_GUID, ++ PARTITION_MSFT_RESERVED_GUID, ++ PARTITION_BASIC_DATA_GUID, ++ PARTITION_MSFT_RECOVERY, ++ PARTITION_APPLE_TV_RECOVERY_GUID, ++ PARTITION_IRST_GUID, ++ PARTITION_CHROMEOS_KERNEL_GUID, ++ PARTITION_BLS_BOOT_GUID, ++}; ++ + static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST + gpt_find_flag_uuid_mapping (PedPartitionFlag flag) + { +@@ -1421,6 +1439,21 @@ gpt_partition_destroy (PedPartition *part) + _ped_partition_free (part); + } + ++/* is_skip_guid checks the guid against the list of guids that should not be ++ * overridden by set_system. It returns a 1 if it is in the list. ++*/ ++static bool ++is_skip_guid(efi_guid_t guid) { ++ int n = sizeof(skip_set_system_guids) / sizeof(skip_set_system_guids[0]); ++ for (int i = 0; i < n; ++i) { ++ if (guid_cmp(guid, skip_set_system_guids[i]) == 0) { ++ return true; ++ } ++ } ++ ++ return false; ++} ++ + static int + gpt_partition_set_system (PedPartition *part, + const PedFileSystemType *fs_type) +@@ -1431,6 +1464,11 @@ gpt_partition_set_system (PedPartition *part, + + part->fs_type = fs_type; + ++ // Is this a GUID that should skip fs_type checking? ++ if (is_skip_guid(gpt_part_data->type)) { ++ return 1; ++ } ++ + if (fs_type) + { + if (strncmp (fs_type->name, "fat", 3) == 0 +@@ -1563,10 +1601,13 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); + if (p) + { +- if (state) ++ if (state) { + gpt_part_data->type = p->type_uuid; +- else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) ++ } else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) { ++ // Clear the GUID so that fs_type will be used to return it to the default ++ gpt_part_data->type = PARTITION_LINUX_DATA_GUID; + return gpt_partition_set_system (part, part->fs_type); ++ } + return 1; + } + +-- +2.37.1 + diff --git a/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch new file mode 100644 index 0000000..3484833 --- /dev/null +++ b/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch @@ -0,0 +1,160 @@ +From 14cf5be3d322d7e3e81c21a3542ae046a5fe1fda Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 8 Aug 2022 13:49:09 -0700 +Subject: [PATCH 08/10] tests: Add a libparted test for + ped_partition_set_system on gpt + +Test the libparted API to make sure the flag is not cleared by calling +ped_partition_set_system. +--- + libparted/tests/Makefile.am | 6 ++- + libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++ + libparted/tests/t1001-flags.sh | 23 ++++++++++ + 3 files changed, 108 insertions(+), 2 deletions(-) + create mode 100644 libparted/tests/flags.c + create mode 100755 libparted/tests/t1001-flags.sh + +diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am +index fd5cba5..260b692 100644 +--- a/libparted/tests/Makefile.am ++++ b/libparted/tests/Makefile.am +@@ -3,9 +3,10 @@ + # + # This file may be modified and/or distributed without restriction. + +-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh ++TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \ ++ t3000-symlink.sh t4000-volser.sh + EXTRA_DIST = $(TESTS) +-check_PROGRAMS = label disk zerolen symlink volser ++check_PROGRAMS = label disk zerolen symlink volser flags + AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) + + LDADD = \ +@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c + zerolen_SOURCES = common.h common.c zerolen.c + symlink_SOURCES = common.h common.c symlink.c + volser_SOURCES = common.h common.c volser.c ++flags_SOURCES = common.h common.c flags.c + + # Arrange to symlink to tests/init.sh. + CLEANFILES = init.sh +diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c +new file mode 100644 +index 0000000..c83a361 +--- /dev/null ++++ b/libparted/tests/flags.c +@@ -0,0 +1,81 @@ ++#include ++#include ++ ++#include ++ ++#include ++ ++#include "common.h" ++#include "progname.h" ++ ++#define STREQ(a, b) (strcmp (a, b) == 0) ++ ++static char* temporary_disk; ++ ++static void ++create_disk (void) ++{ ++ temporary_disk = _create_disk (80 * 1024 * 1024); ++ fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++} ++ ++static void ++destroy_disk (void) ++{ ++ unlink (temporary_disk); ++ free (temporary_disk); ++} ++ ++/* TEST: Test partition type flag on gpt disklabel */ ++START_TEST (test_gpt_flag) ++{ ++ PedDevice* dev = ped_device_get (temporary_disk); ++ if (dev == NULL) ++ return; ++ ++ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt")); ++ PedConstraint *constraint = ped_constraint_any (dev); ++ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, ++ ped_file_system_type_get("ext4"), 2048, 4096); ++ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); ++ // Type should remain set to BIOS_GRUB ++ ped_partition_set_system(part, ped_file_system_type_get("ext4")); ++ ++ ped_disk_add_partition (disk, part, constraint); ++ ped_disk_commit (disk); ++ ped_constraint_destroy (constraint); ++ ++ // Check flag to confirm it is still set ++ part = ped_disk_get_partition (disk, 1); ++ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); ++ ++ ped_disk_destroy (disk); ++ ped_device_destroy (dev); ++} ++END_TEST ++ ++int ++main (int argc, char **argv) ++{ ++ set_program_name (argv[0]); ++ int number_failed; ++ Suite* suite = suite_create ("Partition Flags"); ++ TCase* tcase_gpt = tcase_create ("GPT"); ++ ++ /* Fail when an exception is raised */ ++ ped_exception_set_handler (_test_exception_handler); ++ ++ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk); ++ tcase_add_test (tcase_gpt, test_gpt_flag); ++ /* Disable timeout for this test */ ++ tcase_set_timeout (tcase_gpt, 0); ++ suite_add_tcase (suite, tcase_gpt); ++ ++ SRunner* srunner = srunner_create (suite); ++ srunner_run_all (srunner, CK_VERBOSE); ++ ++ number_failed = srunner_ntests_failed (srunner); ++ srunner_free (srunner); ++ ++ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; ++} +diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh +new file mode 100755 +index 0000000..60a6248 +--- /dev/null ++++ b/libparted/tests/t1001-flags.sh +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# run the flags unittest ++ ++# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ . ++ ++flags || fail=1 ++ ++Exit $fail +-- +2.37.1 + diff --git a/0009-libparted-Fix-handling-of-msdos-partition-types.patch b/0009-libparted-Fix-handling-of-msdos-partition-types.patch new file mode 100644 index 0000000..1b689e0 --- /dev/null +++ b/0009-libparted-Fix-handling-of-msdos-partition-types.patch @@ -0,0 +1,109 @@ +From 9be9067bc5a3641fc890b0d4ba994000941109bf Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 8 Aug 2022 15:02:30 -0700 +Subject: [PATCH 09/10] libparted: Fix handling of msdos partition types + +This restores the previous behavior by testing the partition type +against the list of known types and skipping the filesystem type reset. +Now the sequence of: + +ped_partition_new(...) +ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); +ped_partition_set_system(part, ped_file_system_type_get("ext4")); + +Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used +to behave. +--- + libparted/labels/dos.c | 54 +++++++++++++++++++++++++++++++++++------- + 1 file changed, 46 insertions(+), 8 deletions(-) + +diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c +index bd7465d..4359276 100644 +--- a/libparted/labels/dos.c ++++ b/libparted/labels/dos.c +@@ -121,6 +121,22 @@ static const struct flag_id_mapping_t flag_id_mapping[] = + { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, + }; + ++static const unsigned char skip_set_system_types[] = ++{ ++ PARTITION_EXT_LBA, ++ PARTITION_DOS_EXT, ++ PARTITION_COMPAQ_DIAG, ++ PARTITION_MSFT_RECOVERY, ++ PARTITION_LINUX_LVM, ++ PARTITION_LINUX_SWAP, ++ PARTITION_LINUX_RAID, ++ PARTITION_PALO, ++ PARTITION_PREP, ++ PARTITION_IRST, ++ PARTITION_ESP, ++ PARTITION_BLS_BOOT ++}; ++ + static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST + dos_find_flag_id_mapping (PedPartitionFlag flag) + { +@@ -1540,6 +1556,21 @@ msdos_partition_destroy (PedPartition* part) + free (part); + } + ++/* is_skip_type checks the type against the list of types that should not be ++ * overridden by set_system. It returns a 1 if it is in the list. ++*/ ++static bool ++is_skip_type(unsigned char type_id) { ++ int n = sizeof(skip_set_system_types) / sizeof(skip_set_system_types[0]); ++ for (int i = 0; i < n; ++i) { ++ if (type_id == skip_set_system_types[i]) { ++ return true; ++ } ++ } ++ ++ return false; ++} ++ + static int + msdos_partition_set_system (PedPartition* part, + const PedFileSystemType* fs_type) +@@ -1548,6 +1579,11 @@ msdos_partition_set_system (PedPartition* part, + + part->fs_type = fs_type; + ++ // Is this a type that should skip fs_type checking? ++ if (is_skip_type(dos_data->system)) { ++ return 1; ++ } ++ + if (part->type & PED_PARTITION_EXTENDED) { + dos_data->system = PARTITION_EXT_LBA; + return 1; +@@ -1590,15 +1626,17 @@ msdos_partition_set_flag (PedPartition* part, + const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); + if (p) + { +- if (part->type & PED_PARTITION_EXTENDED) +- return 0; +- +- if (state) +- dos_data->system = p->type_id; +- else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) +- return ped_partition_set_system (part, part->fs_type); ++ if (part->type & PED_PARTITION_EXTENDED) ++ return 0; + +- return 1; ++ if (state) { ++ dos_data->system = p->type_id; ++ } else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) { ++ // Clear the type so that fs_type will be used to return it to the default ++ dos_data->system = PARTITION_LINUX; ++ return ped_partition_set_system (part, part->fs_type); ++ } ++ return 1; + } + + switch (flag) { +-- +2.37.1 + diff --git a/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch new file mode 100644 index 0000000..4c313e7 --- /dev/null +++ b/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch @@ -0,0 +1,75 @@ +From 7830678dbe832ea6815d9a31be8cbe3a67f3ed7e Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 8 Aug 2022 15:06:03 -0700 +Subject: [PATCH 10/10] tests: Add a libparted test for + ped_partition_set_system on msdos + +Test the libparted API to make sure the flag is not cleared by calling +ped_partition_set_system. +--- + libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c +index c83a361..c4b290b 100644 +--- a/libparted/tests/flags.c ++++ b/libparted/tests/flags.c +@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag) + } + END_TEST + ++/* TEST: Test partition type flag on msdos disklabel */ ++START_TEST (test_msdos_flag) ++{ ++ PedDevice* dev = ped_device_get (temporary_disk); ++ if (dev == NULL) ++ return; ++ ++ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos")); ++ PedConstraint *constraint = ped_constraint_any (dev); ++ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, ++ ped_file_system_type_get("ext4"), 2048, 4096); ++ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); ++ // Type should remain set to BIOS_GRUB ++ ped_partition_set_system(part, ped_file_system_type_get("ext4")); ++ ++ ped_disk_add_partition (disk, part, constraint); ++ ped_disk_commit (disk); ++ ped_constraint_destroy (constraint); ++ ++ // Check flag to confirm it is still set ++ part = ped_disk_get_partition (disk, 1); ++ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); ++ ++ ped_disk_destroy (disk); ++ ped_device_destroy (dev); ++} ++END_TEST ++ + int + main (int argc, char **argv) + { +@@ -61,6 +89,7 @@ main (int argc, char **argv) + int number_failed; + Suite* suite = suite_create ("Partition Flags"); + TCase* tcase_gpt = tcase_create ("GPT"); ++ TCase* tcase_msdos = tcase_create ("MSDOS"); + + /* Fail when an exception is raised */ + ped_exception_set_handler (_test_exception_handler); +@@ -71,6 +100,12 @@ main (int argc, char **argv) + tcase_set_timeout (tcase_gpt, 0); + suite_add_tcase (suite, tcase_gpt); + ++ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk); ++ tcase_add_test (tcase_msdos, test_msdos_flag); ++ /* Disable timeout for this test */ ++ tcase_set_timeout (tcase_msdos, 0); ++ suite_add_tcase (suite, tcase_msdos); ++ + SRunner* srunner = srunner_create (suite); + srunner_run_all (srunner, CK_VERBOSE); + +-- +2.37.1 + diff --git a/parted.spec b/parted.spec index 7b49a68..ea6c27d 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -17,6 +17,11 @@ Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch Patch0005: 0005-tests-t3200-type-change-now-passes.patch Patch0006: 0006-disk.in.h-Remove-use-of-enums-with-define.patch +Patch0007: 0007-libparted-Fix-handling-of-gpt-partition-types.patch +Patch0008: 0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +Patch0009: 0009-libparted-Fix-handling-of-msdos-partition-types.patch +Patch0010: 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -37,9 +42,10 @@ BuildRequires: xfsprogs BuildRequires: dosfstools BuildRequires: perl-Digest-CRC BuildRequires: bc -Buildrequires: python3 +BuildRequires: python3 BuildRequires: gperf BuildRequires: make +BuildRequires: check-devel # bundled gnulib library exception, as per packaging guidelines # https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries @@ -120,6 +126,9 @@ make check %changelog +* Mon Aug 08 2022 Brian C. Lane - 3.5-5.bcl.1 +- Fix ped_partition_set_system handling of existing flags + * Thu Aug 04 2022 Brian C. Lane - 3.5-5 - Update enum patch description for upstream From 7fc0182f627a5cedbbbb7f44d8f62d509ad90d65 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 4 Oct 2022 08:43:04 -0700 Subject: [PATCH 39/60] - libparted: Fix handling of msdos partition types - tests: Add a libparted test for ped_partition_set_system on msdos - parted: Add display of GPT UUIDs in JSON output - Add no_automount flag support - increase xfs size to 300M --- 0001-maint-post-release-administrivia.patch | 4 +- 0002-parted-add-type-command.patch | 4 +- ...bparted-add-swap-flag-for-DASD-label.patch | 4 +- ...-filesystem-type-when-changing-the-i.patch | 4 +- 0005-tests-t3200-type-change-now-passes.patch | 4 +- ...eck-for-availability-of-_type_id-fun.patch | 40 ++ ...parted-Simplify-code-for-json-output.patch | 34 ++ ...in.h-Remove-use-of-enums-with-define.patch | 4 +- ...arted-test-for-ped_partition_set_sys.patch | 160 -------- ...-Fix-handling-of-gpt-partition-types.patch | 6 +- ...arted-test-for-ped_partition_set_sys.patch | 169 ++++++--- ...ix-handling-of-msdos-partition-types.patch | 6 +- ...arted-test-for-ped_partition_set_sys.patch | 75 ++++ 0013-show-GPT-UUIDs-in-JSON-output.patch | 351 ++++++++++++++++++ ...-gpt-Add-no_automount-partition-flag.patch | 145 ++++++++ ...-XFS-requires-a-minimum-size-of-300M.patch | 54 +++ parted.spec | 25 +- 17 files changed, 862 insertions(+), 227 deletions(-) create mode 100644 0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch create mode 100644 0007-parted-Simplify-code-for-json-output.patch rename 0006-disk.in.h-Remove-use-of-enums-with-define.patch => 0008-disk.in.h-Remove-use-of-enums-with-define.patch (96%) delete mode 100644 0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch rename 0007-libparted-Fix-handling-of-gpt-partition-types.patch => 0009-libparted-Fix-handling-of-gpt-partition-types.patch (95%) rename 0009-libparted-Fix-handling-of-msdos-partition-types.patch => 0011-libparted-Fix-handling-of-msdos-partition-types.patch (95%) create mode 100644 0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch create mode 100644 0013-show-GPT-UUIDs-in-JSON-output.patch create mode 100644 0014-gpt-Add-no_automount-partition-flag.patch create mode 100644 0015-tests-XFS-requires-a-minimum-size-of-300M.patch diff --git a/0001-maint-post-release-administrivia.patch b/0001-maint-post-release-administrivia.patch index c32732c..d8aa4ef 100644 --- a/0001-maint-post-release-administrivia.patch +++ b/0001-maint-post-release-administrivia.patch @@ -1,7 +1,7 @@ From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 18 Apr 2022 15:10:06 -0400 -Subject: [PATCH 1/5] maint: post-release administrivia +Subject: [PATCH 01/13] maint: post-release administrivia * NEWS: Add header line for next release. * .prev-version: Record previous version. @@ -46,5 +46,5 @@ index d5fdd80..11fa51b 100644 include $(srcdir)/dist-check.mk -- -2.35.3 +2.37.3 diff --git a/0002-parted-add-type-command.patch b/0002-parted-add-type-command.patch index 8472a6b..4eddee7 100644 --- a/0002-parted-add-type-command.patch +++ b/0002-parted-add-type-command.patch @@ -1,7 +1,7 @@ From 61b3a9733c0e0a79ccc43096642d378c8706add6 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Wed, 11 May 2022 14:02:21 +0000 -Subject: [PATCH 2/5] parted: add type command +Subject: [PATCH 02/13] parted: add type command Include the partition type-id and type-uuid in the JSON output. Also add the the command 'type' to set them. Remove @@ -1632,5 +1632,5 @@ index f2001c5..b35d443 100644 for mode in on_only on_and_off ; do -- -2.35.3 +2.37.3 diff --git a/0003-libparted-add-swap-flag-for-DASD-label.patch b/0003-libparted-add-swap-flag-for-DASD-label.patch index a9d7f7e..424ddc7 100644 --- a/0003-libparted-add-swap-flag-for-DASD-label.patch +++ b/0003-libparted-add-swap-flag-for-DASD-label.patch @@ -1,7 +1,7 @@ From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Fri, 8 Oct 2021 10:06:24 +0000 -Subject: [PATCH 3/5] libparted: add swap flag for DASD label +Subject: [PATCH 03/13] libparted: add swap flag for DASD label Support the swap flag and fix reading flags from disk. Also cleanup code by dropping the 2 flags "raid" and "lvm" from @@ -224,5 +224,5 @@ index 0c00c4f..27baad0 100644 dasd_data->system = PARTITION_LINUX; PDEBUG; -- -2.35.3 +2.37.3 diff --git a/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch b/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch index 66f1a08..2060b77 100644 --- a/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch +++ b/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch @@ -1,7 +1,7 @@ From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 13 May 2022 10:02:06 -0700 -Subject: [PATCH 4/5] parted: Reset the filesystem type when changing the +Subject: [PATCH 04/13] parted: Reset the filesystem type when changing the id/uuid Without this the print command keeps showing the type selected with @@ -26,5 +26,5 @@ index b8a4acf..96da30d 100644 goto error; return 1; -- -2.35.3 +2.37.3 diff --git a/0005-tests-t3200-type-change-now-passes.patch b/0005-tests-t3200-type-change-now-passes.patch index 2b71270..a61d327 100644 --- a/0005-tests-t3200-type-change-now-passes.patch +++ b/0005-tests-t3200-type-change-now-passes.patch @@ -1,7 +1,7 @@ From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 13 May 2022 10:15:41 -0700 -Subject: [PATCH 5/5] tests: t3200-type-change now passes +Subject: [PATCH 05/13] tests: t3200-type-change now passes --- tests/Makefile.am | 3 --- @@ -19,5 +19,5 @@ index 2da653b..1d109d7 100644 SH_LOG_COMPILER = $(SHELL) -- -2.35.3 +2.37.3 diff --git a/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch b/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch new file mode 100644 index 0000000..afa6bc2 --- /dev/null +++ b/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch @@ -0,0 +1,40 @@ +From bafa84b25a265ef9eed3872790d52bf56ac42998 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Wed, 27 Jul 2022 09:36:54 +0000 +Subject: [PATCH 06/13] libparted: Fix check for availability of _type_id + functions + +Fix a copy/paste error. In practice this didn't cause any problems +because the *_set_type_id and *_get_type_id are either both NULL or both +set to the function. + +Signed-off-by: Brian C. Lane +--- + libparted/disk.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libparted/disk.c b/libparted/disk.c +index 22dff36..a961d65 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -1572,7 +1572,7 @@ ped_partition_get_type_id (const PedPartition *part) + if (!_assert_partition_type_id_feature (part->disk->type)) + return 0; + +- PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); ++ PED_ASSERT (part->disk->type->ops->partition_get_type_id != NULL); + return part->disk->type->ops->partition_get_type_id (part); + } + +@@ -1608,7 +1608,7 @@ ped_partition_get_type_uuid (const PedPartition *part) + if (!_assert_partition_type_uuid_feature (part->disk->type)) + return NULL; + +- PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); ++ PED_ASSERT (part->disk->type->ops->partition_get_type_uuid != NULL); + return part->disk->type->ops->partition_get_type_uuid (part); + } + +-- +2.37.3 + diff --git a/0007-parted-Simplify-code-for-json-output.patch b/0007-parted-Simplify-code-for-json-output.patch new file mode 100644 index 0000000..50a600d --- /dev/null +++ b/0007-parted-Simplify-code-for-json-output.patch @@ -0,0 +1,34 @@ +From b16be5ffc8e700df2b6b2545c4b6794cea71b8e7 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Wed, 27 Jul 2022 13:36:08 +0000 +Subject: [PATCH 07/13] parted: Simplify code for json output + +_PedDiskOps::get_max_primary_partition_count is always available, the +macro PT_op_function_initializers ensures it. So use +ped_disk_get_max_primary_partition_count instead of +_PedDiskOps::get_max_primary_partition_count directly. + +Signed-off-by: Brian C. Lane +--- + parted/parted.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 96da30d..36c39c7 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1215,9 +1215,8 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); + ul_jsonwrt_value_s (&json, "label", pt_name); + if (diskp) { +- if (diskp->type->ops->get_max_primary_partition_count) +- ul_jsonwrt_value_u64 (&json, "max-partitions", +- diskp->type->ops->get_max_primary_partition_count(diskp)); ++ ul_jsonwrt_value_u64 (&json, "max-partitions", ++ ped_disk_get_max_primary_partition_count(diskp)); + disk_print_flags_json (diskp); + } + } else { +-- +2.37.3 + diff --git a/0006-disk.in.h-Remove-use-of-enums-with-define.patch b/0008-disk.in.h-Remove-use-of-enums-with-define.patch similarity index 96% rename from 0006-disk.in.h-Remove-use-of-enums-with-define.patch rename to 0008-disk.in.h-Remove-use-of-enums-with-define.patch index 335be09..bb56d68 100644 --- a/0006-disk.in.h-Remove-use-of-enums-with-define.patch +++ b/0008-disk.in.h-Remove-use-of-enums-with-define.patch @@ -1,7 +1,7 @@ From aa690ee275db86d1edb2468bcf31c3d7cf81228e Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 4 Aug 2022 11:39:09 -0700 -Subject: [PATCH] disk.in.h: Remove use of enums with #define +Subject: [PATCH 08/13] disk.in.h: Remove use of enums with #define The preprocessor doesn't evaluate the enum, so it ends up being 0, which causes problems for library users like pyparted which try to use the _LAST @@ -55,5 +55,5 @@ index 672c4ee..715637d 100644 struct _PedDisk; struct _PedPartition; -- -2.37.1 +2.37.3 diff --git a/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch deleted file mode 100644 index 3484833..0000000 --- a/0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +++ /dev/null @@ -1,160 +0,0 @@ -From 14cf5be3d322d7e3e81c21a3542ae046a5fe1fda Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 13:49:09 -0700 -Subject: [PATCH 08/10] tests: Add a libparted test for - ped_partition_set_system on gpt - -Test the libparted API to make sure the flag is not cleared by calling -ped_partition_set_system. ---- - libparted/tests/Makefile.am | 6 ++- - libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++ - libparted/tests/t1001-flags.sh | 23 ++++++++++ - 3 files changed, 108 insertions(+), 2 deletions(-) - create mode 100644 libparted/tests/flags.c - create mode 100755 libparted/tests/t1001-flags.sh - -diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am -index fd5cba5..260b692 100644 ---- a/libparted/tests/Makefile.am -+++ b/libparted/tests/Makefile.am -@@ -3,9 +3,10 @@ - # - # This file may be modified and/or distributed without restriction. - --TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh -+TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \ -+ t3000-symlink.sh t4000-volser.sh - EXTRA_DIST = $(TESTS) --check_PROGRAMS = label disk zerolen symlink volser -+check_PROGRAMS = label disk zerolen symlink volser flags - AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) - - LDADD = \ -@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c - zerolen_SOURCES = common.h common.c zerolen.c - symlink_SOURCES = common.h common.c symlink.c - volser_SOURCES = common.h common.c volser.c -+flags_SOURCES = common.h common.c flags.c - - # Arrange to symlink to tests/init.sh. - CLEANFILES = init.sh -diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c -new file mode 100644 -index 0000000..c83a361 ---- /dev/null -+++ b/libparted/tests/flags.c -@@ -0,0 +1,81 @@ -+#include -+#include -+ -+#include -+ -+#include -+ -+#include "common.h" -+#include "progname.h" -+ -+#define STREQ(a, b) (strcmp (a, b) == 0) -+ -+static char* temporary_disk; -+ -+static void -+create_disk (void) -+{ -+ temporary_disk = _create_disk (80 * 1024 * 1024); -+ fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+} -+ -+static void -+destroy_disk (void) -+{ -+ unlink (temporary_disk); -+ free (temporary_disk); -+} -+ -+/* TEST: Test partition type flag on gpt disklabel */ -+START_TEST (test_gpt_flag) -+{ -+ PedDevice* dev = ped_device_get (temporary_disk); -+ if (dev == NULL) -+ return; -+ -+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt")); -+ PedConstraint *constraint = ped_constraint_any (dev); -+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, -+ ped_file_system_type_get("ext4"), 2048, 4096); -+ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); -+ // Type should remain set to BIOS_GRUB -+ ped_partition_set_system(part, ped_file_system_type_get("ext4")); -+ -+ ped_disk_add_partition (disk, part, constraint); -+ ped_disk_commit (disk); -+ ped_constraint_destroy (constraint); -+ -+ // Check flag to confirm it is still set -+ part = ped_disk_get_partition (disk, 1); -+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); -+ -+ ped_disk_destroy (disk); -+ ped_device_destroy (dev); -+} -+END_TEST -+ -+int -+main (int argc, char **argv) -+{ -+ set_program_name (argv[0]); -+ int number_failed; -+ Suite* suite = suite_create ("Partition Flags"); -+ TCase* tcase_gpt = tcase_create ("GPT"); -+ -+ /* Fail when an exception is raised */ -+ ped_exception_set_handler (_test_exception_handler); -+ -+ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk); -+ tcase_add_test (tcase_gpt, test_gpt_flag); -+ /* Disable timeout for this test */ -+ tcase_set_timeout (tcase_gpt, 0); -+ suite_add_tcase (suite, tcase_gpt); -+ -+ SRunner* srunner = srunner_create (suite); -+ srunner_run_all (srunner, CK_VERBOSE); -+ -+ number_failed = srunner_ntests_failed (srunner); -+ srunner_free (srunner); -+ -+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -+} -diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh -new file mode 100755 -index 0000000..60a6248 ---- /dev/null -+++ b/libparted/tests/t1001-flags.sh -@@ -0,0 +1,23 @@ -+#!/bin/sh -+# run the flags unittest -+ -+# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ . -+ -+flags || fail=1 -+ -+Exit $fail --- -2.37.1 - diff --git a/0007-libparted-Fix-handling-of-gpt-partition-types.patch b/0009-libparted-Fix-handling-of-gpt-partition-types.patch similarity index 95% rename from 0007-libparted-Fix-handling-of-gpt-partition-types.patch rename to 0009-libparted-Fix-handling-of-gpt-partition-types.patch index 1d13342..bfe30cb 100644 --- a/0007-libparted-Fix-handling-of-gpt-partition-types.patch +++ b/0009-libparted-Fix-handling-of-gpt-partition-types.patch @@ -1,7 +1,7 @@ -From 717d39a0a16b6fddfac65cf355a895d04995cdff Mon Sep 17 00:00:00 2001 +From 8957382b98fd79bc06dad132ef28a0be8b46ea16 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 8 Aug 2022 12:04:32 -0700 -Subject: [PATCH 07/10] libparted: Fix handling of gpt partition types +Subject: [PATCH 09/13] libparted: Fix handling of gpt partition types This restores the previous behavior by testing the GUID against the list of known types and skipping the filesystem GUID reset. Now the sequence @@ -97,5 +97,5 @@ index 0e9e060..8e6a37d 100644 } -- -2.37.1 +2.37.3 diff --git a/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch index 4c313e7..b905115 100644 --- a/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +++ b/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch @@ -1,35 +1,90 @@ -From 7830678dbe832ea6815d9a31be8cbe3a67f3ed7e Mon Sep 17 00:00:00 2001 +From d50b7bf2b66b7b67ee332c1af63bc1f5fdfba7ad Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 15:06:03 -0700 -Subject: [PATCH 10/10] tests: Add a libparted test for - ped_partition_set_system on msdos +Date: Mon, 8 Aug 2022 13:49:09 -0700 +Subject: [PATCH 10/13] tests: Add a libparted test for + ped_partition_set_system on gpt Test the libparted API to make sure the flag is not cleared by calling ped_partition_set_system. --- - libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) + libparted/tests/Makefile.am | 6 ++- + libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++ + libparted/tests/t1001-flags.sh | 23 ++++++++++ + 3 files changed, 108 insertions(+), 2 deletions(-) + create mode 100644 libparted/tests/flags.c + create mode 100755 libparted/tests/t1001-flags.sh -diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c -index c83a361..c4b290b 100644 ---- a/libparted/tests/flags.c -+++ b/libparted/tests/flags.c -@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag) - } - END_TEST +diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am +index fd5cba5..260b692 100644 +--- a/libparted/tests/Makefile.am ++++ b/libparted/tests/Makefile.am +@@ -3,9 +3,10 @@ + # + # This file may be modified and/or distributed without restriction. -+/* TEST: Test partition type flag on msdos disklabel */ -+START_TEST (test_msdos_flag) +-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh ++TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \ ++ t3000-symlink.sh t4000-volser.sh + EXTRA_DIST = $(TESTS) +-check_PROGRAMS = label disk zerolen symlink volser ++check_PROGRAMS = label disk zerolen symlink volser flags + AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) + + LDADD = \ +@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c + zerolen_SOURCES = common.h common.c zerolen.c + symlink_SOURCES = common.h common.c symlink.c + volser_SOURCES = common.h common.c volser.c ++flags_SOURCES = common.h common.c flags.c + + # Arrange to symlink to tests/init.sh. + CLEANFILES = init.sh +diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c +new file mode 100644 +index 0000000..c83a361 +--- /dev/null ++++ b/libparted/tests/flags.c +@@ -0,0 +1,81 @@ ++#include ++#include ++ ++#include ++ ++#include ++ ++#include "common.h" ++#include "progname.h" ++ ++#define STREQ(a, b) (strcmp (a, b) == 0) ++ ++static char* temporary_disk; ++ ++static void ++create_disk (void) ++{ ++ temporary_disk = _create_disk (80 * 1024 * 1024); ++ fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++} ++ ++static void ++destroy_disk (void) ++{ ++ unlink (temporary_disk); ++ free (temporary_disk); ++} ++ ++/* TEST: Test partition type flag on gpt disklabel */ ++START_TEST (test_gpt_flag) +{ + PedDevice* dev = ped_device_get (temporary_disk); + if (dev == NULL) + return; + -+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos")); ++ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt")); + PedConstraint *constraint = ped_constraint_any (dev); + PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, + ped_file_system_type_get("ext4"), 2048, 4096); -+ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); ++ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); + // Type should remain set to BIOS_GRUB + ped_partition_set_system(part, ped_file_system_type_get("ext4")); + @@ -39,37 +94,67 @@ index c83a361..c4b290b 100644 + + // Check flag to confirm it is still set + part = ped_disk_get_partition (disk, 1); -+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); ++ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); + + ped_disk_destroy (disk); + ped_device_destroy (dev); +} +END_TEST + - int - main (int argc, char **argv) - { -@@ -61,6 +89,7 @@ main (int argc, char **argv) - int number_failed; - Suite* suite = suite_create ("Partition Flags"); - TCase* tcase_gpt = tcase_create ("GPT"); -+ TCase* tcase_msdos = tcase_create ("MSDOS"); - - /* Fail when an exception is raised */ - ped_exception_set_handler (_test_exception_handler); -@@ -71,6 +100,12 @@ main (int argc, char **argv) - tcase_set_timeout (tcase_gpt, 0); - suite_add_tcase (suite, tcase_gpt); - -+ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk); -+ tcase_add_test (tcase_msdos, test_msdos_flag); -+ /* Disable timeout for this test */ -+ tcase_set_timeout (tcase_msdos, 0); -+ suite_add_tcase (suite, tcase_msdos); ++int ++main (int argc, char **argv) ++{ ++ set_program_name (argv[0]); ++ int number_failed; ++ Suite* suite = suite_create ("Partition Flags"); ++ TCase* tcase_gpt = tcase_create ("GPT"); + - SRunner* srunner = srunner_create (suite); - srunner_run_all (srunner, CK_VERBOSE); - ++ /* Fail when an exception is raised */ ++ ped_exception_set_handler (_test_exception_handler); ++ ++ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk); ++ tcase_add_test (tcase_gpt, test_gpt_flag); ++ /* Disable timeout for this test */ ++ tcase_set_timeout (tcase_gpt, 0); ++ suite_add_tcase (suite, tcase_gpt); ++ ++ SRunner* srunner = srunner_create (suite); ++ srunner_run_all (srunner, CK_VERBOSE); ++ ++ number_failed = srunner_ntests_failed (srunner); ++ srunner_free (srunner); ++ ++ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; ++} +diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh +new file mode 100755 +index 0000000..60a6248 +--- /dev/null ++++ b/libparted/tests/t1001-flags.sh +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# run the flags unittest ++ ++# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ . ++ ++flags || fail=1 ++ ++Exit $fail -- -2.37.1 +2.37.3 diff --git a/0009-libparted-Fix-handling-of-msdos-partition-types.patch b/0011-libparted-Fix-handling-of-msdos-partition-types.patch similarity index 95% rename from 0009-libparted-Fix-handling-of-msdos-partition-types.patch rename to 0011-libparted-Fix-handling-of-msdos-partition-types.patch index 1b689e0..bcbb062 100644 --- a/0009-libparted-Fix-handling-of-msdos-partition-types.patch +++ b/0011-libparted-Fix-handling-of-msdos-partition-types.patch @@ -1,7 +1,7 @@ -From 9be9067bc5a3641fc890b0d4ba994000941109bf Mon Sep 17 00:00:00 2001 +From 4a0e468ed63fff85a1f9b923189f20945b32f4f1 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 8 Aug 2022 15:02:30 -0700 -Subject: [PATCH 09/10] libparted: Fix handling of msdos partition types +Subject: [PATCH 11/13] libparted: Fix handling of msdos partition types This restores the previous behavior by testing the partition type against the list of known types and skipping the filesystem type reset. @@ -105,5 +105,5 @@ index bd7465d..4359276 100644 switch (flag) { -- -2.37.1 +2.37.3 diff --git a/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch new file mode 100644 index 0000000..0628463 --- /dev/null +++ b/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch @@ -0,0 +1,75 @@ +From 8f37b28825933af9bbbac7f00cc7e23f916c7018 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 8 Aug 2022 15:06:03 -0700 +Subject: [PATCH 12/13] tests: Add a libparted test for + ped_partition_set_system on msdos + +Test the libparted API to make sure the flag is not cleared by calling +ped_partition_set_system. +--- + libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) + +diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c +index c83a361..c4b290b 100644 +--- a/libparted/tests/flags.c ++++ b/libparted/tests/flags.c +@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag) + } + END_TEST + ++/* TEST: Test partition type flag on msdos disklabel */ ++START_TEST (test_msdos_flag) ++{ ++ PedDevice* dev = ped_device_get (temporary_disk); ++ if (dev == NULL) ++ return; ++ ++ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos")); ++ PedConstraint *constraint = ped_constraint_any (dev); ++ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, ++ ped_file_system_type_get("ext4"), 2048, 4096); ++ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); ++ // Type should remain set to BIOS_GRUB ++ ped_partition_set_system(part, ped_file_system_type_get("ext4")); ++ ++ ped_disk_add_partition (disk, part, constraint); ++ ped_disk_commit (disk); ++ ped_constraint_destroy (constraint); ++ ++ // Check flag to confirm it is still set ++ part = ped_disk_get_partition (disk, 1); ++ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); ++ ++ ped_disk_destroy (disk); ++ ped_device_destroy (dev); ++} ++END_TEST ++ + int + main (int argc, char **argv) + { +@@ -61,6 +89,7 @@ main (int argc, char **argv) + int number_failed; + Suite* suite = suite_create ("Partition Flags"); + TCase* tcase_gpt = tcase_create ("GPT"); ++ TCase* tcase_msdos = tcase_create ("MSDOS"); + + /* Fail when an exception is raised */ + ped_exception_set_handler (_test_exception_handler); +@@ -71,6 +100,12 @@ main (int argc, char **argv) + tcase_set_timeout (tcase_gpt, 0); + suite_add_tcase (suite, tcase_gpt); + ++ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk); ++ tcase_add_test (tcase_msdos, test_msdos_flag); ++ /* Disable timeout for this test */ ++ tcase_set_timeout (tcase_msdos, 0); ++ suite_add_tcase (suite, tcase_msdos); ++ + SRunner* srunner = srunner_create (suite); + srunner_run_all (srunner, CK_VERBOSE); + +-- +2.37.3 + diff --git a/0013-show-GPT-UUIDs-in-JSON-output.patch b/0013-show-GPT-UUIDs-in-JSON-output.patch new file mode 100644 index 0000000..31518b5 --- /dev/null +++ b/0013-show-GPT-UUIDs-in-JSON-output.patch @@ -0,0 +1,351 @@ +From 2194035fc0fe678472d279676a13511769f7ef20 Mon Sep 17 00:00:00 2001 +From: Arvin Schnell +Date: Thu, 28 Jul 2022 09:20:09 +0000 +Subject: [PATCH 13/13] show GPT UUIDs in JSON output + +Include GPT UUIDs in JSON output. +--- + include/parted/disk.in.h | 13 ++++++-- + libparted/disk.c | 64 ++++++++++++++++++++++++++++++++++++++++ + libparted/labels/gpt.c | 40 ++++++++++++++++++++++++- + parted/parted.c | 18 +++++++++++ + tests/t0800-json-gpt.sh | 7 +++-- + tests/t0900-type-gpt.sh | 8 +++-- + 6 files changed, 142 insertions(+), 8 deletions(-) + +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index 715637d..f649bcc 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -98,10 +98,12 @@ enum _PedDiskTypeFeature { + PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ + PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ + PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ ++ PED_DISK_TYPE_DISK_UUID=16, /**< supports disk uuids */ ++ PED_DISK_TYPE_PARTITION_UUID=32, /**< supports partition uuids */ + }; + // NOTE: DO NOT define using enums +-#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED +-#define PED_DISK_TYPE_LAST_FEATURE 8 // PED_DISK_TYPE_PARTITION_TYPE_UUID ++#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED ++#define PED_DISK_TYPE_LAST_FEATURE 32 // PED_DISK_TYPE_PARTITION_UUID + + struct _PedDisk; + struct _PedPartition; +@@ -228,6 +230,7 @@ struct _PedDiskOps { + int (*disk_is_flag_available) ( + const PedDisk *disk, + PedDiskFlag flag); ++ uint8_t* (*disk_get_uuid) (const PedDisk* disk); + /** \todo add label guessing op here */ + + /* partition operations */ +@@ -260,6 +263,8 @@ struct _PedDiskOps { + int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid); + uint8_t* (*partition_get_type_uuid) (const PedPartition* part); + ++ uint8_t* (*partition_get_uuid) (const PedPartition* part); ++ + int (*partition_align) (PedPartition* part, + const PedConstraint* constraint); + int (*partition_enumerate) (PedPartition* part); +@@ -331,6 +336,8 @@ extern int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state); + extern int ped_disk_get_flag(const PedDisk *disk, PedDiskFlag flag); + extern int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag); + ++extern uint8_t* ped_disk_get_uuid (const PedDisk* disk); ++ + extern const char *ped_disk_flag_get_name(PedDiskFlag flag); + extern PedDiskFlag ped_disk_flag_get_by_name(const char *name); + extern PedDiskFlag ped_disk_flag_next(PedDiskFlag flag) _GL_ATTRIBUTE_CONST; +@@ -367,6 +374,8 @@ extern uint8_t ped_partition_get_type_id (const PedPartition* part); + extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid); + extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part); + ++extern uint8_t* ped_partition_get_uuid (const PedPartition* part); ++ + extern int ped_partition_is_busy (const PedPartition* part); + extern char* ped_partition_get_path (const PedPartition* part); + +diff --git a/libparted/disk.c b/libparted/disk.c +index a961d65..0ed3d91 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -886,6 +886,37 @@ ped_disk_flag_next(PedDiskFlag flag) + return (flag + 1) % (PED_DISK_LAST_FLAG + 1); + } + ++static int ++_assert_disk_uuid_feature (const PedDiskType* disk_type) ++{ ++ if (!ped_disk_type_check_feature ( ++ disk_type, PED_DISK_TYPE_DISK_UUID)) { ++ ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_CANCEL, ++ "%s disk labels do not support disk uuids.", ++ disk_type->name); ++ return 0; ++ } ++ return 1; ++} ++ ++/** ++ * Get the uuid of the disk \p disk. This will only work if the disk label ++ * supports it. ++ */ ++uint8_t* ++ped_disk_get_uuid (const PedDisk *disk) ++{ ++ PED_ASSERT (disk != NULL); ++ ++ if (!_assert_disk_uuid_feature (disk->type)) ++ return NULL; ++ ++ PED_ASSERT (disk->type->ops->disk_get_uuid != NULL); ++ return disk->type->ops->disk_get_uuid (disk); ++} ++ + /** + * \internal We turned a really nasty bureaucracy problem into an elegant maths + * problem :-) Basically, there are some constraints to a partition's +@@ -1488,6 +1519,21 @@ _assert_partition_type_uuid_feature (const PedDiskType* disk_type) + return 1; + } + ++static int ++_assert_partition_uuid_feature (const PedDiskType* disk_type) ++{ ++ if (!ped_disk_type_check_feature ( ++ disk_type, PED_DISK_TYPE_PARTITION_UUID)) { ++ ped_exception_throw ( ++ PED_EXCEPTION_ERROR, ++ PED_EXCEPTION_CANCEL, ++ "%s disk labels do not support partition uuids.", ++ disk_type->name); ++ return 0; ++ } ++ return 1; ++} ++ + /** + * Sets the name of a partition. + * +@@ -1612,6 +1658,24 @@ ped_partition_get_type_uuid (const PedPartition *part) + return part->disk->type->ops->partition_get_type_uuid (part); + } + ++/** ++ * Get the uuid of the partition \p part. This will only work if the disk label ++ * supports it. ++ */ ++uint8_t* ++ped_partition_get_uuid (const PedPartition *part) ++{ ++ PED_ASSERT (part != NULL); ++ PED_ASSERT (part->disk != NULL); ++ PED_ASSERT (ped_partition_is_active (part)); ++ ++ if (!_assert_partition_uuid_feature (part->disk->type)) ++ return NULL; ++ ++ PED_ASSERT (part->disk->type->ops->partition_get_uuid != NULL); ++ return part->disk->type->ops->partition_get_uuid (part); ++} ++ + /** @} */ + + /** +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 8e6a37d..1993863 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -1576,6 +1576,24 @@ gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag) + } + } + ++static uint8_t* ++gpt_disk_get_uuid (const PedDisk *disk) ++{ ++ GPTDiskData *gpt_disk_data = disk->disk_specific; ++ ++ efi_guid_t uuid = gpt_disk_data->uuid; ++ ++ /* uuid is always LE, while uint8_t is always kind of BE */ ++ ++ uuid.time_low = PED_SWAP32(uuid.time_low); ++ uuid.time_mid = PED_SWAP16(uuid.time_mid); ++ uuid.time_hi_and_version = PED_SWAP16(uuid.time_hi_and_version); ++ ++ uint8_t *buf = ped_malloc(sizeof (uuid_t)); ++ memcpy(buf, &uuid, sizeof (uuid_t)); ++ return buf; ++} ++ + static int + gpt_disk_get_flag (const PedDisk *disk, PedDiskFlag flag) + { +@@ -1764,6 +1782,23 @@ gpt_partition_get_type_uuid (const PedPartition *part) + return buf; + } + ++static uint8_t* ++gpt_partition_get_uuid (const PedPartition *part) ++{ ++ const GPTPartitionData *gpt_part_data = part->disk_specific; ++ ++ efi_guid_t uuid = gpt_part_data->uuid; ++ ++ /* uuid is always LE, while uint8_t is always kind of BE */ ++ ++ uuid.time_low = PED_SWAP32(uuid.time_low); ++ uuid.time_mid = PED_SWAP16(uuid.time_mid); ++ uuid.time_hi_and_version = PED_SWAP16(uuid.time_hi_and_version); ++ ++ uint8_t *buf = ped_malloc(sizeof (uuid_t)); ++ memcpy(buf, &uuid, sizeof (uuid_t)); ++ return buf; ++} + + static int + gpt_get_max_primary_partition_count (const PedDisk *disk) +@@ -1864,9 +1899,11 @@ static PedDiskOps gpt_disk_ops = + partition_get_type_id: NULL, + partition_set_type_uuid: gpt_partition_set_type_uuid, + partition_get_type_uuid: gpt_partition_get_type_uuid, ++ partition_get_uuid: gpt_partition_get_uuid, + disk_set_flag: gpt_disk_set_flag, + disk_get_flag: gpt_disk_get_flag, + disk_is_flag_available: gpt_disk_is_flag_available, ++ disk_get_uuid: gpt_disk_get_uuid, + + PT_op_function_initializers (gpt) + }; +@@ -1876,7 +1913,8 @@ static PedDiskType gpt_disk_type = + next: NULL, + name: "gpt", + ops: &gpt_disk_ops, +- features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID ++ features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID | ++ PED_DISK_TYPE_DISK_UUID | PED_DISK_TYPE_PARTITION_UUID + }; + + void +diff --git a/parted/parted.c b/parted/parted.c +index 36c39c7..84187b7 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -1215,6 +1215,14 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) + ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); + ul_jsonwrt_value_s (&json, "label", pt_name); + if (diskp) { ++ bool has_disk_uuid = ped_disk_type_check_feature (diskp->type, PED_DISK_TYPE_DISK_UUID); ++ if (has_disk_uuid) { ++ uint8_t* uuid = ped_disk_get_uuid (diskp); ++ static char buf[UUID_STR_LEN]; ++ uuid_unparse_lower (uuid, buf); ++ ul_jsonwrt_value_s (&json, "uuid", buf); ++ free (uuid); ++ } + ul_jsonwrt_value_u64 (&json, "max-partitions", + ped_disk_get_max_primary_partition_count(diskp)); + disk_print_flags_json (diskp); +@@ -1360,6 +1368,8 @@ do_print (PedDevice** dev, PedDisk** diskp) + PED_DISK_TYPE_PARTITION_TYPE_ID); + bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, + PED_DISK_TYPE_PARTITION_TYPE_UUID); ++ bool has_part_uuid = ped_disk_type_check_feature ((*diskp)->type, ++ PED_DISK_TYPE_PARTITION_UUID); + + PedPartition* part; + if (opt_output_mode == HUMAN) { +@@ -1512,6 +1522,14 @@ do_print (PedDevice** dev, PedDisk** diskp) + free (type_uuid); + } + ++ if (has_part_uuid) { ++ uint8_t* uuid = ped_partition_get_uuid (part); ++ static char buf[UUID_STR_LEN]; ++ uuid_unparse_lower (uuid, buf); ++ ul_jsonwrt_value_s (&json, "uuid", buf); ++ free (uuid); ++ } ++ + if (has_name) { + name = ped_partition_get_name (part); + if (strcmp (name, "") != 0) +diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh +index 354c0bd..f6a3fb9 100755 +--- a/tests/t0800-json-gpt.sh ++++ b/tests/t0800-json-gpt.sh +@@ -32,8 +32,8 @@ parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1 + parted --script "$dev" mkpart "test2" xfs 20% 60% > out 2>&1 || fail=1 + parted --script "$dev" set 2 raid on > out 2>&1 || fail=1 + +-# print with json format +-parted --script --json "$dev" unit s print free > out 2>&1 || fail=1 ++# print with json format, replace non-deterministic uuids ++parted --script --json "$dev" unit s print free | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": ""/' > out 2>&1 || fail=1 + + cat < exp || fail=1 + { +@@ -45,6 +45,7 @@ cat < exp || fail=1 + "logical-sector-size": 512, + "physical-sector-size": 512, + "label": "gpt", ++ "uuid": "", + "max-partitions": 128, + "flags": [ + "pmbr_boot" +@@ -63,6 +64,7 @@ cat < exp || fail=1 + "size": "10240s", + "type": "primary", + "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4", ++ "uuid": "", + "name": "test1" + },{ + "number": 2, +@@ -71,6 +73,7 @@ cat < exp || fail=1 + "size": "40960s", + "type": "primary", + "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e", ++ "uuid": "", + "name": "test2", + "flags": [ + "raid" +diff --git a/tests/t0900-type-gpt.sh b/tests/t0900-type-gpt.sh +index 2014820..03febba 100755 +--- a/tests/t0900-type-gpt.sh ++++ b/tests/t0900-type-gpt.sh +@@ -32,8 +32,8 @@ parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 + # set type-uuid + parted --script "$dev" type 1 "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" || fail=1 + +-# print with json format +-parted --script --json "$dev" unit s print > out 2>&1 || fail=1 ++# print with json format, replace non-deterministic uuids ++parted --script --json "$dev" unit s print | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": ""/' > out 2>&1 || fail=1 + + cat < exp || fail=1 + { +@@ -45,6 +45,7 @@ cat < exp || fail=1 + "logical-sector-size": 512, + "physical-sector-size": 512, + "label": "gpt", ++ "uuid": "", + "max-partitions": 128, + "partitions": [ + { +@@ -53,7 +54,8 @@ cat < exp || fail=1 + "end": "20479s", + "size": "10240s", + "type": "primary", +- "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" ++ "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f", ++ "uuid": "" + } + ] + } +-- +2.37.3 + diff --git a/0014-gpt-Add-no_automount-partition-flag.patch b/0014-gpt-Add-no_automount-partition-flag.patch new file mode 100644 index 0000000..66d16eb --- /dev/null +++ b/0014-gpt-Add-no_automount-partition-flag.patch @@ -0,0 +1,145 @@ +From 55e4775c989af42d629401b9aa22c60ba2993e7d Mon Sep 17 00:00:00 2001 +From: Mike Fleetwood +Date: Tue, 13 Dec 2022 12:53:07 +0000 +Subject: [PATCH] gpt: Add no_automount partition flag + +Add user requested support for GPT partition type attribute bit 63 [1] +so the no-auto flag in the systemd originated Discoverable Partitions +Specification [2] can be manipulated. The UEFI specification [3] says +partition attribute bits 48 to 63 are partition type specific, however +the DPS [2] and Microsoft [4] use the bit 63 to mean no automounting / +assign no drive letter and apply it to multiple partition types so don't +restrict its application. + +[1] Request for GPT partition attribute bit 63 "no automount" editing + support + https://gitlab.gnome.org/GNOME/gparted/-/issues/214 +[2] The Discoverable Partitions Specification (DPS), + Partition Attribute Flags + https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ +[3] UEFI Specification, version 2.8, + Table 24. Defined GPT Partition Entry - Attributes + https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf +[4] CREATE_PARTITION_PARAMETERS structure (vds.h) + https://learn.microsoft.com/en-gb/windows/win32/api/vds/ns-vds-create_partition_parameters + +Signed-off-by: Mike Fleetwood +Signed-off-by: Brian C. Lane +--- + NEWS | 2 ++ + doc/C/parted.8 | 2 +- + include/parted/disk.in.h | 3 ++- + libparted/disk.c | 2 ++ + libparted/labels/gpt.c | 12 ++++++++++-- + 5 files changed, 17 insertions(+), 4 deletions(-) + +diff --git a/NEWS b/NEWS +index 099f8bd..ac759fe 100644 +--- a/NEWS ++++ b/NEWS +@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*- + + ** New Features + ++ Support GPT partition attribute bit 63 as no_automount flag. ++ + Add type commands to set type-id on MS-DOS and type-uuid on GPT. + + * Noteworthy changes in release 3.5 (2022-04-18) [stable] +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index ab34be7..3069c33 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -120,7 +120,7 @@ or an LVM logical volume if necessary. + Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. + Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", + "legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home", +-"bios_grub", and "palo". ++"no_automount", "bios_grub", and "palo". + \fIstate\fP should be either "on" or "off". + .TP + .B unit \fIunit\fP +diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h +index f649bcc..402d78a 100644 +--- a/include/parted/disk.in.h ++++ b/include/parted/disk.in.h +@@ -88,10 +88,11 @@ enum _PedPartitionFlag { + PED_PARTITION_CHROMEOS_KERNEL=19, + PED_PARTITION_BLS_BOOT=20, + PED_PARTITION_LINUX_HOME=21, ++ PED_PARTITION_NO_AUTOMOUNT=22, + }; + // NOTE: DO NOT define using enums + #define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME ++#define PED_PARTITION_LAST_FLAG 22 // PED_PARTITION_NO_AUTOMOUNT + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +diff --git a/libparted/disk.c b/libparted/disk.c +index 0ed3d91..45f35fd 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -2579,6 +2579,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) + return N_("bls_boot"); + case PED_PARTITION_LINUX_HOME: + return N_("linux-home"); ++ case PED_PARTITION_NO_AUTOMOUNT: ++ return N_("no_automount"); + + default: + ped_exception_throw ( +diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c +index 1993863..780fb70 100644 +--- a/libparted/labels/gpt.c ++++ b/libparted/labels/gpt.c +@@ -252,7 +252,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t + uint64_t NoBlockIOProtocol:1; + uint64_t LegacyBIOSBootable:1; + uint64_t Reserved:45; +- uint64_t GuidSpecific:16; ++ uint64_t GuidSpecific:15; ++ uint64_t NoAutomount:1; + #else + # warning "Using crippled partition entry type" + uint32_t RequiredToFunction:1; +@@ -260,7 +261,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t + uint32_t LegacyBIOSBootable:1; + uint32_t Reserved:30; + uint32_t LOST:5; +- uint32_t GuidSpecific:16; ++ uint32_t GuidSpecific:15; ++ uint32_t NoAutomount:1; + #endif + }; + +@@ -1637,6 +1639,9 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + case PED_PARTITION_LEGACY_BOOT: + gpt_part_data->attributes.LegacyBIOSBootable = state; + return 1; ++ case PED_PARTITION_NO_AUTOMOUNT: ++ gpt_part_data->attributes.NoAutomount = state; ++ return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: + default: +@@ -1662,6 +1667,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) + return gpt_part_data->attributes.RequiredToFunction; + case PED_PARTITION_LEGACY_BOOT: + return gpt_part_data->attributes.LegacyBIOSBootable; ++ case PED_PARTITION_NO_AUTOMOUNT: ++ return gpt_part_data->attributes.NoAutomount; + case PED_PARTITION_LBA: + case PED_PARTITION_ROOT: + default: +@@ -1681,6 +1688,7 @@ gpt_partition_is_flag_available (const PedPartition *part, + { + case PED_PARTITION_HIDDEN: + case PED_PARTITION_LEGACY_BOOT: ++ case PED_PARTITION_NO_AUTOMOUNT: + return 1; + case PED_PARTITION_ROOT: + case PED_PARTITION_LBA: +-- +2.38.1 + diff --git a/0015-tests-XFS-requires-a-minimum-size-of-300M.patch b/0015-tests-XFS-requires-a-minimum-size-of-300M.patch new file mode 100644 index 0000000..48e0e87 --- /dev/null +++ b/0015-tests-XFS-requires-a-minimum-size-of-300M.patch @@ -0,0 +1,54 @@ +From caa588269709659d5cf51bf64c559e193f371de4 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 13 Dec 2022 14:38:24 -0800 +Subject: [PATCH] tests: XFS requires a minimum size of 300M + +--- + tests/t1700-probe-fs.sh | 3 ++- + tests/t4100-dvh-partition-limits.sh | 2 +- + tests/t4100-msdos-partition-limits.sh | 2 +- + 3 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index d33606e..f8af74e 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -42,7 +42,8 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do + # create an $type file system, creation failures are not parted bugs, + # skip the filesystem instead of failing the test. + if [ "$type" = "xfs" ]; then +- mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || { warn_ "$ME: mkfs.$type failed, skipping"; continue; } ++ # XFS requires at least 300M which is > 1024 sectors with 8192b sector size ++ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=300m || { warn_ "$ME: mkfs.$type failed, skipping"; continue; } + else + dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; } + mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; } +diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh +index d3798d2..a5b3516 100755 +--- a/tests/t4100-dvh-partition-limits.sh ++++ b/tests/t4100-dvh-partition-limits.sh +@@ -37,7 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-mkfs.xfs -dfile,name=$fs,size=100m || fail=1 ++mkfs.xfs -dfile,name=$fs,size=300m || fail=1 + mkdir "$mp" || fail=1 + + # Unmount upon interrupt, failure, etc., as well as upon normal completion. +diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh +index b591123..09267b5 100755 +--- a/tests/t4100-msdos-partition-limits.sh ++++ b/tests/t4100-msdos-partition-limits.sh +@@ -37,7 +37,7 @@ mp=`pwd`/mount-point + n=4096 + + # create an XFS file system +-mkfs.xfs -dfile,name=$fs,size=100m || fail=1 ++mkfs.xfs -dfile,name=$fs,size=300m || fail=1 + mkdir "$mp" || fail=1 + + # Unmount upon interrupt, failure, etc., as well as upon normal completion. +-- +2.38.1 + diff --git a/parted.spec b/parted.spec index ea6c27d..f2d6583 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -16,12 +16,16 @@ Patch0002: 0002-parted-add-type-command.patch Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch Patch0005: 0005-tests-t3200-type-change-now-passes.patch -Patch0006: 0006-disk.in.h-Remove-use-of-enums-with-define.patch -Patch0007: 0007-libparted-Fix-handling-of-gpt-partition-types.patch -Patch0008: 0008-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch -Patch0009: 0009-libparted-Fix-handling-of-msdos-partition-types.patch +Patch0006: 0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch +Patch0007: 0007-parted-Simplify-code-for-json-output.patch +Patch0008: 0008-disk.in.h-Remove-use-of-enums-with-define.patch +Patch0009: 0009-libparted-Fix-handling-of-gpt-partition-types.patch Patch0010: 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch - +Patch0011: 0011-libparted-Fix-handling-of-msdos-partition-types.patch +Patch0012: 0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +Patch0013: 0013-show-GPT-UUIDs-in-JSON-output.patch +Patch0014: 0014-gpt-Add-no_automount-partition-flag.patch +Patch0015: 0015-tests-XFS-requires-a-minimum-size-of-300M.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -126,7 +130,14 @@ make check %changelog -* Mon Aug 08 2022 Brian C. Lane - 3.5-5.bcl.1 +* Wed Dec 14 2022 Brian C. Lane - 3.5-7 +- libparted: Fix handling of msdos partition types +- tests: Add a libparted test for ped_partition_set_system on msdos +- parted: Add display of GPT UUIDs in JSON output +- Add no_automount flag support +- increase xfs size to 300M + +* Mon Aug 08 2022 Brian C. Lane - 3.5-6 - Fix ped_partition_set_system handling of existing flags * Thu Aug 04 2022 Brian C. Lane - 3.5-5 From d2e6c54e3e6a04c5829997e3e8e0b451ec78a6e4 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 14 Dec 2022 15:45:52 -0800 Subject: [PATCH 40/60] tests: Add gating.yaml so tests will be required --- gating.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gating.yaml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..0c1cc35 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - fedora-* +decision_contexts: [bodhi_update_push_stable] +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} From 270e49b9665c44e0162d813c7726471a0e776e90 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 19 Jan 2023 23:25:37 +0000 Subject: [PATCH 41/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index f2d6583..e5a144f 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -130,6 +130,9 @@ make check %changelog +* Thu Jan 19 2023 Fedora Release Engineering - 3.5-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Wed Dec 14 2022 Brian C. Lane - 3.5-7 - libparted: Fix handling of msdos partition types - tests: Add a libparted test for ped_partition_set_system on msdos From fb7cd25e733cf62ed9722d9f3dee5586402f545f Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 30 Jan 2023 15:09:42 -0800 Subject: [PATCH 42/60] SPDX migration --- parted.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parted.spec b/parted.spec index e5a144f..1ba4842 100644 --- a/parted.spec +++ b/parted.spec @@ -1,8 +1,8 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 8%{?dist} -License: GPLv3+ +Release: 9%{?dist} +License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz @@ -130,6 +130,9 @@ make check %changelog +* Mon Jan 30 2023 Brian C. Lane - 3.5-9 +- SPDX migration + * Thu Jan 19 2023 Fedora Release Engineering - 3.5-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From dc75c40906570c4e1bac7c56fa2b942a6dcd9ab3 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 7 Feb 2023 16:44:57 -0800 Subject: [PATCH 43/60] - libparted: Fix problem with creating 1s partitions - tests: Fixing libparted test framework usage --- ...-problem-with-creating-1s-partitions.patch | 133 +++++++++ ...ixing-libparted-test-framework-usage.patch | 262 ++++++++++++++++++ parted.spec | 8 +- 3 files changed, 402 insertions(+), 1 deletion(-) create mode 100644 0016-libparted-Fix-problem-with-creating-1s-partitions.patch create mode 100644 0017-tests-Fixing-libparted-test-framework-usage.patch diff --git a/0016-libparted-Fix-problem-with-creating-1s-partitions.patch b/0016-libparted-Fix-problem-with-creating-1s-partitions.patch new file mode 100644 index 0000000..1cab2e6 --- /dev/null +++ b/0016-libparted-Fix-problem-with-creating-1s-partitions.patch @@ -0,0 +1,133 @@ +From 9b009985da2e5eee5b5c179acfafab3aa1624f8b Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 10 May 2022 15:04:12 -0700 +Subject: [PATCH 16/17] libparted: Fix problem with creating 1s partitions + +There was a 1-off error in _partition_get_overlap_constraint that +prevented partitions from being created in 1s free space. You could +create 1s partitions as long they were done in order, but not after +leaving 'holes'. + +This fixes this and adds tests for it on msdos and gpt disklabels. +--- + libparted/disk.c | 2 +- + tests/Makefile.am | 2 ++ + tests/t9024-msdos-1s-partition.sh | 36 +++++++++++++++++++++++++++++++ + tests/t9025-gpt-1s-partition.sh | 36 +++++++++++++++++++++++++++++++ + 4 files changed, 75 insertions(+), 1 deletion(-) + create mode 100644 tests/t9024-msdos-1s-partition.sh + create mode 100644 tests/t9025-gpt-1s-partition.sh + +diff --git a/libparted/disk.c b/libparted/disk.c +index 45f35fd..e1a3489 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -1960,7 +1960,7 @@ _partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom) + if (walk) + max_end = walk->geom.start - 1; + +- if (min_start >= max_end) ++ if (min_start > max_end) + return NULL; + + ped_geometry_init (&free_space, part->disk->dev, +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 1d109d7..fa27b44 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -91,6 +91,8 @@ TESTS = \ + t9021-maxima.sh \ + t9022-one-unit-snap.sh \ + t9023-value-lt-one.sh \ ++ t9024-msdos-1s-partition.sh \ ++ t9025-gpt-1s-partition.sh \ + t9030-align-check.sh \ + t9040-many-partitions.sh \ + t9041-undetected-in-use-16th-partition.sh \ +diff --git a/tests/t9024-msdos-1s-partition.sh b/tests/t9024-msdos-1s-partition.sh +new file mode 100644 +index 0000000..7115156 +--- /dev/null ++++ b/tests/t9024-msdos-1s-partition.sh +@@ -0,0 +1,36 @@ ++#!/bin/sh ++# Test creating 1s partitions in 1s free space ++ ++# Copyright (C) 2022 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++dev=loop-file ++ ++# create device ++truncate --size 10MiB "$dev" || fail=1 ++ ++# create msdos label and some partitions with 1s free space between ++parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 ++parted --script "$dev" mkpart primary ext4 64s 128s > out 2>&1 || fail=1 ++parted --script "$dev" mkpart primary ext4 130s 200s > out 2>&1 || fail=1 ++parted --script "$dev" u s p free ++ ++# Free space is at 129s ++parted --script "$dev" mkpart primary ext4 129s 129s > out 2>&1 || fail=1 ++parted --script "$dev" u s p free ++ ++Exit $fail +diff --git a/tests/t9025-gpt-1s-partition.sh b/tests/t9025-gpt-1s-partition.sh +new file mode 100644 +index 0000000..c97ab8b +--- /dev/null ++++ b/tests/t9025-gpt-1s-partition.sh +@@ -0,0 +1,36 @@ ++#!/bin/sh ++# Test creating 1s partitions in 1s free space ++ ++# Copyright (C) 2022 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++dev=loop-file ++ ++# create device ++truncate --size 10MiB "$dev" || fail=1 ++ ++# create msdos label and some partitions with 1s free space between ++parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 ++parted --script "$dev" mkpart p1 ext4 64s 128s > out 2>&1 || fail=1 ++parted --script "$dev" mkpart p2 ext4 130s 200s > out 2>&1 || fail=1 ++parted --script "$dev" u s p free ++ ++# Free space is at 129s ++parted --script "$dev" mkpart p3 ext4 129s 129s > out 2>&1 || fail=1 ++parted --script "$dev" u s p free ++ ++Exit $fail +-- +2.39.1 + diff --git a/0017-tests-Fixing-libparted-test-framework-usage.patch b/0017-tests-Fixing-libparted-test-framework-usage.patch new file mode 100644 index 0000000..86f0705 --- /dev/null +++ b/0017-tests-Fixing-libparted-test-framework-usage.patch @@ -0,0 +1,262 @@ +From 7b555132be63172a2d621afcdedfa7797185d3b5 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 7 Feb 2023 09:31:42 -0800 +Subject: [PATCH 17/17] tests: Fixing libparted test framework usage + +The fail and fail_if functions from libcheck are deprecated, replace +them with ck_abort_msg and ck_assert_msg. Note that the logic of assert +is the opposite of fail_if. +--- + libparted/tests/common.c | 8 ++++---- + libparted/tests/disk.c | 6 +++--- + libparted/tests/flags.c | 6 +++--- + libparted/tests/label.c | 14 ++++++-------- + libparted/tests/symlink.c | 31 +++++++++++++++++++++---------- + libparted/tests/volser.c | 2 +- + libparted/tests/zerolen.c | 2 +- + 7 files changed, 39 insertions(+), 30 deletions(-) + +diff --git a/libparted/tests/common.c b/libparted/tests/common.c +index 2be0e3a..8c42ece 100644 +--- a/libparted/tests/common.c ++++ b/libparted/tests/common.c +@@ -27,7 +27,7 @@ size_t get_sector_size (void) + PedExceptionOption + _test_exception_handler (PedException* e) + { +- fail ("Exception of type %s has been raised: %s", ++ ck_abort_msg("Exception of type %s has been raised: %s", + ped_exception_get_type_string (e->type), + e->message); + +@@ -69,10 +69,10 @@ _create_disk_label (PedDevice *dev, PedDiskType *type) + + /* Create the label */ + disk = ped_disk_new_fresh (dev, type); +- fail_if (!disk, "Failed to create a label of type: %s", ++ ck_assert_msg(disk != NULL, "Failed to create a label of type: %s", + type->name); +- fail_if (!ped_disk_commit(disk), +- "Failed to commit label to device"); ++ ck_assert_msg(ped_disk_commit(disk) != 0, ++ "Failed to commit label to device"); + + return disk; + } +diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c +index 62d20c1..f7b16a5 100644 +--- a/libparted/tests/disk.c ++++ b/libparted/tests/disk.c +@@ -14,7 +14,7 @@ static void + create_disk (void) + { + temporary_disk = _create_disk (get_sector_size () * 4 * 10 * 1024); +- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); + } + + static void +@@ -72,8 +72,8 @@ START_TEST (test_duplicate) + part = ped_disk_get_partition (disk, *i); + part_dup = ped_disk_get_partition (disk_dup, *i); + +- fail_if (part->geom.start != part_dup->geom.start || +- part->geom.end != part_dup->geom.end, ++ ck_assert_msg(part->geom.start == part_dup->geom.start && ++ part->geom.end == part_dup->geom.end, + "Duplicated partition %d doesn't match. " + "Details are start: %d/%d end: %d/%d\n", + *i, part->geom.start, part_dup->geom.start, +diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c +index c4b290b..ff4ae71 100644 +--- a/libparted/tests/flags.c ++++ b/libparted/tests/flags.c +@@ -16,7 +16,7 @@ static void + create_disk (void) + { + temporary_disk = _create_disk (80 * 1024 * 1024); +- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); + } + + static void +@@ -47,7 +47,7 @@ START_TEST (test_gpt_flag) + + // Check flag to confirm it is still set + part = ped_disk_get_partition (disk, 1); +- fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); ++ ck_assert_msg(ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) == 1, "BIOS_GRUB flag not set"); + + ped_disk_destroy (disk); + ped_device_destroy (dev); +@@ -75,7 +75,7 @@ START_TEST (test_msdos_flag) + + // Check flag to confirm it is still set + part = ped_disk_get_partition (disk, 1); +- fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); ++ ck_assert_msg(ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) == 1, "BLS_BOOT flag not set"); + + ped_disk_destroy (disk); + ped_device_destroy (dev); +diff --git a/libparted/tests/label.c b/libparted/tests/label.c +index e0d63c7..67b1b07 100644 +--- a/libparted/tests/label.c ++++ b/libparted/tests/label.c +@@ -16,7 +16,7 @@ static void + create_disk (void) + { + temporary_disk = _create_disk (80 * 1024 * 1024); +- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); + } + + static void +@@ -72,12 +72,11 @@ START_TEST (test_probe_label) + + /* Try to probe the disk label. */ + probed = ped_disk_probe (dev); +- fail_if (!probed, ++ ck_assert_msg(probed, + "Failed to probe the just created label of type: %s", + type->name); + if (probed && !STREQ (probed->name, type->name)) +- fail_if (1, +- "Probe returned label of type: %s as type: %s", ++ ck_abort_msg("Probe returned label of type: %s as type: %s", + type->name, probed->name); + } + ped_device_destroy (dev); +@@ -105,12 +104,11 @@ START_TEST (test_read_label) + + /* Try to read the disk label. */ + disk = ped_disk_new (dev); +- fail_if (!disk, ++ ck_assert_msg(disk, + "Failed to read the just created label of type: %s", + type->name); + if (disk && !STREQ (disk->type->name, type->name)) +- fail_if (1, +- "Read returned label of type: %s as type: %s", ++ ck_abort_msg("Read returned label of type: %s as type: %s", + type->name, disk->type->name); + + ped_disk_destroy (disk); +@@ -138,7 +136,7 @@ START_TEST (test_clone_label) + + /* Try to clone the disk label. */ + PedDisk* clone = ped_disk_duplicate (disk); +- fail_if (!clone, ++ ck_assert_msg(clone, + "Failed to clone the just created label of type: %s", + type->name); + +diff --git a/libparted/tests/symlink.c b/libparted/tests/symlink.c +index 52e99ca..da6bef8 100644 +--- a/libparted/tests/symlink.c ++++ b/libparted/tests/symlink.c +@@ -30,7 +30,7 @@ static void + create_disk (void) + { + temporary_disk = _create_disk (4096 * 1024); +- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); ++ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); + } + + static void +@@ -45,7 +45,7 @@ START_TEST (test_symlink) + char cwd[256], ln[256] = "/dev/mapper/parted-test-XXXXXX"; + + if (!getcwd (cwd, sizeof cwd)) { +- fail ("Could not get cwd"); ++ ck_abort_msg("Could not get cwd"); + return; + } + +@@ -53,7 +53,7 @@ START_TEST (test_symlink) + temporary disk */ + int tmp_fd = mkstemp (ln); + if (tmp_fd == -1) { +- fail ("Could not create tempfile"); ++ ck_abort_msg("Could not create tempfile"); + return; + } + +@@ -62,11 +62,17 @@ START_TEST (test_symlink) + close (tmp_fd); + unlink (ln); + char temp_disk_path[256]; +- snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", cwd, +- temporary_disk); ++ int r = snprintf(temp_disk_path, sizeof temp_disk_path, "%s/%s", ++ cwd, ++ temporary_disk); ++ if (r < 0 || r >= sizeof temp_disk_path) { ++ ck_abort_msg("symlink truncated"); ++ return; ++ } ++ + int res = symlink (temp_disk_path, ln); + if (res) { +- fail ("could not create symlink"); ++ ck_abort_msg("could not create symlink"); + return; + } + +@@ -77,7 +83,7 @@ START_TEST (test_symlink) + /* Create a second temporary_disk */ + char *temporary_disk2 = _create_disk (4096 * 1024); + if (temporary_disk2 == NULL) { +- fail ("Failed to create 2nd temporary disk"); ++ ck_abort_msg("Failed to create 2nd temporary disk"); + goto exit_destroy_dev; + } + +@@ -89,11 +95,16 @@ START_TEST (test_symlink) + + /* Update symlink to point to our new / second temporary disk */ + unlink (ln); +- snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", cwd, +- temporary_disk); ++ r = snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", ++ cwd, temporary_disk); ++ if (r < 0 || r >= sizeof temp_disk_path) { ++ ck_abort_msg("2nd symlink truncated"); ++ goto exit_destroy_dev; ++ } ++ + res = symlink (temp_disk_path, ln); + if (res) { +- fail ("could not create 2nd symlink"); ++ ck_abort_msg("could not create 2nd symlink"); + goto exit_destroy_dev; + } + +diff --git a/libparted/tests/volser.c b/libparted/tests/volser.c +index c6efa5f..4b6e2d1 100644 +--- a/libparted/tests/volser.c ++++ b/libparted/tests/volser.c +@@ -34,7 +34,7 @@ static void set_test (void) + type = ped_disk_type_get ("dasd"); + + tmp_disk = _create_disk (20*1024*1024); +- fail_if (tmp_disk == NULL, "Failed to create temporary disk"); ++ ck_assert_msg(tmp_disk != NULL, "Failed to create temporary disk"); + dev = ped_device_get (tmp_disk); + if (dev == NULL) + return; +diff --git a/libparted/tests/zerolen.c b/libparted/tests/zerolen.c +index cf2bd1c..2d9b424 100644 +--- a/libparted/tests/zerolen.c ++++ b/libparted/tests/zerolen.c +@@ -28,7 +28,7 @@ main (int argc, char **argv) + TCase* tcase_probe = tcase_create ("Probe"); + + if (argc < 2) { +- fail ("Insufficient arguments"); ++ ck_abort_msg("Insufficient arguments"); + return EXIT_FAILURE; + } + temporary_disk = argv[1]; +-- +2.39.1 + diff --git a/parted.spec b/parted.spec index 1ba4842..9a2cd2c 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 9%{?dist} +Release: 10%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -26,6 +26,8 @@ Patch0012: 0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch Patch0013: 0013-show-GPT-UUIDs-in-JSON-output.patch Patch0014: 0014-gpt-Add-no_automount-partition-flag.patch Patch0015: 0015-tests-XFS-requires-a-minimum-size-of-300M.patch +Patch0016: 0016-libparted-Fix-problem-with-creating-1s-partitions.patch +Patch0017: 0017-tests-Fixing-libparted-test-framework-usage.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -130,6 +132,10 @@ make check %changelog +* Tue Feb 07 2023 Brian C. Lane - 3.5-9.bcl.1 +- libparted: Fix problem with creating 1s partitions +- tests: Fixing libparted test framework usage + * Mon Jan 30 2023 Brian C. Lane - 3.5-9 - SPDX migration From d747d1a8fec6c2f52350c41756bc72f4ad3955af Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 17 Mar 2023 16:27:05 -0700 Subject: [PATCH 44/60] - parted: Fix ending sector location when using kibi IEC suffix (bcl) - tests: Fix formatting and snprintf warnings in tests. (bcl) - ui: Add checks for prompt being NULL (bcl) - strlist: Handle realloc error in wchar_to_str (bcl) - libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl) - filesys: Check for null from close_fn (bcl) --- ...filesys-Check-for-null-from-close_fn.patch | 28 ++++ ...tential-NULL-dereference-in-ped_disk.patch | 30 ++++ ...Handle-realloc-error-in-wchar_to_str.patch | 28 ++++ ...-ui-Add-checks-for-prompt-being-NULL.patch | 50 ++++++ ...tting-and-snprintf-warnings-in-tests.patch | 46 ++++++ ...g-sector-location-when-using-kibi-IE.patch | 146 ++++++++++++++++++ parted.spec | 18 ++- 7 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 0018-filesys-Check-for-null-from-close_fn.patch create mode 100644 0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch create mode 100644 0020-strlist-Handle-realloc-error-in-wchar_to_str.patch create mode 100644 0021-ui-Add-checks-for-prompt-being-NULL.patch create mode 100644 0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch create mode 100644 0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch diff --git a/0018-filesys-Check-for-null-from-close_fn.patch b/0018-filesys-Check-for-null-from-close_fn.patch new file mode 100644 index 0000000..1793509 --- /dev/null +++ b/0018-filesys-Check-for-null-from-close_fn.patch @@ -0,0 +1,28 @@ +From c409dbf423d870ab26684cd6a6953c76c4a08d7f Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 10:04:36 -0800 +Subject: [PATCH 18/24] filesys: Check for null from close_fn + +If the filesystem type name isn't known it can return a NULL. +--- + libparted/fs/r/filesys.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c +index 9dafd71..6e795bc 100644 +--- a/libparted/fs/r/filesys.c ++++ b/libparted/fs/r/filesys.c +@@ -198,8 +198,9 @@ ped_file_system_close (PedFileSystem* fs) + { + PED_ASSERT (fs != NULL); + PedDevice *dev = fs->geom->dev; ++ close_fn_t fn = close_fn (fs->type->name); + +- if (!(close_fn (fs->type->name) (fs))) ++ if (!fn || !(fn (fs))) + goto error_close_dev; + ped_device_close (dev); + return 1; +-- +2.39.2 + diff --git a/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch b/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch new file mode 100644 index 0000000..7fb9647 --- /dev/null +++ b/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch @@ -0,0 +1,30 @@ +From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 10:13:58 -0800 +Subject: [PATCH 19/24] libparted: Fix potential NULL dereference in + ped_disk_next_partition + +--- + libparted/disk.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libparted/disk.c b/libparted/disk.c +index e1a3489..6c82877 100644 +--- a/libparted/disk.c ++++ b/libparted/disk.c +@@ -1718,8 +1718,11 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part) + return part->part_list ? part->part_list : part->next; + if (part->next) + return part->next; +- if (part->type & PED_PARTITION_LOGICAL) ++ if (part->type & PED_PARTITION_LOGICAL) { ++ if (!ped_disk_extended_partition (disk)) ++ return NULL; + return ped_disk_extended_partition (disk)->next; ++ } + return NULL; + } + +-- +2.39.2 + diff --git a/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch b/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch new file mode 100644 index 0000000..b2f9ca4 --- /dev/null +++ b/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch @@ -0,0 +1,28 @@ +From 9cb38a7444d02023d112ae8e9e38436104f75f64 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 10:32:59 -0800 +Subject: [PATCH 20/24] strlist: Handle realloc error in wchar_to_str + +It could return a NULL if the realloc fails. This handles the failure in +the same way as other failures in wchar_to_str, it exits immediately +with an error message. +--- + parted/strlist.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/parted/strlist.c b/parted/strlist.c +index 71cba59..7901789 100644 +--- a/parted/strlist.c ++++ b/parted/strlist.c +@@ -166,6 +166,8 @@ wchar_to_str (const wchar_t* str, size_t count) + goto error; + + result = realloc (result, strlen (result) + 1); ++ if (!result) ++ goto error; + return result; + + error: +-- +2.39.2 + diff --git a/0021-ui-Add-checks-for-prompt-being-NULL.patch b/0021-ui-Add-checks-for-prompt-being-NULL.patch new file mode 100644 index 0000000..4f342a2 --- /dev/null +++ b/0021-ui-Add-checks-for-prompt-being-NULL.patch @@ -0,0 +1,50 @@ +From 09c95d2feab0c087339886134dfe2dc04094348a Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 11:15:28 -0800 +Subject: [PATCH 21/24] ui: Add checks for prompt being NULL + +Also removes a cast from const char* to char* when passing to readline +that doesn't appear to be necessary any longer. + +Added asserts to make sure prompt isn't NULL after strdup and realloc +calls. +--- + parted/ui.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/parted/ui.c b/parted/ui.c +index df14e55..9e5ced2 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -564,8 +564,7 @@ _readline (const char* prompt, const StrList* possibilities) + wipe_line (); + #ifdef HAVE_LIBREADLINE + if (!opt_script_mode) { +- /* XXX: why isn't prompt const? */ +- line = readline ((char*) prompt); ++ line = readline (prompt); + if (line) + _add_history_unique (line); + } else +@@ -781,6 +780,8 @@ realloc_and_cat (char* str, const char* append) + int length = strlen (str) + strlen (append) + 1; + char* new_str = realloc (str, length); + ++ PED_ASSERT(new_str != NULL); ++ + strcat (new_str, append); + return new_str; + } +@@ -789,7 +790,9 @@ static char* + _construct_prompt (const char* head, const char* def, + const StrList* possibilities) + { ++ PED_ASSERT(head != NULL); + char* prompt = strdup (head); ++ PED_ASSERT(prompt != NULL); + + if (def && possibilities) + PED_ASSERT (str_list_match_any (possibilities, def)); +-- +2.39.2 + diff --git a/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch b/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch new file mode 100644 index 0000000..12b403c --- /dev/null +++ b/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch @@ -0,0 +1,46 @@ +From d272bb5b5343fd288a204314654a7fbaea84528d Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 15 Feb 2023 11:52:42 -0800 +Subject: [PATCH 22/24] tests: Fix formatting and snprintf warnings in tests. + +The assert message includes sector values, which are long long int, so +use the proper formatting of %lld. + +The snprintf warning complained about trying to write 258 bytes so I +bumped the buffer size up to 259. The return value is already being +checked for truncation so this is just to keep the compiler happy +without having to suppress the warning. +--- + libparted/tests/disk.c | 2 +- + libparted/tests/symlink.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c +index f7b16a5..a2e304c 100644 +--- a/libparted/tests/disk.c ++++ b/libparted/tests/disk.c +@@ -75,7 +75,7 @@ START_TEST (test_duplicate) + ck_assert_msg(part->geom.start == part_dup->geom.start && + part->geom.end == part_dup->geom.end, + "Duplicated partition %d doesn't match. " +- "Details are start: %d/%d end: %d/%d\n", ++ "Details are start: %lld/%lld end: %lld/%lld\n", + *i, part->geom.start, part_dup->geom.start, + part->geom.end, part_dup->geom.end); + } +diff --git a/libparted/tests/symlink.c b/libparted/tests/symlink.c +index da6bef8..7be02cd 100644 +--- a/libparted/tests/symlink.c ++++ b/libparted/tests/symlink.c +@@ -61,7 +61,7 @@ START_TEST (test_symlink) + here, but as /dev/mapper is root owned this is a non issue */ + close (tmp_fd); + unlink (ln); +- char temp_disk_path[256]; ++ char temp_disk_path[259]; + int r = snprintf(temp_disk_path, sizeof temp_disk_path, "%s/%s", + cwd, + temporary_disk); +-- +2.39.2 + diff --git a/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch b/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch new file mode 100644 index 0000000..dca568c --- /dev/null +++ b/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch @@ -0,0 +1,146 @@ +From 3f6b723a7d610d98afb0c9d0cfefe4700712e4db Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 3 Mar 2023 14:35:22 -0800 +Subject: [PATCH] parted: Fix ending sector location when using kibi IEC suffix + +This fixes a bug when using KiB to specify the ending location of a +partition. It was not subtracting 1s like it does with the other units +because it was looking for a 'k' not a 'K'. + +This also fixes a quirk of the suffix checking code, it would check for +matching case, but converting to the actual IEC value was case +insensitive. This now uses common functions for the matching so that +case doesn't matter. + +It also adds tests to check for the fix. + +The only change in behavior is that using KiB to specify the ending +location of a partition will now correctly create the end 1s lower than +the specified location like it does for MiB, GiB, etc. +--- + parted/parted.c | 29 ++++++++++++++++++---------- + tests/t0207-IEC-binary-notation.sh | 31 ++++++++++++++++++++++++++++++ + tests/t0208-mkpart-end-in-IEC.sh | 2 +- + 3 files changed, 51 insertions(+), 11 deletions(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 84187b7..84465d5 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -583,16 +583,27 @@ void _strip_trailing_spaces(char *str) + str[i]='\0'; + } + +-/* Return true, if str ends with [kMGTPEZY]iB, i.e. IEC units. */ ++/* Return true if the unit is one of the supported IEC unit values */ ++static bool ++_is_unit_IEC(const PedUnit unit) { ++ return (unit == PED_UNIT_KIBIBYTE) || (unit == PED_UNIT_MEBIBYTE) || ++ (unit == PED_UNIT_GIBIBYTE) || (unit == PED_UNIT_TEBIBYTE); ++} ++ ++/* Return true, if str ends with IEC units. */ + static bool + _string_ends_with_iec_unit(const char *str) + { +- /* 3 characters for the IEC unit and at least 1 digit */ +- if (!str || strlen(str) < 4) +- return false; ++ /* 3 characters for the IEC unit and at least 1 digit */ ++ if (!str || strlen(str) < 4) ++ return false; + +- char const *p = str + strlen(str) - 3; +- return strchr ("kMGTPEZY", *p) && c_strcasecmp (p+1, "iB") == 0; ++ char const *p = str + strlen(str) - 3; ++ PedUnit unit = ped_unit_get_by_name(p); ++ if (unit == -1) { ++ return false; ++ } ++ return _is_unit_IEC(unit); + } + + /* Return true if str ends with explicit unit identifier. +@@ -612,7 +623,7 @@ _string_has_unit_suffix(const char *str) + return false; + } + +-/* If the selected unit is one of kiB, MiB, GiB or TiB and the partition is not ++/* If the selected unit is one of KiB, MiB, GiB or TiB and the partition is not + * only 1 sector long, then adjust the end so that it is one sector before the + * given position. Also adjust range_end accordingly. Thus next partition can + * start immediately after this one. +@@ -636,9 +647,7 @@ _adjust_end_if_iec (PedSector* start, PedSector* end, + _strip_trailing_spaces(end_input); + PedUnit unit = ped_unit_get_default(); + if (_string_ends_with_iec_unit(end_input) || +- (!_string_has_unit_suffix(end_input) && +- ((unit == PED_UNIT_KIBIBYTE) || (unit == PED_UNIT_MEBIBYTE) || +- (unit == PED_UNIT_GIBIBYTE) || (unit == PED_UNIT_TEBIBYTE)))) { ++ (!_string_has_unit_suffix(end_input) && _is_unit_IEC(unit))) { + *end -= 1; + range_end->start -= 1; + range_end->end -= 1; +diff --git a/tests/t0207-IEC-binary-notation.sh b/tests/t0207-IEC-binary-notation.sh +index d9bbad6..b8a789e 100644 +--- a/tests/t0207-IEC-binary-notation.sh ++++ b/tests/t0207-IEC-binary-notation.sh +@@ -28,6 +28,7 @@ parted --align=none -s $dev mklabel gpt mkpart p1 $((64*1024))B $((1024*1024-$ss + compare /dev/null err || fail=1 + parted -m -s $dev u s p > exp || fail=1 + ++# Test using MiB + rm $dev + dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 + parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1MiB \ +@@ -37,4 +38,34 @@ parted -m -s $dev u s p > out || fail=1 + + compare exp out || fail=1 + ++# Test using lower case kib and mib ++rm $dev ++dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 ++parted --align=none -s $dev mklabel gpt mkpart p1 64kib 1mib \ ++ > err 2>&1 || fail=1 ++compare /dev/null err || fail=1 ++parted -m -s $dev u s p > out || fail=1 ++ ++compare exp out || fail=1 ++ ++# Test using KiB ++rm $dev ++dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 ++parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1024KiB \ ++ > err 2>&1 || fail=1 ++compare /dev/null err || fail=1 ++parted -m -s $dev u s p > out || fail=1 ++ ++compare exp out || fail=1 ++ ++# Test using kiB ++rm $dev ++dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 ++parted --align=none -s $dev mklabel gpt mkpart p1 64kiB 1024kiB \ ++ > err 2>&1 || fail=1 ++compare /dev/null err || fail=1 ++parted -m -s $dev u s p > out || fail=1 ++ ++compare exp out || fail=1 ++ + Exit $fail +diff --git a/tests/t0208-mkpart-end-in-IEC.sh b/tests/t0208-mkpart-end-in-IEC.sh +index 118ec72..a3db2c3 100644 +--- a/tests/t0208-mkpart-end-in-IEC.sh ++++ b/tests/t0208-mkpart-end-in-IEC.sh +@@ -25,7 +25,7 @@ dev=dev-file + + dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1 + # create 1st partition +-parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2MiB > err 2>&1 || fail=1 ++parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2048KiB > err 2>&1 || fail=1 + compare /dev/null err || fail=1 # expect no output + #parted -m -s $dev u s p > exp || fail=1 + +-- +2.39.2 + diff --git a/parted.spec b/parted.spec index 9a2cd2c..f474be6 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.5 -Release: 10%{?dist} +Release: 11%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -28,6 +28,12 @@ Patch0014: 0014-gpt-Add-no_automount-partition-flag.patch Patch0015: 0015-tests-XFS-requires-a-minimum-size-of-300M.patch Patch0016: 0016-libparted-Fix-problem-with-creating-1s-partitions.patch Patch0017: 0017-tests-Fixing-libparted-test-framework-usage.patch +Patch0018: 0018-filesys-Check-for-null-from-close_fn.patch +Patch0019: 0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch +Patch0020: 0020-strlist-Handle-realloc-error-in-wchar_to_str.patch +Patch0021: 0021-ui-Add-checks-for-prompt-being-NULL.patch +Patch0022: 0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch +Patch0023: 0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -132,7 +138,15 @@ make check %changelog -* Tue Feb 07 2023 Brian C. Lane - 3.5-9.bcl.1 +* Fri Mar 17 2023 Brian C. Lane - 3.5-11 +- parted: Fix ending sector location when using kibi IEC suffix (bcl) +- tests: Fix formatting and snprintf warnings in tests. (bcl) +- ui: Add checks for prompt being NULL (bcl) +- strlist: Handle realloc error in wchar_to_str (bcl) +- libparted: Fix potential NULL dereference in ped_disk_next_partition (bcl) +- filesys: Check for null from close_fn (bcl) + +* Tue Feb 07 2023 Brian C. Lane - 3.5-10 - libparted: Fix problem with creating 1s partitions - tests: Fixing libparted test framework usage From 7fdac872b5806876f8184185e3b77c6659101ce1 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 27 Mar 2023 08:13:23 -0700 Subject: [PATCH 45/60] - Upstream 3.5.28 Alpha release - Dropped all patches included in new upstream release - Bumped minor version on libparted.so and libparted-fs-resize.so --- .gitignore | 2 + 0001-maint-post-release-administrivia.patch | 50 - 0002-parted-add-type-command.patch | 1636 ----------------- ...bparted-add-swap-flag-for-DASD-label.patch | 228 --- ...-filesystem-type-when-changing-the-i.patch | 30 - 0005-tests-t3200-type-change-now-passes.patch | 23 - ...eck-for-availability-of-_type_id-fun.patch | 40 - ...parted-Simplify-code-for-json-output.patch | 34 - ...in.h-Remove-use-of-enums-with-define.patch | 59 - ...-Fix-handling-of-gpt-partition-types.patch | 101 - ...arted-test-for-ped_partition_set_sys.patch | 160 -- ...ix-handling-of-msdos-partition-types.patch | 109 -- ...arted-test-for-ped_partition_set_sys.patch | 75 - 0013-show-GPT-UUIDs-in-JSON-output.patch | 351 ---- ...-gpt-Add-no_automount-partition-flag.patch | 145 -- ...-XFS-requires-a-minimum-size-of-300M.patch | 54 - ...-problem-with-creating-1s-partitions.patch | 133 -- ...ixing-libparted-test-framework-usage.patch | 262 --- ...filesys-Check-for-null-from-close_fn.patch | 28 - ...tential-NULL-dereference-in-ped_disk.patch | 30 - ...Handle-realloc-error-in-wchar_to_str.patch | 28 - ...-ui-Add-checks-for-prompt-being-NULL.patch | 50 - ...tting-and-snprintf-warnings-in-tests.patch | 46 - ...g-sector-location-when-using-kibi-IE.patch | 146 -- parted.spec | 38 +- sources | 4 +- 26 files changed, 13 insertions(+), 3849 deletions(-) delete mode 100644 0001-maint-post-release-administrivia.patch delete mode 100644 0002-parted-add-type-command.patch delete mode 100644 0003-libparted-add-swap-flag-for-DASD-label.patch delete mode 100644 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch delete mode 100644 0005-tests-t3200-type-change-now-passes.patch delete mode 100644 0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch delete mode 100644 0007-parted-Simplify-code-for-json-output.patch delete mode 100644 0008-disk.in.h-Remove-use-of-enums-with-define.patch delete mode 100644 0009-libparted-Fix-handling-of-gpt-partition-types.patch delete mode 100644 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch delete mode 100644 0011-libparted-Fix-handling-of-msdos-partition-types.patch delete mode 100644 0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch delete mode 100644 0013-show-GPT-UUIDs-in-JSON-output.patch delete mode 100644 0014-gpt-Add-no_automount-partition-flag.patch delete mode 100644 0015-tests-XFS-requires-a-minimum-size-of-300M.patch delete mode 100644 0016-libparted-Fix-problem-with-creating-1s-partitions.patch delete mode 100644 0017-tests-Fixing-libparted-test-framework-usage.patch delete mode 100644 0018-filesys-Check-for-null-from-close_fn.patch delete mode 100644 0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch delete mode 100644 0020-strlist-Handle-realloc-error-in-wchar_to_str.patch delete mode 100644 0021-ui-Add-checks-for-prompt-being-NULL.patch delete mode 100644 0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch delete mode 100644 0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch diff --git a/.gitignore b/.gitignore index c6404f5..fdd046b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ clog /parted-3.4.64.tar.xz.sig /parted-3.5.tar.xz /parted-3.5.tar.xz.sig +/parted-3.5.28.tar.xz +/parted-3.5.28.tar.xz.sig diff --git a/0001-maint-post-release-administrivia.patch b/0001-maint-post-release-administrivia.patch deleted file mode 100644 index d8aa4ef..0000000 --- a/0001-maint-post-release-administrivia.patch +++ /dev/null @@ -1,50 +0,0 @@ -From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 18 Apr 2022 15:10:06 -0400 -Subject: [PATCH 01/13] 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 e917998..5a95802 100644 ---- a/.prev-version -+++ b/.prev-version -@@ -1 +1 @@ --3.4.64.2 -+3.5 -diff --git a/NEWS b/NEWS -index 68a164a..2bd161f 100644 ---- a/NEWS -+++ b/NEWS -@@ -1,5 +1,8 @@ - GNU parted NEWS -*- outline -*- - -+* Noteworthy changes in release ?.? (????-??-??) [?] -+ -+ - * Noteworthy changes in release 3.5 (2022-04-18) [stable] - - ** New Features -diff --git a/cfg.mk b/cfg.mk -index d5fdd80..11fa51b 100644 ---- a/cfg.mk -+++ b/cfg.mk -@@ -45,7 +45,7 @@ local-checks-to-skip = \ - export VERBOSE = yes - - # Hash of lines 42-208 for release 3.2 --old_NEWS_hash = 64a8f4d9ec1a5c256f3cc792450dc257 -+old_NEWS_hash = 81f624d1d62a34f24e1286bd3cf5c736 - - include $(srcdir)/dist-check.mk - --- -2.37.3 - diff --git a/0002-parted-add-type-command.patch b/0002-parted-add-type-command.patch deleted file mode 100644 index 4eddee7..0000000 --- a/0002-parted-add-type-command.patch +++ /dev/null @@ -1,1636 +0,0 @@ -From 61b3a9733c0e0a79ccc43096642d378c8706add6 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Wed, 11 May 2022 14:02:21 +0000 -Subject: [PATCH 02/13] parted: add type command - -Include the partition type-id and type-uuid in the JSON -output. Also add the the command 'type' to set them. Remove -redundant flags from DosPartitionData and use only the system -variable. - -Signed-off-by: Brian C. Lane ---- - NEWS | 3 + - doc/C/parted.8 | 5 + - doc/parted.texi | 20 + - include/parted/disk.in.h | 23 +- - libparted/disk.c | 102 +++++ - libparted/labels/dasd.c | 4 + - libparted/labels/dos.c | 621 ++++++++++++-------------- - libparted/labels/gpt.c | 44 +- - parted/parted.c | 113 ++++- - tests/Makefile.am | 4 + - tests/t0800-json-gpt.sh | 2 + - tests/t0801-json-msdos.sh | 5 +- - tests/t0900-type-gpt.sh | 69 +++ - tests/t0901-type-gpt-invalid.sh | 35 ++ - tests/t0910-type-dos.sh | 69 +++ - tests/t0911-type-dos-invalid.sh | 35 ++ - tests/t2400-dos-hfs-partition-type.sh | 2 +- - tests/t3300-palo-prep.sh | 8 +- - tests/t3310-flags.sh | 4 + - 19 files changed, 825 insertions(+), 343 deletions(-) - create mode 100755 tests/t0900-type-gpt.sh - create mode 100755 tests/t0901-type-gpt-invalid.sh - create mode 100755 tests/t0910-type-dos.sh - create mode 100755 tests/t0911-type-dos-invalid.sh - -diff --git a/NEWS b/NEWS -index 2bd161f..099f8bd 100644 ---- a/NEWS -+++ b/NEWS -@@ -2,6 +2,9 @@ GNU parted NEWS -*- outline -*- - - * Noteworthy changes in release ?.? (????-??-??) [?] - -+** New Features -+ -+ Add type commands to set type-id on MS-DOS and type-uuid on GPT. - - * Noteworthy changes in release 3.5 (2022-04-18) [stable] - -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index 7895440..ab34be7 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -134,6 +134,11 @@ human-friendly form for output). - .B toggle \fIpartition\fP \fIflag\fP - Toggle the state of \fIflag\fP on \fIpartition\fP. - .TP -+.B type \fIpartition\fP \fIid\fP or \fIuuid\fP -+On MS-DOS set the type aka. partition id of \fIpartition\fP to -+\fIid\fP. The \fIid\fP is a value between "0x01" and "0xff". On GPT -+the type-uuid of \fIpartition\fP to \fIuuid\fP. -+.TP - .B disk_set \fIflag\fP \fIstate\fP - Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off". - Some or all of these flags will be available, depending on what disk label you -diff --git a/doc/parted.texi b/doc/parted.texi -index 8a3978a..9c9d282 100644 ---- a/doc/parted.texi -+++ b/doc/parted.texi -@@ -466,6 +466,7 @@ GNU Parted provides the following commands: - * select:: - * set:: - * toggle:: -+* type:: - * unit:: - @end menu - -@@ -1034,6 +1035,25 @@ Toggle the state of @var{flag} on partition @var{number}. - - @end deffn - -+@node type -+@subsection type -+@cindex type, command description -+@cindex command description, type -+ -+@deffn Command type @var{number} @var{id} or @var{uuid} -+ -+On MS-DOS set the type-id aka partition id to @var{id} on partition -+@var{number}. The id is a value between 0x01 and 0xff, e.g. the ID for -+Linux is 0x83. A list with some IDs is available at -+@uref{https://en.wikipedia.org/wiki/Partition_type}. -+ -+On GPT set the type-uuid to @var{uuid} on partition -+@var{number}. E.g. the UUID for Linux is -+0fc63daf-8483-4772-8e79-3d69d8477de4. A list with some UUIDs is availabe -+at @uref{https://en.wikipedia.org/wiki/GUID_Partition_Table}. -+ -+@end deffn -+ - @node unit - @subsection unit - @cindex unit, command description -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index 38e869d..672c4ee 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -32,6 +32,7 @@ - */ - #include - #include -+#include - - /** - * Disk flags -@@ -91,11 +92,13 @@ enum _PedPartitionFlag { - #define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME - - enum _PedDiskTypeFeature { -- PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */ -+ PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -+ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ -+ PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ -+ PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ - }; - #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED --#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME -+#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID - - struct _PedDisk; - struct _PedPartition; -@@ -247,6 +250,13 @@ struct _PedDiskOps { - PedPartitionFlag flag); - void (*partition_set_name) (PedPartition* part, const char* name); - const char* (*partition_get_name) (const PedPartition* part); -+ -+ int (*partition_set_type_id) (PedPartition* part, uint8_t id); -+ uint8_t (*partition_get_type_id) (const PedPartition* part); -+ -+ int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid); -+ uint8_t* (*partition_get_type_uuid) (const PedPartition* part); -+ - int (*partition_align) (PedPartition* part, - const PedConstraint* constraint); - int (*partition_enumerate) (PedPartition* part); -@@ -347,6 +357,13 @@ extern int ped_partition_set_system (PedPartition* part, - const PedFileSystemType* fs_type); - extern int ped_partition_set_name (PedPartition* part, const char* name); - extern const char* ped_partition_get_name (const PedPartition* part); -+ -+extern int ped_partition_set_type_id (PedPartition* part, uint8_t id); -+extern uint8_t ped_partition_get_type_id (const PedPartition* part); -+ -+extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid); -+extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part); -+ - extern int ped_partition_is_busy (const PedPartition* part); - extern char* ped_partition_get_path (const PedPartition* part); - -diff --git a/libparted/disk.c b/libparted/disk.c -index 3bf7634..22dff36 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -1458,6 +1458,36 @@ _assert_partition_name_feature (const PedDiskType* disk_type) - return 1; - } - -+static int -+_assert_partition_type_id_feature (const PedDiskType* disk_type) -+{ -+ if (!ped_disk_type_check_feature ( -+ disk_type, PED_DISK_TYPE_PARTITION_TYPE_ID)) { -+ ped_exception_throw ( -+ PED_EXCEPTION_ERROR, -+ PED_EXCEPTION_CANCEL, -+ "%s disk labels do not support partition type-ids.", -+ disk_type->name); -+ return 0; -+ } -+ return 1; -+} -+ -+static int -+_assert_partition_type_uuid_feature (const PedDiskType* disk_type) -+{ -+ if (!ped_disk_type_check_feature ( -+ disk_type, PED_DISK_TYPE_PARTITION_TYPE_UUID)) { -+ ped_exception_throw ( -+ PED_EXCEPTION_ERROR, -+ PED_EXCEPTION_CANCEL, -+ "%s disk labels do not support partition type-uuids.", -+ disk_type->name); -+ return 0; -+ } -+ return 1; -+} -+ - /** - * Sets the name of a partition. - * -@@ -1510,6 +1540,78 @@ ped_partition_get_name (const PedPartition* part) - return part->disk->type->ops->partition_get_name (part); - } - -+/** -+ * Set the type-id of the partition \p part. This will only work if the disk label -+ * supports it. -+ */ -+int -+ped_partition_set_type_id (PedPartition *part, uint8_t id) -+{ -+ PED_ASSERT (part != NULL); -+ PED_ASSERT (part->disk != NULL); -+ PED_ASSERT (ped_partition_is_active (part)); -+ -+ if (!_assert_partition_type_id_feature (part->disk->type)) -+ return 0; -+ -+ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); -+ return part->disk->type->ops->partition_set_type_id (part, id); -+} -+ -+/** -+ * Get the type-id of the partition \p part. This will only work if the disk label -+ * supports it. -+ */ -+uint8_t -+ped_partition_get_type_id (const PedPartition *part) -+{ -+ PED_ASSERT (part != NULL); -+ PED_ASSERT (part->disk != NULL); -+ PED_ASSERT (ped_partition_is_active (part)); -+ -+ if (!_assert_partition_type_id_feature (part->disk->type)) -+ return 0; -+ -+ PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); -+ return part->disk->type->ops->partition_get_type_id (part); -+} -+ -+/** -+ * Set the type-uuid of the partition \p part. This will only work if the disk label -+ * supports it. -+ */ -+int -+ped_partition_set_type_uuid (PedPartition *part, const uint8_t* uuid) -+{ -+ PED_ASSERT (part != NULL); -+ PED_ASSERT (part->disk != NULL); -+ PED_ASSERT (ped_partition_is_active (part)); -+ -+ if (!_assert_partition_type_uuid_feature (part->disk->type)) -+ return 0; -+ -+ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); -+ return part->disk->type->ops->partition_set_type_uuid (part, uuid); -+} -+ -+/** -+ * Get the type-uuid of the partition \p part. This will only work if the disk label -+ * supports it. -+ */ -+uint8_t* -+ped_partition_get_type_uuid (const PedPartition *part) -+{ -+ PED_ASSERT (part != NULL); -+ PED_ASSERT (part->disk != NULL); -+ PED_ASSERT (ped_partition_is_active (part)); -+ -+ if (!_assert_partition_type_uuid_feature (part->disk->type)) -+ return NULL; -+ -+ PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); -+ return part->disk->type->ops->partition_get_type_uuid (part); -+} -+ - /** @} */ - - /** -diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c -index 38f2b00..0c00c4f 100644 ---- a/libparted/labels/dasd.c -+++ b/libparted/labels/dasd.c -@@ -117,6 +117,10 @@ static PedDiskOps dasd_disk_ops = { - - partition_set_name: NULL, - partition_get_name: NULL, -+ partition_set_type_id: NULL, -+ partition_get_type_id: NULL, -+ partition_set_type_uuid: NULL, -+ partition_get_type_uuid: NULL, - - get_partition_alignment: dasd_get_partition_alignment, - -diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c -index 26d8804..bd7465d 100644 ---- a/libparted/labels/dos.c -+++ b/libparted/labels/dos.c -@@ -100,6 +100,209 @@ static const char MBR_BOOT_CODE[] = { - #define PARTITION_LINUX_RAID 0xfd - #define PARTITION_LINUX_LVM_OLD 0xfe - -+struct flag_id_mapping_t -+{ -+ enum _PedPartitionFlag flag; -+ unsigned char type_id; -+ unsigned char alt_type_id; -+}; -+ -+static const struct flag_id_mapping_t flag_id_mapping[] = -+{ -+ { PED_PARTITION_BLS_BOOT, PARTITION_BLS_BOOT }, -+ { PED_PARTITION_DIAG, PARTITION_COMPAQ_DIAG, PARTITION_DELL_DIAG }, -+ { PED_PARTITION_ESP, PARTITION_ESP }, -+ { PED_PARTITION_IRST, PARTITION_IRST }, -+ { PED_PARTITION_LVM, PARTITION_LINUX_LVM, PARTITION_LINUX_LVM_OLD }, -+ { PED_PARTITION_MSFT_RESERVED, PARTITION_MSFT_RECOVERY }, -+ { PED_PARTITION_PALO, PARTITION_PALO }, -+ { PED_PARTITION_PREP, PARTITION_PREP }, -+ { PED_PARTITION_RAID, PARTITION_LINUX_RAID }, -+ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, -+}; -+ -+static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST -+dos_find_flag_id_mapping (PedPartitionFlag flag) -+{ -+ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]); -+ -+ for (int i = 0; i < n; ++i) -+ if (flag_id_mapping[i].flag == flag) -+ return &flag_id_mapping[i]; -+ -+ return NULL; -+} -+ -+/** -+ * Check whether the type_id supports the hidden flag. Returns true for both hidden and -+ * non-hidden id. -+ */ -+static bool -+dos_type_id_supports_hidden(unsigned char type_id) -+{ -+ switch (type_id) -+ { -+ case PARTITION_DOS_EXT: -+ case PARTITION_DOS_EXT_H: -+ case PARTITION_FAT12: -+ case PARTITION_FAT12_H: -+ case PARTITION_FAT16: -+ case PARTITION_FAT16_H: -+ case PARTITION_FAT16_LBA: -+ case PARTITION_FAT16_LBA_H: -+ case PARTITION_FAT16_SM: -+ case PARTITION_FAT16_SM_H: -+ case PARTITION_FAT32: -+ case PARTITION_FAT32_H: -+ case PARTITION_FAT32_LBA: -+ case PARTITION_FAT32_LBA_H: -+ case PARTITION_NTFS: -+ case PARTITION_NTFS_H: -+ return true; -+ -+ default: -+ return false; -+ } -+} -+ -+/** -+ * Check whether the type_id has the hidden flag set. -+ */ -+static bool -+dos_type_id_is_hidden(unsigned char type_id) -+{ -+ switch (type_id) -+ { -+ case PARTITION_DOS_EXT_H: -+ case PARTITION_FAT12_H: -+ case PARTITION_FAT16_H: -+ case PARTITION_FAT16_LBA_H: -+ case PARTITION_FAT16_SM_H: -+ case PARTITION_FAT32_H: -+ case PARTITION_FAT32_LBA_H: -+ case PARTITION_NTFS_H: -+ return true; -+ -+ default: -+ return false; -+ } -+} -+ -+/** -+ * Sets the hidden flag on type_id. -+ */ -+static bool -+dos_type_id_set_hidden(unsigned char* type_id, bool state) -+{ -+ PED_ASSERT (type_id); -+ -+ if (!dos_type_id_supports_hidden(*type_id)) -+ return false; -+ -+ if (state) -+ *type_id |= PART_FLAG_HIDDEN; -+ else -+ *type_id &= ~PART_FLAG_HIDDEN; -+ -+ return 1; -+} -+ -+/** -+ * Check whether the type_id supports the lba flag. Returns true for both lba and non-lba -+ * id. -+ */ -+static bool -+dos_type_id_supports_lba(unsigned char type_id) -+{ -+ switch (type_id) -+ { -+ case PARTITION_FAT16: -+ case PARTITION_FAT16_H: -+ case PARTITION_FAT16_LBA: -+ case PARTITION_FAT16_LBA_H: -+ case PARTITION_FAT32: -+ case PARTITION_FAT32_H: -+ case PARTITION_FAT32_LBA: -+ case PARTITION_FAT32_LBA_H: -+ case PARTITION_DOS_EXT: -+ case PARTITION_EXT_LBA: -+ return true; -+ -+ default: -+ return false; -+ } -+} -+ -+/** -+ * Check whether the type_id has the lba flag set. -+ */ -+static bool -+dos_type_id_is_lba(unsigned char type_id) -+{ -+ switch (type_id) -+ { -+ case PARTITION_FAT16_LBA: -+ case PARTITION_FAT16_LBA_H: -+ case PARTITION_FAT32_LBA: -+ case PARTITION_FAT32_LBA_H: -+ case PARTITION_EXT_LBA: -+ return true; -+ -+ default: -+ return false; -+ } -+} -+ -+/** -+ * Sets the lba flag on type_id. -+ */ -+static bool -+dos_type_id_set_lba(unsigned char* type_id, bool state) -+{ -+ PED_ASSERT (type_id); -+ -+ if (!dos_type_id_supports_lba(*type_id)) -+ return false; -+ -+ if (state) -+ { -+ switch (*type_id) -+ { -+ case PARTITION_FAT16: -+ *type_id = PARTITION_FAT16_LBA; -+ break; -+ -+ case PARTITION_FAT32: -+ *type_id = PARTITION_FAT32_LBA; -+ break; -+ -+ case PARTITION_DOS_EXT: -+ *type_id = PARTITION_EXT_LBA; -+ break; -+ } -+ } -+ else -+ { -+ switch (*type_id) -+ { -+ case PARTITION_FAT16_LBA: -+ *type_id = PARTITION_FAT16; -+ break; -+ -+ case PARTITION_FAT32_LBA: -+ *type_id = PARTITION_FAT32; -+ break; -+ -+ case PARTITION_EXT_LBA: -+ *type_id = PARTITION_DOS_EXT; -+ break; -+ } -+ } -+ -+ return true; -+} -+ -+ - /* This constant contains the maximum cylinder number that can be represented - * in (C,H,S) notation. Higher cylinder numbers are reserved for - * "too big" indicators (in which case only LBA addressing can be used). -@@ -156,18 +359,6 @@ typedef struct { - typedef struct { - unsigned char system; - int boot; -- int hidden; -- int msftres; -- int raid; -- int lvm; -- int swap; -- int lba; -- int palo; -- int prep; -- int diag; -- int irst; -- int esp; -- int bls_boot; - OrigState* orig; /* used for CHS stuff */ - } DosPartitionData; - -@@ -891,48 +1082,6 @@ raw_part_is_extended (const DosRawPartition* raw_part) - return 0; - } - --static int _GL_ATTRIBUTE_PURE --raw_part_is_hidden (const DosRawPartition* raw_part) --{ -- PED_ASSERT (raw_part != NULL); -- -- switch (raw_part->type) { -- case PARTITION_FAT12_H: -- case PARTITION_FAT16_SM_H: -- case PARTITION_FAT16_H: -- case PARTITION_FAT32_H: -- case PARTITION_NTFS_H: -- case PARTITION_FAT32_LBA_H: -- case PARTITION_FAT16_LBA_H: -- return 1; -- -- default: -- return 0; -- } -- -- return 0; --} -- --static int _GL_ATTRIBUTE_PURE --raw_part_is_lba (const DosRawPartition* raw_part) --{ -- PED_ASSERT (raw_part != NULL); -- -- switch (raw_part->type) { -- case PARTITION_FAT32_LBA: -- case PARTITION_FAT16_LBA: -- case PARTITION_EXT_LBA: -- case PARTITION_FAT32_LBA_H: -- case PARTITION_FAT16_LBA_H: -- return 1; -- -- default: -- return 0; -- } -- -- return 0; --} -- - static PedPartition* - raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, - PedSector lba_offset, PedPartitionType type) -@@ -952,20 +1101,6 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part, - dos_data = part->disk_specific; - dos_data->system = raw_part->type; - dos_data->boot = raw_part->boot_ind != 0; -- dos_data->diag = raw_part->type == PARTITION_COMPAQ_DIAG || -- raw_part->type == PARTITION_DELL_DIAG; -- dos_data->msftres = raw_part->type == PARTITION_MSFT_RECOVERY; -- dos_data->hidden = raw_part_is_hidden (raw_part); -- dos_data->raid = raw_part->type == PARTITION_LINUX_RAID; -- dos_data->lvm = raw_part->type == PARTITION_LINUX_LVM_OLD -- || raw_part->type == PARTITION_LINUX_LVM; -- dos_data->swap = raw_part->type == PARTITION_LINUX_SWAP; -- dos_data->lba = raw_part_is_lba (raw_part); -- dos_data->palo = raw_part->type == PARTITION_PALO; -- dos_data->prep = raw_part->type == PARTITION_PREP; -- dos_data->irst = raw_part->type == PARTITION_IRST; -- dos_data->esp = raw_part->type == PARTITION_ESP; -- dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT; - dos_data->orig = ped_malloc (sizeof (OrigState)); - if (!dos_data->orig) { - ped_partition_destroy (part); -@@ -1377,18 +1512,6 @@ msdos_partition_duplicate (const PedPartition* part) - new_dos_data = (DosPartitionData*) new_part->disk_specific; - new_dos_data->system = old_dos_data->system; - new_dos_data->boot = old_dos_data->boot; -- new_dos_data->diag = old_dos_data->diag; -- new_dos_data->hidden = old_dos_data->hidden; -- new_dos_data->msftres = old_dos_data->msftres; -- new_dos_data->raid = old_dos_data->raid; -- new_dos_data->lvm = old_dos_data->lvm; -- new_dos_data->swap = old_dos_data->swap; -- new_dos_data->lba = old_dos_data->lba; -- new_dos_data->palo = old_dos_data->palo; -- new_dos_data->prep = old_dos_data->prep; -- new_dos_data->irst = old_dos_data->irst; -- new_dos_data->esp = old_dos_data->esp; -- new_dos_data->bls_boot = old_dos_data->bls_boot; - - if (old_dos_data->orig) { - new_dos_data->orig = ped_malloc (sizeof (OrigState)); -@@ -1425,234 +1548,87 @@ msdos_partition_set_system (PedPartition* part, - - part->fs_type = fs_type; - -- if (dos_data->hidden -- && fs_type -- && strncmp (fs_type->name, "fat", 3) != 0 -- && strcmp (fs_type->name, "ntfs") != 0) -- dos_data->hidden = 0; -- -- if (dos_data->msftres -- && fs_type -- && strcmp (fs_type->name, "ntfs") != 0) -- dos_data->msftres = 0; -- - if (part->type & PED_PARTITION_EXTENDED) { -- dos_data->diag = 0; -- dos_data->raid = 0; -- dos_data->lvm = 0; -- dos_data->swap = 0; -- dos_data->palo = 0; -- dos_data->prep = 0; -- dos_data->irst = 0; -- dos_data->esp = 0; -- if (dos_data->lba) -- dos_data->system = PARTITION_EXT_LBA; -- else -- dos_data->system = PARTITION_DOS_EXT; -- return 1; -- } -- -- if (dos_data->diag) { -- /* Don't change the system if it already is a diag type, -- otherwise use Compaq as almost all vendors use that. */ -- if (dos_data->system != PARTITION_COMPAQ_DIAG && -- dos_data->system != PARTITION_DELL_DIAG) -- dos_data->system = PARTITION_COMPAQ_DIAG; -- return 1; -- } -- if (dos_data->msftres) { -- dos_data->system = PARTITION_MSFT_RECOVERY; -- return 1; -- } -- if (dos_data->lvm) { -- dos_data->system = PARTITION_LINUX_LVM; -- return 1; -- } -- if (dos_data->swap) { -- dos_data->system = PARTITION_LINUX_SWAP; -- return 1; -- } -- if (dos_data->raid) { -- dos_data->system = PARTITION_LINUX_RAID; -- return 1; -- } -- if (dos_data->palo) { -- dos_data->system = PARTITION_PALO; -- return 1; -- } -- if (dos_data->prep) { -- dos_data->system = PARTITION_PREP; -- return 1; -- } -- if (dos_data->irst) { -- dos_data->system = PARTITION_IRST; -- return 1; -- } -- if (dos_data->esp) { -- dos_data->system = PARTITION_ESP; -- return 1; -- } -- if (dos_data->bls_boot) { -- dos_data->system = PARTITION_BLS_BOOT; -+ dos_data->system = PARTITION_EXT_LBA; - return 1; - } - - if (!fs_type) - dos_data->system = PARTITION_LINUX; -- else if (!strcmp (fs_type->name, "fat16")) { -- dos_data->system = dos_data->lba -- ? PARTITION_FAT16_LBA : PARTITION_FAT16; -- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; -- } else if (!strcmp (fs_type->name, "fat32")) { -- dos_data->system = dos_data->lba -- ? PARTITION_FAT32_LBA : PARTITION_FAT32; -- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; -- } else if (!strcmp (fs_type->name, "ntfs") -- || !strcmp (fs_type->name, "hpfs")) { -+ else if (!strcmp (fs_type->name, "fat16")) -+ dos_data->system = PARTITION_FAT16; -+ else if (!strcmp (fs_type->name, "fat32")) -+ dos_data->system = PARTITION_FAT32; -+ else if (!strcmp (fs_type->name, "ntfs") -+ || !strcmp (fs_type->name, "hpfs")) - dos_data->system = PARTITION_NTFS; -- dos_data->system |= dos_data->hidden ? PART_FLAG_HIDDEN : 0; -- } else if (!strcmp (fs_type->name, "hfs") -+ else if (!strcmp (fs_type->name, "hfs") - || !strcmp (fs_type->name, "hfs+")) - dos_data->system = PARTITION_HFS; - else if (!strcmp (fs_type->name, "udf")) - dos_data->system = PARTITION_UDF; - else if (!strcmp (fs_type->name, "sun-ufs")) - dos_data->system = PARTITION_SUN_UFS; -- else if (is_linux_swap (fs_type->name)) { -+ else if (is_linux_swap (fs_type->name)) - dos_data->system = PARTITION_LINUX_SWAP; -- dos_data->swap = 1; -- } else -+ else - dos_data->system = PARTITION_LINUX; - - return 1; - } - --static void --clear_flags (DosPartitionData *dos_data) --{ -- dos_data->diag = 0; -- dos_data->hidden = 0; -- dos_data->msftres = 0; -- dos_data->lvm = 0; -- dos_data->swap = 0; -- dos_data->palo = 0; -- dos_data->prep = 0; -- dos_data->irst = 0; -- dos_data->esp = 0; -- dos_data->raid = 0; -- dos_data->bls_boot = 0; --} -- - static int - msdos_partition_set_flag (PedPartition* part, - PedPartitionFlag flag, int state) - { -- PedDisk* disk; -- PedPartition* walk; -- DosPartitionData* dos_data; -- - PED_ASSERT (part != NULL); - PED_ASSERT (part->disk_specific != NULL); - PED_ASSERT (part->disk != NULL); - -- dos_data = part->disk_specific; -- disk = part->disk; -- -- switch (flag) { -- case PED_PARTITION_HIDDEN: -- if (part->type == PED_PARTITION_EXTENDED) { -- ped_exception_throw ( -- PED_EXCEPTION_ERROR, -- PED_EXCEPTION_CANCEL, -- _("Extended partitions cannot be hidden on " -- "msdos disk labels.")); -- return 0; -- } -- dos_data->hidden = state; -- return ped_partition_set_system (part, part->fs_type); -- -- case PED_PARTITION_MSFT_RESERVED: -- if (part->type == PED_PARTITION_EXTENDED) { -- ped_exception_throw ( -- PED_EXCEPTION_ERROR, -- PED_EXCEPTION_CANCEL, -- _("Extended partitions cannot be recovery partitions on " -- "msdos disk labels.")); -- return 0; -- } -- dos_data->msftres = state; -- return ped_partition_set_system (part, part->fs_type); -- -- case PED_PARTITION_BOOT: -- dos_data->boot = state; -- if (!state) -- return 1; -- -- walk = ped_disk_next_partition (disk, NULL); -- for (; walk; walk = ped_disk_next_partition (disk, walk)) { -- if (walk == part || !ped_partition_is_active (walk)) -- continue; -- msdos_partition_set_flag (walk, PED_PARTITION_BOOT, 0); -- } -- return 1; -+ DosPartitionData* dos_data = part->disk_specific; - -- case PED_PARTITION_DIAG: -- if (state) -- clear_flags (dos_data); -- dos_data->diag = state; -- return ped_partition_set_system (part, part->fs_type); -+ const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); -+ if (p) -+ { -+ if (part->type & PED_PARTITION_EXTENDED) -+ return 0; - -- case PED_PARTITION_RAID: -- if (state) -- clear_flags (dos_data); -- dos_data->raid = state; -+ if (state) -+ dos_data->system = p->type_id; -+ else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) - return ped_partition_set_system (part, part->fs_type); - -- case PED_PARTITION_LVM: -- if (state) -- clear_flags (dos_data); -- dos_data->lvm = state; -- return ped_partition_set_system (part, part->fs_type); -+ return 1; -+ } - -- case PED_PARTITION_SWAP: -- if (state) -- clear_flags (dos_data); -- dos_data->swap = state; -- return ped_partition_set_system (part, part->fs_type); -+ switch (flag) { -+ case PED_PARTITION_HIDDEN: -+ { -+ return dos_type_id_set_hidden(&dos_data->system, state); -+ } - - case PED_PARTITION_LBA: -- dos_data->lba = state; -- return ped_partition_set_system (part, part->fs_type); -- -- case PED_PARTITION_PALO: -- if (state) -- clear_flags (dos_data); -- dos_data->palo = state; -- return ped_partition_set_system (part, part->fs_type); -- -- case PED_PARTITION_PREP: -- if (state) -- clear_flags (dos_data); -- dos_data->prep = state; -- return ped_partition_set_system (part, part->fs_type); -+ { -+ return dos_type_id_set_lba(&dos_data->system, state); -+ } - -- case PED_PARTITION_IRST: -- if (state) -- clear_flags (dos_data); -- dos_data->irst = state; -- return ped_partition_set_system (part, part->fs_type); -+ case PED_PARTITION_BOOT: -+ { -+ dos_data->boot = state; - -- case PED_PARTITION_ESP: - if (state) -- clear_flags (dos_data); -- dos_data->esp = state; -- return ped_partition_set_system (part, part->fs_type); -+ { -+ PedDisk* disk = part->disk; -+ PedPartition* walk = ped_disk_next_partition (disk, NULL); -+ for (; walk; walk = ped_disk_next_partition (disk, walk)) { -+ if (walk == part || !ped_partition_is_active (walk)) -+ continue; -+ msdos_partition_set_flag (walk, PED_PARTITION_BOOT, 0); -+ } -+ } - -- case PED_PARTITION_BLS_BOOT: -- if (state) -- clear_flags (dos_data); -- dos_data->bls_boot = state; -- return ped_partition_set_system (part, part->fs_type); -+ return 1; -+ } - - default: - return 0; -@@ -1662,58 +1638,25 @@ msdos_partition_set_flag (PedPartition* part, - static int _GL_ATTRIBUTE_PURE - msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) - { -- DosPartitionData* dos_data; -- - PED_ASSERT (part != NULL); - PED_ASSERT (part->disk_specific != NULL); - -- dos_data = part->disk_specific; -+ DosPartitionData* dos_data = part->disk_specific; -+ -+ const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); -+ if (p) -+ return dos_data->system == p->type_id || dos_data->system == p->alt_type_id; -+ - switch (flag) { - case PED_PARTITION_HIDDEN: -- if (part->type == PED_PARTITION_EXTENDED) -- return 0; -- else -- return dos_data->hidden; -+ return dos_type_id_is_hidden(dos_data->system); - -- case PED_PARTITION_MSFT_RESERVED: -- if (part->type == PED_PARTITION_EXTENDED) -- return 0; -- else -- return dos_data->msftres; -+ case PED_PARTITION_LBA: -+ return dos_type_id_is_lba(dos_data->system); - - case PED_PARTITION_BOOT: - return dos_data->boot; - -- case PED_PARTITION_DIAG: -- return dos_data->diag; -- -- case PED_PARTITION_RAID: -- return dos_data->raid; -- -- case PED_PARTITION_LVM: -- return dos_data->lvm; -- -- case PED_PARTITION_SWAP: -- return dos_data->swap; -- -- case PED_PARTITION_LBA: -- return dos_data->lba; -- -- case PED_PARTITION_PALO: -- return dos_data->palo; -- -- case PED_PARTITION_PREP: -- return dos_data->prep; -- -- case PED_PARTITION_IRST: -- return dos_data->irst; -- -- case PED_PARTITION_ESP: -- return dos_data->esp; -- -- case PED_PARTITION_BLS_BOOT: -- return dos_data->bls_boot; -- - default: - return 0; - } -@@ -1723,30 +1666,19 @@ static int - msdos_partition_is_flag_available (const PedPartition* part, - PedPartitionFlag flag) - { -+ if (dos_find_flag_id_mapping (flag)) -+ return part->type != PED_PARTITION_EXTENDED; -+ -+ DosPartitionData* dos_data = part->disk_specific; -+ - switch (flag) { - case PED_PARTITION_HIDDEN: -- if (part->type == PED_PARTITION_EXTENDED) -- return 0; -- else -- return 1; -+ return dos_type_id_supports_hidden(dos_data->system); - -- case PED_PARTITION_MSFT_RESERVED: -- if (part->type == PED_PARTITION_EXTENDED) -- return 0; -- else -- return 1; -+ case PED_PARTITION_LBA: -+ return dos_type_id_supports_lba(dos_data->system); - - case PED_PARTITION_BOOT: -- case PED_PARTITION_RAID: -- case PED_PARTITION_LVM: -- case PED_PARTITION_SWAP: -- case PED_PARTITION_LBA: -- case PED_PARTITION_PALO: -- case PED_PARTITION_PREP: -- case PED_PARTITION_IRST: -- case PED_PARTITION_ESP: -- case PED_PARTITION_BLS_BOOT: -- case PED_PARTITION_DIAG: - return 1; - - default: -@@ -1754,6 +1686,27 @@ msdos_partition_is_flag_available (const PedPartition* part, - } - } - -+ -+int -+msdos_partition_set_type_id (PedPartition* part, uint8_t id) -+{ -+ DosPartitionData* dos_data = part->disk_specific; -+ -+ dos_data->system = id; -+ -+ return 1; -+} -+ -+ -+uint8_t _GL_ATTRIBUTE_PURE -+msdos_partition_get_type_id (const PedPartition* part) -+{ -+ const DosPartitionData* dos_data = part->disk_specific; -+ -+ return dos_data->system; -+} -+ -+ - static PedGeometry* - _try_constraint (const PedPartition* part, const PedConstraint* external, - PedConstraint* internal) -@@ -2590,6 +2543,10 @@ static PedDiskOps msdos_disk_ops = { - - partition_set_name: NULL, - partition_get_name: NULL, -+ partition_set_type_id: msdos_partition_set_type_id, -+ partition_get_type_id: msdos_partition_get_type_id, -+ partition_set_type_uuid: NULL, -+ partition_get_type_uuid: NULL, - - PT_op_function_initializers (msdos) - }; -@@ -2598,7 +2555,7 @@ static PedDiskType msdos_disk_type = { - next: NULL, - name: "msdos", - ops: &msdos_disk_ops, -- features: PED_DISK_TYPE_EXTENDED -+ features: PED_DISK_TYPE_EXTENDED | PED_DISK_TYPE_PARTITION_TYPE_ID - }; - - void -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 037d021..0e9e060 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -1686,6 +1686,44 @@ gpt_partition_get_name (const PedPartition *part) - return gpt_part_data->translated_name; - } - -+ -+static int -+gpt_partition_set_type_uuid (PedPartition *part, const uint8_t *uuid) -+{ -+ GPTPartitionData *gpt_part_data = part->disk_specific; -+ -+ efi_guid_t* type_uuid = &gpt_part_data->type; -+ memcpy(type_uuid, uuid, sizeof (efi_guid_t)); -+ -+ /* type_uuid is always LE, while uint8_t is always kind of BE */ -+ -+ type_uuid->time_low = PED_SWAP32(type_uuid->time_low); -+ type_uuid->time_mid = PED_SWAP16(type_uuid->time_mid); -+ type_uuid->time_hi_and_version = PED_SWAP16(type_uuid->time_hi_and_version); -+ -+ return 1; -+} -+ -+ -+static uint8_t* -+gpt_partition_get_type_uuid (const PedPartition *part) -+{ -+ const GPTPartitionData *gpt_part_data = part->disk_specific; -+ -+ efi_guid_t type_uuid = gpt_part_data->type; -+ -+ /* type_uuid is always LE, while uint8_t is always kind of BE */ -+ -+ type_uuid.time_low = PED_SWAP32(type_uuid.time_low); -+ type_uuid.time_mid = PED_SWAP16(type_uuid.time_mid); -+ type_uuid.time_hi_and_version = PED_SWAP16(type_uuid.time_hi_and_version); -+ -+ uint8_t *buf = ped_malloc(sizeof (uuid_t)); -+ memcpy(buf, &type_uuid, sizeof (uuid_t)); -+ return buf; -+} -+ -+ - static int - gpt_get_max_primary_partition_count (const PedDisk *disk) - { -@@ -1781,6 +1819,10 @@ static PedDiskOps gpt_disk_ops = - - partition_set_name: gpt_partition_set_name, - partition_get_name: gpt_partition_get_name, -+ partition_set_type_id: NULL, -+ partition_get_type_id: NULL, -+ partition_set_type_uuid: gpt_partition_set_type_uuid, -+ partition_get_type_uuid: gpt_partition_get_type_uuid, - disk_set_flag: gpt_disk_set_flag, - disk_get_flag: gpt_disk_get_flag, - disk_is_flag_available: gpt_disk_is_flag_available, -@@ -1793,7 +1835,7 @@ static PedDiskType gpt_disk_type = - next: NULL, - name: "gpt", - ops: &gpt_disk_ops, -- features: PED_DISK_TYPE_PARTITION_NAME -+ features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID - }; - - void -diff --git a/parted/parted.c b/parted/parted.c -index 5c7c270..b8a4acf 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - #include "argmatch.h" - #include "closeout.h" -@@ -174,6 +175,8 @@ static const char* end_msg = N_("END is disk location, such as " - static const char* state_msg = N_("STATE is one of: on, off\n"); - static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n"); - static const char* name_msg = N_("NAME is any word you want\n"); -+static const char* type_msg = N_("TYPE_ID is a value between 0x01 and 0xff, " -+ "TYPE_UUID is a UUID\n"); - - static const char* copyright_msg = N_( - "Copyright (C) 1998 - 2006 Free Software Foundation, Inc.\n" -@@ -917,6 +920,87 @@ error: - return 0; - } - -+static int -+do_type (PedDevice** dev, PedDisk** diskp) -+{ -+ if (!*diskp) -+ *diskp = ped_disk_new (*dev); -+ if (!*diskp) -+ goto error; -+ -+ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type, -+ PED_DISK_TYPE_PARTITION_TYPE_ID); -+ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, -+ PED_DISK_TYPE_PARTITION_TYPE_UUID); -+ -+ PED_ASSERT (!(has_type_id && has_type_uuid)); -+ -+ if (!has_type_id && !has_type_uuid) { -+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, -+ _("%s disk labels do not support partition type."), -+ (*diskp)->type->name); -+ goto error; -+ } -+ -+ PedPartition* part = NULL; -+ if (!command_line_get_partition (_("Partition number?"), *diskp, &part)) -+ goto error; -+ -+ char* input = NULL; -+ -+ if (has_type_id) { -+ uint8_t type_id = ped_partition_get_type_id (part); -+ static char buf[8]; -+ snprintf(buf, 8, "0x%02x", type_id); -+ -+ input = command_line_get_word (_("Partition type-id?"), buf, NULL, 0); -+ if (!input) -+ goto error; -+ -+ unsigned int tmp = strtol (input, (char**) NULL, 16); -+ if (tmp < 0x01 || tmp > 0xff) { -+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, -+ _("Invalid type-id.")); -+ goto error_free_input; -+ } -+ -+ if (!ped_partition_set_type_id (part, tmp)) -+ goto error_free_input; -+ } -+ -+ if (has_type_uuid) { -+ uint8_t* type_uuid = ped_partition_get_type_uuid (part); -+ static char buf[UUID_STR_LEN]; -+ uuid_unparse_lower (type_uuid, buf); -+ free (type_uuid); -+ -+ input = command_line_get_word (_("Partition type-uuid?"), buf, NULL, 0); -+ if (!input) -+ goto error; -+ -+ uuid_t tmp; -+ if (uuid_parse (input, tmp) != 0 || uuid_is_null (tmp)) { -+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, -+ _("Invalid type-uuid.")); -+ goto error_free_input; -+ } -+ -+ if (!ped_partition_set_type_uuid (part, tmp)) -+ goto error_free_input; -+ } -+ -+ free (input); -+ -+ if (!ped_disk_commit (*diskp)) -+ goto error; -+ return 1; -+ -+error_free_input: -+ free (input); -+error: -+ return 0; -+} -+ - static char* - partition_print_flags (PedPartition const *part) - { -@@ -1270,6 +1354,10 @@ do_print (PedDevice** dev, PedDisk** diskp) - PED_DISK_TYPE_EXTENDED); - has_name = ped_disk_type_check_feature ((*diskp)->type, - PED_DISK_TYPE_PARTITION_NAME); -+ bool has_type_id = ped_disk_type_check_feature ((*diskp)->type, -+ PED_DISK_TYPE_PARTITION_TYPE_ID); -+ bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, -+ PED_DISK_TYPE_PARTITION_TYPE_UUID); - - PedPartition* part; - if (opt_output_mode == HUMAN) { -@@ -1407,10 +1495,25 @@ do_print (PedDevice** dev, PedDisk** diskp) - - if (!(part->type & PED_PARTITION_FREESPACE)) { - -+ if (has_type_id) { -+ uint8_t type_id = ped_partition_get_type_id (part); -+ static char buf[8]; -+ snprintf(buf, 8, "0x%02x", type_id); -+ ul_jsonwrt_value_s (&json, "type-id", buf); -+ } -+ -+ if (has_type_uuid) { -+ uint8_t* type_uuid = ped_partition_get_type_uuid (part); -+ static char buf[UUID_STR_LEN]; -+ uuid_unparse_lower (type_uuid, buf); -+ ul_jsonwrt_value_s (&json, "type-uuid", buf); -+ free (type_uuid); -+ } -+ - if (has_name) { - name = ped_partition_get_name (part); - if (strcmp (name, "") != 0) -- ul_jsonwrt_value_s (&json, "name", ped_partition_get_name (part)); -+ ul_jsonwrt_value_s (&json, "name", name); - } - - if (part->fs_type) -@@ -2316,6 +2419,14 @@ _("toggle [NUMBER [FLAG]] toggle the state of FLAG on " - NULL), - str_list_create (_(number_msg), flag_msg, NULL), 1)); - -+command_register (commands, command_create ( -+ str_list_create_unique ("type", _("type"), NULL), -+ do_type, -+ str_list_create ( -+_("type NUMBER TYPE-ID or TYPE-UUID type set TYPE-ID or TYPE-UUID of partition NUMBER"), -+NULL), -+ str_list_create (_(number_msg), _(type_msg), NULL), 1)); -+ - command_register (commands, command_create ( - str_list_create_unique ("unit", _("unit"), NULL), - do_unit, -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 5cb7aa3..2da653b 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -43,6 +43,10 @@ TESTS = \ - t0501-duplicate.sh \ - t0800-json-gpt.sh \ - t0801-json-msdos.sh \ -+ t0900-type-gpt.sh \ -+ t0901-type-gpt-invalid.sh \ -+ t0910-type-dos.sh \ -+ t0911-type-dos-invalid.sh \ - t1100-busy-label.sh \ - t1101-busy-partition.sh \ - t1102-loop-label.sh \ -diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh -index 8dd1862..354c0bd 100755 ---- a/tests/t0800-json-gpt.sh -+++ b/tests/t0800-json-gpt.sh -@@ -62,6 +62,7 @@ cat < exp || fail=1 - "end": "20479s", - "size": "10240s", - "type": "primary", -+ "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4", - "name": "test1" - },{ - "number": 2, -@@ -69,6 +70,7 @@ cat < exp || fail=1 - "end": "61439s", - "size": "40960s", - "type": "primary", -+ "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e", - "name": "test2", - "flags": [ - "raid" -diff --git a/tests/t0801-json-msdos.sh b/tests/t0801-json-msdos.sh -index a14a5af..c5446d8 100755 ---- a/tests/t0801-json-msdos.sh -+++ b/tests/t0801-json-msdos.sh -@@ -52,13 +52,15 @@ cat < exp || fail=1 - "start": "5.00MiB", - "end": "10.0MiB", - "size": "5.00MiB", -- "type": "primary" -+ "type": "primary", -+ "type-id": "0x83" - },{ - "number": 2, - "start": "10.0MiB", - "end": "30.0MiB", - "size": "20.0MiB", - "type": "extended", -+ "type-id": "0x0f", - "flags": [ - "lba" - ] -@@ -68,6 +70,7 @@ cat < exp || fail=1 - "end": "20.0MiB", - "size": "10.0MiB", - "type": "logical", -+ "type-id": "0x8e", - "flags": [ - "lvm" - ] -diff --git a/tests/t0900-type-gpt.sh b/tests/t0900-type-gpt.sh -new file mode 100755 -index 0000000..2014820 ---- /dev/null -+++ b/tests/t0900-type-gpt.sh -@@ -0,0 +1,69 @@ -+#!/bin/sh -+ -+# Test type command with GPT label -+ -+# Copyright (C) 2022 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create gpt label and one partition -+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 -+parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 -+ -+# set type-uuid -+parted --script "$dev" type 1 "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" || fail=1 -+ -+# print with json format -+parted --script --json "$dev" unit s print > out 2>&1 || fail=1 -+ -+cat < exp || fail=1 -+{ -+ "disk": { -+ "path": "loop-file", -+ "size": "102400s", -+ "model": "", -+ "transport": "file", -+ "logical-sector-size": 512, -+ "physical-sector-size": 512, -+ "label": "gpt", -+ "max-partitions": 128, -+ "partitions": [ -+ { -+ "number": 1, -+ "start": "10240s", -+ "end": "20479s", -+ "size": "10240s", -+ "type": "primary", -+ "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" -+ } -+ ] -+ } -+} -+EOF -+ -+# remove full path of device from actual output -+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 -+ -+# check for expected output -+compare exp out || fail=1 -+ -+Exit $fail -diff --git a/tests/t0901-type-gpt-invalid.sh b/tests/t0901-type-gpt-invalid.sh -new file mode 100755 -index 0000000..681df3a ---- /dev/null -+++ b/tests/t0901-type-gpt-invalid.sh -@@ -0,0 +1,35 @@ -+#!/bin/sh -+ -+# Test type command with GPT label -+ -+# Copyright (C) 2022 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create gpt label and one partition -+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 -+parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 -+ -+# set type-uuid -+parted --script "$dev" type 1 "invalidd-a4ab-43c4-84e5-0933c84b4f4f" && fail=1 -+ -+Exit $fail -diff --git a/tests/t0910-type-dos.sh b/tests/t0910-type-dos.sh -new file mode 100755 -index 0000000..d7cc37f ---- /dev/null -+++ b/tests/t0910-type-dos.sh -@@ -0,0 +1,69 @@ -+#!/bin/sh -+ -+# Test type command with MS-DOS label -+ -+# Copyright (C) 2022 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create msdos label and one partition -+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 -+parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1 -+ -+# set type-id -+parted --script "$dev" type 1 "0x83" || fail=1 -+ -+# print with json format -+parted --script --json "$dev" unit s print > out 2>&1 || fail=1 -+ -+cat < exp || fail=1 -+{ -+ "disk": { -+ "path": "loop-file", -+ "size": "102400s", -+ "model": "", -+ "transport": "file", -+ "logical-sector-size": 512, -+ "physical-sector-size": 512, -+ "label": "msdos", -+ "max-partitions": 4, -+ "partitions": [ -+ { -+ "number": 1, -+ "start": "10240s", -+ "end": "20479s", -+ "size": "10240s", -+ "type": "primary", -+ "type-id": "0x83" -+ } -+ ] -+ } -+} -+EOF -+ -+# remove full path of device from actual output -+mv out o2 && sed "s,\"/.*/$dev\",\"$dev\"," o2 > out || fail=1 -+ -+# check for expected output -+compare exp out || fail=1 -+ -+Exit $fail -diff --git a/tests/t0911-type-dos-invalid.sh b/tests/t0911-type-dos-invalid.sh -new file mode 100755 -index 0000000..f1036d1 ---- /dev/null -+++ b/tests/t0911-type-dos-invalid.sh -@@ -0,0 +1,35 @@ -+#!/bin/sh -+ -+# Test type command with MS-DOS label -+ -+# Copyright (C) 2022 SUSE LLC -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+require_512_byte_sector_size_ -+ -+dev=loop-file -+ -+# create device -+truncate --size 50MiB "$dev" || fail=1 -+ -+# create msdos label and one partition -+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 -+parted --script "$dev" mkpart primary "linux-swap" 10% 20% > out 2>&1 || fail=1 -+ -+# set type-id -+parted --script "$dev" type 1 "0x101" && fail=1 -+ -+Exit $fail -diff --git a/tests/t2400-dos-hfs-partition-type.sh b/tests/t2400-dos-hfs-partition-type.sh -index 6733683..8c54ec4 100644 ---- a/tests/t2400-dos-hfs-partition-type.sh -+++ b/tests/t2400-dos-hfs-partition-type.sh -@@ -24,7 +24,7 @@ n_sectors=8000 - - dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure - --# create a GPT partition table -+# create a MS-DOS partition table - parted -s $dev mklabel msdos \ - mkpart pri hfs 2048s 4095s \ - mkpart pri hfs+ 4096s 6143s > out 2>&1 || fail=1 -diff --git a/tests/t3300-palo-prep.sh b/tests/t3300-palo-prep.sh -index 5005e0e..efe54db 100755 ---- a/tests/t3300-palo-prep.sh -+++ b/tests/t3300-palo-prep.sh -@@ -20,9 +20,9 @@ - ss=$sector_size_ - - cat > exp < out 2> err || fail=1 - --grep -E '^1:2048s:4095s:2048s:ext2::lba, p...;$' out > k; mv k out -+grep -E '^1:2048s:4095s:2048s:ext2::p...;$' out > k; mv k out - - compare exp out || fail=1 - -diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh -index f2001c5..b35d443 100644 ---- a/tests/t3310-flags.sh -+++ b/tests/t3310-flags.sh -@@ -91,6 +91,10 @@ for table_type in aix amiga atari bsd dvh gpt mac msdos pc98 sun loop; do - # test to fail. - flags=`echo "$flags" | egrep -v 'lvm|raid'` - ;; -+ msdos) # FIXME: Exclude flags that can only be set in combination -+ # with certain other flags. -+ flags=`echo "$flags" | egrep -v 'hidden|lba'` -+ ;; - esac - - for mode in on_only on_and_off ; do --- -2.37.3 - diff --git a/0003-libparted-add-swap-flag-for-DASD-label.patch b/0003-libparted-add-swap-flag-for-DASD-label.patch deleted file mode 100644 index 424ddc7..0000000 --- a/0003-libparted-add-swap-flag-for-DASD-label.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Fri, 8 Oct 2021 10:06:24 +0000 -Subject: [PATCH 03/13] libparted: add swap flag for DASD label - -Support the swap flag and fix reading flags from disk. Also -cleanup code by dropping the 2 flags "raid" and "lvm" from -DasdPartitionData and instead use "system" directly. - -Signed-off-by: Brian C. Lane ---- - include/parted/fdasd.in.h | 2 - - libparted/labels/dasd.c | 118 ++++++++++++++++---------------------- - 2 files changed, 50 insertions(+), 70 deletions(-) - -diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h -index 9e5d7d1..e3ba183 100644 ---- a/include/parted/fdasd.in.h -+++ b/include/parted/fdasd.in.h -@@ -28,10 +28,8 @@ - - #define PARTITION_LINUX_SWAP 0x82 - #define PARTITION_LINUX 0x83 --#define PARTITION_LINUX_EXT 0x85 - #define PARTITION_LINUX_LVM 0x8e - #define PARTITION_LINUX_RAID 0xfd --#define PARTITION_LINUX_LVM_OLD 0xfe - - #define PART_TYPE_NATIVE "NATIVE" - #define PART_TYPE_SWAP "SWAP " -diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c -index 0c00c4f..27baad0 100644 ---- a/libparted/labels/dasd.c -+++ b/libparted/labels/dasd.c -@@ -53,10 +53,8 @@ - - #define PARTITION_LINUX_SWAP 0x82 - #define PARTITION_LINUX 0x83 --#define PARTITION_LINUX_EXT 0x85 - #define PARTITION_LINUX_LVM 0x8e - #define PARTITION_LINUX_RAID 0xfd --#define PARTITION_LINUX_LVM_OLD 0xfe - - extern void ped_disk_dasd_init (); - extern void ped_disk_dasd_done (); -@@ -66,8 +64,6 @@ extern void ped_disk_dasd_done (); - typedef struct { - int type; - int system; -- int raid; -- int lvm; - } DasdPartitionData; - - typedef struct { -@@ -134,6 +130,31 @@ static PedDiskType dasd_disk_type = { - features: 0 - }; - -+struct flag_id_mapping_t -+{ -+ enum _PedPartitionFlag flag; -+ int type_id; -+}; -+ -+static const struct flag_id_mapping_t flag_id_mapping[] = -+{ -+ { PED_PARTITION_LVM, PARTITION_LINUX_LVM }, -+ { PED_PARTITION_RAID, PARTITION_LINUX_RAID }, -+ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, -+}; -+ -+static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST -+dasd_find_flag_id_mapping (PedPartitionFlag flag) -+{ -+ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]); -+ -+ for (int i = 0; i < n; ++i) -+ if (flag_id_mapping[i].flag == flag) -+ return &flag_id_mapping[i]; -+ -+ return NULL; -+} -+ - static PedDisk* - dasd_alloc (const PedDevice* dev) - { -@@ -310,8 +331,6 @@ dasd_read (PedDisk* disk) - part->num = 1; - part->fs_type = ped_file_system_probe (&part->geom); - dasd_data = part->disk_specific; -- dasd_data->raid = 0; -- dasd_data->lvm = 0; - dasd_data->type = 0; - - if (!ped_disk_add_partition (disk, part, NULL)) -@@ -394,8 +413,6 @@ dasd_read (PedDisk* disk) - part->num = 1; - part->fs_type = ped_file_system_probe (&part->geom); - dasd_data = part->disk_specific; -- dasd_data->raid = 0; -- dasd_data->lvm = 0; - dasd_data->type = 0; - - if (!ped_disk_add_partition (disk, part, NULL)) -@@ -452,25 +469,12 @@ dasd_read (PedDisk* disk) - - dasd_data = part->disk_specific; - -- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) && -- (ped_file_system_probe(&part->geom) == NULL)) -- ped_partition_set_flag(part, PED_PARTITION_RAID, 1); -- else -- ped_partition_set_flag(part, PED_PARTITION_RAID, 0); -- -- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) && -- (ped_file_system_probe(&part->geom) == NULL)) -- ped_partition_set_flag(part, PED_PARTITION_LVM, 1); -- else -- ped_partition_set_flag(part, PED_PARTITION_LVM, 0); -- -- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) { -- fs = ped_file_system_probe(&part->geom); -- if (fs && is_linux_swap(fs->name)) { -- dasd_data->system = PARTITION_LINUX_SWAP; -- PDEBUG; -- } -- } -+ if (strncmp(PART_TYPE_RAID, str, 6) == 0) -+ dasd_data->system = PARTITION_LINUX_RAID; -+ else if (strncmp(PART_TYPE_LVM, str, 6) == 0) -+ dasd_data->system = PARTITION_LINUX_LVM; -+ else if (strncmp(PART_TYPE_SWAP, str, 6) == 0) -+ dasd_data->system = PARTITION_LINUX_SWAP; - - vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44); - -@@ -747,20 +751,17 @@ dasd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state) - PED_ASSERT(part->disk_specific != NULL); - dasd_data = part->disk_specific; - -- switch (flag) { -- case PED_PARTITION_RAID: -- if (state) -- dasd_data->lvm = 0; -- dasd_data->raid = state; -- return ped_partition_set_system(part, part->fs_type); -- case PED_PARTITION_LVM: -- if (state) -- dasd_data->raid = 0; -- dasd_data->lvm = state; -- return ped_partition_set_system(part, part->fs_type); -- default: -- return 0; -+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag); -+ if (p) -+ { -+ if (state) -+ dasd_data->system = p->type_id; -+ else if (dasd_data->system == p->type_id) -+ return dasd_partition_set_system (part, part->fs_type); -+ return 1; - } -+ -+ return 0; - } - - static int -@@ -772,14 +773,11 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) - PED_ASSERT (part->disk_specific != NULL); - dasd_data = part->disk_specific; - -- switch (flag) { -- case PED_PARTITION_RAID: -- return dasd_data->raid; -- case PED_PARTITION_LVM: -- return dasd_data->lvm; -- default: -- return 0; -- } -+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag); -+ if (p) -+ return dasd_data->system == p->type_id; -+ -+ return 0; - } - - /* -@@ -800,14 +798,10 @@ dasd_partition_is_flag_available (const PedPartition* part, - if (disk_specific->format_type == 1) - return 0; - -- switch (flag) { -- case PED_PARTITION_RAID: -- return 1; -- case PED_PARTITION_LVM: -- return 1; -- default: -- return 0; -- } -+ if (dasd_find_flag_id_mapping (flag)) -+ return 1; -+ -+ return 0; - } - - -@@ -938,18 +932,6 @@ dasd_partition_set_system (PedPartition* part, - - part->fs_type = fs_type; - -- if (dasd_data->lvm) { -- dasd_data->system = PARTITION_LINUX_LVM; -- PDEBUG; -- return 1; -- } -- -- if (dasd_data->raid) { -- dasd_data->system = PARTITION_LINUX_RAID; -- PDEBUG; -- return 1; -- } -- - if (!fs_type) { - dasd_data->system = PARTITION_LINUX; - PDEBUG; --- -2.37.3 - diff --git a/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch b/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch deleted file mode 100644 index 2060b77..0000000 --- a/0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 13 May 2022 10:02:06 -0700 -Subject: [PATCH 04/13] parted: Reset the filesystem type when changing the - id/uuid - -Without this the print command keeps showing the type selected with -mkpart, which doesn't match the id/uuid set by the user. So rescan the -partition for a filesystem. ---- - parted/parted.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/parted/parted.c b/parted/parted.c -index b8a4acf..96da30d 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -991,6 +991,9 @@ do_type (PedDevice** dev, PedDisk** diskp) - - free (input); - -+ // Reset the fs_type based on the filesystem, if it exists -+ part->fs_type = ped_file_system_probe (&part->geom); -+ - if (!ped_disk_commit (*diskp)) - goto error; - return 1; --- -2.37.3 - diff --git a/0005-tests-t3200-type-change-now-passes.patch b/0005-tests-t3200-type-change-now-passes.patch deleted file mode 100644 index a61d327..0000000 --- a/0005-tests-t3200-type-change-now-passes.patch +++ /dev/null @@ -1,23 +0,0 @@ -From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 13 May 2022 10:15:41 -0700 -Subject: [PATCH 05/13] tests: t3200-type-change now passes - ---- - tests/Makefile.am | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 2da653b..1d109d7 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -1,6 +1,3 @@ --XFAIL_TESTS = \ -- t3200-type-change.sh -- - TEST_EXTENSIONS = .sh - SH_LOG_COMPILER = $(SHELL) - --- -2.37.3 - diff --git a/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch b/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch deleted file mode 100644 index afa6bc2..0000000 --- a/0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch +++ /dev/null @@ -1,40 +0,0 @@ -From bafa84b25a265ef9eed3872790d52bf56ac42998 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Wed, 27 Jul 2022 09:36:54 +0000 -Subject: [PATCH 06/13] libparted: Fix check for availability of _type_id - functions - -Fix a copy/paste error. In practice this didn't cause any problems -because the *_set_type_id and *_get_type_id are either both NULL or both -set to the function. - -Signed-off-by: Brian C. Lane ---- - libparted/disk.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libparted/disk.c b/libparted/disk.c -index 22dff36..a961d65 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -1572,7 +1572,7 @@ ped_partition_get_type_id (const PedPartition *part) - if (!_assert_partition_type_id_feature (part->disk->type)) - return 0; - -- PED_ASSERT (part->disk->type->ops->partition_set_type_id != NULL); -+ PED_ASSERT (part->disk->type->ops->partition_get_type_id != NULL); - return part->disk->type->ops->partition_get_type_id (part); - } - -@@ -1608,7 +1608,7 @@ ped_partition_get_type_uuid (const PedPartition *part) - if (!_assert_partition_type_uuid_feature (part->disk->type)) - return NULL; - -- PED_ASSERT (part->disk->type->ops->partition_set_type_uuid != NULL); -+ PED_ASSERT (part->disk->type->ops->partition_get_type_uuid != NULL); - return part->disk->type->ops->partition_get_type_uuid (part); - } - --- -2.37.3 - diff --git a/0007-parted-Simplify-code-for-json-output.patch b/0007-parted-Simplify-code-for-json-output.patch deleted file mode 100644 index 50a600d..0000000 --- a/0007-parted-Simplify-code-for-json-output.patch +++ /dev/null @@ -1,34 +0,0 @@ -From b16be5ffc8e700df2b6b2545c4b6794cea71b8e7 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Wed, 27 Jul 2022 13:36:08 +0000 -Subject: [PATCH 07/13] parted: Simplify code for json output - -_PedDiskOps::get_max_primary_partition_count is always available, the -macro PT_op_function_initializers ensures it. So use -ped_disk_get_max_primary_partition_count instead of -_PedDiskOps::get_max_primary_partition_count directly. - -Signed-off-by: Brian C. Lane ---- - parted/parted.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index 96da30d..36c39c7 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1215,9 +1215,8 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); - ul_jsonwrt_value_s (&json, "label", pt_name); - if (diskp) { -- if (diskp->type->ops->get_max_primary_partition_count) -- ul_jsonwrt_value_u64 (&json, "max-partitions", -- diskp->type->ops->get_max_primary_partition_count(diskp)); -+ ul_jsonwrt_value_u64 (&json, "max-partitions", -+ ped_disk_get_max_primary_partition_count(diskp)); - disk_print_flags_json (diskp); - } - } else { --- -2.37.3 - diff --git a/0008-disk.in.h-Remove-use-of-enums-with-define.patch b/0008-disk.in.h-Remove-use-of-enums-with-define.patch deleted file mode 100644 index bb56d68..0000000 --- a/0008-disk.in.h-Remove-use-of-enums-with-define.patch +++ /dev/null @@ -1,59 +0,0 @@ -From aa690ee275db86d1edb2468bcf31c3d7cf81228e Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Thu, 4 Aug 2022 11:39:09 -0700 -Subject: [PATCH 08/13] disk.in.h: Remove use of enums with #define - -The preprocessor doesn't evaluate the enum, so it ends up being 0, which -causes problems for library users like pyparted which try to use the _LAST -value to conditionally include support for newer flags. - -Instead just define the int that is the first and last entry in each enum. - -Thanks to adamw and dcantrell for help arriving at a solution. ---- - include/parted/disk.in.h | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index 672c4ee..715637d 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -47,8 +47,9 @@ enum _PedDiskFlag { - /* This flag controls whether the boot flag of a GPT PMBR is set */ - PED_DISK_GPT_PMBR_BOOT=2, - }; --#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT --#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT -+// NOTE: DO NOT define using enums -+#define PED_DISK_FIRST_FLAG 1 // PED_DISK_CYLINDER_ALIGNMENT -+#define PED_DISK_LAST_FLAG 2 // PED_DISK_GPT_PMBR_BOOT - - /** - * Partition types -@@ -88,8 +89,9 @@ enum _PedPartitionFlag { - PED_PARTITION_BLS_BOOT=20, - PED_PARTITION_LINUX_HOME=21, - }; --#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_LINUX_HOME -+// NOTE: DO NOT define using enums -+#define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT -+#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -@@ -97,8 +99,9 @@ enum _PedDiskTypeFeature { - PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ - PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ - }; --#define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED --#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_TYPE_UUID -+// NOTE: DO NOT define using enums -+#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED -+#define PED_DISK_TYPE_LAST_FEATURE 8 // PED_DISK_TYPE_PARTITION_TYPE_UUID - - struct _PedDisk; - struct _PedPartition; --- -2.37.3 - diff --git a/0009-libparted-Fix-handling-of-gpt-partition-types.patch b/0009-libparted-Fix-handling-of-gpt-partition-types.patch deleted file mode 100644 index bfe30cb..0000000 --- a/0009-libparted-Fix-handling-of-gpt-partition-types.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8957382b98fd79bc06dad132ef28a0be8b46ea16 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 12:04:32 -0700 -Subject: [PATCH 09/13] libparted: Fix handling of gpt partition types - -This restores the previous behavior by testing the GUID against the list -of known types and skipping the filesystem GUID reset. Now the sequence -of: - -ped_partition_new(...) -ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); -ped_partition_set_system(part, ped_file_system_type_get("ext4")); - -Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used -to behave. ---- - libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 43 insertions(+), 2 deletions(-) - -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 0e9e060..8e6a37d 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -196,6 +196,24 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] = - { PED_PARTITION_SWAP, PARTITION_SWAP_GUID }, - }; - -+static const efi_guid_t skip_set_system_guids[] = -+{ -+ PARTITION_LVM_GUID, -+ PARTITION_SWAP_GUID, -+ PARTITION_RAID_GUID, -+ PARTITION_PREP_GUID, -+ PARTITION_SYSTEM_GUID, -+ PARTITION_BIOS_GRUB_GUID, -+ PARTITION_HPSERVICE_GUID, -+ PARTITION_MSFT_RESERVED_GUID, -+ PARTITION_BASIC_DATA_GUID, -+ PARTITION_MSFT_RECOVERY, -+ PARTITION_APPLE_TV_RECOVERY_GUID, -+ PARTITION_IRST_GUID, -+ PARTITION_CHROMEOS_KERNEL_GUID, -+ PARTITION_BLS_BOOT_GUID, -+}; -+ - static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST - gpt_find_flag_uuid_mapping (PedPartitionFlag flag) - { -@@ -1421,6 +1439,21 @@ gpt_partition_destroy (PedPartition *part) - _ped_partition_free (part); - } - -+/* is_skip_guid checks the guid against the list of guids that should not be -+ * overridden by set_system. It returns a 1 if it is in the list. -+*/ -+static bool -+is_skip_guid(efi_guid_t guid) { -+ int n = sizeof(skip_set_system_guids) / sizeof(skip_set_system_guids[0]); -+ for (int i = 0; i < n; ++i) { -+ if (guid_cmp(guid, skip_set_system_guids[i]) == 0) { -+ return true; -+ } -+ } -+ -+ return false; -+} -+ - static int - gpt_partition_set_system (PedPartition *part, - const PedFileSystemType *fs_type) -@@ -1431,6 +1464,11 @@ gpt_partition_set_system (PedPartition *part, - - part->fs_type = fs_type; - -+ // Is this a GUID that should skip fs_type checking? -+ if (is_skip_guid(gpt_part_data->type)) { -+ return 1; -+ } -+ - if (fs_type) - { - if (strncmp (fs_type->name, "fat", 3) == 0 -@@ -1563,10 +1601,13 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag); - if (p) - { -- if (state) -+ if (state) { - gpt_part_data->type = p->type_uuid; -- else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) -+ } else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) { -+ // Clear the GUID so that fs_type will be used to return it to the default -+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID; - return gpt_partition_set_system (part, part->fs_type); -+ } - return 1; - } - --- -2.37.3 - diff --git a/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch deleted file mode 100644 index b905115..0000000 --- a/0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +++ /dev/null @@ -1,160 +0,0 @@ -From d50b7bf2b66b7b67ee332c1af63bc1f5fdfba7ad Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 13:49:09 -0700 -Subject: [PATCH 10/13] tests: Add a libparted test for - ped_partition_set_system on gpt - -Test the libparted API to make sure the flag is not cleared by calling -ped_partition_set_system. ---- - libparted/tests/Makefile.am | 6 ++- - libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++ - libparted/tests/t1001-flags.sh | 23 ++++++++++ - 3 files changed, 108 insertions(+), 2 deletions(-) - create mode 100644 libparted/tests/flags.c - create mode 100755 libparted/tests/t1001-flags.sh - -diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am -index fd5cba5..260b692 100644 ---- a/libparted/tests/Makefile.am -+++ b/libparted/tests/Makefile.am -@@ -3,9 +3,10 @@ - # - # This file may be modified and/or distributed without restriction. - --TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh -+TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \ -+ t3000-symlink.sh t4000-volser.sh - EXTRA_DIST = $(TESTS) --check_PROGRAMS = label disk zerolen symlink volser -+check_PROGRAMS = label disk zerolen symlink volser flags - AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) - - LDADD = \ -@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c - zerolen_SOURCES = common.h common.c zerolen.c - symlink_SOURCES = common.h common.c symlink.c - volser_SOURCES = common.h common.c volser.c -+flags_SOURCES = common.h common.c flags.c - - # Arrange to symlink to tests/init.sh. - CLEANFILES = init.sh -diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c -new file mode 100644 -index 0000000..c83a361 ---- /dev/null -+++ b/libparted/tests/flags.c -@@ -0,0 +1,81 @@ -+#include -+#include -+ -+#include -+ -+#include -+ -+#include "common.h" -+#include "progname.h" -+ -+#define STREQ(a, b) (strcmp (a, b) == 0) -+ -+static char* temporary_disk; -+ -+static void -+create_disk (void) -+{ -+ temporary_disk = _create_disk (80 * 1024 * 1024); -+ fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+} -+ -+static void -+destroy_disk (void) -+{ -+ unlink (temporary_disk); -+ free (temporary_disk); -+} -+ -+/* TEST: Test partition type flag on gpt disklabel */ -+START_TEST (test_gpt_flag) -+{ -+ PedDevice* dev = ped_device_get (temporary_disk); -+ if (dev == NULL) -+ return; -+ -+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt")); -+ PedConstraint *constraint = ped_constraint_any (dev); -+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, -+ ped_file_system_type_get("ext4"), 2048, 4096); -+ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1); -+ // Type should remain set to BIOS_GRUB -+ ped_partition_set_system(part, ped_file_system_type_get("ext4")); -+ -+ ped_disk_add_partition (disk, part, constraint); -+ ped_disk_commit (disk); -+ ped_constraint_destroy (constraint); -+ -+ // Check flag to confirm it is still set -+ part = ped_disk_get_partition (disk, 1); -+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); -+ -+ ped_disk_destroy (disk); -+ ped_device_destroy (dev); -+} -+END_TEST -+ -+int -+main (int argc, char **argv) -+{ -+ set_program_name (argv[0]); -+ int number_failed; -+ Suite* suite = suite_create ("Partition Flags"); -+ TCase* tcase_gpt = tcase_create ("GPT"); -+ -+ /* Fail when an exception is raised */ -+ ped_exception_set_handler (_test_exception_handler); -+ -+ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk); -+ tcase_add_test (tcase_gpt, test_gpt_flag); -+ /* Disable timeout for this test */ -+ tcase_set_timeout (tcase_gpt, 0); -+ suite_add_tcase (suite, tcase_gpt); -+ -+ SRunner* srunner = srunner_create (suite); -+ srunner_run_all (srunner, CK_VERBOSE); -+ -+ number_failed = srunner_ntests_failed (srunner); -+ srunner_free (srunner); -+ -+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -+} -diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh -new file mode 100755 -index 0000000..60a6248 ---- /dev/null -+++ b/libparted/tests/t1001-flags.sh -@@ -0,0 +1,23 @@ -+#!/bin/sh -+# run the flags unittest -+ -+# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ . -+ -+flags || fail=1 -+ -+Exit $fail --- -2.37.3 - diff --git a/0011-libparted-Fix-handling-of-msdos-partition-types.patch b/0011-libparted-Fix-handling-of-msdos-partition-types.patch deleted file mode 100644 index bcbb062..0000000 --- a/0011-libparted-Fix-handling-of-msdos-partition-types.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 4a0e468ed63fff85a1f9b923189f20945b32f4f1 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 15:02:30 -0700 -Subject: [PATCH 11/13] libparted: Fix handling of msdos partition types - -This restores the previous behavior by testing the partition type -against the list of known types and skipping the filesystem type reset. -Now the sequence of: - -ped_partition_new(...) -ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); -ped_partition_set_system(part, ped_file_system_type_get("ext4")); - -Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used -to behave. ---- - libparted/labels/dos.c | 54 +++++++++++++++++++++++++++++++++++------- - 1 file changed, 46 insertions(+), 8 deletions(-) - -diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c -index bd7465d..4359276 100644 ---- a/libparted/labels/dos.c -+++ b/libparted/labels/dos.c -@@ -121,6 +121,22 @@ static const struct flag_id_mapping_t flag_id_mapping[] = - { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP }, - }; - -+static const unsigned char skip_set_system_types[] = -+{ -+ PARTITION_EXT_LBA, -+ PARTITION_DOS_EXT, -+ PARTITION_COMPAQ_DIAG, -+ PARTITION_MSFT_RECOVERY, -+ PARTITION_LINUX_LVM, -+ PARTITION_LINUX_SWAP, -+ PARTITION_LINUX_RAID, -+ PARTITION_PALO, -+ PARTITION_PREP, -+ PARTITION_IRST, -+ PARTITION_ESP, -+ PARTITION_BLS_BOOT -+}; -+ - static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST - dos_find_flag_id_mapping (PedPartitionFlag flag) - { -@@ -1540,6 +1556,21 @@ msdos_partition_destroy (PedPartition* part) - free (part); - } - -+/* is_skip_type checks the type against the list of types that should not be -+ * overridden by set_system. It returns a 1 if it is in the list. -+*/ -+static bool -+is_skip_type(unsigned char type_id) { -+ int n = sizeof(skip_set_system_types) / sizeof(skip_set_system_types[0]); -+ for (int i = 0; i < n; ++i) { -+ if (type_id == skip_set_system_types[i]) { -+ return true; -+ } -+ } -+ -+ return false; -+} -+ - static int - msdos_partition_set_system (PedPartition* part, - const PedFileSystemType* fs_type) -@@ -1548,6 +1579,11 @@ msdos_partition_set_system (PedPartition* part, - - part->fs_type = fs_type; - -+ // Is this a type that should skip fs_type checking? -+ if (is_skip_type(dos_data->system)) { -+ return 1; -+ } -+ - if (part->type & PED_PARTITION_EXTENDED) { - dos_data->system = PARTITION_EXT_LBA; - return 1; -@@ -1590,15 +1626,17 @@ msdos_partition_set_flag (PedPartition* part, - const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag); - if (p) - { -- if (part->type & PED_PARTITION_EXTENDED) -- return 0; -- -- if (state) -- dos_data->system = p->type_id; -- else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) -- return ped_partition_set_system (part, part->fs_type); -+ if (part->type & PED_PARTITION_EXTENDED) -+ return 0; - -- return 1; -+ if (state) { -+ dos_data->system = p->type_id; -+ } else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) { -+ // Clear the type so that fs_type will be used to return it to the default -+ dos_data->system = PARTITION_LINUX; -+ return ped_partition_set_system (part, part->fs_type); -+ } -+ return 1; - } - - switch (flag) { --- -2.37.3 - diff --git a/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch b/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch deleted file mode 100644 index 0628463..0000000 --- a/0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 8f37b28825933af9bbbac7f00cc7e23f916c7018 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 8 Aug 2022 15:06:03 -0700 -Subject: [PATCH 12/13] tests: Add a libparted test for - ped_partition_set_system on msdos - -Test the libparted API to make sure the flag is not cleared by calling -ped_partition_set_system. ---- - libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - -diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c -index c83a361..c4b290b 100644 ---- a/libparted/tests/flags.c -+++ b/libparted/tests/flags.c -@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag) - } - END_TEST - -+/* TEST: Test partition type flag on msdos disklabel */ -+START_TEST (test_msdos_flag) -+{ -+ PedDevice* dev = ped_device_get (temporary_disk); -+ if (dev == NULL) -+ return; -+ -+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos")); -+ PedConstraint *constraint = ped_constraint_any (dev); -+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL, -+ ped_file_system_type_get("ext4"), 2048, 4096); -+ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1); -+ // Type should remain set to BIOS_GRUB -+ ped_partition_set_system(part, ped_file_system_type_get("ext4")); -+ -+ ped_disk_add_partition (disk, part, constraint); -+ ped_disk_commit (disk); -+ ped_constraint_destroy (constraint); -+ -+ // Check flag to confirm it is still set -+ part = ped_disk_get_partition (disk, 1); -+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); -+ -+ ped_disk_destroy (disk); -+ ped_device_destroy (dev); -+} -+END_TEST -+ - int - main (int argc, char **argv) - { -@@ -61,6 +89,7 @@ main (int argc, char **argv) - int number_failed; - Suite* suite = suite_create ("Partition Flags"); - TCase* tcase_gpt = tcase_create ("GPT"); -+ TCase* tcase_msdos = tcase_create ("MSDOS"); - - /* Fail when an exception is raised */ - ped_exception_set_handler (_test_exception_handler); -@@ -71,6 +100,12 @@ main (int argc, char **argv) - tcase_set_timeout (tcase_gpt, 0); - suite_add_tcase (suite, tcase_gpt); - -+ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk); -+ tcase_add_test (tcase_msdos, test_msdos_flag); -+ /* Disable timeout for this test */ -+ tcase_set_timeout (tcase_msdos, 0); -+ suite_add_tcase (suite, tcase_msdos); -+ - SRunner* srunner = srunner_create (suite); - srunner_run_all (srunner, CK_VERBOSE); - --- -2.37.3 - diff --git a/0013-show-GPT-UUIDs-in-JSON-output.patch b/0013-show-GPT-UUIDs-in-JSON-output.patch deleted file mode 100644 index 31518b5..0000000 --- a/0013-show-GPT-UUIDs-in-JSON-output.patch +++ /dev/null @@ -1,351 +0,0 @@ -From 2194035fc0fe678472d279676a13511769f7ef20 Mon Sep 17 00:00:00 2001 -From: Arvin Schnell -Date: Thu, 28 Jul 2022 09:20:09 +0000 -Subject: [PATCH 13/13] show GPT UUIDs in JSON output - -Include GPT UUIDs in JSON output. ---- - include/parted/disk.in.h | 13 ++++++-- - libparted/disk.c | 64 ++++++++++++++++++++++++++++++++++++++++ - libparted/labels/gpt.c | 40 ++++++++++++++++++++++++- - parted/parted.c | 18 +++++++++++ - tests/t0800-json-gpt.sh | 7 +++-- - tests/t0900-type-gpt.sh | 8 +++-- - 6 files changed, 142 insertions(+), 8 deletions(-) - -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index 715637d..f649bcc 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -98,10 +98,12 @@ enum _PedDiskTypeFeature { - PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ - PED_DISK_TYPE_PARTITION_TYPE_ID=4, /**< supports partition type-ids */ - PED_DISK_TYPE_PARTITION_TYPE_UUID=8, /**< supports partition type-uuids */ -+ PED_DISK_TYPE_DISK_UUID=16, /**< supports disk uuids */ -+ PED_DISK_TYPE_PARTITION_UUID=32, /**< supports partition uuids */ - }; - // NOTE: DO NOT define using enums --#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED --#define PED_DISK_TYPE_LAST_FEATURE 8 // PED_DISK_TYPE_PARTITION_TYPE_UUID -+#define PED_DISK_TYPE_FIRST_FEATURE 1 // PED_DISK_TYPE_EXTENDED -+#define PED_DISK_TYPE_LAST_FEATURE 32 // PED_DISK_TYPE_PARTITION_UUID - - struct _PedDisk; - struct _PedPartition; -@@ -228,6 +230,7 @@ struct _PedDiskOps { - int (*disk_is_flag_available) ( - const PedDisk *disk, - PedDiskFlag flag); -+ uint8_t* (*disk_get_uuid) (const PedDisk* disk); - /** \todo add label guessing op here */ - - /* partition operations */ -@@ -260,6 +263,8 @@ struct _PedDiskOps { - int (*partition_set_type_uuid) (PedPartition* part, const uint8_t* uuid); - uint8_t* (*partition_get_type_uuid) (const PedPartition* part); - -+ uint8_t* (*partition_get_uuid) (const PedPartition* part); -+ - int (*partition_align) (PedPartition* part, - const PedConstraint* constraint); - int (*partition_enumerate) (PedPartition* part); -@@ -331,6 +336,8 @@ extern int ped_disk_set_flag(PedDisk *disk, PedDiskFlag flag, int state); - extern int ped_disk_get_flag(const PedDisk *disk, PedDiskFlag flag); - extern int ped_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag); - -+extern uint8_t* ped_disk_get_uuid (const PedDisk* disk); -+ - extern const char *ped_disk_flag_get_name(PedDiskFlag flag); - extern PedDiskFlag ped_disk_flag_get_by_name(const char *name); - extern PedDiskFlag ped_disk_flag_next(PedDiskFlag flag) _GL_ATTRIBUTE_CONST; -@@ -367,6 +374,8 @@ extern uint8_t ped_partition_get_type_id (const PedPartition* part); - extern int ped_partition_set_type_uuid (PedPartition* part, const uint8_t* uuid); - extern uint8_t* ped_partition_get_type_uuid (const PedPartition* part); - -+extern uint8_t* ped_partition_get_uuid (const PedPartition* part); -+ - extern int ped_partition_is_busy (const PedPartition* part); - extern char* ped_partition_get_path (const PedPartition* part); - -diff --git a/libparted/disk.c b/libparted/disk.c -index a961d65..0ed3d91 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -886,6 +886,37 @@ ped_disk_flag_next(PedDiskFlag flag) - return (flag + 1) % (PED_DISK_LAST_FLAG + 1); - } - -+static int -+_assert_disk_uuid_feature (const PedDiskType* disk_type) -+{ -+ if (!ped_disk_type_check_feature ( -+ disk_type, PED_DISK_TYPE_DISK_UUID)) { -+ ped_exception_throw ( -+ PED_EXCEPTION_ERROR, -+ PED_EXCEPTION_CANCEL, -+ "%s disk labels do not support disk uuids.", -+ disk_type->name); -+ return 0; -+ } -+ return 1; -+} -+ -+/** -+ * Get the uuid of the disk \p disk. This will only work if the disk label -+ * supports it. -+ */ -+uint8_t* -+ped_disk_get_uuid (const PedDisk *disk) -+{ -+ PED_ASSERT (disk != NULL); -+ -+ if (!_assert_disk_uuid_feature (disk->type)) -+ return NULL; -+ -+ PED_ASSERT (disk->type->ops->disk_get_uuid != NULL); -+ return disk->type->ops->disk_get_uuid (disk); -+} -+ - /** - * \internal We turned a really nasty bureaucracy problem into an elegant maths - * problem :-) Basically, there are some constraints to a partition's -@@ -1488,6 +1519,21 @@ _assert_partition_type_uuid_feature (const PedDiskType* disk_type) - return 1; - } - -+static int -+_assert_partition_uuid_feature (const PedDiskType* disk_type) -+{ -+ if (!ped_disk_type_check_feature ( -+ disk_type, PED_DISK_TYPE_PARTITION_UUID)) { -+ ped_exception_throw ( -+ PED_EXCEPTION_ERROR, -+ PED_EXCEPTION_CANCEL, -+ "%s disk labels do not support partition uuids.", -+ disk_type->name); -+ return 0; -+ } -+ return 1; -+} -+ - /** - * Sets the name of a partition. - * -@@ -1612,6 +1658,24 @@ ped_partition_get_type_uuid (const PedPartition *part) - return part->disk->type->ops->partition_get_type_uuid (part); - } - -+/** -+ * Get the uuid of the partition \p part. This will only work if the disk label -+ * supports it. -+ */ -+uint8_t* -+ped_partition_get_uuid (const PedPartition *part) -+{ -+ PED_ASSERT (part != NULL); -+ PED_ASSERT (part->disk != NULL); -+ PED_ASSERT (ped_partition_is_active (part)); -+ -+ if (!_assert_partition_uuid_feature (part->disk->type)) -+ return NULL; -+ -+ PED_ASSERT (part->disk->type->ops->partition_get_uuid != NULL); -+ return part->disk->type->ops->partition_get_uuid (part); -+} -+ - /** @} */ - - /** -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 8e6a37d..1993863 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -1576,6 +1576,24 @@ gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag) - } - } - -+static uint8_t* -+gpt_disk_get_uuid (const PedDisk *disk) -+{ -+ GPTDiskData *gpt_disk_data = disk->disk_specific; -+ -+ efi_guid_t uuid = gpt_disk_data->uuid; -+ -+ /* uuid is always LE, while uint8_t is always kind of BE */ -+ -+ uuid.time_low = PED_SWAP32(uuid.time_low); -+ uuid.time_mid = PED_SWAP16(uuid.time_mid); -+ uuid.time_hi_and_version = PED_SWAP16(uuid.time_hi_and_version); -+ -+ uint8_t *buf = ped_malloc(sizeof (uuid_t)); -+ memcpy(buf, &uuid, sizeof (uuid_t)); -+ return buf; -+} -+ - static int - gpt_disk_get_flag (const PedDisk *disk, PedDiskFlag flag) - { -@@ -1764,6 +1782,23 @@ gpt_partition_get_type_uuid (const PedPartition *part) - return buf; - } - -+static uint8_t* -+gpt_partition_get_uuid (const PedPartition *part) -+{ -+ const GPTPartitionData *gpt_part_data = part->disk_specific; -+ -+ efi_guid_t uuid = gpt_part_data->uuid; -+ -+ /* uuid is always LE, while uint8_t is always kind of BE */ -+ -+ uuid.time_low = PED_SWAP32(uuid.time_low); -+ uuid.time_mid = PED_SWAP16(uuid.time_mid); -+ uuid.time_hi_and_version = PED_SWAP16(uuid.time_hi_and_version); -+ -+ uint8_t *buf = ped_malloc(sizeof (uuid_t)); -+ memcpy(buf, &uuid, sizeof (uuid_t)); -+ return buf; -+} - - static int - gpt_get_max_primary_partition_count (const PedDisk *disk) -@@ -1864,9 +1899,11 @@ static PedDiskOps gpt_disk_ops = - partition_get_type_id: NULL, - partition_set_type_uuid: gpt_partition_set_type_uuid, - partition_get_type_uuid: gpt_partition_get_type_uuid, -+ partition_get_uuid: gpt_partition_get_uuid, - disk_set_flag: gpt_disk_set_flag, - disk_get_flag: gpt_disk_get_flag, - disk_is_flag_available: gpt_disk_is_flag_available, -+ disk_get_uuid: gpt_disk_get_uuid, - - PT_op_function_initializers (gpt) - }; -@@ -1876,7 +1913,8 @@ static PedDiskType gpt_disk_type = - next: NULL, - name: "gpt", - ops: &gpt_disk_ops, -- features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID -+ features: PED_DISK_TYPE_PARTITION_NAME | PED_DISK_TYPE_PARTITION_TYPE_UUID | -+ PED_DISK_TYPE_DISK_UUID | PED_DISK_TYPE_PARTITION_UUID - }; - - void -diff --git a/parted/parted.c b/parted/parted.c -index 36c39c7..84187b7 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -1215,6 +1215,14 @@ _print_disk_info (const PedDevice *dev, const PedDisk *diskp) - ul_jsonwrt_value_u64 (&json, "physical-sector-size", dev->phys_sector_size); - ul_jsonwrt_value_s (&json, "label", pt_name); - if (diskp) { -+ bool has_disk_uuid = ped_disk_type_check_feature (diskp->type, PED_DISK_TYPE_DISK_UUID); -+ if (has_disk_uuid) { -+ uint8_t* uuid = ped_disk_get_uuid (diskp); -+ static char buf[UUID_STR_LEN]; -+ uuid_unparse_lower (uuid, buf); -+ ul_jsonwrt_value_s (&json, "uuid", buf); -+ free (uuid); -+ } - ul_jsonwrt_value_u64 (&json, "max-partitions", - ped_disk_get_max_primary_partition_count(diskp)); - disk_print_flags_json (diskp); -@@ -1360,6 +1368,8 @@ do_print (PedDevice** dev, PedDisk** diskp) - PED_DISK_TYPE_PARTITION_TYPE_ID); - bool has_type_uuid = ped_disk_type_check_feature ((*diskp)->type, - PED_DISK_TYPE_PARTITION_TYPE_UUID); -+ bool has_part_uuid = ped_disk_type_check_feature ((*diskp)->type, -+ PED_DISK_TYPE_PARTITION_UUID); - - PedPartition* part; - if (opt_output_mode == HUMAN) { -@@ -1512,6 +1522,14 @@ do_print (PedDevice** dev, PedDisk** diskp) - free (type_uuid); - } - -+ if (has_part_uuid) { -+ uint8_t* uuid = ped_partition_get_uuid (part); -+ static char buf[UUID_STR_LEN]; -+ uuid_unparse_lower (uuid, buf); -+ ul_jsonwrt_value_s (&json, "uuid", buf); -+ free (uuid); -+ } -+ - if (has_name) { - name = ped_partition_get_name (part); - if (strcmp (name, "") != 0) -diff --git a/tests/t0800-json-gpt.sh b/tests/t0800-json-gpt.sh -index 354c0bd..f6a3fb9 100755 ---- a/tests/t0800-json-gpt.sh -+++ b/tests/t0800-json-gpt.sh -@@ -32,8 +32,8 @@ parted --script "$dev" mkpart "test1" ext4 10% 20% > out 2>&1 || fail=1 - parted --script "$dev" mkpart "test2" xfs 20% 60% > out 2>&1 || fail=1 - parted --script "$dev" set 2 raid on > out 2>&1 || fail=1 - --# print with json format --parted --script --json "$dev" unit s print free > out 2>&1 || fail=1 -+# print with json format, replace non-deterministic uuids -+parted --script --json "$dev" unit s print free | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": ""/' > out 2>&1 || fail=1 - - cat < exp || fail=1 - { -@@ -45,6 +45,7 @@ cat < exp || fail=1 - "logical-sector-size": 512, - "physical-sector-size": 512, - "label": "gpt", -+ "uuid": "", - "max-partitions": 128, - "flags": [ - "pmbr_boot" -@@ -63,6 +64,7 @@ cat < exp || fail=1 - "size": "10240s", - "type": "primary", - "type-uuid": "0fc63daf-8483-4772-8e79-3d69d8477de4", -+ "uuid": "", - "name": "test1" - },{ - "number": 2, -@@ -71,6 +73,7 @@ cat < exp || fail=1 - "size": "40960s", - "type": "primary", - "type-uuid": "a19d880f-05fc-4d3b-a006-743f0f84911e", -+ "uuid": "", - "name": "test2", - "flags": [ - "raid" -diff --git a/tests/t0900-type-gpt.sh b/tests/t0900-type-gpt.sh -index 2014820..03febba 100755 ---- a/tests/t0900-type-gpt.sh -+++ b/tests/t0900-type-gpt.sh -@@ -32,8 +32,8 @@ parted --script "$dev" mkpart "''" "linux-swap" 10% 20% > out 2>&1 || fail=1 - # set type-uuid - parted --script "$dev" type 1 "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" || fail=1 - --# print with json format --parted --script --json "$dev" unit s print > out 2>&1 || fail=1 -+# print with json format, replace non-deterministic uuids -+parted --script --json "$dev" unit s print | sed -E 's/"uuid": "[0-9a-f-]{36}"/"uuid": ""/' > out 2>&1 || fail=1 - - cat < exp || fail=1 - { -@@ -45,6 +45,7 @@ cat < exp || fail=1 - "logical-sector-size": 512, - "physical-sector-size": 512, - "label": "gpt", -+ "uuid": "", - "max-partitions": 128, - "partitions": [ - { -@@ -53,7 +54,8 @@ cat < exp || fail=1 - "end": "20479s", - "size": "10240s", - "type": "primary", -- "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f" -+ "type-uuid": "deadfd6d-a4ab-43c4-84e5-0933c84b4f4f", -+ "uuid": "" - } - ] - } --- -2.37.3 - diff --git a/0014-gpt-Add-no_automount-partition-flag.patch b/0014-gpt-Add-no_automount-partition-flag.patch deleted file mode 100644 index 66d16eb..0000000 --- a/0014-gpt-Add-no_automount-partition-flag.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 55e4775c989af42d629401b9aa22c60ba2993e7d Mon Sep 17 00:00:00 2001 -From: Mike Fleetwood -Date: Tue, 13 Dec 2022 12:53:07 +0000 -Subject: [PATCH] gpt: Add no_automount partition flag - -Add user requested support for GPT partition type attribute bit 63 [1] -so the no-auto flag in the systemd originated Discoverable Partitions -Specification [2] can be manipulated. The UEFI specification [3] says -partition attribute bits 48 to 63 are partition type specific, however -the DPS [2] and Microsoft [4] use the bit 63 to mean no automounting / -assign no drive letter and apply it to multiple partition types so don't -restrict its application. - -[1] Request for GPT partition attribute bit 63 "no automount" editing - support - https://gitlab.gnome.org/GNOME/gparted/-/issues/214 -[2] The Discoverable Partitions Specification (DPS), - Partition Attribute Flags - https://uapi-group.org/specifications/specs/discoverable_partitions_specification/ -[3] UEFI Specification, version 2.8, - Table 24. Defined GPT Partition Entry - Attributes - https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf -[4] CREATE_PARTITION_PARAMETERS structure (vds.h) - https://learn.microsoft.com/en-gb/windows/win32/api/vds/ns-vds-create_partition_parameters - -Signed-off-by: Mike Fleetwood -Signed-off-by: Brian C. Lane ---- - NEWS | 2 ++ - doc/C/parted.8 | 2 +- - include/parted/disk.in.h | 3 ++- - libparted/disk.c | 2 ++ - libparted/labels/gpt.c | 12 ++++++++++-- - 5 files changed, 17 insertions(+), 4 deletions(-) - -diff --git a/NEWS b/NEWS -index 099f8bd..ac759fe 100644 ---- a/NEWS -+++ b/NEWS -@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*- - - ** New Features - -+ Support GPT partition attribute bit 63 as no_automount flag. -+ - Add type commands to set type-id on MS-DOS and type-uuid on GPT. - - * Noteworthy changes in release 3.5 (2022-04-18) [stable] -diff --git a/doc/C/parted.8 b/doc/C/parted.8 -index ab34be7..3069c33 100644 ---- a/doc/C/parted.8 -+++ b/doc/C/parted.8 -@@ -120,7 +120,7 @@ or an LVM logical volume if necessary. - Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. - Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", - "legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home", --"bios_grub", and "palo". -+"no_automount", "bios_grub", and "palo". - \fIstate\fP should be either "on" or "off". - .TP - .B unit \fIunit\fP -diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h -index f649bcc..402d78a 100644 ---- a/include/parted/disk.in.h -+++ b/include/parted/disk.in.h -@@ -88,10 +88,11 @@ enum _PedPartitionFlag { - PED_PARTITION_CHROMEOS_KERNEL=19, - PED_PARTITION_BLS_BOOT=20, - PED_PARTITION_LINUX_HOME=21, -+ PED_PARTITION_NO_AUTOMOUNT=22, - }; - // NOTE: DO NOT define using enums - #define PED_PARTITION_FIRST_FLAG 1 // PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG 21 // PED_PARTITION_LINUX_HOME -+#define PED_PARTITION_LAST_FLAG 22 // PED_PARTITION_NO_AUTOMOUNT - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -diff --git a/libparted/disk.c b/libparted/disk.c -index 0ed3d91..45f35fd 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -2579,6 +2579,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) - return N_("bls_boot"); - case PED_PARTITION_LINUX_HOME: - return N_("linux-home"); -+ case PED_PARTITION_NO_AUTOMOUNT: -+ return N_("no_automount"); - - default: - ped_exception_throw ( -diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c -index 1993863..780fb70 100644 ---- a/libparted/labels/gpt.c -+++ b/libparted/labels/gpt.c -@@ -252,7 +252,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t - uint64_t NoBlockIOProtocol:1; - uint64_t LegacyBIOSBootable:1; - uint64_t Reserved:45; -- uint64_t GuidSpecific:16; -+ uint64_t GuidSpecific:15; -+ uint64_t NoAutomount:1; - #else - # warning "Using crippled partition entry type" - uint32_t RequiredToFunction:1; -@@ -260,7 +261,8 @@ struct __attribute__ ((packed)) _GuidPartitionEntryAttributes_t - uint32_t LegacyBIOSBootable:1; - uint32_t Reserved:30; - uint32_t LOST:5; -- uint32_t GuidSpecific:16; -+ uint32_t GuidSpecific:15; -+ uint32_t NoAutomount:1; - #endif - }; - -@@ -1637,6 +1639,9 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) - case PED_PARTITION_LEGACY_BOOT: - gpt_part_data->attributes.LegacyBIOSBootable = state; - return 1; -+ case PED_PARTITION_NO_AUTOMOUNT: -+ gpt_part_data->attributes.NoAutomount = state; -+ return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: - default: -@@ -1662,6 +1667,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) - return gpt_part_data->attributes.RequiredToFunction; - case PED_PARTITION_LEGACY_BOOT: - return gpt_part_data->attributes.LegacyBIOSBootable; -+ case PED_PARTITION_NO_AUTOMOUNT: -+ return gpt_part_data->attributes.NoAutomount; - case PED_PARTITION_LBA: - case PED_PARTITION_ROOT: - default: -@@ -1681,6 +1688,7 @@ gpt_partition_is_flag_available (const PedPartition *part, - { - case PED_PARTITION_HIDDEN: - case PED_PARTITION_LEGACY_BOOT: -+ case PED_PARTITION_NO_AUTOMOUNT: - return 1; - case PED_PARTITION_ROOT: - case PED_PARTITION_LBA: --- -2.38.1 - diff --git a/0015-tests-XFS-requires-a-minimum-size-of-300M.patch b/0015-tests-XFS-requires-a-minimum-size-of-300M.patch deleted file mode 100644 index 48e0e87..0000000 --- a/0015-tests-XFS-requires-a-minimum-size-of-300M.patch +++ /dev/null @@ -1,54 +0,0 @@ -From caa588269709659d5cf51bf64c559e193f371de4 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 13 Dec 2022 14:38:24 -0800 -Subject: [PATCH] tests: XFS requires a minimum size of 300M - ---- - tests/t1700-probe-fs.sh | 3 ++- - tests/t4100-dvh-partition-limits.sh | 2 +- - tests/t4100-msdos-partition-limits.sh | 2 +- - 3 files changed, 4 insertions(+), 3 deletions(-) - -diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh -index d33606e..f8af74e 100755 ---- a/tests/t1700-probe-fs.sh -+++ b/tests/t1700-probe-fs.sh -@@ -42,7 +42,8 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do - # create an $type file system, creation failures are not parted bugs, - # skip the filesystem instead of failing the test. - if [ "$type" = "xfs" ]; then -- mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || { warn_ "$ME: mkfs.$type failed, skipping"; continue; } -+ # XFS requires at least 300M which is > 1024 sectors with 8192b sector size -+ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=300m || { warn_ "$ME: mkfs.$type failed, skipping"; continue; } - else - dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || { warn_ "$ME: dd failed, skipping $type"; continue; } - mkfs.$type $force $dev || { warn_ "$ME: mkfs.$type failed skipping"; continue; } -diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh -index d3798d2..a5b3516 100755 ---- a/tests/t4100-dvh-partition-limits.sh -+++ b/tests/t4100-dvh-partition-limits.sh -@@ -37,7 +37,7 @@ mp=`pwd`/mount-point - n=4096 - - # create an XFS file system --mkfs.xfs -dfile,name=$fs,size=100m || fail=1 -+mkfs.xfs -dfile,name=$fs,size=300m || fail=1 - mkdir "$mp" || fail=1 - - # Unmount upon interrupt, failure, etc., as well as upon normal completion. -diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh -index b591123..09267b5 100755 ---- a/tests/t4100-msdos-partition-limits.sh -+++ b/tests/t4100-msdos-partition-limits.sh -@@ -37,7 +37,7 @@ mp=`pwd`/mount-point - n=4096 - - # create an XFS file system --mkfs.xfs -dfile,name=$fs,size=100m || fail=1 -+mkfs.xfs -dfile,name=$fs,size=300m || fail=1 - mkdir "$mp" || fail=1 - - # Unmount upon interrupt, failure, etc., as well as upon normal completion. --- -2.38.1 - diff --git a/0016-libparted-Fix-problem-with-creating-1s-partitions.patch b/0016-libparted-Fix-problem-with-creating-1s-partitions.patch deleted file mode 100644 index 1cab2e6..0000000 --- a/0016-libparted-Fix-problem-with-creating-1s-partitions.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 9b009985da2e5eee5b5c179acfafab3aa1624f8b Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 10 May 2022 15:04:12 -0700 -Subject: [PATCH 16/17] libparted: Fix problem with creating 1s partitions - -There was a 1-off error in _partition_get_overlap_constraint that -prevented partitions from being created in 1s free space. You could -create 1s partitions as long they were done in order, but not after -leaving 'holes'. - -This fixes this and adds tests for it on msdos and gpt disklabels. ---- - libparted/disk.c | 2 +- - tests/Makefile.am | 2 ++ - tests/t9024-msdos-1s-partition.sh | 36 +++++++++++++++++++++++++++++++ - tests/t9025-gpt-1s-partition.sh | 36 +++++++++++++++++++++++++++++++ - 4 files changed, 75 insertions(+), 1 deletion(-) - create mode 100644 tests/t9024-msdos-1s-partition.sh - create mode 100644 tests/t9025-gpt-1s-partition.sh - -diff --git a/libparted/disk.c b/libparted/disk.c -index 45f35fd..e1a3489 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -1960,7 +1960,7 @@ _partition_get_overlap_constraint (PedPartition* part, PedGeometry* geom) - if (walk) - max_end = walk->geom.start - 1; - -- if (min_start >= max_end) -+ if (min_start > max_end) - return NULL; - - ped_geometry_init (&free_space, part->disk->dev, -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 1d109d7..fa27b44 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -91,6 +91,8 @@ TESTS = \ - t9021-maxima.sh \ - t9022-one-unit-snap.sh \ - t9023-value-lt-one.sh \ -+ t9024-msdos-1s-partition.sh \ -+ t9025-gpt-1s-partition.sh \ - t9030-align-check.sh \ - t9040-many-partitions.sh \ - t9041-undetected-in-use-16th-partition.sh \ -diff --git a/tests/t9024-msdos-1s-partition.sh b/tests/t9024-msdos-1s-partition.sh -new file mode 100644 -index 0000000..7115156 ---- /dev/null -+++ b/tests/t9024-msdos-1s-partition.sh -@@ -0,0 +1,36 @@ -+#!/bin/sh -+# Test creating 1s partitions in 1s free space -+ -+# Copyright (C) 2022 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+ -+dev=loop-file -+ -+# create device -+truncate --size 10MiB "$dev" || fail=1 -+ -+# create msdos label and some partitions with 1s free space between -+parted --script "$dev" mklabel msdos > out 2>&1 || fail=1 -+parted --script "$dev" mkpart primary ext4 64s 128s > out 2>&1 || fail=1 -+parted --script "$dev" mkpart primary ext4 130s 200s > out 2>&1 || fail=1 -+parted --script "$dev" u s p free -+ -+# Free space is at 129s -+parted --script "$dev" mkpart primary ext4 129s 129s > out 2>&1 || fail=1 -+parted --script "$dev" u s p free -+ -+Exit $fail -diff --git a/tests/t9025-gpt-1s-partition.sh b/tests/t9025-gpt-1s-partition.sh -new file mode 100644 -index 0000000..c97ab8b ---- /dev/null -+++ b/tests/t9025-gpt-1s-partition.sh -@@ -0,0 +1,36 @@ -+#!/bin/sh -+# Test creating 1s partitions in 1s free space -+ -+# Copyright (C) 2022 Free Software Foundation, Inc. -+ -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or -+# (at your option) any later version. -+ -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+ -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see . -+ -+. "${srcdir=.}/init.sh"; path_prepend_ ../parted -+ -+dev=loop-file -+ -+# create device -+truncate --size 10MiB "$dev" || fail=1 -+ -+# create msdos label and some partitions with 1s free space between -+parted --script "$dev" mklabel gpt > out 2>&1 || fail=1 -+parted --script "$dev" mkpart p1 ext4 64s 128s > out 2>&1 || fail=1 -+parted --script "$dev" mkpart p2 ext4 130s 200s > out 2>&1 || fail=1 -+parted --script "$dev" u s p free -+ -+# Free space is at 129s -+parted --script "$dev" mkpart p3 ext4 129s 129s > out 2>&1 || fail=1 -+parted --script "$dev" u s p free -+ -+Exit $fail --- -2.39.1 - diff --git a/0017-tests-Fixing-libparted-test-framework-usage.patch b/0017-tests-Fixing-libparted-test-framework-usage.patch deleted file mode 100644 index 86f0705..0000000 --- a/0017-tests-Fixing-libparted-test-framework-usage.patch +++ /dev/null @@ -1,262 +0,0 @@ -From 7b555132be63172a2d621afcdedfa7797185d3b5 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Tue, 7 Feb 2023 09:31:42 -0800 -Subject: [PATCH 17/17] tests: Fixing libparted test framework usage - -The fail and fail_if functions from libcheck are deprecated, replace -them with ck_abort_msg and ck_assert_msg. Note that the logic of assert -is the opposite of fail_if. ---- - libparted/tests/common.c | 8 ++++---- - libparted/tests/disk.c | 6 +++--- - libparted/tests/flags.c | 6 +++--- - libparted/tests/label.c | 14 ++++++-------- - libparted/tests/symlink.c | 31 +++++++++++++++++++++---------- - libparted/tests/volser.c | 2 +- - libparted/tests/zerolen.c | 2 +- - 7 files changed, 39 insertions(+), 30 deletions(-) - -diff --git a/libparted/tests/common.c b/libparted/tests/common.c -index 2be0e3a..8c42ece 100644 ---- a/libparted/tests/common.c -+++ b/libparted/tests/common.c -@@ -27,7 +27,7 @@ size_t get_sector_size (void) - PedExceptionOption - _test_exception_handler (PedException* e) - { -- fail ("Exception of type %s has been raised: %s", -+ ck_abort_msg("Exception of type %s has been raised: %s", - ped_exception_get_type_string (e->type), - e->message); - -@@ -69,10 +69,10 @@ _create_disk_label (PedDevice *dev, PedDiskType *type) - - /* Create the label */ - disk = ped_disk_new_fresh (dev, type); -- fail_if (!disk, "Failed to create a label of type: %s", -+ ck_assert_msg(disk != NULL, "Failed to create a label of type: %s", - type->name); -- fail_if (!ped_disk_commit(disk), -- "Failed to commit label to device"); -+ ck_assert_msg(ped_disk_commit(disk) != 0, -+ "Failed to commit label to device"); - - return disk; - } -diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c -index 62d20c1..f7b16a5 100644 ---- a/libparted/tests/disk.c -+++ b/libparted/tests/disk.c -@@ -14,7 +14,7 @@ static void - create_disk (void) - { - temporary_disk = _create_disk (get_sector_size () * 4 * 10 * 1024); -- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); - } - - static void -@@ -72,8 +72,8 @@ START_TEST (test_duplicate) - part = ped_disk_get_partition (disk, *i); - part_dup = ped_disk_get_partition (disk_dup, *i); - -- fail_if (part->geom.start != part_dup->geom.start || -- part->geom.end != part_dup->geom.end, -+ ck_assert_msg(part->geom.start == part_dup->geom.start && -+ part->geom.end == part_dup->geom.end, - "Duplicated partition %d doesn't match. " - "Details are start: %d/%d end: %d/%d\n", - *i, part->geom.start, part_dup->geom.start, -diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c -index c4b290b..ff4ae71 100644 ---- a/libparted/tests/flags.c -+++ b/libparted/tests/flags.c -@@ -16,7 +16,7 @@ static void - create_disk (void) - { - temporary_disk = _create_disk (80 * 1024 * 1024); -- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); - } - - static void -@@ -47,7 +47,7 @@ START_TEST (test_gpt_flag) - - // Check flag to confirm it is still set - part = ped_disk_get_partition (disk, 1); -- fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set"); -+ ck_assert_msg(ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) == 1, "BIOS_GRUB flag not set"); - - ped_disk_destroy (disk); - ped_device_destroy (dev); -@@ -75,7 +75,7 @@ START_TEST (test_msdos_flag) - - // Check flag to confirm it is still set - part = ped_disk_get_partition (disk, 1); -- fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set"); -+ ck_assert_msg(ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) == 1, "BLS_BOOT flag not set"); - - ped_disk_destroy (disk); - ped_device_destroy (dev); -diff --git a/libparted/tests/label.c b/libparted/tests/label.c -index e0d63c7..67b1b07 100644 ---- a/libparted/tests/label.c -+++ b/libparted/tests/label.c -@@ -16,7 +16,7 @@ static void - create_disk (void) - { - temporary_disk = _create_disk (80 * 1024 * 1024); -- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); - } - - static void -@@ -72,12 +72,11 @@ START_TEST (test_probe_label) - - /* Try to probe the disk label. */ - probed = ped_disk_probe (dev); -- fail_if (!probed, -+ ck_assert_msg(probed, - "Failed to probe the just created label of type: %s", - type->name); - if (probed && !STREQ (probed->name, type->name)) -- fail_if (1, -- "Probe returned label of type: %s as type: %s", -+ ck_abort_msg("Probe returned label of type: %s as type: %s", - type->name, probed->name); - } - ped_device_destroy (dev); -@@ -105,12 +104,11 @@ START_TEST (test_read_label) - - /* Try to read the disk label. */ - disk = ped_disk_new (dev); -- fail_if (!disk, -+ ck_assert_msg(disk, - "Failed to read the just created label of type: %s", - type->name); - if (disk && !STREQ (disk->type->name, type->name)) -- fail_if (1, -- "Read returned label of type: %s as type: %s", -+ ck_abort_msg("Read returned label of type: %s as type: %s", - type->name, disk->type->name); - - ped_disk_destroy (disk); -@@ -138,7 +136,7 @@ START_TEST (test_clone_label) - - /* Try to clone the disk label. */ - PedDisk* clone = ped_disk_duplicate (disk); -- fail_if (!clone, -+ ck_assert_msg(clone, - "Failed to clone the just created label of type: %s", - type->name); - -diff --git a/libparted/tests/symlink.c b/libparted/tests/symlink.c -index 52e99ca..da6bef8 100644 ---- a/libparted/tests/symlink.c -+++ b/libparted/tests/symlink.c -@@ -30,7 +30,7 @@ static void - create_disk (void) - { - temporary_disk = _create_disk (4096 * 1024); -- fail_if (temporary_disk == NULL, "Failed to create temporary disk"); -+ ck_assert_msg(temporary_disk != NULL, "Failed to create temporary disk"); - } - - static void -@@ -45,7 +45,7 @@ START_TEST (test_symlink) - char cwd[256], ln[256] = "/dev/mapper/parted-test-XXXXXX"; - - if (!getcwd (cwd, sizeof cwd)) { -- fail ("Could not get cwd"); -+ ck_abort_msg("Could not get cwd"); - return; - } - -@@ -53,7 +53,7 @@ START_TEST (test_symlink) - temporary disk */ - int tmp_fd = mkstemp (ln); - if (tmp_fd == -1) { -- fail ("Could not create tempfile"); -+ ck_abort_msg("Could not create tempfile"); - return; - } - -@@ -62,11 +62,17 @@ START_TEST (test_symlink) - close (tmp_fd); - unlink (ln); - char temp_disk_path[256]; -- snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", cwd, -- temporary_disk); -+ int r = snprintf(temp_disk_path, sizeof temp_disk_path, "%s/%s", -+ cwd, -+ temporary_disk); -+ if (r < 0 || r >= sizeof temp_disk_path) { -+ ck_abort_msg("symlink truncated"); -+ return; -+ } -+ - int res = symlink (temp_disk_path, ln); - if (res) { -- fail ("could not create symlink"); -+ ck_abort_msg("could not create symlink"); - return; - } - -@@ -77,7 +83,7 @@ START_TEST (test_symlink) - /* Create a second temporary_disk */ - char *temporary_disk2 = _create_disk (4096 * 1024); - if (temporary_disk2 == NULL) { -- fail ("Failed to create 2nd temporary disk"); -+ ck_abort_msg("Failed to create 2nd temporary disk"); - goto exit_destroy_dev; - } - -@@ -89,11 +95,16 @@ START_TEST (test_symlink) - - /* Update symlink to point to our new / second temporary disk */ - unlink (ln); -- snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", cwd, -- temporary_disk); -+ r = snprintf (temp_disk_path, sizeof temp_disk_path, "%s/%s", -+ cwd, temporary_disk); -+ if (r < 0 || r >= sizeof temp_disk_path) { -+ ck_abort_msg("2nd symlink truncated"); -+ goto exit_destroy_dev; -+ } -+ - res = symlink (temp_disk_path, ln); - if (res) { -- fail ("could not create 2nd symlink"); -+ ck_abort_msg("could not create 2nd symlink"); - goto exit_destroy_dev; - } - -diff --git a/libparted/tests/volser.c b/libparted/tests/volser.c -index c6efa5f..4b6e2d1 100644 ---- a/libparted/tests/volser.c -+++ b/libparted/tests/volser.c -@@ -34,7 +34,7 @@ static void set_test (void) - type = ped_disk_type_get ("dasd"); - - tmp_disk = _create_disk (20*1024*1024); -- fail_if (tmp_disk == NULL, "Failed to create temporary disk"); -+ ck_assert_msg(tmp_disk != NULL, "Failed to create temporary disk"); - dev = ped_device_get (tmp_disk); - if (dev == NULL) - return; -diff --git a/libparted/tests/zerolen.c b/libparted/tests/zerolen.c -index cf2bd1c..2d9b424 100644 ---- a/libparted/tests/zerolen.c -+++ b/libparted/tests/zerolen.c -@@ -28,7 +28,7 @@ main (int argc, char **argv) - TCase* tcase_probe = tcase_create ("Probe"); - - if (argc < 2) { -- fail ("Insufficient arguments"); -+ ck_abort_msg("Insufficient arguments"); - return EXIT_FAILURE; - } - temporary_disk = argv[1]; --- -2.39.1 - diff --git a/0018-filesys-Check-for-null-from-close_fn.patch b/0018-filesys-Check-for-null-from-close_fn.patch deleted file mode 100644 index 1793509..0000000 --- a/0018-filesys-Check-for-null-from-close_fn.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c409dbf423d870ab26684cd6a6953c76c4a08d7f Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 15 Feb 2023 10:04:36 -0800 -Subject: [PATCH 18/24] filesys: Check for null from close_fn - -If the filesystem type name isn't known it can return a NULL. ---- - libparted/fs/r/filesys.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c -index 9dafd71..6e795bc 100644 ---- a/libparted/fs/r/filesys.c -+++ b/libparted/fs/r/filesys.c -@@ -198,8 +198,9 @@ ped_file_system_close (PedFileSystem* fs) - { - PED_ASSERT (fs != NULL); - PedDevice *dev = fs->geom->dev; -+ close_fn_t fn = close_fn (fs->type->name); - -- if (!(close_fn (fs->type->name) (fs))) -+ if (!fn || !(fn (fs))) - goto error_close_dev; - ped_device_close (dev); - return 1; --- -2.39.2 - diff --git a/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch b/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch deleted file mode 100644 index 7fb9647..0000000 --- a/0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 15 Feb 2023 10:13:58 -0800 -Subject: [PATCH 19/24] libparted: Fix potential NULL dereference in - ped_disk_next_partition - ---- - libparted/disk.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/libparted/disk.c b/libparted/disk.c -index e1a3489..6c82877 100644 ---- a/libparted/disk.c -+++ b/libparted/disk.c -@@ -1718,8 +1718,11 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part) - return part->part_list ? part->part_list : part->next; - if (part->next) - return part->next; -- if (part->type & PED_PARTITION_LOGICAL) -+ if (part->type & PED_PARTITION_LOGICAL) { -+ if (!ped_disk_extended_partition (disk)) -+ return NULL; - return ped_disk_extended_partition (disk)->next; -+ } - return NULL; - } - --- -2.39.2 - diff --git a/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch b/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch deleted file mode 100644 index b2f9ca4..0000000 --- a/0020-strlist-Handle-realloc-error-in-wchar_to_str.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 9cb38a7444d02023d112ae8e9e38436104f75f64 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 15 Feb 2023 10:32:59 -0800 -Subject: [PATCH 20/24] strlist: Handle realloc error in wchar_to_str - -It could return a NULL if the realloc fails. This handles the failure in -the same way as other failures in wchar_to_str, it exits immediately -with an error message. ---- - parted/strlist.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/parted/strlist.c b/parted/strlist.c -index 71cba59..7901789 100644 ---- a/parted/strlist.c -+++ b/parted/strlist.c -@@ -166,6 +166,8 @@ wchar_to_str (const wchar_t* str, size_t count) - goto error; - - result = realloc (result, strlen (result) + 1); -+ if (!result) -+ goto error; - return result; - - error: --- -2.39.2 - diff --git a/0021-ui-Add-checks-for-prompt-being-NULL.patch b/0021-ui-Add-checks-for-prompt-being-NULL.patch deleted file mode 100644 index 4f342a2..0000000 --- a/0021-ui-Add-checks-for-prompt-being-NULL.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 09c95d2feab0c087339886134dfe2dc04094348a Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 15 Feb 2023 11:15:28 -0800 -Subject: [PATCH 21/24] ui: Add checks for prompt being NULL - -Also removes a cast from const char* to char* when passing to readline -that doesn't appear to be necessary any longer. - -Added asserts to make sure prompt isn't NULL after strdup and realloc -calls. ---- - parted/ui.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/parted/ui.c b/parted/ui.c -index df14e55..9e5ced2 100644 ---- a/parted/ui.c -+++ b/parted/ui.c -@@ -564,8 +564,7 @@ _readline (const char* prompt, const StrList* possibilities) - wipe_line (); - #ifdef HAVE_LIBREADLINE - if (!opt_script_mode) { -- /* XXX: why isn't prompt const? */ -- line = readline ((char*) prompt); -+ line = readline (prompt); - if (line) - _add_history_unique (line); - } else -@@ -781,6 +780,8 @@ realloc_and_cat (char* str, const char* append) - int length = strlen (str) + strlen (append) + 1; - char* new_str = realloc (str, length); - -+ PED_ASSERT(new_str != NULL); -+ - strcat (new_str, append); - return new_str; - } -@@ -789,7 +790,9 @@ static char* - _construct_prompt (const char* head, const char* def, - const StrList* possibilities) - { -+ PED_ASSERT(head != NULL); - char* prompt = strdup (head); -+ PED_ASSERT(prompt != NULL); - - if (def && possibilities) - PED_ASSERT (str_list_match_any (possibilities, def)); --- -2.39.2 - diff --git a/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch b/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch deleted file mode 100644 index 12b403c..0000000 --- a/0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d272bb5b5343fd288a204314654a7fbaea84528d Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 15 Feb 2023 11:52:42 -0800 -Subject: [PATCH 22/24] tests: Fix formatting and snprintf warnings in tests. - -The assert message includes sector values, which are long long int, so -use the proper formatting of %lld. - -The snprintf warning complained about trying to write 258 bytes so I -bumped the buffer size up to 259. The return value is already being -checked for truncation so this is just to keep the compiler happy -without having to suppress the warning. ---- - libparted/tests/disk.c | 2 +- - libparted/tests/symlink.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libparted/tests/disk.c b/libparted/tests/disk.c -index f7b16a5..a2e304c 100644 ---- a/libparted/tests/disk.c -+++ b/libparted/tests/disk.c -@@ -75,7 +75,7 @@ START_TEST (test_duplicate) - ck_assert_msg(part->geom.start == part_dup->geom.start && - part->geom.end == part_dup->geom.end, - "Duplicated partition %d doesn't match. " -- "Details are start: %d/%d end: %d/%d\n", -+ "Details are start: %lld/%lld end: %lld/%lld\n", - *i, part->geom.start, part_dup->geom.start, - part->geom.end, part_dup->geom.end); - } -diff --git a/libparted/tests/symlink.c b/libparted/tests/symlink.c -index da6bef8..7be02cd 100644 ---- a/libparted/tests/symlink.c -+++ b/libparted/tests/symlink.c -@@ -61,7 +61,7 @@ START_TEST (test_symlink) - here, but as /dev/mapper is root owned this is a non issue */ - close (tmp_fd); - unlink (ln); -- char temp_disk_path[256]; -+ char temp_disk_path[259]; - int r = snprintf(temp_disk_path, sizeof temp_disk_path, "%s/%s", - cwd, - temporary_disk); --- -2.39.2 - diff --git a/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch b/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch deleted file mode 100644 index dca568c..0000000 --- a/0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 3f6b723a7d610d98afb0c9d0cfefe4700712e4db Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Fri, 3 Mar 2023 14:35:22 -0800 -Subject: [PATCH] parted: Fix ending sector location when using kibi IEC suffix - -This fixes a bug when using KiB to specify the ending location of a -partition. It was not subtracting 1s like it does with the other units -because it was looking for a 'k' not a 'K'. - -This also fixes a quirk of the suffix checking code, it would check for -matching case, but converting to the actual IEC value was case -insensitive. This now uses common functions for the matching so that -case doesn't matter. - -It also adds tests to check for the fix. - -The only change in behavior is that using KiB to specify the ending -location of a partition will now correctly create the end 1s lower than -the specified location like it does for MiB, GiB, etc. ---- - parted/parted.c | 29 ++++++++++++++++++---------- - tests/t0207-IEC-binary-notation.sh | 31 ++++++++++++++++++++++++++++++ - tests/t0208-mkpart-end-in-IEC.sh | 2 +- - 3 files changed, 51 insertions(+), 11 deletions(-) - -diff --git a/parted/parted.c b/parted/parted.c -index 84187b7..84465d5 100644 ---- a/parted/parted.c -+++ b/parted/parted.c -@@ -583,16 +583,27 @@ void _strip_trailing_spaces(char *str) - str[i]='\0'; - } - --/* Return true, if str ends with [kMGTPEZY]iB, i.e. IEC units. */ -+/* Return true if the unit is one of the supported IEC unit values */ -+static bool -+_is_unit_IEC(const PedUnit unit) { -+ return (unit == PED_UNIT_KIBIBYTE) || (unit == PED_UNIT_MEBIBYTE) || -+ (unit == PED_UNIT_GIBIBYTE) || (unit == PED_UNIT_TEBIBYTE); -+} -+ -+/* Return true, if str ends with IEC units. */ - static bool - _string_ends_with_iec_unit(const char *str) - { -- /* 3 characters for the IEC unit and at least 1 digit */ -- if (!str || strlen(str) < 4) -- return false; -+ /* 3 characters for the IEC unit and at least 1 digit */ -+ if (!str || strlen(str) < 4) -+ return false; - -- char const *p = str + strlen(str) - 3; -- return strchr ("kMGTPEZY", *p) && c_strcasecmp (p+1, "iB") == 0; -+ char const *p = str + strlen(str) - 3; -+ PedUnit unit = ped_unit_get_by_name(p); -+ if (unit == -1) { -+ return false; -+ } -+ return _is_unit_IEC(unit); - } - - /* Return true if str ends with explicit unit identifier. -@@ -612,7 +623,7 @@ _string_has_unit_suffix(const char *str) - return false; - } - --/* If the selected unit is one of kiB, MiB, GiB or TiB and the partition is not -+/* If the selected unit is one of KiB, MiB, GiB or TiB and the partition is not - * only 1 sector long, then adjust the end so that it is one sector before the - * given position. Also adjust range_end accordingly. Thus next partition can - * start immediately after this one. -@@ -636,9 +647,7 @@ _adjust_end_if_iec (PedSector* start, PedSector* end, - _strip_trailing_spaces(end_input); - PedUnit unit = ped_unit_get_default(); - if (_string_ends_with_iec_unit(end_input) || -- (!_string_has_unit_suffix(end_input) && -- ((unit == PED_UNIT_KIBIBYTE) || (unit == PED_UNIT_MEBIBYTE) || -- (unit == PED_UNIT_GIBIBYTE) || (unit == PED_UNIT_TEBIBYTE)))) { -+ (!_string_has_unit_suffix(end_input) && _is_unit_IEC(unit))) { - *end -= 1; - range_end->start -= 1; - range_end->end -= 1; -diff --git a/tests/t0207-IEC-binary-notation.sh b/tests/t0207-IEC-binary-notation.sh -index d9bbad6..b8a789e 100644 ---- a/tests/t0207-IEC-binary-notation.sh -+++ b/tests/t0207-IEC-binary-notation.sh -@@ -28,6 +28,7 @@ parted --align=none -s $dev mklabel gpt mkpart p1 $((64*1024))B $((1024*1024-$ss - compare /dev/null err || fail=1 - parted -m -s $dev u s p > exp || fail=1 - -+# Test using MiB - rm $dev - dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 - parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1MiB \ -@@ -37,4 +38,34 @@ parted -m -s $dev u s p > out || fail=1 - - compare exp out || fail=1 - -+# Test using lower case kib and mib -+rm $dev -+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 -+parted --align=none -s $dev mklabel gpt mkpart p1 64kib 1mib \ -+ > err 2>&1 || fail=1 -+compare /dev/null err || fail=1 -+parted -m -s $dev u s p > out || fail=1 -+ -+compare exp out || fail=1 -+ -+# Test using KiB -+rm $dev -+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 -+parted --align=none -s $dev mklabel gpt mkpart p1 64KiB 1024KiB \ -+ > err 2>&1 || fail=1 -+compare /dev/null err || fail=1 -+parted -m -s $dev u s p > out || fail=1 -+ -+compare exp out || fail=1 -+ -+# Test using kiB -+rm $dev -+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1 -+parted --align=none -s $dev mklabel gpt mkpart p1 64kiB 1024kiB \ -+ > err 2>&1 || fail=1 -+compare /dev/null err || fail=1 -+parted -m -s $dev u s p > out || fail=1 -+ -+compare exp out || fail=1 -+ - Exit $fail -diff --git a/tests/t0208-mkpart-end-in-IEC.sh b/tests/t0208-mkpart-end-in-IEC.sh -index 118ec72..a3db2c3 100644 ---- a/tests/t0208-mkpart-end-in-IEC.sh -+++ b/tests/t0208-mkpart-end-in-IEC.sh -@@ -25,7 +25,7 @@ dev=dev-file - - dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1 - # create 1st partition --parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2MiB > err 2>&1 || fail=1 -+parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2048KiB > err 2>&1 || fail=1 - compare /dev/null err || fail=1 # expect no output - #parted -m -s $dev u s p > exp || fail=1 - --- -2.39.2 - diff --git a/parted.spec b/parted.spec index f474be6..221a8a9 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.5 -Release: 11%{?dist} +Version: 3.5.28 +Release: 1%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -10,31 +10,6 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane -# Upstream patches since v3.5 release -Patch0001: 0001-maint-post-release-administrivia.patch -Patch0002: 0002-parted-add-type-command.patch -Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch -Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch -Patch0005: 0005-tests-t3200-type-change-now-passes.patch -Patch0006: 0006-libparted-Fix-check-for-availability-of-_type_id-fun.patch -Patch0007: 0007-parted-Simplify-code-for-json-output.patch -Patch0008: 0008-disk.in.h-Remove-use-of-enums-with-define.patch -Patch0009: 0009-libparted-Fix-handling-of-gpt-partition-types.patch -Patch0010: 0010-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch -Patch0011: 0011-libparted-Fix-handling-of-msdos-partition-types.patch -Patch0012: 0012-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch -Patch0013: 0013-show-GPT-UUIDs-in-JSON-output.patch -Patch0014: 0014-gpt-Add-no_automount-partition-flag.patch -Patch0015: 0015-tests-XFS-requires-a-minimum-size-of-300M.patch -Patch0016: 0016-libparted-Fix-problem-with-creating-1s-partitions.patch -Patch0017: 0017-tests-Fixing-libparted-test-framework-usage.patch -Patch0018: 0018-filesys-Check-for-null-from-close_fn.patch -Patch0019: 0019-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch -Patch0020: 0020-strlist-Handle-realloc-error-in-wchar_to_str.patch -Patch0021: 0021-ui-Add-checks-for-prompt-being-NULL.patch -Patch0022: 0022-tests-Fix-formatting-and-snprintf-warnings-in-tests.patch -Patch0023: 0023-parted-Fix-ending-sector-location-when-using-kibi-IE.patch - BuildRequires: gcc BuildRequires: e2fsprogs-devel BuildRequires: readline-devel @@ -123,9 +98,9 @@ make check %{_mandir}/man8/parted.8* %{_mandir}/man8/partprobe.8* %{_libdir}/libparted.so.2 -%{_libdir}/libparted.so.2.0.4 +%{_libdir}/libparted.so.2.0.5 %{_libdir}/libparted-fs-resize.so.0 -%{_libdir}/libparted-fs-resize.so.0.0.4 +%{_libdir}/libparted-fs-resize.so.0.0.5 %{_infodir}/parted.info* %files devel @@ -138,6 +113,11 @@ make check %changelog +* Mon Mar 27 2023 Brian C. Lane - 3.5.28-1 +- Upstream 3.5.28 Alpha release +- Dropped all patches included in new upstream release +- Bumped minor version on libparted.so and libparted-fs-resize.so + * Fri Mar 17 2023 Brian C. Lane - 3.5-11 - parted: Fix ending sector location when using kibi IEC suffix (bcl) - tests: Fix formatting and snprintf warnings in tests. (bcl) diff --git a/sources b/sources index eaab8bf..5487849 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.5.tar.xz) = 87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a -SHA512 (parted-3.5.tar.xz.sig) = 2ea1209325595416aa9ee27a0e85ca38bce50ca885d3b52ab1c1fb1b68b78d7887386ea3120274648056d2f1d9dca00b77236991765d84ad226c1b1f5a3f5c62 +SHA512 (parted-3.5.28.tar.xz) = 6cbd280a47b6c8e3beac9db689f505f2f71aaaa62eb1c20cd23e5c4a2dc56841d5bfaa45bf661ac6fe3bb45441bc07f7d0b51e4673fa2c05f968e0a6b3bd4ee6 +SHA512 (parted-3.5.28.tar.xz.sig) = bf806d682ea4fa5f34c6fdcd7bb967c9278e164ba8167ef17e1ba83a4acf5a32355adf4468a457436a85e5ad6a223d2a79a61043728f0d269c69f89775a2e9af From 5243164589992bdb7e028ccd12dafe537495b422 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 10 Apr 2023 17:00:48 -0700 Subject: [PATCH 46/60] - Upstream 3.6 stable release --- .gitignore | 3 ++ parted.spec | 121 +++------------------------------------------------- sources | 4 +- 3 files changed, 10 insertions(+), 118 deletions(-) diff --git a/.gitignore b/.gitignore index fdd046b..ad40058 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ clog /parted-3.5.tar.xz.sig /parted-3.5.28.tar.xz /parted-3.5.28.tar.xz.sig +/parted-3.6.tar.xz +/parted-3.6.tar.xz.sig +/parted-3.6.tar.xz.sug diff --git a/parted.spec b/parted.spec index 221a8a9..cae985c 100644 --- a/parted.spec +++ b/parted.spec @@ -1,6 +1,6 @@ Summary: The GNU disk partition manipulation program Name: parted -Version: 3.5.28 +Version: 3.6 Release: 1%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -113,6 +113,10 @@ make check %changelog +* Mon Apr 10 2023 Brian C. Lane - 3.6-1 +- Upstream 3.6 stable release +- Dropping pre-3.5 changelog entries + * Mon Mar 27 2023 Brian C. Lane - 3.5.28-1 - Upstream 3.5.28 Alpha release - Dropped all patches included in new upstream release @@ -164,118 +168,3 @@ make check * Mon Apr 18 2022 Brian C. Lane - 3.5-1 - Upstream 3.5 stable release - -* Wed Mar 30 2022 Brian C. Lane - 3.4.64-1 -- Upstream 3.4.64 Alpha release -- Dropped all patches included in new upstream release -- Bumped minor version on libparted.so and libparted-fs-resize.so - -* Thu Feb 17 2022 Brian C. Lane - 3.4-12 -- gnulib: Use newer cdefs.h from gnulib (bcl) -- Update parted.spec to allow flatpak builds - -* Thu Jan 20 2022 Fedora Release Engineering - 3.4-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Wed Oct 06 2021 Brian C. Lane - 3.4-11 -- docs: Update documentation to be consistent - -* Wed Oct 06 2021 Brian C. Lane - 3.4-10 -- gpt: Revert to filesystem GUID when setting flag to off (bcl) -- tests: Add a test to make sure GPT GUIDs default to filesystem (bcl) -- doc: Document gpt linux-home flag (bcl) -- gpt: Add linux-home flag (aschnell) -- gpt: Map PED_PARTITON_ flags to GUID values (aschnell) - -* Thu Sep 23 2021 Brian C. Lane - 3.4-9 -- keep GUID specific attributes (aschnell) -- hurd: Implement partition table rereading (cjwatson) -- hurd: Support rumpdisk-based device names (samuel.thibault) -- hurd: Fix partition paths (cjwatson) - -* Wed Aug 25 2021 Brian C. Lane - 3.4-8 -- parted: Add --json cmdline switch to output JSON (aschnell) -- parted: Allow empty string for partition name (aschnell) -- libparted: Check devpath before passing to strlen (bcl) - -* Tue Aug 10 2021 Brian C. Lane - 3.4-7 -- libparted: Tell libdevmapper to retry remove when BUSY (bcl) - Resolves: rhbz#1980697 -- parted: Escape colons and backslashes in machine output (bcl) -- tests: check for vfat kernel support and tools (ross.burton) -- tests: add a helper to check the kernel knows about a file system (ross.burton) -- tests: add aarch64 and mips64 as a valid 64-bit machines (ross.burton) -- libparted: Add swap flag to msdos disklabel (bcl) -- Move Exception Option values into enum (bcl) - -* Tue Aug 03 2021 Brian C. Lane - 3.4-6 -- spec: Use the %%gpgverify macro for the signature check -- tests/t3000: Use mkfs.hfsplus and fsck.hfsplus for resize tests (bcl) -- tests/t3000: Check for hfs and vfat support separately (bcl) -- tests: Reduce memory usage for tests using scsi_debug module (bcl) -- spec: Install to /usr/sbin and /usr/lib64 (bcl) - -* Thu Jul 22 2021 Fedora Release Engineering - 3.4-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Mon Jun 14 2021 Brian C. Lane - 3.4-4 -- Fix issues that covscan classifies as important - Resolves: rhbz#1938836 -- Update gpg key for bcl@redhat.com -- Work around a mkswap bug - -* Wed Mar 10 2021 Brian C. Lane - 3.4-3 -- Use autoreconf -fiv for autoconf 2.71 support - Works with both 2.69 and 2.71 - -* Wed Feb 03 2021 Brian C. Lane - 3.4-2 -- Add --fix support from upstream - -* Wed Jan 27 2021 Brian C. Lane - 3.4-1 -- New stable upstream release v3.4 - -* Tue Jan 26 2021 Fedora Release Engineering - 3.3.52-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Dec 14 2020 Brian C. Lane - 3.3.52-1 -- New upstream ALPHA release v3.3.52 -- Includes all patches - -* Mon Nov 30 2020 Brian C. Lane - 3.3-8 -- Add upstream commits to fix various gcc 10 warnings (bcl) - -* Thu Nov 05 2020 Brian C. Lane - 3.3-7 -- Do not link to libselinux - -* Fri Sep 25 2020 Brian C. Lane - 3.3-6 -- tests: Add a test for resizepart on a busy partition (bcl) -- parted: Preserve resizepart End when prompted for busy partition (bcl) -- tests: Add f2fs to the fs probe test (romain.perier) -- Add support for the F2FS filesystem (romain.perier) -- Removed reference to ped_file_system_create (max) - -* Tue Jul 28 2020 Fedora Release Engineering - 3.3-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Tue Jul 14 2020 Tom Stellard - 3.3-4 -- Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro -- Switch to using %%autosetup instead of %%setup and git (bcl) -- Update tests.yml to install git and simplify source usage (bgoncalv) - -* Fri Mar 06 2020 Brian C. Lane - 3.3-3 -- Add chromeos_kernel partition flag for gpt disklabels -- Add bls_boot partition flag for msdos and gpt disklabels - -* Wed Jan 29 2020 Fedora Release Engineering - 3.3-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Mon Dec 16 2019 Brian C. Lane - 3.3-2 -- tests: Test incomplete resizepart command -- Fix end_input usage in do_resizepart - Resolves: rhbz#1701411 - -* Fri Oct 11 2019 Brian C. Lane - 3.3-1 -- New upstream release v3.3 - Includes the DASD virtio-blk fix. -- Dropping pre-3.2 changelog entries diff --git a/sources b/sources index 5487849..aed1bd4 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (parted-3.5.28.tar.xz) = 6cbd280a47b6c8e3beac9db689f505f2f71aaaa62eb1c20cd23e5c4a2dc56841d5bfaa45bf661ac6fe3bb45441bc07f7d0b51e4673fa2c05f968e0a6b3bd4ee6 -SHA512 (parted-3.5.28.tar.xz.sig) = bf806d682ea4fa5f34c6fdcd7bb967c9278e164ba8167ef17e1ba83a4acf5a32355adf4468a457436a85e5ad6a223d2a79a61043728f0d269c69f89775a2e9af +SHA512 (parted-3.6.tar.xz) = 034a44b25718acba175212019d24f092972a791c5bd1d921ae91e17478657a77c5c5dd0c832bed7968c3a07ec6c65c0785acfac2f90c1ca5e1692f3c141693ef +SHA512 (parted-3.6.tar.xz.sig) = 7c845026937b29fb49085ef9e3354226b73a1c3b5f9082d440d9a8ac13d76b1d07dae0bc10d8c974d4e57bc582f38c0a908e80718dd1ff1adfad3b04699c672c From e932a887a13f44ffe348e33adbebbca802ff2ae2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 20 Jul 2023 18:42:01 +0000 Subject: [PATCH 47/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index cae985c..798602e 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -113,6 +113,9 @@ make check %changelog +* Thu Jul 20 2023 Fedora Release Engineering - 3.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Mon Apr 10 2023 Brian C. Lane - 3.6-1 - Upstream 3.6 stable release - Dropping pre-3.5 changelog entries From dd51fedd16aa86ae32831de44d69ef698bcab8f1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 11:54:19 +0000 Subject: [PATCH 48/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 798602e..a3b392f 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -113,6 +113,9 @@ make check %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 3.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Thu Jul 20 2023 Fedora Release Engineering - 3.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 33a7d91cd031a9bdd577ef0d0085976884bc7c58 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 12:04:58 +0000 Subject: [PATCH 49/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index a3b392f..0712f44 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -113,6 +113,9 @@ make check %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 3.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 3.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 92a16b9fb1fe7fb7e7f10219fdb94abeb995dfce Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Tue, 16 Jul 2024 17:33:24 -0700 Subject: [PATCH 50/60] - doc: Document IEC unit behavior in the manpage (bcl) - parted: Print the Fixing... message to stderr (bcl) --- ...-Print-the-Fixing.-message-to-stderr.patch | 28 ++++++++++++++ ...ent-IEC-unit-behavior-in-the-manpage.patch | 37 +++++++++++++++++++ parted.spec | 9 ++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0001-parted-Print-the-Fixing.-message-to-stderr.patch create mode 100644 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch diff --git a/0001-parted-Print-the-Fixing.-message-to-stderr.patch b/0001-parted-Print-the-Fixing.-message-to-stderr.patch new file mode 100644 index 0000000..bfc90de --- /dev/null +++ b/0001-parted-Print-the-Fixing.-message-to-stderr.patch @@ -0,0 +1,28 @@ +From fc16e90a9fd64e2db12a815417b538b193fe48db Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 10 Jul 2024 15:41:16 -0700 +Subject: [PATCH 1/2] parted: Print the Fixing... message to stderr + +Otherwise it messes up stdout of things like --json + +Thanks to Mikael Q for reporting this. +--- + parted/ui.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parted/ui.c b/parted/ui.c +index 33a1808..d6d1da4 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -645,7 +645,7 @@ exception_handler (PedException* ex) + /* script-mode and fix? */ + int fix_is_an_option = (ex->options & PED_EXCEPTION_FIX); + if (opt_script_mode && opt_fix_mode && fix_is_an_option) { +- printf ("Fixing, due to --fix\n"); ++ fprintf (stderr, "Fixing, due to --fix\n"); + return PED_EXCEPTION_FIX; + } + +-- +2.45.2 + diff --git a/0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch b/0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch new file mode 100644 index 0000000..09f116f --- /dev/null +++ b/0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch @@ -0,0 +1,37 @@ +From e34c1477cfa446f1b44287b10425a9e69602b519 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 12 Jul 2024 16:24:58 -0700 +Subject: [PATCH 2/2] doc: Document IEC unit behavior in the manpage + +Previously this has only been documented in the info page. +--- + doc/C/parted.8 | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 3069c33..171269c 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -151,6 +151,19 @@ Toggle the state of the disk \fIflag\fP. + .B version + Display version information and a copyright message. + .RE ++.SH UNITS ++\fBparted\fP will compute sensible ranges for the locations you specify when using ++units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like ++"GiB", "MiB", to specify exact locations. ++ ++When you specify start or end values using IEC binary units like "MiB", ++"GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to ++the same number specified in bytes (i.e., with the "B" suffix), in that it ++provides no helpful range of sloppiness. Contrast that with a partition ++start request of "4GB", which may actually resolve to some sector up to 500MB ++before or after that point. Thus, when creating a partition in an exact location ++you should use units of bytes ("B"), sectors ("s"), or IEC binary units like ++"MiB", "GiB", but not "MB", "GB", etc. + .SH REPORTING BUGS + Report bugs to + .SH SEE ALSO +-- +2.45.2 + diff --git a/parted.spec b/parted.spec index 0712f44..e68edf4 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -10,6 +10,9 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig Source2: pubkey.phillip.susi Source3: pubkey.brian.lane +Patch0001: 0001-parted-Print-the-Fixing.-message-to-stderr.patch +Patch0002: 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch + BuildRequires: gcc BuildRequires: e2fsprogs-devel BuildRequires: readline-devel @@ -113,6 +116,10 @@ make check %changelog +* Tue Jul 16 2024 Brian C. Lane - 3.6-5 +- doc: Document IEC unit behavior in the manpage (bcl) +- parted: Print the Fixing... message to stderr (bcl) + * Thu Jan 25 2024 Fedora Release Engineering - 3.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 7a70ad0b824134c8e50a6500f7e1bf5418dc6613 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 21:31:19 +0000 Subject: [PATCH 51/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index e68edf4..eeca1ef 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -116,6 +116,9 @@ make check %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 3.6-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jul 16 2024 Brian C. Lane - 3.6-5 - doc: Document IEC unit behavior in the manpage (bcl) - parted: Print the Fixing... message to stderr (bcl) From c43802428646dd0aadee34b5ff16f083932e4520 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 31 Jul 2024 08:54:08 -0700 Subject: [PATCH 52/60] tests: Move to tmt tests and switch to a functional test Instead of repeating the build unit testing, this tests the installed parted with a simple disk image partitioning scheme to verify basic functionality. --- .fmf/version | 1 + plans/test-parted.fmf | 8 ++++++++ tests/provision.fmf | 5 ----- tests/scripts/run_tests.sh | 30 ++++++++++++++++++++++++++++++ tests/simple/run_tests.sh | 29 ----------------------------- tests/tests.yml | 14 -------------- 6 files changed, 39 insertions(+), 48 deletions(-) create mode 100644 .fmf/version create mode 100644 plans/test-parted.fmf delete mode 100644 tests/provision.fmf create mode 100755 tests/scripts/run_tests.sh delete mode 100755 tests/simple/run_tests.sh delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/test-parted.fmf b/plans/test-parted.fmf new file mode 100644 index 0000000..2b22c58 --- /dev/null +++ b/plans/test-parted.fmf @@ -0,0 +1,8 @@ +summary: Run a basic parted test +prepare: + how: install + package: + - parted + - jq +execute: + script: ./tests/scripts/run_tests.sh diff --git a/tests/provision.fmf b/tests/provision.fmf deleted file mode 100644 index dd69f34..0000000 --- a/tests/provision.fmf +++ /dev/null @@ -1,5 +0,0 @@ ---- - -standard-inventory-qcow2: - qemu: - m: 4G diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh new file mode 100755 index 0000000..0161a84 --- /dev/null +++ b/tests/scripts/run_tests.sh @@ -0,0 +1,30 @@ +#!/usr/bin/bash +set -eux + +DISK=/var/tmp/parted-disk.img + +# Make a temporary disk image to use for tests +fallocate -l 100MiB $DISK + +# Make a disklabel and a couple of partitions +parted -s $DISK mklabel gpt +parted -s $DISK mkpart vfat 1MiB 10MiB +parted -s $DISK mkpart ext4 10MiB 50MiB +parted -s $DISK mkpart ext4 50MiB 75MiB +parted -s $DISK set 1 boot +parted -s $DISK set 3 linux-home + +# Check p1 for ESP UUID c12a7328-f81f-11d2-ba4b-00a0c93ec93b +P1_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[0]."type-uuid"') +[ "$P1_TYPE" == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" ] || exit 1 + +# Check p2 for linux data type 0fc63daf-8483-4772-8e79-3d69d8477de4 +P2_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[1]."type-uuid"') +[ "$P2_TYPE" == "0fc63daf-8483-4772-8e79-3d69d8477de4" ] || exit 1 + +# Check p3 for linux home type 933ac7e1-2eb4-4f13-b844-0e14e2aef915 +P3_TYPE=$(parted -s $DISK --json u MiB p | jq -r '.disk.partitions[2]."type-uuid"') +[ "$P3_TYPE" == "933ac7e1-2eb4-4f13-b844-0e14e2aef915" ] || exit 1 + +echo "PASS" +exit 0 diff --git a/tests/simple/run_tests.sh b/tests/simple/run_tests.sh deleted file mode 100755 index 9d40419..0000000 --- a/tests/simple/run_tests.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -set -eux - -: ${1?"Usage: $0 TESTSDIR"} - -TESTSDIR="$1" -SOURCEDIR="${TESTSDIR}/source/" -PACKAGE=parted - -cd "${TESTSDIR}" -if [ ! -e ${PACKAGE}.spec ]; then - echo "Missing ${PACKAGE}.spec" - pwd - ls - exit 1 -fi - -# This runs from the ./tests/ directory -# Install the dependencies from the spec which MUST be copied over by tests.yml -dnf -y build-dep ${PACKAGE}.spec - -# Flattened sources from standard-role-sources -cd "${SOURCEDIR}" || exit - -# Rebuild the package in place, also runs the %check -# skip %prep, it was already run on the source before it was copied over -rpmbuild --noprep --nodeps -bb --build-in-place "${TESTSDIR}/${PACKAGE}.spec" -RET=$? -exit ${RET} diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 5fde476..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- hosts: localhost - tags: - - classic - roles: - - role: standard-test-source - required_packages: - - dnf - - rpm-build - - git - - role: standard-test-basic - tests: - - simple: - run: "./run_tests.sh {{ tenv_workdir }}" From b8c84c998296df51e16ab3d7df3079e452626cf0 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 23 Aug 2024 08:17:29 -0700 Subject: [PATCH 53/60] - tests: Move to tmt tests and switch to a functional test (bcl) --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index eeca1ef..7448a3f 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -116,6 +116,9 @@ make check %changelog +* Fri Aug 23 2024 Brian C. Lane - 3.6-7 +- tests: Move to tmt tests and switch to a functional test (bcl) + * Thu Jul 18 2024 Fedora Release Engineering - 3.6-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From ff0683d294963f0582bd91dd43f0832e3d1fc15d Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 17 Oct 2024 16:57:17 -0700 Subject: [PATCH 54/60] - libparted: Fail early when detecting nilfs2 (oldium.pro) --- ...ted-Fail-early-when-detecting-nilfs2.patch | 55 +++++++++++++++++++ parted.spec | 4 ++ 2 files changed, 59 insertions(+) create mode 100644 0003-libparted-Fail-early-when-detecting-nilfs2.patch diff --git a/0003-libparted-Fail-early-when-detecting-nilfs2.patch b/0003-libparted-Fail-early-when-detecting-nilfs2.patch new file mode 100644 index 0000000..b9675bb --- /dev/null +++ b/0003-libparted-Fail-early-when-detecting-nilfs2.patch @@ -0,0 +1,55 @@ +From 8623f65e1fd064a679f75e3e075dff86f30282a7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= +Date: Sat, 6 Apr 2024 19:21:11 +0200 +Subject: [PATCH] libparted: Fail early when detecting nilfs2 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When the disk is encrypted with TCG Opal HW encryption (supported by +cryptsetup 2.7.0+), the partition initially contains locked area, which +shows reading errors in kernel logs and may lead to configuring the disk +to work with lower reading speed. When the disk area is unlocked with +password, the reading succeeds. The beginning of the protected partition is +not locked and contains LUKS header, this is always readable. + +To work around the errors when reading from the locked area, try first +detecting nilfs2 at the beginning (may be an unprotected LUKS header area) +and only check the second superblock that is at the end of the area (and +possibly locked) if the first one is valid (meaning the partition is not +LUKS-protected). + +This is a change in behavior, but is consistent with the nilfs2 code, which +considers both superblocks mandatory, see [1]. + +[1] https://github.com/nilfs-dev/nilfs-utils/blob/master/lib/sb.c#L135-L158 + +Signed-off-by: Oldřich Jedlička +Signed-off-by: Brian C. Lane +--- + libparted/fs/nilfs2/nilfs2.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c +index 6204542..40f8567 100644 +--- a/libparted/fs/nilfs2/nilfs2.c ++++ b/libparted/fs/nilfs2/nilfs2.c +@@ -118,11 +118,12 @@ nilfs2_probe (PedGeometry* geom) + + if (ped_geometry_read(geom, buf, 0, sectors)) + sb = (struct nilfs2_super_block*)(buf + 1024); ++ if (!sb || !is_valid_nilfs_sb(sb)) ++ return NULL; ++ + if (ped_geometry_read(geom, buff2, sb2off, sectors2)) + sb2 = (struct nilfs2_super_block*)buff2; +- +- if ((!sb || !is_valid_nilfs_sb(sb)) && +- (!sb2 || !is_valid_nilfs_sb(sb2))) ++ if (!sb2 || !is_valid_nilfs_sb(sb2)) + return NULL; + + /* reserve 4k bytes for secondary superblock */ +-- +2.47.0 + diff --git a/parted.spec b/parted.spec index 7448a3f..570a0ba 100644 --- a/parted.spec +++ b/parted.spec @@ -12,6 +12,7 @@ Source3: pubkey.brian.lane Patch0001: 0001-parted-Print-the-Fixing.-message-to-stderr.patch Patch0002: 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch +Patch0003: 0003-libparted-Fail-early-when-detecting-nilfs2.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -116,6 +117,9 @@ make check %changelog +* Thu Oct 17 2024 Brian C. Lane - 3.6-7 +- libparted: Fail early when detecting nilfs2 (oldium.pro) + * Fri Aug 23 2024 Brian C. Lane - 3.6-7 - tests: Move to tmt tests and switch to a functional test (bcl) From b58c412aedf8334506cf58ab66cc6c58630414ea Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Thu, 17 Oct 2024 16:59:43 -0700 Subject: [PATCH 55/60] Properly bump the release number --- parted.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parted.spec b/parted.spec index 570a0ba..991599e 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 7%{?dist} +Release: 8%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -117,7 +117,7 @@ make check %changelog -* Thu Oct 17 2024 Brian C. Lane - 3.6-7 +* Thu Oct 17 2024 Brian C. Lane - 3.6-8 - libparted: Fail early when detecting nilfs2 (oldium.pro) * Fri Aug 23 2024 Brian C. Lane - 3.6-7 From b1522a97110c5f2fd7a47f18d5d21b5dfe746f43 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 20 Nov 2024 09:35:26 -0800 Subject: [PATCH 56/60] - parted: Fix do_version declaration (rudi) --- ...CH-parted-fix-do_version-declaration.patch | 41 +++++++++++++++++++ parted.spec | 6 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch diff --git a/0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch b/0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch new file mode 100644 index 0000000..187e4c4 --- /dev/null +++ b/0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch @@ -0,0 +1,41 @@ +From 16343bda6ce0d41edf43f8dac368db3bbb63d271 Mon Sep 17 00:00:00 2001 +From: Rudi Heitbaum +Date: Wed, 20 Nov 2024 12:22:22 +0000 +Subject: [PATCH] bug#74444: [PATCH] parted: fix do_version declaration + +With gcc 15-20241117 compile fails with the below error, update the +do_version declaration to match the header in command.h + +../../parted/parted.c: In function '_init_commands': +../../parted/parted.c:2469:9: error: passing argument 2 of 'command_create' from incompatible pointer type [-Wincompatible-pointer-types] + 2469 | do_version, + | ^~~~~~~~~~ + | | + | int (*)(void) +In file included from ../../parted/parted.c:28: +../../parted/command.h:35:39: note: expected 'int (*)(PedDevice **, PedDisk **)' {aka 'int (*)(struct _PedDevice **, struct _PedDisk **)'} but argument is of type 'int (*)(void)' + 35 | int (*method) (PedDevice** dev, PedDisk** diskp), + | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Signed-off-by: Rudi Heitbaum +Signed-off-by: Brian C. Lane +--- + parted/parted.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/parted/parted.c b/parted/parted.c +index 3abb52f..fc2aeba 100644 +--- a/parted/parted.c ++++ b/parted/parted.c +@@ -2172,7 +2172,7 @@ do_unit (PedDevice** dev, PedDisk** diskp) + } + + static int +-do_version () ++do_version (PedDevice** dev, PedDisk** diskp) + { + printf ("\n%s\n%s", + prog_name, +-- +2.47.0 + diff --git a/parted.spec b/parted.spec index 991599e..fc4362f 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 8%{?dist} +Release: 9%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -13,6 +13,7 @@ Source3: pubkey.brian.lane Patch0001: 0001-parted-Print-the-Fixing.-message-to-stderr.patch Patch0002: 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch Patch0003: 0003-libparted-Fail-early-when-detecting-nilfs2.patch +Patch0004: 0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -117,6 +118,9 @@ make check %changelog +* Wed Nov 20 2024 Brian C. Lane - 3.6-9 +- parted: Fix do_version declaration (rudi) + * Thu Oct 17 2024 Brian C. Lane - 3.6-8 - libparted: Fail early when detecting nilfs2 (oldium.pro) From c89e7cb3be6ef3b491388f3fdc00e3170708eb8f Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 15 Jan 2025 10:19:36 -0800 Subject: [PATCH 57/60] - tests: Add test for dvh with a bad checksum (bcl) - libparted: Fix dvh disklabel unhandled exception (bcl) - tests: Add test for SUN disklabel handling (bcl) - libparted: Fix sun disklabel unhandled exception (bcl) --- ...ix-sun-disklabel-unhandled-exception.patch | 31 +++++ ...-Add-test-for-SUN-disklabel-handling.patch | 116 ++++++++++++++++++ ...ix-dvh-disklabel-unhandled-exception.patch | 29 +++++ ...Add-test-for-dvh-with-a-bad-checksum.patch | 57 +++++++++ parted.spec | 12 +- 5 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 0005-libparted-Fix-sun-disklabel-unhandled-exception.patch create mode 100644 0006-tests-Add-test-for-SUN-disklabel-handling.patch create mode 100644 0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch create mode 100644 0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch diff --git a/0005-libparted-Fix-sun-disklabel-unhandled-exception.patch b/0005-libparted-Fix-sun-disklabel-unhandled-exception.patch new file mode 100644 index 0000000..e4c5d9f --- /dev/null +++ b/0005-libparted-Fix-sun-disklabel-unhandled-exception.patch @@ -0,0 +1,31 @@ +From 95b877cfa36c1571487c2a67a3902f1f5c4dc747 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Tue, 7 Jan 2025 16:50:21 -0800 +Subject: [PATCH 5/8] libparted: Fix sun disklabel unhandled exception + +The CHS warning should only continue if ignored, not if unhandled. + +Script mode, or exception handlers can return PED_EXCEPTION_UNHANDLED +which should act the same as a cancel. Previously it would only exit if +cancel was selected, allowing it to continue to use the bad CHS and +crash later. +--- + libparted/labels/sun.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c +index 5ed2886..853576b 100644 +--- a/libparted/labels/sun.c ++++ b/libparted/labels/sun.c +@@ -284,7 +284,7 @@ _check_geometry_sanity (PedDisk* disk, SunRawLabel* label) + PED_BE16_TO_CPU(label->pcylcount), + PED_BE16_TO_CPU(label->ntrks), + PED_BE16_TO_CPU(label->nsect)) +- == PED_EXCEPTION_CANCEL) ++ != PED_EXCEPTION_IGNORE) + return 0; + #endif + dev->bios_geom.sectors = PED_BE16_TO_CPU(label->nsect); +-- +2.47.1 + diff --git a/0006-tests-Add-test-for-SUN-disklabel-handling.patch b/0006-tests-Add-test-for-SUN-disklabel-handling.patch new file mode 100644 index 0000000..735e60d --- /dev/null +++ b/0006-tests-Add-test-for-SUN-disklabel-handling.patch @@ -0,0 +1,116 @@ +From bdb92f73112177c091a764836a9ceaa59f7e9b15 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 8 Jan 2025 11:59:40 -0800 +Subject: [PATCH 6/8] tests: Add test for SUN disklabel handling + +When fixed the output from script mode should be an unknown disklabel, +not sun. +--- + tests/Makefile.am | 3 ++- + tests/sun-badlabel | 42 +++++++++++++++++++++++++++++++++++++ + tests/t4002-sun-badlabel.sh | 23 ++++++++++++++++++++ + 3 files changed, 67 insertions(+), 1 deletion(-) + create mode 100755 tests/sun-badlabel + create mode 100644 tests/t4002-sun-badlabel.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index fa27b44..00f4a9d 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -67,6 +67,7 @@ TESTS = \ + t3400-whole-disk-FAT-partition.sh \ + t4000-sun-raid-type.sh \ + t4001-sun-vtoc.sh \ ++ t4002-sun-badlabel.sh \ + t4100-msdos-partition-limits.sh \ + t4100-dvh-partition-limits.sh \ + t4100-msdos-starting-sector.sh \ +@@ -103,7 +104,7 @@ TESTS = \ + EXTRA_DIST = \ + $(TESTS) t-local.sh t-lvm.sh \ + init.cfg init.sh t-lib-helpers.sh gpt-header-munge \ +- gpt-header-move msdos-overlap gpt-attrs ++ gpt-header-move msdos-overlap gpt-attrs sun-badlabel + + check_PROGRAMS = print-align print-flags print-max dup-clobber duplicate \ + fs-resize +diff --git a/tests/sun-badlabel b/tests/sun-badlabel +new file mode 100755 +index 0000000..6a28e86 +--- /dev/null ++++ b/tests/sun-badlabel +@@ -0,0 +1,42 @@ ++#!/usr/bin/python3 ++# Mangle the CHS values stored in a SUN disklabel ++# This sets CHS to 1 track, 2 sectors and updates the checksum ++# This triggers a bug in the SUN disklabel code when the CHS ++# error is UNHANDLED (in script mode or with a custom exception ++# handler) and it continues using a bad label which will coredump ++# when .duplicate() is called on it. ++ ++import array ++from struct import unpack_from, pack_into ++import sys ++ ++file = open(sys.argv[1],'rb+') ++header = file.read(512) ++ ++# Make sure it looks like a SUN disklabel first ++magic = unpack_from(">H", header, 0x1FC)[0] ++if magic != 0xDABE: ++ raise RuntimeError("Not a SUN disklabel. magic = 0x%04X" % magic) ++csum = unpack_from(">H", header, 0x1FE)[0] ++ntrks = unpack_from(">H", header, 0x1B4)[0] ++nsect = unpack_from(">H", header, 0x1B6)[0] ++ ++header = array.array('B', header) ++# cylinders at 0x1B0 ++# modify ntrks at offset 0x1B4 ++pack_into('>H', header, 0x1B4, 1) ++# modify nsect at offset 0x1B6 ++pack_into('>H', header, 0x1B6, 2) ++ ++## Undo old values ++csum ^= ntrks ++csum ^= nsect ++ ++## Add new ++csum ^= 1 ++csum ^= 2 ++pack_into('>H', header, 0x1FE, csum) ++ ++file.seek(0) ++file.write(header) ++file.close() +diff --git a/tests/t4002-sun-badlabel.sh b/tests/t4002-sun-badlabel.sh +new file mode 100644 +index 0000000..177c0e4 +--- /dev/null ++++ b/tests/t4002-sun-badlabel.sh +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# Test exception handling on a bad SUN disklabel ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir ++ss=$sector_size_ ++ ++n_sectors=2000 # number of sectors ++dev=sun-disk-file ++# create an empty file as a test disk ++dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1 ++ ++# label the test disk as a sun disk ++parted -s $dev mklabel sun > out 2>&1 || fail=1 ++compare /dev/null out || fail=1 ++ ++# Mangle the disklabel to have incorrect CHS values, but a valid checksum ++sun-badlabel $dev || fail=1 ++ ++# Check the output (this should return 1, but depend on checking the output for the test) ++parted -m -s $dev p > out 2>&1 ++grep unknown out || { cat out; fail=1; } ++ ++Exit $fail +-- +2.47.1 + diff --git a/0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch b/0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch new file mode 100644 index 0000000..59dacde --- /dev/null +++ b/0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch @@ -0,0 +1,29 @@ +From 1480769f2a7071c5a251b6c69658808199e8b05b Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 8 Jan 2025 13:35:04 -0800 +Subject: [PATCH 7/8] libparted: Fix dvh disklabel unhandled exception + +When an exception is using PED_EXCEPTION_IGNORE_CANCEL it should check +for !PED_EXCEPTION_IGNORE so that an unhandled exception is treated the +same as cancel. Otherwise it could lead to using the disklabel with +incorrect values. +--- + libparted/labels/dvh.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c +index 0f9124d..7d7dae3 100644 +--- a/libparted/labels/dvh.c ++++ b/libparted/labels/dvh.c +@@ -308,7 +308,7 @@ dvh_read (PedDisk* disk) + PED_EXCEPTION_IGNORE_CANCEL, + _("Checksum is wrong, indicating the partition " + "table is corrupt.")) +- == PED_EXCEPTION_CANCEL) ++ != PED_EXCEPTION_IGNORE) + return 0; + } + +-- +2.47.1 + diff --git a/0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch b/0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch new file mode 100644 index 0000000..b1f9451 --- /dev/null +++ b/0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch @@ -0,0 +1,57 @@ +From 82b582996ce691eb635bed124603207515b92efe Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 8 Jan 2025 14:01:39 -0800 +Subject: [PATCH 8/8] tests: Add test for dvh with a bad checksum + +When using script mode it should return an unknown partition type, not +dvh, because the exception is unhandled. +--- + tests/Makefile.am | 1 + + tests/t4101-dvh-badlabel.sh | 23 +++++++++++++++++++++++ + 2 files changed, 24 insertions(+) + create mode 100644 tests/t4101-dvh-badlabel.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 00f4a9d..5eeab08 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -71,6 +71,7 @@ TESTS = \ + t4100-msdos-partition-limits.sh \ + t4100-dvh-partition-limits.sh \ + t4100-msdos-starting-sector.sh \ ++ t4101-dvh-badlabel.sh \ + t4200-partprobe.sh \ + t4300-nilfs2-tiny.sh \ + t4301-nilfs2-badsb2.sh \ +diff --git a/tests/t4101-dvh-badlabel.sh b/tests/t4101-dvh-badlabel.sh +new file mode 100644 +index 0000000..075c044 +--- /dev/null ++++ b/tests/t4101-dvh-badlabel.sh +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# Test exception handling on a bad DVH disklabel ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir ++ss=$sector_size_ ++ ++n_sectors=2000 # number of sectors ++dev=sun-disk-file ++# create an empty file as a test disk ++dd if=/dev/zero of=$dev bs=$ss count=$n_sectors 2> /dev/null || fail=1 ++ ++# label the test disk as a dvh disk ++parted -s $dev mklabel dvh > out 2>&1 || fail=1 ++compare /dev/null out || fail=1 ++ ++# Mangle the disklabel to have incorrect checksum ++dd if=/dev/zero of=$dev conv=notrunc bs=4 count=1 seek=1 ++ ++# Check the output (this should return 1, but depend on checking the output for the test) ++parted -m -s $dev p > out 2>&1 ++grep unknown out || { cat out; fail=1; } ++ ++Exit $fail +-- +2.47.1 + diff --git a/parted.spec b/parted.spec index fc4362f..a07d44e 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 9%{?dist} +Release: 10%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -14,6 +14,10 @@ Patch0001: 0001-parted-Print-the-Fixing.-message-to-stderr.patch Patch0002: 0002-doc-Document-IEC-unit-behavior-in-the-manpage.patch Patch0003: 0003-libparted-Fail-early-when-detecting-nilfs2.patch Patch0004: 0004-bug-74444-PATCH-parted-fix-do_version-declaration.patch +Patch0005: 0005-libparted-Fix-sun-disklabel-unhandled-exception.patch +Patch0006: 0006-tests-Add-test-for-SUN-disklabel-handling.patch +Patch0007: 0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch +Patch0008: 0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -118,6 +122,12 @@ make check %changelog +* Wed Jan 15 2025 Brian C. Lane - 3.6-10 +- tests: Add test for dvh with a bad checksum (bcl) +- libparted: Fix dvh disklabel unhandled exception (bcl) +- tests: Add test for SUN disklabel handling (bcl) +- libparted: Fix sun disklabel unhandled exception (bcl) + * Wed Nov 20 2024 Brian C. Lane - 3.6-9 - parted: Fix do_version declaration (rudi) From 2e579d4323385b4491069adbb56e851bbc67606e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 22:26:33 +0000 Subject: [PATCH 58/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index a07d44e..c0203d1 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 10%{?dist} +Release: 11%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -122,6 +122,9 @@ make check %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 3.6-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Wed Jan 15 2025 Brian C. Lane - 3.6-10 - tests: Add test for dvh with a bad checksum (bcl) - libparted: Fix dvh disklabel unhandled exception (bcl) From a13c518ae560f199c9c6412fa923896ec7b2a96a Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 30 May 2025 10:49:27 -0700 Subject: [PATCH 59/60] - doc: Fix some groff/mandoc linting complaints (bcl) - nilfs2: Fixed possible sigsegv in case of corrupted superblock (abutenko) - libparted: Do not detect ext4 without journal as ext2 (pascal) - tests: probing ext4 without journal should still indicate ext4 (bcl) --- ...t4-without-journal-should-still-indi.patch | 52 +++++++++++ ...-detect-ext4-without-journal-as-ext2.patch | 61 +++++++++++++ ...sible-sigsegv-in-case-of-corrupted-s.patch | 61 +++++++++++++ ...some-groff-mandoc-linting-complaints.patch | 90 +++++++++++++++++++ parted.spec | 12 ++- 5 files changed, 275 insertions(+), 1 deletion(-) create mode 100644 0009-tests-probing-ext4-without-journal-should-still-indi.patch create mode 100644 0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch create mode 100644 0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch create mode 100644 0012-doc-Fix-some-groff-mandoc-linting-complaints.patch diff --git a/0009-tests-probing-ext4-without-journal-should-still-indi.patch b/0009-tests-probing-ext4-without-journal-should-still-indi.patch new file mode 100644 index 0000000..1fa6a1c --- /dev/null +++ b/0009-tests-probing-ext4-without-journal-should-still-indi.patch @@ -0,0 +1,52 @@ +From 43c2b908396e8b7baa475e009f3f4dbf9b9beac7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 28 May 2025 11:24:21 -0700 +Subject: [PATCH 09/12] tests: probing ext4 without journal should still + indicate ext4 + +t1700 tests a fix for the ext filesystem probe code, it was previously +returning ext2 when the filesystem is really ext4 without a journal. + +t3200 is updated to reflect the correct filesystem type -- it creates a +fs too small for a journal so it used to identify it as ext2 but now +correctly identifies it as ext4. +--- + tests/t1700-probe-fs.sh | 10 ++++++++++ + tests/t3200-resize-partition.sh | 2 +- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh +index 7557f92..2bf2810 100755 +--- a/tests/t1700-probe-fs.sh ++++ b/tests/t1700-probe-fs.sh +@@ -70,4 +70,14 @@ for feature in uninit_bg flex_bg; do + rm $dev + done + ++# ext4 without a journal should still indicate ext4 ++# create an ext3 file system ++dd if=/dev/null of=$dev bs=1024 seek=8192 >/dev/null || skip_ "dd failed" ++mkfs.ext4 -O ^has_journal -F $dev >/dev/null || skip_ "mkfs.ext4 failed" ++ ++# probe the file system, which should still be ext4 ++parted -m -s $dev u s print >out 2>&1 || fail=1 ++grep '^1:.*:ext4::;$' out || fail=1 ++rm $dev ++ + Exit $fail +diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh +index 846fbc3..c9decab 100755 +--- a/tests/t3200-resize-partition.sh ++++ b/tests/t3200-resize-partition.sh +@@ -111,7 +111,7 @@ compare exp out || fail=1 + parted -m -s $dev u s p > out 2>&1 || fail=1 + + sed -n 3p out > k && mv k out || fail=1 +-printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1 ++printf "1:$default_start:$new_end:3073s:ext4::$ms;\n" > exp || fail=1 + compare exp out || fail=1 + + umount "${dev}1" || fail=1 +-- +2.49.0 + diff --git a/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch b/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch new file mode 100644 index 0000000..2739563 --- /dev/null +++ b/0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch @@ -0,0 +1,61 @@ +From e61584ddeb952ff04823936dabd1a6a241f04f38 Mon Sep 17 00:00:00 2001 +From: Pascal Hambourg +Date: Thu, 17 Apr 2025 18:42:33 +0200 +Subject: [PATCH 10/12] libparted: Do not detect ext4 without journal as ext2 + +ext4 may have other incompatible features than journal and cannot be +mounted as ext2 by linux, so detect it as ext4 even without journal +if it has other incompatible features. + +Signed-off-by: Brian C. Lane +--- + libparted/fs/ext2/interface.c | 33 +++++++++++++++------------------ + 1 file changed, 15 insertions(+), 18 deletions(-) + +diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c +index 7e0b197..5f64ab3 100644 +--- a/libparted/fs/ext2/interface.c ++++ b/libparted/fs/ext2/interface.c +@@ -52,24 +52,21 @@ _ext2_generic_probe (PedGeometry* geom, int expect_ext_ver) + int is_ext3 = 0; + int is_ext4 = 0; + +- is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb) +- & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0; +- if (is_ext3) { +- is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb) +- & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) +- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) +- & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) +- || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) +- & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) +- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) +- & EXT4_FEATURE_INCOMPAT_EXTENTS) +- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) +- & EXT4_FEATURE_INCOMPAT_64BIT) +- || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) +- & EXT4_FEATURE_INCOMPAT_FLEX_BG)); +- if (is_ext4) +- is_ext3 = 0; +- } ++ is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb) ++ & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) ++ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) ++ & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) ++ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) ++ & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) ++ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) ++ & EXT4_FEATURE_INCOMPAT_EXTENTS) ++ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) ++ & EXT4_FEATURE_INCOMPAT_64BIT) ++ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) ++ & EXT4_FEATURE_INCOMPAT_FLEX_BG)); ++ if (!is_ext4) ++ is_ext3 = (EXT2_SUPER_FEATURE_COMPAT (*sb) ++ & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0; + if (expect_ext_ver == 2 && (is_ext3 || is_ext4)) + return NULL; + if (expect_ext_ver == 3 && !is_ext3) +-- +2.49.0 + diff --git a/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch b/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch new file mode 100644 index 0000000..de1b0c5 --- /dev/null +++ b/0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch @@ -0,0 +1,61 @@ +From 2fad7d827d27e75298f1d17b5fa6567ddfc4c338 Mon Sep 17 00:00:00 2001 +From: Anton Butenko +Date: Fri, 28 Feb 2025 16:09:18 +0100 +Subject: [PATCH 11/12] nilfs2: Fixed possible sigsegv in case of corrupted + superblock + +bytes value comes from the superblock and it must be at least as long as +s_sum which is a 32 bit value. So sumoff + 4 is the correct lower limit +for it, not sumoff - 4. + +Signed-off-by: Brian C. Lane +--- + libparted/fs/nilfs2/nilfs2.c | 2 +- + tests/t4301-nilfs2-badsb2.sh | 10 ++++++++-- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c +index 40f8567..74186f1 100644 +--- a/libparted/fs/nilfs2/nilfs2.c ++++ b/libparted/fs/nilfs2/nilfs2.c +@@ -88,7 +88,7 @@ is_valid_nilfs_sb(struct nilfs2_super_block *sb) + return 0; + + bytes = PED_LE16_TO_CPU(sb->s_bytes); +- if (bytes > 1024 || bytes < sumoff - 4) ++ if (bytes > 1024 || bytes < sumoff + 4) + return 0; + + crc = __efi_crc32(sb, sumoff, PED_LE32_TO_CPU(sb->s_crc_seed)); +diff --git a/tests/t4301-nilfs2-badsb2.sh b/tests/t4301-nilfs2-badsb2.sh +index 2a1205b..45b6644 100755 +--- a/tests/t4301-nilfs2-badsb2.sh ++++ b/tests/t4301-nilfs2-badsb2.sh +@@ -27,16 +27,22 @@ end=$(($len * 512 / $ss)) + parted -s $dev mklabel msdos mkpart primary 1s ${end}s || framework_failure_ + + # Write a secondary superblock with the nilfs magic number and a nilfs +-# superblock length (s_bytes) field of only 10 bytes. ++# superblock length (s_bytes) field of only 13 bytes. + # struct nilfs2_super_block starts with these four fields... + # uint32_t s_rev_level; + # uint16_t s_minor_rev_level; + # uint16_t s_magic; + # uint16_t s_bytes; + sb2_offset=$(( 24 / ($ss / 512) + 1)) +-perl -e "print pack 'LSSS.', 0, 0, 0x3434, 10, $ss" | ++perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" | + dd of=$dev bs=$ss seek=$sb2_offset count=1 conv=notrunc + ++# Write primary nilfs magic number and a nilfs ++# superblock length (s_bytes) field of only 13 bytes. ++sb_offset=3 ++perl -e "print pack 'LSSS.', 0, 0, 0x3434, 13, $ss" | ++ dd of=$dev bs=$ss seek=$sb_offset count=1 conv=notrunc ++ + # This used to give parted a sigsegv. + parted -s $dev print || fail=1 + +-- +2.49.0 + diff --git a/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch b/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch new file mode 100644 index 0000000..a846f6f --- /dev/null +++ b/0012-doc-Fix-some-groff-mandoc-linting-complaints.patch @@ -0,0 +1,90 @@ +From a2164c99b4d7d37334f9ca5ece55d8af95d002b7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 28 May 2025 13:09:32 -0700 +Subject: [PATCH 12/12] doc: Fix some groff/mandoc linting complaints + +--- + doc/C/parted.8 | 27 ++++++++++++--------------- + 1 file changed, 12 insertions(+), 15 deletions(-) + +diff --git a/doc/C/parted.8 b/doc/C/parted.8 +index 171269c..c852112 100644 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 +@@ -54,7 +54,6 @@ Use optimum alignment as given by the disk topology information. This + aligns to a multiple of the physical block size in a way that guarantees + optimal performance. + .RE +- + .SH COMMANDS + .TP + .B [device] +@@ -62,8 +61,7 @@ The block device to be used. When none is given, \fBparted\fP will use the + first block device it finds. + .TP + .B [command [options]] +-Specifies the command to be executed. If no command is given, +-.BR parted ++Specifies the command to be executed. If no command is given, \fBparted\fP + will present a command prompt. Possible commands are: + .RS + .TP +@@ -119,8 +117,8 @@ or an LVM logical volume if necessary. + .B set \fIpartition\fP \fIflag\fP \fIstate\fP + Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP. + Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba", +-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", "linux-home", +-"no_automount", "bios_grub", and "palo". ++"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot", ++"linux-home", "no_automount", "bios_grub", and "palo". + \fIstate\fP should be either "on" or "off". + .TP + .B unit \fIunit\fP +@@ -140,10 +138,10 @@ On MS-DOS set the type aka. partition id of \fIpartition\fP to + the type-uuid of \fIpartition\fP to \fIuuid\fP. + .TP + .B disk_set \fIflag\fP \fIstate\fP +-Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or "off". +-Some or all of these flags will be available, depending on what disk label you +-are using. Supported flags are: "pmbr_boot" on GPT to enable the boot flag on the +-GPT's protective MBR partition. ++Change a \fIflag\fP on the disk to \fIstate\fP. A flag can be either "on" or ++"off". Some or all of these flags will be available, depending on what disk ++abel you are using. Supported flags are: "pmbr_boot" on GPT to enable the ++boot flag on the GPT's protective MBR partition. + .TP + .B disk_toggle \fIflag\fP + Toggle the state of the disk \fIflag\fP. +@@ -155,24 +153,23 @@ Display version information and a copyright message. + \fBparted\fP will compute sensible ranges for the locations you specify when using + units like "GB", "MB", etc. Use the sector unit "s" or IEC binary units like + "GiB", "MiB", to specify exact locations. +- + When you specify start or end values using IEC binary units like "MiB", + "GiB", "TiB", etc., \fBparted\fP treats those values as exact, and equivalent to + the same number specified in bytes (i.e., with the "B" suffix), in that it + provides no helpful range of sloppiness. Contrast that with a partition + start request of "4GB", which may actually resolve to some sector up to 500MB +-before or after that point. Thus, when creating a partition in an exact location +-you should use units of bytes ("B"), sectors ("s"), or IEC binary units like +-"MiB", "GiB", but not "MB", "GB", etc. ++before or after that point. Thus, when creating a partition in an exact ++location you should use units of bytes ("B"), sectors ("s"), or IEC binary units ++like "MiB", "GiB", but not "MB", "GB", etc. + .SH REPORTING BUGS + Report bugs to + .SH SEE ALSO + .BR fdisk (8), + .BR mkfs (8), + The \fIparted\fP program is fully documented in the +-.BR info(1) ++.BR info (1) + format +-.IR "GNU partitioning software" ++.I "GNU partitioning software" + manual. + .SH AUTHOR + This manual page was written by Timshel Knoll , +-- +2.49.0 + diff --git a/parted.spec b/parted.spec index c0203d1..31ea054 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 11%{?dist} +Release: 12%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -18,6 +18,10 @@ Patch0005: 0005-libparted-Fix-sun-disklabel-unhandled-exception.patch Patch0006: 0006-tests-Add-test-for-SUN-disklabel-handling.patch Patch0007: 0007-libparted-Fix-dvh-disklabel-unhandled-exception.patch Patch0008: 0008-tests-Add-test-for-dvh-with-a-bad-checksum.patch +Patch0009: 0009-tests-probing-ext4-without-journal-should-still-indi.patch +Patch0010: 0010-libparted-Do-not-detect-ext4-without-journal-as-ext2.patch +Patch0011: 0011-nilfs2-Fixed-possible-sigsegv-in-case-of-corrupted-s.patch +Patch0012: 0012-doc-Fix-some-groff-mandoc-linting-complaints.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -122,6 +126,12 @@ make check %changelog +* Fri May 30 2025 Brian C. Lane - 3.6-12 +- doc: Fix some groff/mandoc linting complaints (bcl) +- nilfs2: Fixed possible sigsegv in case of corrupted superblock (abutenko) +- libparted: Do not detect ext4 without journal as ext2 (pascal) +- tests: probing ext4 without journal should still indicate ext4 (bcl) + * Fri Jan 17 2025 Fedora Release Engineering - 3.6-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From 66c2ad5f018ccccbdaa60f883675cf6c0243aba7 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 23:58:58 +0000 Subject: [PATCH 60/60] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- parted.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parted.spec b/parted.spec index 31ea054..7948ba4 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.6 -Release: 12%{?dist} +Release: 13%{?dist} License: GPL-3.0-or-later URL: http://www.gnu.org/software/parted @@ -126,6 +126,9 @@ make check %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 3.6-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Fri May 30 2025 Brian C. Lane - 3.6-12 - doc: Fix some groff/mandoc linting complaints (bcl) - nilfs2: Fixed possible sigsegv in case of corrupted superblock (abutenko)