- Rebase to upstream parted v3.1

- removed merged patches
- add new libparted-fs-resize library
This commit is contained in:
Brian C. Lane 2012-03-13 15:58:23 -07:00
parent c4a50494de
commit 67735861c5
22 changed files with 12 additions and 1982 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ clog
/parted-2.4.tar.xz.sig
/parted-3.0.tar.xz
/parted-3.0.tar.xz.sig
/parted-3.1.tar.xz

View File

@ -1,27 +0,0 @@
From bbe2661b012ecf3948722ddfd0bd56c6891f1930 Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Mon, 20 Dec 2010 13:55:24 -0800
Subject: [PATCH] Document align-check (#642476)
---
doc/C/parted.8 | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 2a8992e..c48e059 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -62,6 +62,10 @@ Specifies the command to be executed. If no command is given,
will present a command prompt. Possible commands are:
.RS
.TP
+.B align-check \fIalignment-type\fP \fIpartition\fP
+Determine whether the starting sector of \fIpartition\fP is aligned for the disk.
+\fIalignment-type\fP is "minimal" or "optimal".
+.TP
.B check \fIpartition\fP
Do a simple check on \fIpartition\fP.
.TP
--
1.7.3.3

View File

@ -1,62 +0,0 @@
From 6a38a57cb567ae4206bdfde09bcbed9e50639107 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:12:00 -0800
Subject: [PATCH 5/5] doc: update parted documentation
* doc/parted.text: Add disk_set command.
---
doc/parted.texi | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/doc/parted.texi b/doc/parted.texi
index f6c64f5..bd8c33b 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -415,6 +415,7 @@ GNU Parted provides the following commands:
@menu
* align-check::
+* disk_set::
* help::
* mklabel::
* mkpart::
@@ -458,6 +459,36 @@ Example:
@end deffn
+@node disk_set
+@subsection disk_set
+@cindex disk_set, command description
+@cindex command description, disk_set
+
+@deffn Command disk_set @var{flag} @var{state}
+
+Changes a flag on the disk. 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:
+
+@table @samp
+
+@item pmbr_boot
+(GPT) - this flag enables the boot flag on the GPT's protective MBR
+partition.
+
+@end table
+
+The disk's flags are displayed by the print command on the "Disk Flags:"
+line. They are also output as the last field of the disk information
+in machine mode.
+
+@example
+(parted) @kbd{disk_set pmbr_boot on}
+@end example
+
+Set the PMBR's boot flag.
+@end deffn
+
@node help
@subsection help
@cindex help, command description
--
1.7.6.5

View File

@ -1,333 +0,0 @@
From 88197d7ebf7f0e805749c4daf203e3dab778cd52 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Wed, 1 Feb 2012 15:12:20 +0100
Subject: [PATCH 1/6] gpt: add commands to manipulate pMBR boot flag
Some BIOS systems will only boot from GPT partitions if the boot flag is
set on the protective MBR partition. This adds the ability to set this
flag using the disk_set and disk_toggle commands.
* include/parted/disk.h (_PedDiskFlag): Add PED_DISK_GPT_PMBR_BOOT
* libparted/disk.c (ped_disk_flag_get_name): Add PED_DISK_GPT_PMBR_BOOT
* libparted/labels/gpt.c (_GPTDiskData): Add pmbr_boot flag.
(gpt_alloc): Init pmbr_boot to 0.
(gpt_read_headers): Set pmbr_boot state from PMBR boot flag.
(_write_pmbr): Add pmbr_boot flag and set PMBR boot flag from it.
(gpt_write): Pass pmbr_boot flag through to _write_pmbr
(gpt_disk_set_flag): New function
(gpt_disk_is_flag_available): New function
(gpt_disk_get_flag): New function
(gpt_disk_ops): Add disk_set_flag, disk_get_flag, disk_is_flag_available
* parted/parted.c (do_disk_set): New function
(do_disk_toggle): New function
(_init_commands): Add do_disk_set and do_disk_toggle
* parted/ui.c (command_line_get_disk_flag): New function
* parted/ui.h: Add command_line_get_disk_flag prototype.
---
include/parted/disk.h | 5 +++-
libparted/disk.c | 3 +-
libparted/labels/gpt.c | 60 ++++++++++++++++++++++++++++++++++++++++++-
parted/parted.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
parted/ui.c | 29 +++++++++++++++++++++
parted/ui.h | 3 ++
6 files changed, 162 insertions(+), 4 deletions(-)
diff --git a/include/parted/disk.h b/include/parted/disk.h
index dd461fb..fb9898e 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -36,9 +36,12 @@ enum _PedDiskFlag {
This flag is available for msdos and sun disklabels (for sun labels
it only controls the aligning of the end of the partition) */
PED_DISK_CYLINDER_ALIGNMENT=1,
+ /* 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_CYLINDER_ALIGNMENT
+#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT
/**
* Partition types
diff --git a/libparted/disk.c b/libparted/disk.c
index 1057aa8..f763ac1 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -836,7 +836,8 @@ ped_disk_flag_get_name(PedDiskFlag flag)
switch (flag) {
case PED_DISK_CYLINDER_ALIGNMENT:
return N_("cylinder_alignment");
-
+ case PED_DISK_GPT_PMBR_BOOT:
+ return N_("pmbr_boot");
default:
ped_exception_throw (
PED_EXCEPTION_BUG,
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 7b4e014..689ea46 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -264,6 +264,7 @@ struct __attribute__ ((packed)) _GPTDiskData
PedGeometry data_area;
int entry_count;
efi_guid_t uuid;
+ int pmbr_boot;
};
/* uses libparted's disk_specific field in PedPartition, to store our info */
@@ -535,6 +536,7 @@ gpt_alloc (const PedDevice *dev)
gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES;
uuid_generate ((unsigned char *) &gpt_disk_data->uuid);
swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid));
+ gpt_disk_data->pmbr_boot = 0;
return disk;
error_free_disk:
@@ -848,6 +850,15 @@ gpt_read_headers (PedDisk const *disk,
*primary_gpt = NULL;
*backup_gpt = NULL;
PedDevice const *dev = disk->dev;
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ LegacyMBR_t *mbr;
+
+ if (!ptt_read_sector (dev, 0, (void *)&mbr))
+ return 1;
+
+ if (mbr->PartitionRecord[0].BootIndicator == 0x80)
+ gpt_disk_data->pmbr_boot = 1;
+ free (mbr);
void *s1;
if (!ptt_read_sector (dev, 1, &s1))
@@ -1085,7 +1096,7 @@ error:
#ifndef DISCOVER_ONLY
/* Write the protective MBR (to keep DOS happy) */
static int
-_write_pmbr (PedDevice *dev)
+_write_pmbr (PedDevice *dev, bool pmbr_boot)
{
/* The UEFI spec is not clear about what to do with the following
elements of the Protective MBR (pmbr): BootCode (0-440B),
@@ -1110,6 +1121,8 @@ _write_pmbr (PedDevice *dev)
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (0xFFFFFFFF);
else
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL);
+ if (pmbr_boot)
+ pmbr->PartitionRecord[0].BootIndicator = 0x80;
int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA,
GPT_PMBR_SECTORS);
@@ -1226,7 +1239,7 @@ gpt_write (const PedDisk *disk)
ptes_crc = efi_crc32 (ptes, ptes_size);
/* Write protective MBR */
- if (!_write_pmbr (disk->dev))
+ if (!_write_pmbr (disk->dev, gpt_disk_data->pmbr_boot))
goto error_free_ptes;
/* Write PTH and PTEs */
@@ -1529,6 +1542,46 @@ gpt_partition_enumerate (PedPartition *part)
}
static int
+gpt_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state)
+{
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ gpt_disk_data->pmbr_boot = state;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int
+gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
+{
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int
+gpt_disk_get_flag (const PedDisk *disk, PedDiskFlag flag)
+{
+ GPTDiskData *gpt_disk_data = disk->disk_specific;
+ switch (flag)
+ {
+ case PED_DISK_GPT_PMBR_BOOT:
+ return gpt_disk_data->pmbr_boot;
+ break;
+ default:
+ return 0;
+ }
+}
+
+static int
gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
{
GPTPartitionData *gpt_part_data;
@@ -1816,6 +1869,9 @@ static PedDiskOps gpt_disk_ops =
partition_set_name: gpt_partition_set_name,
partition_get_name: gpt_partition_get_name,
+ disk_set_flag: gpt_disk_set_flag,
+ disk_get_flag: gpt_disk_get_flag,
+ disk_is_flag_available: gpt_disk_is_flag_available,
PT_op_function_initializers (gpt)
};
diff --git a/parted/parted.c b/parted/parted.c
index 32c2fcc..4220265 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1475,6 +1475,43 @@ error:
}
static int
+do_disk_set (PedDevice** dev)
+{
+ PedDisk* disk;
+ PedDiskFlag flag;
+ int state;
+
+ disk = ped_disk_new (*dev);
+ if (!disk)
+ goto error;
+
+ if (!command_line_get_disk_flag (_("Flag to Invert?"), disk, &flag))
+ goto error_destroy_disk;
+ state = (ped_disk_get_flag (disk, flag) == 0 ? 1 : 0);
+
+ if (!is_toggle_mode) {
+ if (!command_line_get_state (_("New state?"), &state))
+ goto error_destroy_disk;
+ }
+
+ if (!ped_disk_set_flag (disk, flag, state))
+ goto error_destroy_disk;
+ if (!ped_disk_commit (disk))
+ goto error_destroy_disk;
+ ped_disk_destroy (disk);
+
+ if ((*dev)->type != PED_DEVICE_FILE)
+ disk_is_modified = 1;
+
+ return 1;
+
+error_destroy_disk:
+ ped_disk_destroy (disk);
+error:
+ return 0;
+}
+
+static int
do_set (PedDevice** dev)
{
PedDisk* disk;
@@ -1515,6 +1552,18 @@ error:
}
static int
+do_disk_toggle (PedDevice **dev)
+{
+ int result;
+
+ is_toggle_mode = 1;
+ result = do_disk_set (dev);
+ is_toggle_mode = 0;
+
+ return result;
+}
+
+static int
do_toggle (PedDevice **dev)
{
int result;
@@ -1751,6 +1800,23 @@ NULL),
str_list_create (_(device_msg), NULL), 1));
command_register (commands, command_create (
+ str_list_create_unique ("disk_set", _("disk_set"), NULL),
+ do_disk_set,
+ str_list_create (
+_("disk_set FLAG STATE change the FLAG on selected device"),
+NULL),
+ str_list_create (flag_msg, _(state_msg), NULL), 1));
+
+command_register (commands, command_create (
+ str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL),
+ do_disk_toggle,
+ str_list_create (
+_("disk_toggle [FLAG] toggle the state of FLAG on "
+"selected device"),
+NULL),
+ str_list_create (flag_msg, NULL), 1));
+
+command_register (commands, command_create (
str_list_create_unique ("set", _("set"), NULL),
do_set,
str_list_create (
diff --git a/parted/ui.c b/parted/ui.c
index 6d2fde1..d66029f 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1113,6 +1113,35 @@ command_line_get_disk_type (const char* prompt, const PedDiskType*(* value))
}
int
+command_line_get_disk_flag (const char* prompt, const PedDisk* disk,
+ PedDiskFlag* flag)
+{
+ StrList* opts = NULL;
+ PedPartitionFlag walk = 0;
+ char* flag_name;
+
+ while ( (walk = ped_disk_flag_next (walk)) ) {
+ if (ped_disk_is_flag_available (disk, walk)) {
+ const char* walk_name;
+
+ walk_name = ped_disk_flag_get_name (walk);
+ opts = str_list_append (opts, walk_name);
+ opts = str_list_append_unique (opts, _(walk_name));
+ }
+ }
+
+ flag_name = command_line_get_word (prompt, NULL, opts, 1);
+ str_list_destroy (opts);
+
+ if (flag_name) {
+ *flag = ped_disk_flag_get_by_name (flag_name);
+ free (flag_name);
+ return 1;
+ } else
+ return 0;
+}
+
+int
command_line_get_part_flag (const char* prompt, const PedPartition* part,
PedPartitionFlag* flag)
{
diff --git a/parted/ui.h b/parted/ui.h
index 44b521a..2a27c86 100644
--- a/parted/ui.h
+++ b/parted/ui.h
@@ -63,6 +63,9 @@ extern int command_line_get_fs_type (const char* prompt,
const PedFileSystemType*(* value));
extern int command_line_get_disk_type (const char* prompt,
const PedDiskType*(* value));
+extern int command_line_get_disk_flag (const char* prompt,
+ const PedDisk* disk,
+ PedDiskFlag* flag);
extern int command_line_get_part_flag (const char* prompt,
const PedPartition* part,
PedPartitionFlag* flag);
--
1.7.6.5

View File

@ -1,145 +0,0 @@
From 1bb50f026e3e034dc7a93c89dea69b3710c6e9cd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Fri, 24 Jun 2011 13:32:33 +0200
Subject: [PATCH 1/4] gpt: don't abort for a truncated GPT-formatted device
This fixes the problem two ways. The first fix (via gpt_alloc)
rejects any device that is too small, but it is insufficient.
Choose a slightly larger truncated device with an otherwise intact
primary GPT header and you can still trigger the failed assertion.
To fix it in general, we make _header_is_valid detect the problem.
* libparted/labels/gpt.c (gpt_alloc): Reject a device that is so
small that there is no room for a single partition.
(_header_is_valid): Validate LastUsableLBA here, as well, so that
we now reject as invalid any GPT header that specifies a
LastUsableLBA larger than the device size.
Leave the assertion in _parse_header.
* tests/t0203-gpt-tiny-device-abort.sh: Test for this.
* tests/Makefile.am (TESTS): Add it.
* NEWS: (Bug fixes): Mention it.
Reported by Daniel Fandrich in
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466
---
NEWS | 2 +
libparted/labels/gpt.c | 16 ++++++++++--
tests/Makefile.am | 1 +
tests/t0203-gpt-tiny-device-abort.sh | 44 ++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+), 3 deletions(-)
create mode 100644 tests/t0203-gpt-tiny-device-abort.sh
diff --git a/NEWS b/NEWS
index 6b7c02a..24e28e6 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ GNU parted NEWS -*- outline -*-
** Bug fixes
+ libparted: no longer aborts when reading a truncated GPT-formatted device
+
Fix numerous small leaks in both the library and the UI.
** Changes in behavior
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index e1c0a32..8c9816f 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -517,13 +517,19 @@ gpt_alloc (const PedDevice *dev)
disk = _ped_disk_alloc ((PedDevice *) dev, &gpt_disk_type);
if (!disk)
goto error;
- disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
- if (!disk->disk_specific)
- goto error_free_disk;
data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
data_end = dev->length - 2
- GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
+
+ /* If the device is too small to have room for data, reject it. */
+ if (data_end <= data_start)
+ goto error_free_disk;
+
+ disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
+ if (!disk->disk_specific)
+ goto error_free_disk;
+
ped_geometry_init (&gpt_disk_data->data_area, dev, data_start,
data_end - data_start + 1);
gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES;
@@ -665,6 +671,10 @@ _header_is_valid (PedDisk const *disk, GuidPartitionTableHeader_t *gpt,
if (first_usable < 3)
return 0;
+ PedSector last_usable = PED_LE64_TO_CPU (gpt->LastUsableLBA);
+ if (disk->dev->length < last_usable)
+ return 0;
+
origcrc = gpt->HeaderCRC32;
gpt->HeaderCRC32 = 0;
if (pth_crc32 (dev, gpt, &crc) != 0)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b57142b..86402c0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -11,6 +11,7 @@ TESTS = \
t0200-gpt.sh \
t0201-gpt.sh \
t0202-gpt-pmbr.sh \
+ t0203-gpt-tiny-device-abort.sh \
t0205-gpt-list-clobbers-pmbr.sh \
t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
t0207-IEC-binary-notation.sh \
diff --git a/tests/t0203-gpt-tiny-device-abort.sh b/tests/t0203-gpt-tiny-device-abort.sh
new file mode 100644
index 0000000..22c8b21
--- /dev/null
+++ b/tests/t0203-gpt-tiny-device-abort.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# parted before 3.1 could abort for a pathologically small device with
+# a valid primary GPT header but no room for the backup header.
+
+# Copyright (C) 2009-2011 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
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+# truncate it to 34 sectors.
+for i in 33 34 35 67 68 69 101 102 103; do
+ dd if=$dev of=bad count=$i
+
+ # Print the partition table. Before, this would evoke a failed assertion.
+ printf 'i\no\n' > in
+ parted ---pretend-input-tty bad u s p < in > out 2> err || fail=1
+ # don't bother comparing stdout
+ # expect no stderr
+ compare err /dev/null || fail=1
+done
+
+Exit $fail
--
1.7.6.4

View File

@ -1,67 +0,0 @@
From fa9d7db0dfc89befe87a73f22e7d0473e505c9d9 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 5 Oct 2011 15:51:10 -0700
Subject: [PATCH 4/4] libparted: Fix a bug in the hfs probe functions
(#714758)
* libparted/fs/hfs/probe.c (hfsplus_probe): Add a check on the
search value and reject it if it is negative.
(hfsx_probe): Same
(hfs_and_wrapper_probe): Same
---
libparted/fs/hfs/probe.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/libparted/fs/hfs/probe.c b/libparted/fs/hfs/probe.c
index 8c656cf..bf4d70b 100644
--- a/libparted/fs/hfs/probe.c
+++ b/libparted/fs/hfs/probe.c
@@ -82,7 +82,8 @@ hfs_and_wrapper_probe (PedGeometry* geom)
+ ((PedSector) PED_BE16_TO_CPU (mdb->total_blocks)
* (PED_BE32_TO_CPU (mdb->block_size) / PED_SECTOR_SIZE_DEFAULT )));
max = search + (PED_BE32_TO_CPU (mdb->block_size) / PED_SECTOR_SIZE_DEFAULT);
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start, search + 2)))
+ if ((search < 0)
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start, search + 2)))
return NULL;
for (; search < max; search++) {
@@ -141,8 +142,9 @@ hfsplus_probe (PedGeometry* geom)
- 2;
search = max - 2 * ( PED_BE32_TO_CPU (vh->block_size)
/ PED_SECTOR_SIZE_DEFAULT ) + 2;
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
- search + 2)))
+ if ((search < 0)
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start,
+ search + 2)))
return NULL;
for (; search < max; search++) {
@@ -156,8 +158,9 @@ hfsplus_probe (PedGeometry* geom)
search = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) - 1)
* ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- 1;
- if (!ped_geometry_set (geom_ret, geom_ret->start,
- search + 2)
+ if ((search < 0)
+ || !ped_geometry_set (geom_ret, geom_ret->start,
+ search + 2)
|| !ped_geometry_read (geom_ret, buf, search, 1)
|| vh->signature != PED_CPU_TO_BE16 (HFSP_SIGNATURE)) {
ped_geometry_destroy (geom_ret);
@@ -213,8 +216,9 @@ hfsx_probe (PedGeometry* geom)
* ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- 2;
search = max - ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT );
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
- search + 2)))
+ if ((search < 0)
+ || !(geom_ret = ped_geometry_new (geom->dev, geom->start,
+ search + 2)))
return NULL;
for (; search < max; search++) {
if (!ped_geometry_set (geom_ret, geom_ret->start,
--
1.7.6.4

View File

@ -1,35 +0,0 @@
From bb4fbe2130cd85727bbaf6c71b2d27b6769aa4aa Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sun, 5 Jun 2011 18:15:31 +0200
Subject: [PATCH] libparted: accommodate two-component linux version number
like 3.0
* libparted/arch/linux.c (_get_linux_version): Also accept 2-component
version numbers.
* NEWS: (Bug fixes): Mention it.
Reported by Richard W.M. Jones.
---
NEWS | 4 ++++
libparted/arch/linux.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index aeaf98f..111816c 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -610,7 +610,11 @@ _get_linux_version ()
if (uname (&uts))
return kver = 0;
- if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) != 3)
+ if (sscanf (uts.release, "%u.%u.%u", &major, &minor, &teeny) == 3)
+ ; /* ok */
+ else if (sscanf (uts.release, "%u.%u", &major, &minor) == 2)
+ teeny = 0;
+ else
return kver = 0;
return kver = KERNEL_VERSION (major, minor, teeny);
--
1.7.5.2

View File

@ -1,46 +0,0 @@
From febeedd8d3dbddcc6e831591b05f590eaca97b12 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 31 Oct 2011 16:35:16 -0700
Subject: [PATCH] libparted: copy flags when duplicating GPT partitions
* libparted/labels/gpt.c (gpt_partition_duplicate): Copy flags to new
partition.
* NEWS: Mention this fix.
Reported by Chris Murphy in https://bugzilla.redhat.com/747497.
---
NEWS | 3 +++
libparted/labels/gpt.c | 4 +---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index bc5152b..af1d957 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ GNU parted NEWS -*- outline -*-
** Bug fixes
+ libparted: gpt_disk_duplicate now copies the flags over to the new
+ disk object. Previously the flags would be undefined.
+
libparted: no longer aborts (failed assertion) due to a nilfs2_probe bug
[bug introduced in parted-2.4 with the addition of nilfs2 support]
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 8c9816f..f2bda41 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1362,9 +1362,7 @@ gpt_partition_duplicate (const PedPartition *part)
if (!result_data)
goto error_free_part;
- result_data->type = part_data->type;
- result_data->uuid = part_data->uuid;
- strcpy (result_data->name, part_data->name);
+ *result_data = *part_data;
return result;
error_free_part:
--
1.7.6.5

View File

@ -1,35 +0,0 @@
From bca7bb94e16acb1e88df97a5ce2c38adb76b072d Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Tue, 21 Jun 2011 10:44:16 -0700
Subject: [PATCH 2/4] libparted: don't allow values less than 1 (#665496)
When a value < 1 is used there is the possibility that the range can
overlap sector 0. The user should use smaller units instead. 0 is a
special case and is still allowed.
* libparted/unit.c (ped_unit_parse_custom): Throw error if a value
between 0 and 1 is used.
---
libparted/unit.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/libparted/unit.c b/libparted/unit.c
index c2921e3..232f81b 100644
--- a/libparted/unit.c
+++ b/libparted/unit.c
@@ -531,6 +531,12 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
_("Invalid number."));
goto error_free_copy;
}
+ if (num > 0 && num < 1) {
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("Use a smaller unit instead of a value < 1"));
+ goto error_free_copy;
+ }
unit_size = ped_unit_get_size (dev, unit);
radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
--
1.7.4.4

