- Rebase to upstream release 3.5
- Drop patches included in new upstream tar - Add upstream patches for new type command - Add upstream patch for swap flag on DASD Resolves: rhbz#1999333
This commit is contained in:
parent
69de3928ff
commit
b898e4ada1
2
.gitignore
vendored
2
.gitignore
vendored
@ -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.5.tar.xz
|
||||
/parted-3.5.tar.xz.sig
|
||||
|
50
0001-maint-post-release-administrivia.patch
Normal file
50
0001-maint-post-release-administrivia.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,123 +0,0 @@
|
||||
From 7c9a96209af2b84e1eec98ad3527f82ddd966cdf Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Klein <cristian.klein@elastisys.com>
|
||||
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 <bcl@redhat.com>
|
||||
---
|
||||
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<align>] [DEVICE [COMMAND [PARAMETERS]]...]\n"),
|
||||
+ _("Usage: %s [-hlmsfv] [-a<align>] [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
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 8aa569aa60c37526a8c37b06e88a833745a7a6ef Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Klein <cristian.klein@elastisys.com>
|
||||
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 <bcl@redhat.com>
|
||||
---
|
||||
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
|
||||
|
1636
0002-parted-add-type-command.patch
Normal file
1636
0002-parted-add-type-command.patch
Normal file
File diff suppressed because it is too large
Load Diff
228
0003-libparted-add-swap-flag-for-DASD-label.patch
Normal file
228
0003-libparted-add-swap-flag-for-DASD-label.patch
Normal file
@ -0,0 +1,228 @@
|
||||
From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001
|
||||
From: Arvin Schnell <aschnell@suse.com>
|
||||
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 <bcl@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,135 +0,0 @@
|
||||
From 6b2c8806b42a7214d726cc2b3dac6b96013a6cce Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Klein <cristian.klein@elastisys.com>
|
||||
Date: Fri, 11 Dec 2020 22:19:24 +0100
|
||||
Subject: [PATCH 3/5] tests: Add tests for --fix
|
||||
|
||||
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
||||
---
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+. "${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 <<EOF > 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 <<EOF > 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
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 9bb4afe61426419c8bb83a25aa9822e00611c8f3 Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Klein <cristian.klein@elastisys.com>
|
||||
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 <bcl@redhat.com>
|
||||
---
|
||||
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
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 6ed9c9e82ea6cfbee93a47e82e92a90abdb82343 Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Klein <cristian.klein@elastisys.com>
|
||||
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 <bcl@redhat.com>
|
||||
---
|
||||
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
|
||||
|
23
0005-tests-t3200-type-change-now-passes.patch
Normal file
23
0005-tests-t3200-type-change-now-passes.patch
Normal file
@ -0,0 +1,23 @@
|
||||
From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,26 +0,0 @@
|
||||
From dacdfc20957d92eff7a3c9fd72baa849b45485e3 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,38 +0,0 @@
|
||||
From 8e6976661409d7c87b1f0a80ebdddc450b4db2dd Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,34 +0,0 @@
|
||||
From acb5300bfc37f8b8c217758e83a31b7ecca84f4a Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 3a7f644f21703afcf7088a5994be1a6dff19f679 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,25 +0,0 @@
|
||||
From fbd83d9df7bf5fd0c830935decb9bbc482bf95f4 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,43 +0,0 @@
|
||||
From 6c4050af2c6c0abdbe1d553fdf2f19a6b600e9d1 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,57 +0,0 @@
|
||||
From 86594612f8ae4dbc416e3cd1bc8bb05445df09e5 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 16751493376db612abcceae5ae81fd798c0a4d18 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,34 +0,0 @@
|
||||
From f801496427db11cc468065dcd77d1c610c0a1047 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
@ -1,46 +0,0 @@
|
||||
From ea1a97b57d4e84005c66bc9c05f2e7c9244b5118 Mon Sep 17 00:00:00 2001
|
||||
From: "Brian C. Lane" <bcl@redhat.com>
|
||||
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
|
||||
|
46
parted.spec
46
parted.spec
@ -1,7 +1,7 @@
|
||||
Summary: The GNU disk partition manipulation program
|
||||
Name: parted
|
||||
Version: 3.4
|
||||
Release: 6%{?dist}
|
||||
Version: 3.5
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/parted
|
||||
|
||||
@ -10,22 +10,12 @@ 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
|
||||
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
|
||||
# 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
|
||||
BuildRequires: e2fsprogs-devel
|
||||
@ -38,7 +28,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
|
||||
@ -78,8 +70,9 @@ gpg2 --verify %{SOURCE1} %{SOURCE0}
|
||||
iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS
|
||||
|
||||
%build
|
||||
autoreconf
|
||||
autoconf
|
||||
# RHEL has 2.69 which works fine with the macros parted uses
|
||||
sed -i s/2.71/2.69/ configure.ac
|
||||
autoreconf -fiv
|
||||
CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS
|
||||
%configure --disable-static --disable-gcc-warnings
|
||||
# Don't use rpath!
|
||||
@ -114,9 +107,9 @@ make check
|
||||
%{_mandir}/man8/parted.8.gz
|
||||
%{_mandir}/man8/partprobe.8.gz
|
||||
%{_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
|
||||
@ -129,6 +122,13 @@ make check
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri May 27 2022 Brian C. Lane <bcl@redhat.com> - 3.5-1
|
||||
- Rebase to upstream release 3.5
|
||||
- Drop patches included in new upstream tar
|
||||
- Add upstream patches for new type command
|
||||
- Add upstream patch for swap flag on DASD
|
||||
Resolves: rhbz#1999333
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.4-6
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (parted-3.4.tar.xz) = e69bd1b610778e980d4595d04892f2ea1faf4ae9bfc98cd62abfc70066423f08ddaa396f9461c7beb1330d023232274606b6b26091a0458aeedd0f3f57536690
|
||||
SHA512 (parted-3.4.tar.xz.sig) = 6b11812267e66470ba2908ee1cc78b232b0bc2519787f5a17b92cd5f8ba904b1a836833f19c5244b23d4c7810437eeb26fbbd68fac819391b342709682345472
|
||||
SHA512 (parted-3.5.tar.xz) = 87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a
|
||||
SHA512 (parted-3.5.tar.xz.sig) = 2ea1209325595416aa9ee27a0e85ca38bce50ca885d3b52ab1c1fb1b68b78d7887386ea3120274648056d2f1d9dca00b77236991765d84ad226c1b1f5a3f5c62
|
||||
|
Loading…
Reference in New Issue
Block a user