View File

@ -1,55 +0,0 @@
From 81a1eb6a888f85074536ed89c5c316de4e918c2b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 25 Jun 2011 08:49:58 +0200
Subject: [PATCH 2/4] libparted: fix a bug in the nilfs2 probe function
* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Reject this partition
if we get a negative sb2 offset. Passing a negative offset to
ped_geometry_read_alloc would evoke a failed assertion.
Bug introduced by 2010-07-09 commit d463e7de.
* NEWS: (Bug fixes): Mention it.
Reported by Daniel Fandrich in
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466/focus=10472
---
NEWS | 3 +++
libparted/fs/nilfs2/nilfs2.c | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 24e28e6..d35c6cc 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ GNU parted NEWS -*- outline -*-
** Bug fixes
+ libparted: no longer aborts (failed assertion) due to a nilfs2_probe bug
+ [bug introduced in parted-2.4 with the addition of nilfs2 support]
+
libparted: no longer aborts when reading a truncated GPT-formatted device
Fix numerous small leaks in both the library and the UI.
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 511b155..166c54c 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -108,13 +108,14 @@ nilfs2_probe (PedGeometry* geom)
struct nilfs2_super_block *sb = NULL;
struct nilfs2_super_block *sb2 = NULL;
PedSector length = geom->length;
- PedSector sb2off;
/* ignore if sector size is not 512bytes for now */
if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT)
return NULL;
- sb2off = NILFS_SB2_OFFSET(length);
+ PedSector sb2off = NILFS_SB2_OFFSET(length);
+ if (sb2off <= 2)
+ return NULL;
if (ped_geometry_read_alloc(geom, &sb_v, 2, 1))
sb = sb_v;
--
1.7.6.4

View File

@ -1,34 +0,0 @@
From 18e727d492933ae1ebb16961e1df553f9299af8b Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Tue, 21 Jun 2011 10:44:15 -0700
Subject: [PATCH 1/4] libparted: fix snap radius so that it is using half
(#665496)
The snap radius didn't match the documentation, it has been using +/-
unit size instead +/- 0.5 * unit (eg. 500KB for a MB unit). This caused
problems when specifying 1MB, 1GB, etc. as a partition start or end
resulting in partitions being created that were nowhere near the
specified size.
* libparted/unit.c (ped_unit_parse_custom): divide radius by 2
This addresses http://bugzilla.redhat.com/665496
---
libparted/unit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libparted/unit.c b/libparted/unit.c
index dc4205b..c2921e3 100644
--- a/libparted/unit.c
+++ b/libparted/unit.c
@@ -533,7 +533,7 @@ ped_unit_parse_custom (const char* str, const PedDevice* dev, PedUnit unit,
}
unit_size = ped_unit_get_size (dev, unit);
- radius = ped_div_round_up (unit_size, dev->sector_size) - 1;
+ radius = (ped_div_round_up (unit_size, dev->sector_size) / 2) - 1;
if (radius < 0)
radius = 0;
/* If the user specifies units in a power of 2, e.g., 4MiB, as in
--
1.7.4.4

View File

@ -1,75 +0,0 @@
From 68ff2e0c7563054e95389c1da5164b3d9c75c52b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 7 Oct 2011 10:56:00 -0700
Subject: [PATCH 1/2] libparted: make pc98 detection depend on signatures
(#646053)
pc98 is not a common disk label. Change pc98_probe to only return true
if one of the recognized signatures is present.
Currently these include:
IPL1
Linux 98
GRUB/98
This will prevent false-positive detection on msdos labeled disks
* libparted/labels/pc98.c (pc98_probe): Change to require signature
(pc98_check_ipl_signature): Add more signatures
---
libparted/labels/pc98.c | 32 ++++++++++----------------------
1 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index 3afa8a2..ea3cf4e 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -140,7 +140,14 @@ pc98_check_magic (const PC98RawTable *part_table)
static int
pc98_check_ipl_signature (const PC98RawTable *part_table)
{
- return !memcmp (part_table->boot_code + 4, "IPL1", 4);
+ if (memcmp (part_table->boot_code + 4, "IPL1", 4) == 0)
+ return 1;
+ else if (memcmp (part_table->boot_code + 4, "Linux 98", 8) == 0)
+ return 1;
+ else if (memcmp (part_table->boot_code + 4, "GRUB/98 ", 8) == 0)
+ return 1;
+ else
+ return 0;
}
static int
@@ -192,27 +199,8 @@ pc98_probe (const PedDevice *dev)
if (!pc98_check_magic (&part_table))
return 0;
- /* check consistency */
- empty = 1;
- for (p = part_table.partitions;
- p < part_table.partitions + MAX_PART_COUNT;
- p++)
- {
- if (p->mid == 0 && p->sid == 0)
- continue;
- empty = 0;
- if (!check_partition_consistency (dev, p))
- return 0;
- }
-
- /* check boot loader */
- if (pc98_check_ipl_signature (&part_table))
- return 1;
- else if (part_table.boot_code[0]) /* invalid boot loader */
- return 0;
-
- /* Not to mistake msdos disk map for PC-9800's empty disk map */
- if (empty)
+ /* check for boot loader signatures */
+ if (!pc98_check_ipl_signature (&part_table))
return 0;
return 1;
--
1.7.6.4

View File

@ -1,97 +0,0 @@
From acb972e2dffecdb5e464236978d22bc6387a2f69 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 27 Jan 2012 16:59:03 -0800
Subject: [PATCH 2/5] parted: when printing, also print the new disk flags
This adds a 'Disk Flags:' line the displays the active disk flags.
In machine mode this is appended to the disk info line, after the
device model.
* parted/parted.c (disk_print_flags): New function
(_print_disk_info): Add Disk Flags information.
---
parted/parted.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/parted/parted.c b/parted/parted.c
index 4220265..38daf81 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -825,6 +825,43 @@ partition_print (PedPartition* part)
return 1;
}
+static char*
+disk_print_flags (PedDisk const *disk)
+{
+ PedDiskFlag flag;
+ int first_flag;
+ const char* name;
+ char* res = ped_malloc(1);
+ void* _res = res;
+
+ *res = '\0';
+ if (!disk)
+ return res;
+
+ first_flag = 1;
+ for (flag = ped_disk_flag_next (0); flag;
+ flag = ped_disk_flag_next (flag)) {
+ if (ped_disk_get_flag (disk, flag)) {
+ if (first_flag)
+ first_flag = 0;
+ else {
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 + 2);
+ res = _res;
+ strncat (res, ", ", 2);
+ }
+
+ name = _(ped_disk_flag_get_name (flag));
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 + strlen (name));
+ res = _res;
+ strcat(res, name);
+ }
+ }
+
+ return res;
+}
+
static void
_print_disk_geometry (const PedDevice *dev)
{
@@ -862,6 +899,7 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
default_unit == PED_UNIT_CYLINDER));
const char* pt_name = disk ? disk->type->name : "unknown";
+ char *disk_flags = disk_print_flags (disk);
if (opt_machine_mode) {
switch (default_unit) {
@@ -873,10 +911,10 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
break;
}
- printf ("%s:%s:%s:%lld:%lld:%s:%s;\n",
+ printf ("%s:%s:%s:%lld:%lld:%s:%s:%s;\n",
dev->path, end, transport[dev->type],
dev->sector_size, dev->phys_sector_size,
- pt_name, dev->model);
+ pt_name, dev->model, disk_flags);
} else {
printf (_("Model: %s (%s)\n"),
dev->model, transport[dev->type]);
@@ -894,7 +932,9 @@ _print_disk_info (const PedDevice *dev, const PedDisk *disk)
if (!opt_machine_mode) {
printf (_("Partition Table: %s\n"), pt_name);
+ printf (_("Disk Flags: %s\n"), disk_flags);
}
+ free (disk_flags);
}
static int
--
1.7.6.5

View File

@ -1,210 +0,0 @@
From 1fad3afd9587de566b2f3b451ed4de2fc409ad21 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 31 Oct 2011 14:30:12 -0700
Subject: [PATCH 2/2] tests: add new test to check ped_disk_duplicate
* tests/duplicate.c: New test
* tests/t0501-duplicate.sh: New test program
* tests/Makefile.am (TEST): Add new test
(check_PROGRAMS): Add new test program
---
tests/Makefile.am | 3 +-
tests/duplicate.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++
tests/t0501-duplicate.sh | 28 ++++++++++
3 files changed, 159 insertions(+), 1 deletions(-)
create mode 100644 tests/duplicate.c
create mode 100644 tests/t0501-duplicate.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a8a539..ae4c5f4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,6 +24,7 @@ TESTS = \
t0300-dos-on-gpt.sh \
t0400-loop-clobber-infloop.sh \
t0500-dup-clobber.sh \
+ t0501-duplicate.sh \
t1100-busy-label.sh \
t1101-busy-partition.sh \
t1700-probe-fs.sh \
@@ -62,7 +63,7 @@ EXTRA_DIST = \
$(TESTS) lvm-utils.sh t-local.sh t-lvm.sh \
init.cfg init.sh t-lib-helpers.sh
-check_PROGRAMS = print-align print-max dup-clobber
+check_PROGRAMS = print-align print-max dup-clobber duplicate
LDADD = \
$(top_builddir)/libparted/libparted.la
AM_CPPFLAGS = \
diff --git a/tests/duplicate.c b/tests/duplicate.c
new file mode 100644
index 0000000..5af8543
--- /dev/null
+++ b/tests/duplicate.c
@@ -0,0 +1,129 @@
+/* Demonstrate that ped_disk_duplicate is working correctly.
+*/
+#include <config.h>
+#include <parted/parted.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include "closeout.h"
+#include "progname.h"
+
+int
+main (int argc, char **argv)
+{
+ atexit (close_stdout);
+ set_program_name (argv[0]);
+
+ if (argc != 2)
+ return EXIT_FAILURE;
+
+ char const *dev_name = "dev-file";
+
+ /* Create a file. */
+ int fd = open (dev_name, O_CREAT|O_TRUNC|O_WRONLY, 0644);
+ assert (0 <= fd);
+ off_t size = 8 * 1024 * 1024;
+ assert (ftruncate (fd, size) == 0);
+ assert (close (fd) == 0);
+
+ PedDevice *dev = ped_device_get (dev_name);
+ assert (dev);
+
+ PedDisk *disk = ped_disk_new_fresh (dev, ped_disk_type_get (argv[1]));
+ assert (disk);
+ assert (ped_disk_commit(disk));
+ ped_disk_destroy (disk);
+
+ /* re-open the disk */
+ disk = ped_disk_new (dev);
+ assert (disk);
+
+ /* Create a partition */
+ const PedFileSystemType *fs_type = ped_file_system_type_get ("ext2");
+ assert (fs_type);
+ PedPartitionType part_type = PED_PARTITION_NORMAL;
+ const PedGeometry *geometry = ped_geometry_new (dev, 34, 1024);
+ assert (geometry);
+ PedPartition *part = ped_partition_new (disk, part_type, fs_type, geometry->start, geometry->end);
+ assert (part);
+ PedConstraint *constraint = ped_constraint_exact (geometry);
+ assert (constraint);
+
+ if (ped_partition_is_flag_available (part, PED_PARTITION_BOOT))
+ assert (ped_partition_set_flag (part, PED_PARTITION_BOOT, 1));
+
+ assert (ped_disk_add_partition (disk, part, constraint));
+ ped_constraint_destroy (constraint);
+
+ assert (ped_partition_set_system (part, fs_type));
+ if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
+ ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
+
+ assert (ped_disk_commit(disk));
+
+ /* Duplicate it */
+ PedDisk *copy = ped_disk_duplicate (disk);
+ assert (ped_disk_commit(copy));
+
+ /* Compare the two copies */
+
+ /* Check the device */
+ assert (strcmp (disk->dev->model, copy->dev->model) == 0);
+ assert (strcmp (disk->dev->path, copy->dev->path) == 0);
+ assert (disk->dev->sector_size == copy->dev->sector_size);
+ assert (disk->dev->phys_sector_size == copy->dev->phys_sector_size);
+ assert (disk->dev->length == copy->dev->length);
+
+ /* Check the type */
+ assert (strcmp (disk->type->name, copy->type->name) == 0);
+ assert (disk->type->features == copy->type->features);
+
+ /* Check the flags */
+ for (PedDiskFlag flag = PED_DISK_FIRST_FLAG; flag <= PED_DISK_LAST_FLAG; flag++) {
+ if (!ped_disk_is_flag_available(disk, flag))
+ continue;
+ assert (ped_disk_get_flag (disk, flag) == ped_disk_get_flag (copy, flag));
+ }
+
+ /* Check the partitions */
+ PedPartition *disk_part, *copy_part;
+ for ( disk_part = disk->part_list, copy_part = copy->part_list;
+ disk_part && copy_part;
+ disk_part = disk_part->next, copy_part = copy_part->next)
+ {
+ /* Only active partitions are duplicated */
+ if (!ped_partition_is_active (disk_part))
+ continue;
+
+ assert (disk_part->geom.start == copy_part->geom.start);
+ assert (disk_part->geom.end == copy_part->geom.end);
+ assert (disk_part->geom.length == copy_part->geom.length);
+ assert (disk_part->num == copy_part->num);
+ assert (disk_part->type == copy_part->type);
+
+ if (disk_part->fs_type && disk_part->fs_type->name) {
+ assert (strcmp (disk_part->fs_type->name, copy_part->fs_type->name) == 0);
+ }
+
+ /* Check the flags */
+ for (PedPartitionFlag flag = PED_PARTITION_FIRST_FLAG; flag <= PED_PARTITION_LAST_FLAG; flag++) {
+ if (!ped_partition_is_flag_available(disk_part, flag))
+ continue;
+ fprintf (stderr, "Checking partition flag %d\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) == ped_partition_get_flag (copy_part, flag));
+ }
+ }
+
+ /* Cleanup the mess */
+ ped_disk_destroy (copy);
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/t0501-duplicate.sh b/tests/t0501-duplicate.sh
new file mode 100644
index 0000000..0585a95
--- /dev/null
+++ b/tests/t0501-duplicate.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# Drive the dup-clobber program.
+
+# Copyright (C) 2011 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
+
+PATH="..:$PATH"
+export PATH
+
+for t in msdos gpt bsd; do
+ duplicate $t || fail=1
+done
+
+Exit $fail
--
1.7.6.4

View File

@ -1,112 +0,0 @@
From 9c3bf96c790d963ff9dff7223a97c51989feaa75 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:11:59 -0800
Subject: [PATCH 4/5] tests: add test for GPT PMBR pmbr_boot flag
* tests/t0209-gpt-pmbr_boot.sh: New test
* tests/Makefile.am: Add new test
* NEWS: Add information about the GPT PMBR pmbr_boot flag
---
NEWS | 21 ++++++++++++++++++++-
tests/Makefile.am | 1 +
tests/t0209-gpt-pmbr_boot.sh | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 1 deletions(-)
create mode 100755 tests/t0209-gpt-pmbr_boot.sh
diff --git a/NEWS b/NEWS
index e8ffed5..d535612 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,24 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release 3.0-6 (Fedora)
+
+ Add the ability to set the boot flag on the GPT PMBR. This is needed
+ for some BIOS systems that refuse to boot from GPT unless this is set.
+ disk_set and disk_toggle commands can be used to set the pmbr_boot
+ flag on the disk.
+
+ The flag is also displayed in a new line, 'Disk Flags:' like this:
+
+ Model: (file)
+ Disk /home/bcl/disk.img: 4295MB
+ Sector size (logical/physical): 512B/512B
+ Partition Table: gpt
+ Disk Flags: pmbr_boot
+
+ Using -m the flags are added after the model name field:
+
+ /root/disk.img:4295MB:file:512:512:gpt::pmbr_boot;
+
* Noteworthy changes in release 3.0 (2011-05-30) [stable]
** Bug fixes
@@ -16,7 +35,7 @@ GNU parted NEWS -*- outline -*-
** Changes in behavior
- Remove all FS-related (file system-related) sub-commands; these commands
+ Remove all FS-gelated (file system-related) sub-commands; these commands
are no longer recognized because they were all dependent on parted "knowing"
too much about file system: mkpartfs, mkfs, cp, move, check, resize.
This change removes not just the user interface bits, but also the
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2218a2c..cd74ff9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,6 +15,7 @@ TESTS = \
t0205-gpt-list-clobbers-pmbr.sh \
t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
t0207-IEC-binary-notation.sh \
+ t0209-gpt-pmbr_boot.sh \
t0220-gpt-msftres.sh \
t0250-gpt.sh \
t0280-gpt-corrupt.sh \
diff --git a/tests/t0209-gpt-pmbr_boot.sh b/tests/t0209-gpt-pmbr_boot.sh
new file mode 100755
index 0000000..b15cc9c
--- /dev/null
+++ b/tests/t0209-gpt-pmbr_boot.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Ensure that pmbr_boot flag can be set
+
+# Copyright (C) 2012 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
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+# Set the pmbr_boot flag on the PMBR
+parted -s $dev disk_set pmbr_boot on
+
+# Check to see if the flag is set
+parted -m -s $dev u s p > out 2> err || fail=1
+grep "$dev:.*:gpt::pmbr_boot;" out || { cat out; fail=1; }
+
+Exit $fail
--
1.7.6.5

View File

@ -1,76 +0,0 @@
From 801a0d9957116757dddc4e62abe62a403d22c9b2 Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Tue, 21 Jun 2011 10:44:17 -0700
Subject: [PATCH 3/4] tests: add test for radius divide by 2 fix
* tests/t9022-one-unit-snap.sh: New file.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 1 +
tests/t9022-one-unit-snap.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
create mode 100644 tests/t9022-one-unit-snap.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4ea08f3..7487a5d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,6 +44,7 @@ TESTS = \
t9010-big-sector.sh \
t9020-alignment.sh \
t9021-maxima.sh \
+ t9022-one-unit-snap.sh \
t9030-align-check.sh \
t9040-many-partitions.sh \
t9041-undetected-in-use-16th-partition.sh \
diff --git a/tests/t9022-one-unit-snap.sh b/tests/t9022-one-unit-snap.sh
new file mode 100644
index 0000000..ce903a5
--- /dev/null
+++ b/tests/t9022-one-unit-snap.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Confirm that specifying 1 unit snaps to the correct value
+
+# Copyright (C) 2011 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
+
+ss=$sector_size_
+n_sectors=3000
+dev=dev-file
+
+# Create an example of what the result should look like
+# start should be at 1 sector.
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 1s $((1000*1000))B \
+ > err 2>&1 || fail=1
+compare err /dev/null || fail=1
+parted -m -s $dev u s p > exp || fail=1
+
+rm $dev
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 0 1MB \
+ > err 2>&1 || fail=1
+compare err /dev/null || fail=1
+parted -m -s $dev u s p > out || fail=1
+
+compare out exp || fail=1
+
+Exit $fail
--
1.7.4.4

View File

@ -1,66 +0,0 @@
From b8f017f18fa99f9377ef461cbbd3264c7878a9aa Mon Sep 17 00:00:00 2001
From: Brian C. Lane <bcl@redhat.com>
Date: Tue, 21 Jun 2011 10:44:18 -0700
Subject: [PATCH 4/4] tests: add test for value less than 1
* tests/t9023-value-lt-one.sh: New file.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 1 +
tests/t9023-value-lt-one.sh | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
create mode 100644 tests/t9023-value-lt-one.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7487a5d..b57142b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,6 +45,7 @@ TESTS = \
t9020-alignment.sh \
t9021-maxima.sh \
t9022-one-unit-snap.sh \
+ t9023-value-lt-one.sh \
t9030-align-check.sh \
t9040-many-partitions.sh \
t9041-undetected-in-use-16th-partition.sh \
diff --git a/tests/t9023-value-lt-one.sh b/tests/t9023-value-lt-one.sh
new file mode 100644
index 0000000..67be8d6
--- /dev/null
+++ b/tests/t9023-value-lt-one.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Confirm that a value between 0 and 1 throws an error
+
+# Copyright (C) 2011 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
+
+ss=$sector_size_
+n_sectors=3000
+dev=dev-file
+
+echo 'Error: Use a smaller unit instead of a value < 1' > exp
+
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+parted --align=none -s $dev mklabel msdos mkpart pri 0 0.5MB \
+ > err 2>&1
+compare err exp || fail=1
+
+Exit $fail
--
1.7.4.4

View File

@ -1,75 +0,0 @@
From 1a6336b7a903a6720604d7e8983f99939ec4b070 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 7 Oct 2011 11:41:25 -0700
Subject: [PATCH 2/2] tests: add tests for new pc98 signatures (#646053)
* tests/t2201-pc98-label-recog.sh: New file
* tests/Makefile.am: Add test
---
tests/Makefile.am | 1 +
tests/t2201-pc98-label-recog.sh | 41 +++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
create mode 100755 tests/t2201-pc98-label-recog.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 903ca64..525ec99 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ TESTS = \
t1101-busy-partition.sh \
t1700-probe-fs.sh \
t2200-dos-label-recog.sh \
+ t2201-pc98-label-recog.sh \
t2300-dos-label-extended-bootcode.sh \
t2310-dos-extended-2-sector-min-offset.sh \
t2400-dos-hfs-partition-type.sh \
diff --git a/tests/t2201-pc98-label-recog.sh b/tests/t2201-pc98-label-recog.sh
new file mode 100755
index 0000000..6228159
--- /dev/null
+++ b/tests/t2201-pc98-label-recog.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Recognize PC98 labeled disks
+
+# Copyright (C) 2011 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_
+
+ss=$sector_size_
+N=8192
+dev=loop-file
+
+# create a file to simulate the underlying device
+dd if=/dev/null of=$dev bs=$ss seek=$N 2> /dev/null || fail=1
+
+# label the test disk
+parted -s $dev mklabel pc98 > out 2>&1 || fail=1
+compare out /dev/null || fail=1 # expect no output
+
+parted -s $dev p | grep "^Partition Table: pc98" || fail=1
+
+for s in "Linux 98" "GRUB/98 "; do
+ printf "$s" | dd bs=1c seek=4 of=$dev conv=notrunc || fail=1
+ parted -s $dev p | grep "^Partition Table: pc98" || fail=1
+done
+
+Exit $fail
--
1.7.6.4

View File

@ -1,66 +0,0 @@
From d8d4eac278939db6a22fe69181138be2d2dd79e6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 28 Sep 2011 19:43:40 +0200
Subject: [PATCH 3/4] tests: test for the nilfs2 bug
* tests/t4300-nilfs2-tiny.sh: New test.
* tests/Makefile.am (TESTS): Add it.
---
tests/Makefile.am | 1 +
tests/t4300-nilfs2-tiny.sh | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
create mode 100755 tests/t4300-nilfs2-tiny.sh
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 86402c0..e721f88 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -38,6 +38,7 @@ TESTS = \
t4100-dvh-partition-limits.sh \
t4100-msdos-starting-sector.sh \
t4200-partprobe.sh \
+ t4300-nilfs2-tiny.sh \
t5000-tags.sh \
t6000-dm.sh \
t7000-scripting.sh \
diff --git a/tests/t4300-nilfs2-tiny.sh b/tests/t4300-nilfs2-tiny.sh
new file mode 100755
index 0000000..009a3cd
--- /dev/null
+++ b/tests/t4300-nilfs2-tiny.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Trigger a nilfs2-related bug.
+
+# Copyright (C) 2011 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
+ss=$sector_size_
+
+n_sectors=200
+dev=dev-file
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || framework_failure_
+
+# Create a tiny, 7-sector partition.
+parted -s $dev mklabel gpt mkpart p1 64s 70s || framework_failure_
+
+# This used to make parted abort.
+parted -s $dev u s p || fail=1
+
+Exit $fail
--
1.7.6.4

View File

@ -1,337 +0,0 @@
From 26d43fea236f7e1af0d9fd3531b39cceb5276c0e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 1 Feb 2012 13:11:58 -0800
Subject: [PATCH 3/5] tests: update tests for new disk flags output
* tests/t0010-script-no-ctrl-chars.sh: Updated
* tests/t0100-print.sh: Updated
* tests/t0101-print-empty.sh: Updated
* tests/t0220-gpt-msftres.sh: Updated
* tests/t0250-gpt.sh: Updated
* tests/t0280-gpt-corrupt.sh: Updated
* tests/t2310-dos-extended-2-sector-min-offset.sh: Updated
* tests/t4000-sun-raid-type.sh: Updated
* tests/t4100-dvh-partition-limits.sh: Updated
* tests/t4100-msdos-partition-limits.sh: Updated
* tests/t4100-msdos-starting-sector.sh: Updated
* tests/t4200-partprobe.sh: Updated
* tests/t5000-tags.sh: Updated
* tests/t6000-dm.sh: Updated
* tests/t9040-many-partitions.sh: Updated
* tests/t9041-undetected-in-use-16th-partition.sh: Updated
---
tests/t0010-script-no-ctrl-chars.sh | 2 +-
tests/t0100-print.sh | 6 ++++--
tests/t0101-print-empty.sh | 2 ++
tests/t0220-gpt-msftres.sh | 2 +-
tests/t0250-gpt.sh | 2 +-
tests/t0280-gpt-corrupt.sh | 4 ++--
tests/t2310-dos-extended-2-sector-min-offset.sh | 2 +-
tests/t4000-sun-raid-type.sh | 2 +-
tests/t4100-dvh-partition-limits.sh | 6 ++++--
tests/t4100-msdos-partition-limits.sh | 6 ++++--
tests/t4100-msdos-starting-sector.sh | 4 ++--
tests/t4200-partprobe.sh | 2 +-
tests/t5000-tags.sh | 6 +++---
tests/t6000-dm.sh | 5 +++--
tests/t9040-many-partitions.sh | 2 +-
tests/t9041-undetected-in-use-16th-partition.sh | 2 +-
16 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/tests/t0010-script-no-ctrl-chars.sh b/tests/t0010-script-no-ctrl-chars.sh
index 49b3ff1..25efb73 100755
--- a/tests/t0010-script-no-ctrl-chars.sh
+++ b/tests/t0010-script-no-ctrl-chars.sh
@@ -32,7 +32,7 @@ compare out /dev/null || fail=1
TERM=xterm parted -m -s $dev u s p > out 2>&1 || fail=1
sed "s,.*/$dev:,$dev:," out > k && mv k out || fail=1
-printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos:;\n" > exp || fail=1
+printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:msdos::;\n" > exp || fail=1
compare out exp || fail=1
diff --git a/tests/t0100-print.sh b/tests/t0100-print.sh
index d09b8ed..ccf58b4 100755
--- a/tests/t0100-print.sh
+++ b/tests/t0100-print.sh
@@ -27,6 +27,7 @@ Model: (file)
Disk .../$dev: 8s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: msdos
+Disk Flags:
Number Start End Size Type File system Flags
@@ -46,10 +47,11 @@ msdos_magic='\125\252'
{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"
dd if=/dev/zero bs=$(expr 8 '*' $ss - 510) count=1; } > $dev || fail=1
-# print the empty table' \
+# print the empty table
parted -s $dev unit s print >out 2>&1 || fail=1
-# prepare actual and expected output' \
+# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:," o2 > out || fail=1
# check for expected output
diff --git a/tests/t0101-print-empty.sh b/tests/t0101-print-empty.sh
index 3e77850..1c15eb2 100755
--- a/tests/t0101-print-empty.sh
+++ b/tests/t0101-print-empty.sh
@@ -28,6 +28,7 @@ Model: (file)
Disk .../$dev: 8s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: unknown
+Disk Flags:
EOF
} > exp || framework_failure
@@ -38,6 +39,7 @@ dd if=/dev/zero of=$dev bs=$(expr 8 '*' $ss) count=1 >/dev/null 2>&1 || fail=1
parted -s $dev unit s print >out 2>&1 || fail=1
# prepare actual and expected output
+sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
mv out o2 && sed "s,^Disk .*/$dev:,Disk .../$dev:,; \
s,^Error: .*/$dev:,Error: .../$dev:," o2 > out || fail=1
diff --git a/tests/t0220-gpt-msftres.sh b/tests/t0220-gpt-msftres.sh
index 1247ee0..00d588c 100755
--- a/tests/t0220-gpt-msftres.sh
+++ b/tests/t0220-gpt-msftres.sh
@@ -52,7 +52,7 @@ parted -s $dev mklabel gpt > out 2>&1 || fail=1
# expect no output
compare out /dev/null || fail=1
-printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt:;\n" > exp
+printf "BYT;\n$dev:${n_sectors}s:file:$ss:$ss:gpt::;\n" > exp
i=1
for type in $fs_types; do
end=$(expr $start + $part_size - 1)
diff --git a/tests/t0250-gpt.sh b/tests/t0250-gpt.sh
index 5f42440..d9e0496 100755
--- a/tests/t0250-gpt.sh
+++ b/tests/t0250-gpt.sh
@@ -35,7 +35,7 @@ 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" \
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
> exp || fail=1
compare exp out || fail=1
diff --git a/tests/t0280-gpt-corrupt.sh b/tests/t0280-gpt-corrupt.sh
index df54817..375da0e 100755
--- a/tests/t0280-gpt-corrupt.sh
+++ b/tests/t0280-gpt-corrupt.sh
@@ -34,7 +34,7 @@ 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" \
+printf "BYT;\n$dev:${n_sectors}s:file:$sector_size_:$sector_size_:gpt::;\n" \
> exp || fail=1
compare exp out || fail=1
@@ -90,7 +90,7 @@ parted -m -s $dev u s print > out 2>&1 || fail=1
# check for expected output
printf "BYT;\nfile\n1:2048s:4095s:2048s::foo:;\n" > exp || fail=1
-sed "s/.*gpt:;/file/" out > k && mv k out || fail=1
+sed "s/.*gpt::;/file/" out > k && mv k out || fail=1
compare exp out || fail=1
Exit $fail
diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh
index b86c6bc..aad575a 100644
--- a/tests/t2310-dos-extended-2-sector-min-offset.sh
+++ b/tests/t2310-dos-extended-2-sector-min-offset.sh
@@ -33,7 +33,7 @@ p5=${scsi_dev}5
cat <<EOF > exp || framework_failure
BYT;
-$scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug;
+$scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:;
1:64s:128s:65s:::lba;
5:66s:128s:63s:::;
EOF
diff --git a/tests/t4000-sun-raid-type.sh b/tests/t4000-sun-raid-type.sh
index 91a9f63..84b170a 100755
--- a/tests/t4000-sun-raid-type.sh
+++ b/tests/t4000-sun-raid-type.sh
@@ -24,7 +24,7 @@ ss=$sector_size_
N=2000 # number of sectors
dev=sun-disk-file
-exp="BYT;\n---:${N}s:file:$ss:$ss:sun:;\n1:0s:127s:128s"
+exp="BYT;\n---:${N}s:file:$ss:$ss:sun::;\n1:0s:127s:128s"
# create an empty file as a test disk
dd if=/dev/zero of=$dev bs=${ss}c count=$N 2> /dev/null || fail=1
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
index b57a1c3..1280f8e 100755
--- a/tests/t4100-dvh-partition-limits.sh
+++ b/tests/t4100-dvh-partition-limits.sh
@@ -129,9 +129,10 @@ do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
# FIXME: In the long run, figure out if it's sensible.
cat > exp <<EOF
Model: (file)
-Disk: 4294970342s
+Disk $dev: 4294970342s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: $table_type
+Disk Flags:
Number Start End Size Type File system Name Flags
9 0s 4095s 4096s extended
@@ -141,7 +142,8 @@ EOF
# print the result
parted -s $dev unit s p > out 2>&1 || fail=1
-sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
compare out exp || fail=1
# a partition start sector number of 2^32 must fail
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
index 4ec3c27..f8f1fc4 100755
--- a/tests/t4100-msdos-partition-limits.sh
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -116,9 +116,10 @@ do_mkpart_start_and_len $(echo 2^32-1|bc) 1000 || fail=1
cat > exp <<EOF
Model: (file)
-Disk: 4294970342s
+Disk $dev: 4294970342s
Sector size (logical/physical): ${ss}B/${ss}B
Partition Table: $table_type
+Disk Flags:
Number Start End Size Type File system Flags
1 4294967295s 4294968294s 1000s primary
@@ -127,7 +128,8 @@ EOF
# print the result
parted -s $dev unit s p > out 2>&1 || fail=1
-sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out || fail=1
+sed "s/^Disk .*\($dev: [0-9][0-9]*s\)$/Disk \1/;s/ *$//" out > k \
+ && mv k out || fail=1
compare out exp || fail=1
# a partition start sector number of 2^32 must fail
diff --git a/tests/t4100-msdos-starting-sector.sh b/tests/t4100-msdos-starting-sector.sh
index f768646..26b5a57 100755
--- a/tests/t4100-msdos-starting-sector.sh
+++ b/tests/t4100-msdos-starting-sector.sh
@@ -38,7 +38,7 @@ compare out /dev/null || fail=1
# Test the output of print free with no partitions.
cat <<EOF > exp || fail=1
BYT;
-path:${N}s:file:$ss:$ss:msdos:;
+path:${N}s:file:$ss:$ss:msdos::;
1:32s:4095s:4064s:free;
EOF
@@ -54,7 +54,7 @@ compare out exp || fail=1
# Test the output of print free with one partition.
cat <<EOF > exp || fail=1
BYT;
-path:${N}s:file:$ss:$ss:msdos:;
+path:${N}s:file:$ss:$ss:msdos::;
1:32s:2047s:2016s:free;
1:2048s:4095s:2048s:::;
EOF
diff --git a/tests/t4200-partprobe.sh b/tests/t4200-partprobe.sh
index bd5e15d..41bc802 100755
--- a/tests/t4200-partprobe.sh
+++ b/tests/t4200-partprobe.sh
@@ -33,7 +33,7 @@ dvhtool -d $dev --unix-to-vh d data || fail=1
# Here's sample output from the parted...print command below:
# BYT;
-# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk;
+# /dev/sdd:128880s:scsi:512:512:dvh: Flash Disk:;
# 9:0s:4095s:4096s:::;
# 17:4s:11s:8s::data:;
diff --git a/tests/t5000-tags.sh b/tests/t5000-tags.sh
index ef2f610..47437d3 100755
--- a/tests/t5000-tags.sh
+++ b/tests/t5000-tags.sh
@@ -44,7 +44,7 @@ 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}s:file:$ss:$ss:gpt:;\n" > exp || fail=1
+printf "BYT;\n$dev:${N}s:file:$ss:$ss:gpt::;\n" > exp || fail=1
compare exp out || fail=1
# add a partition
@@ -66,10 +66,10 @@ gen_exp()
{
cat <<EOF
BYT;
-$dev:${N}s:file:$ss:$ss:gpt:;
+$dev:${N}s:file:$ss:$ss:gpt::;
1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:;
BYT;
-$dev:${N}s:file:$ss:$ss:gpt:;
+$dev:${N}s:file:$ss:$ss:gpt::;
1:${start_sector}s:${end_sector}s:${part_sectors}s::name1:bios_grub;
EOF
}
diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh
index 03586c7..d593914 100755
--- a/tests/t6000-dm.sh
+++ b/tests/t6000-dm.sh
@@ -72,14 +72,15 @@ for type in linear ; do
compare out /dev/null || fail=1
parted -s "$dev" print > out 2>&1 || fail=1
- sed 's/^Disk .*: /Disk DEV: /' out > k; mv k out
+ sed 's/ $//' out > k && mv k out || fail=1 # Remove trailing blank.
# Create expected output file.
cat <<EOF >> exp || fail=1
Model: Linux device-mapper ($type) (dm)
-Disk DEV: 524kB
+Disk $dev: 524kB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
+Disk Flags:
Number Start End Size Type File system Flags
diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index 1282c1f..55530fe 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -40,7 +40,7 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
scsi_dev=$(cat dev-name)
n=$((n_MiB * sectors_per_MiB))
-printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug;\n" \
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
> exp || fail=1
parted -s $scsi_dev mklabel gpt || fail=1
diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh
index 74c30fc..1c6bad2 100644
--- a/tests/t9041-undetected-in-use-16th-partition.sh
+++ b/tests/t9041-undetected-in-use-16th-partition.sh
@@ -40,7 +40,7 @@ scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
scsi_dev=$(cat dev-name)
n=$((n_MiB * sectors_per_MiB))
-printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug;\n" \
+printf "BYT;\n$scsi_dev:${n}s:scsi:$ss:$ss:gpt:Linux scsi_debug:;\n" \
> exp || fail=1
parted -s $scsi_dev mklabel gpt || fail=1
--
1.7.6.5

View File

@ -3,8 +3,8 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.0
Release: 7%{?dist}
Version: 3.1
Release: 1%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -12,32 +12,8 @@ URL: http://www.gnu.org/software/parted
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source1: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source2: pubkey.jim.meyering
# All patches are in upstream git
# Report partitions changes when using blkext major numbers
Patch0: parted-2.3-lpn.patch
# Document the align-check command
Patch1: parted-2.3-Document-align-check-642476.patch
Patch2: parted-3.0-libparted-fix-snap-radius-so-that-it-is-using-half.patch
Patch3: parted-3.0-libparted-don-t-allow-values-less-than-1.patch
Patch4: parted-3.0-tests-add-test-for-radius-divide-by-2-fix.patch
Patch5: parted-3.0-tests-add-test-for-value-less-than-1.patch
# Fix for kernel 3.0 new version numbering.
Patch6: parted-3.0-libparted-accommodate-two-component-linux-version-nu.patch
Patch7: parted-3.0-gpt-don-t-abort-for-a-truncated-GPT-formatted-device.patch
Patch8: parted-3.0-libparted-fix-a-bug-in-the-nilfs2-probe-function.patch
Patch9: parted-3.0-tests-test-for-the-nilfs2-bug.patch
Patch10: parted-3.0-libparted-Fix-a-bug-in-the-hfs-probe-functions-71475.patch
Patch11: parted-3.0-libparted-make-pc98-detection-depend-on-signatures.patch
Patch12: parted-3.0-tests-add-tests-for-new-pc98-signatures-646053.patch
Patch13: parted-3.0-libparted-copy-flags-when-duplicating-GPT-partitions.patch
Patch14: parted-3.0-tests-add-new-test-to-check-ped_disk_duplicate.patch
Patch15: parted-3.0-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch
Patch16: parted-3.0-parted-when-printing-also-print-the-new-disk-flags.patch
Patch17: parted-3.0-tests-update-tests-for-new-disk-flags-output.patch
Patch18: parted-3.0-tests-add-test-for-GPT-PMBR-pmbr_boot-flag.patch
Patch19: parted-3.0-doc-update-parted-documentation.patch
Patch20: parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch
Patch0: parted-3.0-libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -158,6 +134,7 @@ fi
%{_mandir}/man8/parted.8.gz
%{_mandir}/man8/partprobe.8.gz
%{_libdir}/libparted.so.*
%{_libdir}/libparted-fs-resize.so*
%{_infodir}/parted.info.gz
%files devel
@ -168,6 +145,11 @@ fi
%changelog
* Tue Mar 13 2012 Brian C. Lane <bcl@redhat.com> 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 <bcl@redhat.com> - 3.0-7
- Update patch for copying flags so that it is generic
- Copy pmbr_boot flag in gpt_duplicate

View File

@ -1,2 +1,2 @@
c415e5c97f86b5ff65a2d925e5a3feb7 parted-3.0.tar.xz
41839de7a7fbd408cd2ada64d174c006 parted-3.0.tar.xz.sig
5d89d64d94bcfefa9ce8f59f4b81bdcb parted-3.1.tar.xz
5d89d64d94bcfefa9ce8f59f4b81bdcb parted-3.1.tar.xz