OBS User unknown 2009-08-06 20:06:27 +00:00 committed by Git OBS Bridge
parent 4094649ec5
commit 414ff5f46c
34 changed files with 416 additions and 1186 deletions

View File

@ -1,248 +0,0 @@
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1,6 +1,6 @@
/*
libparted - a library for manipulating disk partitions
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2007
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -1735,6 +1735,45 @@ _check_partition (PedDisk* disk, PedPartition* part)
return 0;
}
+ if (!(part->type & PED_PARTITION_METADATA)
+ && strcmp (disk->type->name, "msdos") == 0) {
+ /* Enforce some restrictions inherent in the DOS
+ partition table format. Without these, one would be able
+ to create a 2TB partition (or larger), and it would work,
+ but only until the next reboot. This was insidious: the
+ too-large partition would work initially, because with
+ Linux-2.4.x and newer we set the partition start sector
+ and length (in sectors) accurately and directly via the
+ BLKPG ioctl. However, only the last 32 bits of each
+ number would be written to the partition table, and the
+ next time the system would read/use those corrupted numbers
+ it would usually complain about an invalid partition.
+ The same applies to the starting sector number. */
+
+ /* The partition length, in sectors, must fit in 32 bytes. */
+ if (part->geom.length > UINT32_MAX) {
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_CANCEL,
+ _("partition length of %jd sectors exceeds"
+ " the DOS-partition-table-imposed maximum"
+ " of 2^32-1"),
+ part->geom.length);
+ return 0;
+ }
+
+ /* The starting sector number must fit in 32 bytes. */
+ if (part->geom.start > UINT32_MAX) {
+ ped_exception_throw (
+ PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_CANCEL,
+ _("starting sector number, %jd exceeds"
+ " the DOS-partition-table-imposed maximum"
+ " of 2^32-1"), part->geom.start);
+ return 0;
+ }
+ }
+
return 1;
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3a3020e..b9cd205 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,7 +7,8 @@ TESTS = \
t2000-mkfs.sh \
t2100-mkswap.sh \
t3000-constraints.sh \
- t3100-resize-ext2-partion.sh
+ t3100-resize-ext2-partion.sh \
+ t4100-msdos-partition-limits.sh
EXTRA_DIST = \
$(TESTS) test-lib.sh mkdtemp
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
new file mode 100755
index 0000000..13e32af
--- /dev/null
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -0,0 +1,169 @@
+#!/bin/sh
+
+# Copyright (C) 2008 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/>.
+
+test_description='msdos: enforce limits on partition start sector and length'
+
+# Need root privileges to use mount.
+privileges_required_=1
+
+. ./init.sh
+
+####################################################
+# Create and mount a file system capable of dealing with >=2TB files.
+# We must be able to create a file with an apparent length of 2TB or larger.
+# It needn't be a large file system.
+fs=fs_file
+mp=`pwd`/mount-point
+n=128
+
+test_expect_success \
+ 'create an XFS file system' \
+ '
+ dd if=/dev/zero of=$fs bs=1MB count=2 seek=20 &&
+ mkfs.xfs -q $fs &&
+ mkdir "$mp"
+
+ '
+
+# Unmount upon interrupt, failure, etc., as well as upon normal completion.
+cleanup_() { cd "$test_dir_" && umount "$mp" > /dev/null 2>&1; }
+
+test_expect_success \
+ 'mount it' \
+ '
+ mount -o loop $fs "$mp" &&
+ cd "$mp"
+
+ '
+dev=loop-file
+
+do_mkpart()
+{
+ start_sector=$1
+ end_sector=$2
+ # echo '********' $(echo $end_sector - $start_sector + 1 |bc)
+ dd if=/dev/zero of=$dev bs=1b count=2k seek=$end_sector 2> /dev/null &&
+ parted -s $dev mklabel msdos &&
+ parted -s $dev mkpart p xfs ${start_sector}s ${end_sector}s
+}
+
+# Specify the starting sector number and length in sectors,
+# rather than start and end.
+do_mkpart_start_and_len()
+{
+ start_sector=$1
+ len=$2
+ end_sector=$(echo $start_sector + $len - 1|bc)
+ do_mkpart $start_sector $end_sector
+}
+
+test_expect_success \
+ 'a partition length of 2^32-1 works.' \
+ '
+ end=$(echo $n+2^32-2|bc) &&
+ do_mkpart $n $end
+ '
+
+cat > exp <<EOF
+Model: (file)
+Disk: 4294969470s
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+
+Number Start End Size Type File system Flags
+ 1 ${n}s ${end}s 4294967295s primary
+
+EOF
+
+test_expect_success \
+ 'print the result' \
+ 'parted -s $dev unit s p > out 2>&1 &&
+ sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out &&
+ diff -u out exp
+ '
+
+test_expect_failure \
+ 'a partition length of exactly 2^32 sectors provokes failure.' \
+ 'do_mkpart $n $(echo $n+2^32-1|bc) > err 2>&1'
+
+msg='Error: partition length of 4294967296 sectors exceeds the '\
+'DOS-partition-table-imposed maximum of 2^32-1'
+test_expect_success \
+ 'check for new diagnostic' \
+ 'echo "$msg" > exp && diff -u err exp'
+
+# FIXME: investigate this.
+# Unexpectedly to me, both of these failed with this same diagnostic:
+#
+# Error: partition length of 4294967296 sectors exceeds the \
+# DOS-partition-table-imposed maximum of 2^32-1" > exp &&
+#
+# I expected the one below to fail with a length of _4294967297_.
+# Debugging, I see that _check_partition *does* detect this,
+# but the diagnostic doesn't get displayed because of the wonders
+# of parted's exception mechanism.
+
+test_expect_failure \
+ 'a partition length of 2^32+1 sectors provokes failure.' \
+ 'do_mkpart $n $(echo $n+2^32|bc) > err 2>&1'
+
+test_expect_success \
+ 'check for new diagnostic' \
+ 'echo "$msg" > exp && diff -u err exp'
+
+# =========================================================
+# Now consider partition starting sector numbers.
+msg='Error: starting sector number, 4294967296 exceeds the '\
+'DOS-partition-table-imposed maximum of 2^32-1'
+
+test_expect_success \
+ 'a partition start sector number of 2^32-1 works.' \
+ 'do_mkpart_start_and_len $(echo 2^32-1|bc) 1000'
+
+cat > exp <<EOF
+Model: (file)
+Disk: 4294970342s
+Sector size (logical/physical): 512B/512B
+Partition Table: msdos
+
+Number Start End Size Type File system Flags
+ 1 4294967295s 4294968294s 1000s primary
+
+EOF
+
+test_expect_success \
+ 'print the result' \
+ 'parted -s $dev unit s p > out 2>&1 &&
+ sed "s/Disk .*:/Disk:/;s/ *$//" out > k && mv k out &&
+ diff -u out exp
+ '
+
+test_expect_failure \
+ 'a partition start sector number of 2^32 must fail.' \
+ 'do_mkpart_start_and_len $(echo 2^32|bc) 1000 > err 2>&1'
+test_expect_success \
+ 'check for new diagnostic' \
+ 'echo "$msg" > exp && diff -u err exp'
+
+test_expect_failure \
+ 'a partition start sector number of 2^32+1 must fail, too.' \
+ 'do_mkpart_start_and_len $(echo 2^32+1|bc) 1000 > err 2>&1'
+test_expect_success \
+ 'check for new diagnostic' \
+ 'echo "$msg" > exp && diff -u err exp'
+
+test_done
--
1.5.4.rc2.85.g71fd

View File

@ -1,6 +1,8 @@
--- parted/parted.c
+++ parted/parted.c 2006/03/22 10:06:03
@@ -1573,7 +1573,7 @@
Index: parted/parted.c
===================================================================
--- parted/parted.c.orig 2009-07-30 16:28:06.000000000 +0200
+++ parted/parted.c 2009-07-30 16:28:07.000000000 +0200
@@ -1779,7 +1779,7 @@ do_resize (PedDevice** dev)
{
PedDisk *disk;
PedPartition *part = NULL;
@ -9,7 +11,7 @@
PedConstraint *constraint;
PedSector start, end;
PedGeometry *range_start = NULL, *range_end = NULL;
@@ -1610,21 +1610,38 @@
@@ -1816,22 +1816,39 @@ do_resize (PedDevice** dev)
goto error_destroy_constraint;
ped_partition_set_system (part, NULL);
} else {
@ -25,15 +27,11 @@
- if (!fs)
+ if (!fs && (!always_resize || strncmp(fsname,"fat",3)==0) )
goto error_destroy_disk;
- constraint = constraint_intersect_and_destroy (
- ped_file_system_get_resize_constraint (fs),
- constraint_from_start_end (
- *dev, range_start, range_end));
+ if (fs)
+ constraint = constraint_intersect_and_destroy (
+ ped_file_system_get_resize_constraint (fs),
+ constraint_from_start_end (
+ *dev, range_start, range_end));
constraint = constraint_intersect_and_destroy (
ped_file_system_get_resize_constraint (fs),
constraint_from_start_end (
*dev, range_start, range_end));
+ else
+ {
+ new_geom.start = part->geom.start;
@ -43,28 +41,23 @@
new_geom.start, new_geom.end))
goto error_close_fs;
- if (!ped_file_system_resize (fs, &part->geom, g_timer))
- goto error_close_fs;
- /* may have changed... eg fat16 -> fat32 */
- ped_partition_set_system (part, fs->type);
- ped_file_system_close (fs);
+ if(fs)
+ {
+ if (!ped_file_system_resize (fs, &part->geom, g_timer) && !always_resize )
+ goto error_close_fs;
+ /* may have changed... eg fat16 -> fat32 */
+ ped_partition_set_system (part, fs->type);
+ ped_file_system_close (fs);
+ }
goto error_close_fs;
/* may have changed... eg fat16 -> fat32 */
ped_partition_set_system (part, fs->type);
ped_file_system_close (fs);
}
+ }
ped_disk_commit (disk);
@@ -1637,7 +1654,8 @@
ped_constraint_destroy (constraint);
@@ -1847,6 +1864,7 @@ do_resize (PedDevice** dev)
return 1;
error_close_fs:
- ped_file_system_close (fs);
+ if (fs)
+ ped_file_system_close (fs);
ped_file_system_close (fs);
error_destroy_constraint:
ped_constraint_destroy (constraint);
error_destroy_disk:

View File

@ -1,6 +1,8 @@
--- parted/parted.c
+++ parted/parted.c 2006/03/22 11:09:18
@@ -1231,7 +1231,21 @@
Index: parted/parted.c
===================================================================
--- parted/parted.c.orig 2009-07-29 14:41:35.000000000 +0200
+++ parted/parted.c 2009-07-29 14:41:59.000000000 +0200
@@ -1312,7 +1312,21 @@ do_print (PedDevice** dev)
disk = ped_disk_new (*dev);
if (!disk)
@ -15,7 +17,7 @@
+ printf (_("BIOS cylinder,head,sector geometry: %d,%d,%d. "
+ "Each cylinder is %s.\n"),
+ chs->cylinders, chs->heads, chs->sectors, cyl_size);
+ ped_free (cyl_size);
+ free (cyl_size);
+ }
goto error;
+ }

View File

@ -1,20 +0,0 @@
--- libparted/labels/dos.c
+++ libparted/labels/dos.c 2005/01/11 14:39:51
@@ -170,6 +170,9 @@
if (PED_BE32_TO_CPU (*(unsigned int*)(part_table->boot_code)) == AIXIPLRECID)
return 0;
+/* disable this check since it makes parted fail on some IDE disks with
+TurboLinux installed */
+#if 0
/* if this is a FAT fs, fail here. Note that the Smart Boot Manager
* Loader (SBML) signature indicates a partition table, not a file
* system.
@@ -178,6 +181,7 @@
&& strncmp (part_table->boot_code + 0x40, "SBML", 4) != 0)
|| !strncmp (part_table->boot_code + 0x52, "FAT", 3))
goto probe_fail;
+#endif
/* If this is a GPT disk, fail here */
for (i = 0; i < 4; i++) {

View File

@ -1,67 +0,0 @@
From d7d9f2c40c6bb3e83a7e6ea3164b4f4eb7440a47 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Fri, 13 Feb 2009 13:27:55 +0100
Subject: [PATCH] gpt: do not automatically "correct" a suspicious GPT partition table
Previously, when parted was invoked on a disk with a GPT partition table
and the backup GPT was not in the last sector of the disk, and even if
the requested operation was just to print the partition table, parted
would "repair" this automatically. This behavior is undesirable in the
following situation:
dm-raid on top of block device. The dm-raid is partitioned with GPT. If
the dm-raid starts on the first block of underlying device (AFAIK this is
the case with FastTrack controllers) and the user runs parted on the
dm-raid, it will identify the physical device as being partitioned with
GPT and see the backup GPT table not to be in the last sector of the
physical device and thus move it to this location (which may lead to
destruction of dm-raid metadata in case they are located at the end of
physical device).
This patch modifies parted's behavior to ignore fixing of backup GPT
position by default.
---
libparted/labels/gpt.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
Index: parted-1.8.8/libparted/labels/gpt.c
===================================================================
--- parted-1.8.8.orig/libparted/labels/gpt.c
+++ parted-1.8.8/libparted/labels/gpt.c
@@ -836,21 +836,26 @@ gpt_read (PedDisk * disk)
char* zeros = ped_malloc (pth_get_size (disk->dev));
#ifndef DISCOVER_ONLY
- if (ped_exception_throw (
+ switch (ped_exception_throw (
PED_EXCEPTION_ERROR,
- PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL,
+ PED_EXCEPTION_FIX | PED_EXCEPTION_CANCEL | PED_EXCEPTION_IGNORE,
_("The backup GPT table is not at the end of the disk, as it "
"should be. This might mean that another operating system "
"believes the disk is smaller. Fix, by moving the backup "
- "to the end (and removing the old backup)?"))
- == PED_EXCEPTION_CANCEL)
- goto error_free_gpt;
+ "to the end (and removing the old backup)?"))) {
+ case PED_EXCEPTION_CANCEL:
+ goto error_free_gpt;
+ case PED_EXCEPTION_FIX:
+ write_back = 1;
+ memset (zeros, 0, disk->dev->sector_size);
+ ped_device_write (disk->dev, zeros,
+ PED_LE64_TO_CPU (gpt->AlternateLBA),
+ 1);
+ break;
+ default:
+ break;
+ }
- write_back = 1;
- memset (zeros, 0, disk->dev->sector_size);
- ped_device_write (disk->dev, zeros,
- PED_LE64_TO_CPU (gpt->AlternateLBA),
- 1);
#endif /* !DISCOVER_ONLY */
}
} else { /* primary GPT *not* ok */

View File

@ -1,8 +1,8 @@
Index: parted-1.8.8/libparted/labels/dos.c
Index: parted-1.9.0/libparted/labels/dos.c
===================================================================
--- parted-1.8.8.orig/libparted/labels/dos.c
+++ parted-1.8.8/libparted/labels/dos.c
@@ -1065,7 +1065,8 @@ write_ext_table (const PedDisk* disk,
--- parted-1.9.0.orig/libparted/labels/dos.c 2009-07-30 16:28:28.000000000 +0200
+++ parted-1.9.0/libparted/labels/dos.c 2009-07-30 16:28:53.000000000 +0200
@@ -1066,7 +1066,8 @@ write_ext_table (const PedDisk* disk,
lba_offset = ped_disk_extended_partition (disk)->geom.start;
@ -12,7 +12,7 @@ Index: parted-1.8.8/libparted/labels/dos.c
table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
if (!fill_raw_part (&table.partitions[0], logical, sector))
@@ -1099,7 +1100,8 @@ write_empty_table (const PedDisk* disk,
@@ -1100,7 +1101,8 @@ write_empty_table (const PedDisk* disk,
PED_ASSERT (disk != NULL, return 0);

View File

@ -1,58 +0,0 @@
From f564981d2e5f4d5daad5a6f704dfa22ffaa9cf94 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Sat, 2 Feb 2008 20:57:01 +0100
Subject: [PATCH] mkpart: Don't require a DVH partition name if it's guaranteed to fail.
The mkpart command has an undocumented feature whereby it prompts for
(interactive) or requires (-s) a partition name, *regardless* of whether
it already knows the partition type (any thing but 'logical') is
incompatible with a name.
At first I was pissed and simply #if-0'd the offending code.
But in case someone is actually relying on it, I've relented, and
merely remove the prompt/requirement when the partition table type
is "dvh" and the type of the partition in question is not "logical".
* parted/parted.c (do_mkpart):
---
parted/parted.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
Index: parted-1.8.8/parted/parted.c
===================================================================
--- parted-1.8.8.orig/parted/parted.c
+++ parted-1.8.8/parted/parted.c
@@ -1,7 +1,6 @@
/*
parted - a frontend to libparted
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2003, 2005-2008 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
@@ -708,11 +707,21 @@ do_mkpart (PedDevice** dev)
goto error_destroy_disk;
}
+ /* This undocumented _feature_, is next to useless, at least with
+ a dvh partition table, since it makes the "mkpart" command
+ fail unconditionally for a primary partition. E.g.,
+ mkpart primary any-name xfs 4096s 5000s
+ requires the name, yet always fails, saying that only
+ logical partitions may have names.
+ If you want a name, use parted's separate "name" command. */
+
if (ped_disk_type_check_feature (disk->type,
- PED_DISK_TYPE_PARTITION_NAME))
+ PED_DISK_TYPE_PARTITION_NAME)
+ && ! (strcmp (disk->type->name, "dvh") == 0
+ && part_type != PED_PARTITION_LOGICAL))
part_name = command_line_get_word (_("Partition name?"),
- "", NULL, 1);
-
+ "", NULL, 1);
+
peek_word = command_line_peek_word ();
if (part_type == PED_PARTITION_EXTENDED
|| (peek_word && isdigit (peek_word[0]))) {

View File

@ -1,18 +1,22 @@
--- include/parted/device.h
+++ include/parted/device.h 2007/08/13 11:39:37
@@ -48,7 +48,8 @@
#ifdef ENABLE_DEVICE_MAPPER
Index: include/parted/device.h
===================================================================
--- include/parted/device.h.orig 2009-07-23 19:52:08.000000000 +0200
+++ include/parted/device.h 2009-07-30 16:24:58.000000000 +0200
@@ -46,7 +46,8 @@ typedef enum {
PED_DEVICE_DM = 12,
#endif
- PED_DEVICE_XVD = 13
+ PED_DEVICE_XVD = 13,
+ PED_DEVICE_AOE = 14
PED_DEVICE_XVD = 13,
PED_DEVICE_SDMMC = 14,
- PED_DEVICE_VIRTBLK = 15
+ PED_DEVICE_VIRTBLK = 15,
+ PED_DEVICE_AOE = 16
} PedDeviceType;
typedef struct _PedDevice PedDevice;
--- libparted/arch/linux.c
+++ libparted/arch/linux.c 2006/12/04 11:57:25
@@ -260,6 +260,7 @@
Index: libparted/arch/linux.c
===================================================================
--- libparted/arch/linux.c.orig 2009-07-23 19:52:08.000000000 +0200
+++ libparted/arch/linux.c 2009-07-30 16:24:58.000000000 +0200
@@ -251,6 +251,7 @@ struct blkdev_ioctl_param {
#define I2O_MAJOR7 86
#define I2O_MAJOR8 87
#define UBD_MAJOR 98
@ -20,7 +24,7 @@
#define DASD_MAJOR 94
#define VIODASD_MAJOR 112
#define SX8_MAJOR1 160
@@ -452,6 +453,8 @@
@@ -530,6 +531,8 @@ _device_probe_type (PedDevice* dev)
dev->type = PED_DEVICE_DAC960;
} else if (dev_major == ATARAID_MAJOR && (dev_minor % 0x10 == 0)) {
dev->type = PED_DEVICE_ATARAID;
@ -29,7 +33,7 @@
} else if (dev_major == DASD_MAJOR && (dev_minor % 0x4 == 0)) {
dev->type = PED_DEVICE_DASD;
} else if (dev_major == VIODASD_MAJOR && (dev_minor % 0x8 == 0)) {
@@ -1120,6 +1123,11 @@
@@ -1250,6 +1253,11 @@ linux_new (const char* path)
goto error_free_arch_specific;
break;

View File

@ -1,67 +0,0 @@
--- parted-1.6.22/libparted/labels/mac.c
+++ parted-1.6.22/libparted/labels/mac.c
@@ -444,7 +444,7 @@
return _rawpart_cmp_type (raw_part, "Apple_Void");
}
-/* returns 1 if the raw_part represents a partition that is "unused space", or
+/* returns 0 if the raw_part represents a partition that is "unused space", or
* doesn't represent a partition at all. NOTE: some people make Apple_Free
* partitions with MacOS, because they can't select another type. So, if the
* name is anything other than "Extra" or "", it is treated as a "real"
@@ -489,6 +489,13 @@
if (!part)
goto error;
+ /* Check for Apple_Free and set type to PED_PARTITION_FREESPACE */
+ if (_rawpart_cmp_type (raw_part, "Apple_Free")
+ && (strcmp (raw_part->name, "Extra") == 0))
+ part->type = PED_PARTITION_FREESPACE;
+ else
+ part->type = PED_PARTITION_NORMAL;
+
mac_part_data = part->disk_specific;
strncpy (mac_part_data->volume_name, raw_part->name, 32);
--- parted-1.6.22/libparted/fs/fat/calc.c
+++ parted-1.6.22/libparted/fs/fat/calc.c
@@ -26,7 +26,7 @@
fat_min_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
- case FAT_TYPE_FAT16: return 1024/512;
+ case FAT_TYPE_FAT16: return 1; // in KByte
case FAT_TYPE_FAT32: return 4096/512;
}
return 0;
@@ -62,7 +62,7 @@
fat_max_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */
- case FAT_TYPE_FAT16: return 32768/512;
+ case FAT_TYPE_FAT16: return 32768/1024; // = 32
case FAT_TYPE_FAT32: return 65536/512;
}
return 0;
@@ -74,7 +74,7 @@
switch (fat_type) {
case FAT_TYPE_FAT12:
case FAT_TYPE_FAT16:
- return fat_max_cluster_count (fat_type) / 2;
+ return 1024; // http://members.tripod.com/~averstak/fatdox/bootsec.htm
case FAT_TYPE_FAT32: return 0xfff0;
}
--- parted-1.6.22/libparted/fs/fat/fat.c
+++ parted-1.6.22/libparted/fs/fat/fat.c
@@ -763,8 +763,8 @@
if (!min_size)
return NULL;
#else
- min_size = 65794;
- max_size = 2097153;
+ min_size = 4096; // http://members.tripod.com/~averstak/fatdox/bootsec.htm
+ max_size = 2097153; // 32 KByte je Cluster (2^16)
#endif
return ped_constraint_new (

View File

@ -1,83 +0,0 @@
From 8bd3645d7c184ac6a4076414b469ece15fbcccde Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 14 Jan 2008 20:01:39 +0100
Subject: [PATCH] Avoid new error detected by very latest gcc.
* libparted/fs/fat/traverse.c (fat_dir_entry_get_name): Don't reference
->extension[3] via a pointer into the prior ->name[8] struct member.
gcc detected the reference beyond end of name[8].
Declare first parameter to be "const".
* libparted/fs/fat/traverse.c: Update prototype.
---
libparted/fs/fat/traverse.c | 18 ++++++++++--------
libparted/fs/fat/traverse.h | 4 ++--
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/libparted/fs/fat/traverse.c b/libparted/fs/fat/traverse.c
index 3d2e2b5..367f511 100644
--- a/libparted/fs/fat/traverse.c
+++ b/libparted/fs/fat/traverse.c
@@ -1,6 +1,6 @@
/*
libparted
- Copyright (C) 1998, 1999, 2000, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1998-2000, 2005, 2007-2008 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
@@ -340,22 +340,24 @@ fat_dir_entry_has_first_cluster (FatDirEntry* dir_entry, PedFileSystem* fs)
decrypts silly DOS names to FILENAME.EXT
*/
void
-fat_dir_entry_get_name (FatDirEntry*dir_entry, char *result) {
+fat_dir_entry_get_name (const FatDirEntry *dir_entry, char *result) {
int i;
- char *src;
+ const char *src;
+ const char *ext;
src = dir_entry->name;
- for (i=0; i<8; i++) {
+ for (i=0; i < sizeof dir_entry->name; i++) {
if (src[i] == ' ' || src[i] == 0) break;
*result++ = src[i];
}
- if (src[8] != ' ' && src[8] != 0) {
+ ext = (const char *) dir_entry->extension;
+ if (ext[0] != ' ' && ext[0] != 0) {
*result++ = '.';
- for (i=8; i<11; i++) {
- if (src[i] == ' ' || src[i] == 0) break;
- *result++ = src[i];
+ for (i=0; i < sizeof dir_entry->extension; i++) {
+ if (ext[i] == ' ' || ext[i] == 0) break;
+ *result++ = ext[i];
}
}
diff --git a/libparted/fs/fat/traverse.h b/libparted/fs/fat/traverse.h
index 21e4c27..17e4580 100644
--- a/libparted/fs/fat/traverse.h
+++ b/libparted/fs/fat/traverse.h
@@ -1,6 +1,6 @@
/*
libparted
- Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2007-2008 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
@@ -65,7 +65,7 @@ extern int fat_dir_entry_is_null_term (const FatDirEntry* dir_entry);
extern int fat_dir_entry_is_file (FatDirEntry* dir_entry);
extern int fat_dir_entry_is_system_file (FatDirEntry* dir_entry);
extern int fat_dir_entry_is_directory (FatDirEntry* dir_entry);
-extern void fat_dir_entry_get_name (FatDirEntry* dir_entry, char* result);
+extern void fat_dir_entry_get_name (const FatDirEntry* dir_entry, char* result);
extern int fat_dir_entry_is_active (FatDirEntry* dir_entry);
extern int fat_dir_entry_has_first_cluster (FatDirEntry* dir_entry,
PedFileSystem* fs);
--
1.6.3

View File

@ -1,27 +0,0 @@
# fixes (bnc#439910)
# parted used to crash on corrupted gpt label - now warning is printed instead
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 13d2e88..c20d729 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -824,8 +824,18 @@ gpt_read (PedDisk * disk)
goto error;
if (_read_header (disk->dev, &gpt, 1)) {
- PED_ASSERT ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
- <= disk->dev->length - 1, goto error_free_gpt);
+ if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
+ > disk->dev->length - 1) {
+ if (ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_IGNORE_CANCEL,
+ _("The primary GPT table states that the backup GPT table is "
+ "located at the position that is beyond the end of the disk. "
+ "This means that the GPT structure is corrupted."))
+ == PED_EXCEPTION_CANCEL)
+ goto error_free_gpt;
+ }
+
if ((PedSector) PED_LE64_TO_CPU (gpt->AlternateLBA)
< disk->dev->length - 1) {
char* zeros = ped_malloc (pth_get_size (disk->dev));

View File

@ -1,21 +0,0 @@
# fixes (bnc#438681)
# calling ped_exception_throw(*,*,NULL) causes endless loop allocating memory
# since it does not output any usefull data anyway, we can remove that call completely
--- ./libparted/labels/dasd.c.orig 2008-11-26 13:55:11.000000000 +0100
+++ ./libparted/labels/dasd.c 2008-11-26 13:55:49.000000000 +0100
@@ -211,7 +211,6 @@ ped_disk_dasd_done ()
static int
dasd_probe (const PedDevice *dev)
{
- char *errstr = 0;
LinuxSpecific* arch_specific;
struct fdasd_anchor anchor;
@@ -238,7 +237,6 @@ dasd_probe (const PedDevice *dev)
error_cleanup:
fdasd_cleanup(&anchor);
- ped_exception_throw(PED_EXCEPTION_ERROR,PED_EXCEPTION_IGNORE_CANCEL,errstr);
return 0;
}

View File

@ -1,10 +1,10 @@
Index: parted-1.8.8/libparted/arch/linux.c
Index: parted-1.9.0/libparted/arch/linux.c
===================================================================
--- parted-1.8.8.orig/libparted/arch/linux.c 2009-03-09 16:16:58.000000000 +0100
+++ parted-1.8.8/libparted/arch/linux.c 2009-03-09 16:24:20.000000000 +0100
@@ -1983,7 +1983,7 @@
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-07-30 16:28:49.000000000 +0200
+++ parted-1.9.0/libparted/arch/linux.c 2009-07-30 16:28:57.000000000 +0200
@@ -2095,7 +2095,7 @@ _device_get_part_path (PedDevice* dev, i
|| dev->type == PED_DEVICE_ATARAID
|| dev->type == PED_DEVICE_DM
#endif
|| isdigit (dev->path[path_len - 1]))
- snprintf (result, result_len, "%sp%d", dev->path, num);
+ snprintf (result, result_len, "%s_part%d", dev->path, num);

View File

@ -1,41 +0,0 @@
# fixes (bnc#397210)
# see comment in the patch for explanation
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 0107dd2..041208a 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2248,7 +2248,15 @@ static int
_disk_sync_part_table (PedDisk* disk)
{
int i;
- int last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
+ int last;
+
+ /* parted treats DVH directory entries as logical partitions with number > 16;
+ * we don't want to inform kernel about directory entries
+ */
+ if (strcmp (disk->type->name, "dvh") == 0)
+ last = 16;
+ else
+ last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
int* rets = ped_malloc(sizeof(int) * last);
int* errnums = ped_malloc(sizeof(int) * last);
int ret = 1;
@@ -2470,8 +2478,16 @@ static int
_dm_reread_part_table (PedDisk* disk)
{
int rc = 1;
- int last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
int i;
+ int last;
+
+ /* parted treats DVH directory entries as partitions logical with number > 16;
+ * we don't want to inform kernel about directory entries
+ */
+ if (strcmp (disk->type->name, "dvh") == 0)
+ last = 16;
+ else
+ last = PED_MAX (ped_disk_get_last_partition_num (disk), 16);
sync();
if (!_dm_remove_parts(disk->dev))

View File

@ -1,8 +1,8 @@
Index: parted-1.8.8/libparted/arch/linux.c
Index: parted-1.9.0/libparted/arch/linux.c
===================================================================
--- parted-1.8.8.orig/libparted/arch/linux.c
+++ parted-1.8.8/libparted/arch/linux.c
@@ -2120,7 +2120,7 @@ _blkpg_add_partition (PedDisk* disk, Ped
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-07-30 16:28:43.000000000 +0200
+++ parted-1.9.0/libparted/arch/linux.c 2009-07-30 16:28:49.000000000 +0200
@@ -2232,7 +2232,7 @@ _blkpg_add_partition (PedDisk* disk, con
linux_part.start = part->geom.start * disk->dev->sector_size;
/* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */
if (part->type & PED_PARTITION_EXTENDED)

View File

@ -1,17 +0,0 @@
diff -up ./libparted/labels/gpt.c.orig ./libparted/labels/gpt.c
--- ./libparted/labels/gpt.c.orig 2008-10-20 10:05:25.000000000 +0200
+++ ./libparted/labels/gpt.c 2008-10-20 10:35:34.000000000 +0200
@@ -674,11 +674,10 @@ _parse_header (PedDisk* disk, GuidPartit
parted invocation.
*/
- last_usable_if_grown
- = PED_CPU_TO_LE64 (disk->dev->length - 2 -
+ last_usable_if_grown = disk->dev->length - 2 -
((PedSector)(PED_LE32_TO_CPU(gpt->NumberOfPartitionEntries)) *
(PedSector)(PED_LE32_TO_CPU(gpt->SizeOfPartitionEntry)) /
- disk->dev->sector_size));
+ disk->dev->sector_size);
last_usable_min_default = disk->dev->length - 2 -
GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / disk->dev->sector_size;

View File

@ -1,41 +0,0 @@
From 9654bcfbdbeb2dede3a19084d31b41224d3a03f1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Tue, 23 Dec 2008 10:20:20 +0100
Subject: [PATCH] avoid "make install" failure with latest GNU make
* doc/C/Makefile.am (dist_man8_MANS): Use per-section variable
names, as recommended by automake.
(man_MANS): Remove redundant definition.
---
doc/C/Makefile.am | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/doc/C/Makefile.am b/doc/C/Makefile.am
index 447eb74..7d62b7b 100644
--- a/doc/C/Makefile.am
+++ b/doc/C/Makefile.am
@@ -1,11 +1,9 @@
## Process this file with automake to produce Makefile.in
-dist_man_MANS = \
+dist_man8_MANS = \
parted.8 \
partprobe.8
-man_MANS = $(dist_man_MANS)
-
.PHONY: updatepo
# Update the POT in srcdir
# Make sure the update does not only consist in a new POT-Creation-Date
@@ -13,7 +11,7 @@ man_MANS = $(dist_man_MANS)
updatepo:
cd $(srcdir); \
test -w . || exit 0; \
- for name in $(dist_man_MANS); do \
+ for name in $(dist_man8_MANS); do \
echo $$name; \
cp po/$$name.pot po/$$name.new.pot; \
po4a-updatepo -f man -m $$name -p po/$$name.new.pot; \
--
1.6.3

54
fix-tests.sh Normal file
View File

@ -0,0 +1,54 @@
# Change parted testsuite so that it passes with SuSE patchset
# It is not obvious why the t7000 test fails with SuSE, but seems harmless.
# It is reported upstream and probably is SuSE specific (some lib behaves differently) ???
Index: parted-1.9.0/tests/t7000-scripting.sh
===================================================================
--- parted-1.9.0.orig/tests/t7000-scripting.sh 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/tests/t7000-scripting.sh 2009-07-30 16:01:58.000000000 +0200
@@ -28,7 +28,7 @@ EOF
{ emit_superuser_warning
sed s/Error/Warning/ errS
- printf 'Is this still acceptable to you?\nYes/No?'; } >> errI || fail=1
+ printf 'Is this still acceptable to you?\nYes/No? n\n'; } >> errI || fail=1
for mkpart in mkpart mkpartfs; do
Index: parted-1.9.0/tests/t2000-mkfs.sh
===================================================================
--- parted-1.9.0.orig/tests/t2000-mkfs.sh 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/tests/t2000-mkfs.sh 2009-07-30 16:01:58.000000000 +0200
@@ -97,6 +97,7 @@ test_expect_failure \
test_expect_success \
'normalize the actual output' \
'mv out o2 && sed -e "s, * ,,;s, $,," \
+ -e "s,^.*\.libs/parted: ,parted: ," \
-e "s,^.*/lt-parted: ,parted: ," o2 > out'
test_expect_success \
Index: parted-1.9.0/tests/t2200-dos-label-recog.sh
===================================================================
--- parted-1.9.0.orig/tests/t2200-dos-label-recog.sh 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/tests/t2200-dos-label-recog.sh 2009-07-30 16:02:59.000000000 +0200
@@ -54,7 +54,7 @@ test_expect_success \
'
parted -m -s $dev unit s p > out &&
tail -2 out > k && mv k out &&
- printf "1:1s:40s:40s:::;\n2:41s:80s:40s:::;\n" > exp
+ printf "1:1s:40s:40s:::type=83;\n2:41s:80s:40s:::type=83;\n" > exp
'
test_expect_success 'expect two partitions' 'compare out exp'
Index: parted-1.9.0/tests/t4100-msdos-starting-sector.sh
===================================================================
--- parted-1.9.0.orig/tests/t4100-msdos-starting-sector.sh 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/tests/t4100-msdos-starting-sector.sh 2009-07-30 16:01:58.000000000 +0200
@@ -62,7 +62,7 @@ cat <<EOF > exp || fail=1
BYT;
path:200s:file:512:512:msdos:;
1:32s:96s:65s:free;
-1:97s:195s:99s:::;
+1:97s:195s:99s:::type=83;
EOF
test_expect_success 'create expected output file' 'test $fail = 0'

View File

@ -1,98 +0,0 @@
--- m4/extensions.m4
+++ m4/extensions.m4
@@ -1,14 +1,14 @@
-# serial 4 -*- Autoconf -*-
+# serial 5 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
# Autoconf. Perhaps we can remove this once we can assume Autoconf
-# 2.61 or later everywhere, but since CVS Autoconf mutates rapidly
+# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
# enough in this area it's likely we'll need to redefine
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
@@ -16,39 +16,63 @@
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
+# Remember that #undef in AH_VERBATIM gets replaced with #define by
+# AC_DEFINE. The goal here is to define all known feature-enabling
+# macros, then, if reports of conflicts are made, disable macros that
+# cause problems on some platforms (such as __EXTENSIONS__).
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
-
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+
+ AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
+ if test "$MINIX" = yes; then
+ AC_DEFINE([_POSIX_SOURCE], [1],
+ [Define to 1 if you need to in order for `stat' and other
+ things to work.])
+ AC_DEFINE([_POSIX_1_SOURCE], [2],
+ [Define to 2 if the system does not provide POSIX.1 features
+ except with this defined.])
+ AC_DEFINE([_MINIX], [1],
+ [Define to 1 if on MINIX.])
+ fi
AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
+[/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
+/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
-#endif])
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+])
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
+ [AC_LANG_PROGRAM([[
# define __EXTENSIONS__ 1
- AC_INCLUDES_DEFAULT])],
+ ]AC_INCLUDES_DEFAULT])],
[ac_cv_safe_to_define___extensions__=yes],
[ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_ALL_SOURCE])
+ AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
-])
+])# AC_USE_SYSTEM_EXTENSIONS
# gl_USE_SYSTEM_EXTENSIONS
# ------------------------

27
hfs_fix.dif Normal file
View File

@ -0,0 +1,27 @@
Index: parted-1.9.0/libparted/labels/mac.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/mac.c 2009-07-29 11:56:11.000000000 +0200
+++ parted-1.9.0/libparted/labels/mac.c 2009-07-29 12:14:34.000000000 +0200
@@ -495,7 +495,7 @@ _rawpart_is_void (MacRawPartition* raw_p
return _rawpart_cmp_type (raw_part, "Apple_Void");
}
-/* returns 1 if the raw_part represents a partition that is "unused space", or
+/* returns 0 if the raw_part represents a partition that is "unused space", or
* doesn't represent a partition at all. NOTE: some people make Apple_Free
* partitions with MacOS, because they can't select another type. So, if the
* name is anything other than "Extra" or "", it is treated as a "real"
@@ -560,6 +560,13 @@ _rawpart_analyse (MacRawPartition* raw_p
if (!part)
goto error;
+ /* Check for Apple_Free and set type to PED_PARTITION_FREESPACE */
+ if (_rawpart_cmp_type (raw_part, "Apple_Free")
+ && (strcmp (raw_part->name, "Extra") == 0))
+ part->type = PED_PARTITION_FREESPACE;
+ else
+ part->type = PED_PARTITION_NORMAL;
+
mac_part_data = part->disk_specific;
strncpy (mac_part_data->volume_name, raw_part->name, 32);

View File

@ -1,12 +1,14 @@
--- configure.ac
+++ configure.ac 2007/03/19 14:24:09
@@ -442,11 +442,6 @@
AC_EGREP_CPP([__s390x__], , compile_for_s390=yes)
AM_CONDITIONAL([COMPILE_FOR_S390], [test "$compile_for_s390" = yes])
Index: configure.ac
===================================================================
--- configure.ac.orig 2009-07-23 19:52:08.000000000 +0200
+++ configure.ac 2009-07-30 16:27:26.000000000 +0200
@@ -476,11 +476,6 @@ AC_CHECK_HEADER([execinfo.h], [
AM_CONDITIONAL([COMPILE_FOR_S390], [test "$host_cpu" = s390 || test "$host_cpu" = s390x])
AM_CONDITIONAL([BUILD_LINUX], [test "$OS" = linux])
-dnl check for "check", unit testing library/header
-PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
-if test "$have_scintilla" != "yes"; then
-if test "$have_check" != "yes"; then
- AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
-fi
AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dfcd811a9cc7753d6f310a34301716a7e18a45b905fa8c7eb77d5f121bc3c5ea
size 1553881

3
parted-1.9.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:808cbc2394cca1a3df84b0baee781f413d265bf346ef1c052910442ec65ad648
size 1764338

View File

@ -1,100 +0,0 @@
# Fix #473207 - parted cannot recognize any arguments to various commands
# Patch from IBM bugzilla, also showed up on parted-devel ML (not checked in yet)
diff -Nuarp parted-1.8.8.org/parted/parted.c parted-1.8.8/parted/parted.c
--- parted-1.8.8.org/parted/parted.c 2009-01-19 03:20:37.000000000 -0600
+++ parted-1.8.8/parted/parted.c 2009-01-19 03:20:37.000000000 -0600
@@ -511,12 +511,11 @@ do_cp (PedDevice** dev)
_("Can't copy an extended partition."));
goto error_destroy_disk;
}
- if (!_partition_warn_busy (src))
- goto error_destroy_disk;
-
if (!command_line_get_partition (_("Destination partition number?"),
dst_disk, &dst))
goto error_destroy_disk;
+ if (!_partition_warn_busy (src))
+ goto error_destroy_disk;
if (!_partition_warn_busy (dst))
goto error_destroy_disk;
@@ -603,6 +602,9 @@ do_mklabel (PedDevice** dev)
if (!disk) ped_exception_catch ();
ped_exception_leave_all ();
+ if (!command_line_get_disk_type (_("New disk label type?"), &type))
+ goto error;
+
if (disk) {
if (!_disk_warn_busy (disk))
goto error_destroy_disk;
@@ -612,9 +614,6 @@ do_mklabel (PedDevice** dev)
ped_disk_destroy (disk);
}
- if (!command_line_get_disk_type (_("New disk label type?"), &type))
- goto error;
-
disk = ped_disk_new_fresh (*dev, type);
if (!disk)
goto error;
@@ -646,15 +645,15 @@ do_mkfs (PedDevice** dev)
if (!disk)
goto error;
+ if (!command_line_get_partition (_("Partition number?"), disk, &part))
+ goto error_destroy_disk;
+ if (!command_line_get_fs_type (_("File system type?"), &type))
+ goto error_destroy_disk;
if (!opt_script_mode && !_partition_warn_loss())
goto error_destroy_disk;
- if (!command_line_get_partition (_("Partition number?"), disk, &part))
- goto error_destroy_disk;
if (!_partition_warn_busy (part))
goto error_destroy_disk;
- if (!command_line_get_fs_type (_("File system type?"), &type))
- goto error_destroy_disk;
fs = ped_file_system_create (&part->geom, type, g_timer);
if (!fs)
@@ -1046,8 +1045,6 @@ do_move (PedDevice** dev)
if (!command_line_get_partition (_("Partition number?"), disk, &part))
goto error_destroy_disk;
- if (!_partition_warn_busy (part))
- goto error_destroy_disk;
if (part->type == PED_PARTITION_EXTENDED) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("Can't move an extended partition."));
@@ -1064,6 +1061,8 @@ do_move (PedDevice** dev)
end = start + old_geom.length - 1;
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end))
goto error_close_fs;
+ if (!_partition_warn_busy (part))
+ goto error_close_fs;
/* set / test on "disk" */
if (!ped_geometry_init (&new_geom, *dev, start, end - start + 1))
@@ -1817,10 +1816,6 @@ do_resize (PedDevice** dev)
if (!command_line_get_partition (_("Partition number?"), disk, &part))
goto error_destroy_disk;
- if (part->type != PED_PARTITION_EXTENDED) {
- if (!_partition_warn_busy (part))
- goto error_destroy_disk;
- }
start = part->geom.start;
end = part->geom.end;
@@ -1828,6 +1823,10 @@ do_resize (PedDevice** dev)
goto error_destroy_disk;
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end))
goto error_destroy_disk;
+ if (part->type != PED_PARTITION_EXTENDED) {
+ if (!_partition_warn_busy (part))
+ goto error_destroy_disk;
+ }
if (!ped_geometry_init (&new_geom, *dev, start, end - start + 1))
goto error_destroy_disk;

View File

@ -1,13 +0,0 @@
Index: parted-1.8.8/libparted/labels/fdasd.c
===================================================================
--- parted-1.8.8.orig/libparted/labels/fdasd.c
+++ parted-1.8.8/libparted/labels/fdasd.c
@@ -149,7 +149,7 @@ fdasd_error (fdasd_anchor_t *anc, enum f
case device_verification_failed:
sprintf(error, "fdasd: %s -- %s\n",
_("Device verification failed"),
- _("The specified device is not a valid DASD device"));,
+ _("The specified device is not a valid DASD device"));
break;
default:
sprintf(error, "fdasd: %s: %s\n", _("Fatal error"), str);

View File

@ -1,8 +1,8 @@
Index: libparted/labels/gpt.c
===================================================================
--- libparted/labels/gpt.c.orig
+++ libparted/labels/gpt.c
@@ -46,6 +46,11 @@
--- libparted/labels/gpt.c.orig 2009-07-23 19:52:08.000000000 +0200
+++ libparted/labels/gpt.c 2009-07-29 14:36:56.000000000 +0200
@@ -47,6 +47,11 @@
# define _(String) (String)
#endif /* ENABLE_NLS */
@ -14,7 +14,7 @@ Index: libparted/labels/gpt.c
#define EFI_PMBR_OSTYPE_EFI 0xEE
#define MSDOS_MBR_SIGNATURE 0xaa55
@@ -928,15 +933,68 @@ error:
@@ -968,13 +973,62 @@ error:
return 0;
}
@ -33,13 +33,13 @@ Index: libparted/labels/gpt.c
+}
+
+static inline PedPartition*
+_find_first_part (PedDisk* disk)
+_find_first_part (const PedDisk* disk)
+{
+ PedPartition *retval = NULL, *part = NULL;
+ uint64_t lowest_end = 0xffffffffffffffff;
+ while (part = ped_disk_next_partition (disk, part)) {
+ if (part->geom.start == 0 || part->type == PED_PARTITION_METADATA
+ || part->type == PED_PARTITION_FREESPACE)
+ || part->type == PED_PARTITION_FREESPACE)
+ continue;
+ if (part->geom.end < lowest_end) {
+ retval = part;
@ -58,33 +58,42 @@ Index: libparted/labels/gpt.c
+ return (uint32_t)in;
+}
+#endif
+
+
+
#ifndef DISCOVER_ONLY
/* Writes the protective MBR (to keep DOS happy) */
/* Write the protective MBR (to keep DOS happy) */
static int
-_write_pmbr (PedDevice * dev)
+_write_pmbr (PedDisk * disk)
+_write_pmbr (const PedDisk * disk)
{
+ PedDevice * dev = disk->dev;
LegacyMBR_t pmbr;
+#ifdef GPT_SYNC_MBR
+ int i, pmbr_id, first_entry = 0, last_entry = 3;
+ PedPartition *part = NULL, *esp;
+#endif
+
/* The UEFI spec is not clear about what to do with the following
elements of the Protective MBR (pmbr): BootCode (0-440B),
UniqueMBRSignature (440B-444B) and Unknown (444B-446B).
@@ -982,11 +1036,14 @@ _write_pmbr (PedDevice * dev)
if (ped_device_read (dev, &pmbr, 0, GPT_PMBR_SECTORS) < GPT_PMBR_SECTORS)
memset (&pmbr, 0, sizeof(pmbr));
+#ifdef GPT_SYNC_MBR
+ /* Keep the old MBR as much as possible */
+ ped_device_read(dev, &pmbr, 0, GPT_HEADER_SECTORS);
+ memset(&pmbr.PartitionRecord, 0, sizeof(pmbr.PartitionRecord));
+#else
memset(&pmbr, 0, sizeof(pmbr));
+#ifndef GPT_SYNC_MBR
/* Zero out all the legacy partitions.
There are 4 PartitionRecords. */
memset (pmbr.PartitionRecord, 0, sizeof pmbr.PartitionRecord);
+#endif
pmbr.Signature = PED_CPU_TO_LE16(MSDOS_MBR_SIGNATURE);
+#ifndef GPT_SYNC_MBR
pmbr.PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
pmbr.PartitionRecord[0].StartSector = 1;
pmbr.PartitionRecord[0].EndHead = 0xFE;
@@ -947,6 +1005,54 @@ _write_pmbr (PedDevice * dev)
@@ -997,6 +1054,54 @@ _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);
@ -139,7 +148,7 @@ Index: libparted/labels/gpt.c
return ped_device_write (dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS);
}
@@ -1050,7 +1156,7 @@ gpt_write(const PedDisk * disk)
@@ -1100,7 +1205,7 @@ gpt_write(const PedDisk * disk)
ptes_crc = efi_crc32 (ptes, ptes_size);
/* Write protective MBR */

View File

@ -1,8 +1,10 @@
--- parted-1.6.2/libparted/disk.c.mac Tue Aug 6 13:13:27 2002
+++ parted-1.6.2/libparted/disk.c Tue Aug 6 13:55:05 2002
@@ -1014,6 +1014,41 @@
return part->disk->type->ops->partition_get_name (part);
}
Index: parted-1.9.0/libparted/disk.c
===================================================================
--- parted-1.9.0.orig/libparted/disk.c 2009-07-30 15:22:28.000000000 +0200
+++ parted-1.9.0/libparted/disk.c 2009-07-30 15:22:50.000000000 +0200
@@ -969,6 +969,41 @@ _disk_pop_update_mode (PedDisk* disk)
* @{
*/
+const char*
+ped_partition_get_system_name (const PedPartition* part)
@ -40,11 +42,13 @@
+
+
PedPartition*
ped_disk_extended_partition (const PedDisk* disk)
{
--- parted-1.6.2/libparted/labels/mac.c.mac Mon Apr 8 12:08:03 2002
+++ parted-1.6.2/libparted/labels/mac.c Tue Aug 6 14:00:09 2002
@@ -1209,6 +1209,36 @@
_ped_partition_alloc (const PedDisk* disk, PedPartitionType type,
const PedFileSystemType* fs_type,
Index: parted-1.9.0/libparted/labels/mac.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/mac.c 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/labels/mac.c 2009-07-30 15:22:50.000000000 +0200
@@ -1375,6 +1375,36 @@ mac_partition_get_name (const PedPartiti
return mac_data->volume_name;
}
@ -81,7 +85,7 @@
static PedConstraint*
_primary_constraint (PedDisk* disk)
{
@@ -1423,6 +1453,8 @@
@@ -1599,6 +1629,8 @@ static PedDiskOps mac_disk_ops = {
partition_is_flag_available: mac_partition_is_flag_available,
partition_set_name: mac_partition_set_name,
partition_get_name: mac_partition_get_name,
@ -90,7 +94,7 @@
partition_align: mac_partition_align,
partition_enumerate: mac_partition_enumerate,
@@ -1435,7 +1467,7 @@
@@ -1613,7 +1645,7 @@ static PedDiskType mac_disk_type = {
next: NULL,
name: "mac",
ops: &mac_disk_ops,
@ -99,11 +103,13 @@
};
void
--- parted-1.6.2/include/parted/disk.h.mac Tue Aug 6 13:13:27 2002
+++ parted-1.6.2/include/parted/disk.h Tue Aug 6 13:58:09 2002
@@ -71,10 +71,11 @@
Index: parted-1.9.0/include/parted/disk.h
===================================================================
--- parted-1.9.0.orig/include/parted/disk.h 2009-07-30 15:22:28.000000000 +0200
+++ parted-1.9.0/include/parted/disk.h 2009-07-30 15:22:50.000000000 +0200
@@ -61,10 +61,11 @@ enum _PedPartitionFlag {
typedef enum {
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */
+ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */
@ -113,19 +119,18 @@
-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME
+#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_SYSTEM_NAME
/** @} */
@@ -170,6 +171,9 @@
struct _PedDisk;
struct _PedPartition;
@@ -212,6 +213,8 @@ struct _PedDiskOps {
/* other */
int (*alloc_metadata) (PedDisk* disk);
int (*get_max_primary_partition_count) (const PedDisk* disk);
+
+ void (*partition_set_system_name) (PedPartition* part, const char* name);
+ const char* (*partition_get_system_name) (const PedPartition* part);
+ void (*partition_set_system_name) (PedPartition* part, const char* name);
+ const char* (*partition_get_system_name) (const PedPartition* part);
bool (*get_max_supported_partition_count) (const PedDisk* disk,
int* supported);
};
struct _PedDiskType {
@@ -241,7 +245,9 @@
@@ -288,7 +291,9 @@ extern int ped_partition_is_flag_availab
extern int ped_partition_set_system (PedPartition* part,
const PedFileSystemType* fs_type);
extern int ped_partition_set_name (PedPartition* part, const char* name);
@ -135,18 +140,20 @@
extern int ped_partition_is_busy (const PedPartition* part);
extern char* ped_partition_get_path (const PedPartition* part);
--- parted-1.6.2/parted/parted.c.mac Tue Aug 6 13:13:27 2002
+++ parted-1.6.2/parted/parted.c Tue Aug 6 13:13:27 2002
@@ -1088,6 +1088,7 @@
const char* name;
char* res = ped_malloc(1);
Index: parted-1.9.0/parted/parted.c
===================================================================
--- parted-1.9.0.orig/parted/parted.c 2009-07-30 15:22:28.000000000 +0200
+++ parted-1.9.0/parted/parted.c 2009-07-30 15:23:47.000000000 +0200
@@ -1165,6 +1165,7 @@ partition_print_flags (PedPartition* par
char* res = ped_malloc(1);
void* _res = res;
+ const char* sysname;
int xtype;
+ const char* sysname;
*res = '\0';
@@ -1125,6 +1126,23 @@
}
@@ -1201,6 +1202,23 @@ partition_print_flags (PedPartition* par
}
}
+ sysname = ped_partition_get_system_name( part );

View File

@ -1,7 +1,7 @@
Index: parted-1.8.8/libparted/fs/ext2/ext2.h
Index: parted-1.9.0/libparted/fs/ext2/ext2.h
===================================================================
--- parted-1.8.8.orig/libparted/fs/ext2/ext2.h
+++ parted-1.8.8/libparted/fs/ext2/ext2.h
--- parted-1.9.0.orig/libparted/fs/ext2/ext2.h 2009-07-23 19:52:08.000000000 +0200
+++ parted-1.9.0/libparted/fs/ext2/ext2.h 2009-07-30 16:28:45.000000000 +0200
@@ -24,10 +24,6 @@
#include <sys/types.h>
#include "tune.h"
@ -13,11 +13,11 @@ Index: parted-1.8.8/libparted/fs/ext2/ext2.h
#if ENABLE_NLS
# include <libintl.h>
# define _(String) dgettext (PACKAGE, String)
Index: parted-1.8.8/libparted/labels/gpt.c
Index: parted-1.9.0/libparted/labels/gpt.c
===================================================================
--- parted-1.8.8.orig/libparted/labels/gpt.c
+++ parted-1.8.8/libparted/labels/gpt.c
@@ -31,7 +31,6 @@
--- parted-1.9.0.orig/libparted/labels/gpt.c 2009-07-30 16:28:44.000000000 +0200
+++ parted-1.9.0/libparted/labels/gpt.c 2009-07-30 16:28:45.000000000 +0200
@@ -30,7 +30,6 @@
#include <parted/debug.h>
#include <parted/endian.h>
#include <parted/crc32.h>

View File

@ -1,6 +1,8 @@
--- parted-1.6.11/libparted/disk.c.type Fri May 24 00:32:16 2002
+++ parted-1.6.11/libparted/disk.c Wed Jul 24 13:47:58 2002
@@ -1761,6 +1761,8 @@
Index: parted-1.9.0/libparted/disk.c
===================================================================
--- parted-1.9.0.orig/libparted/disk.c 2009-07-30 14:59:14.000000000 +0200
+++ parted-1.9.0/libparted/disk.c 2009-07-30 14:59:21.000000000 +0200
@@ -2240,6 +2240,8 @@ ped_partition_flag_get_name (PedPartitio
return N_("lba");
case PED_PARTITION_HPSERVICE:
return N_("hp-service");
@ -8,10 +10,12 @@
+ return N_("type");
case PED_PARTITION_PALO:
return N_("palo");
--- parted-1.6.11/libparted/labels/dos.c.type Mon Apr 8 12:07:38 2002
+++ parted-1.6.11/libparted/labels/dos.c Wed Jul 24 13:47:58 2002
@@ -952,6 +952,10 @@
case PED_PARTITION_PREP:
Index: parted-1.9.0/libparted/labels/dos.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/dos.c 2009-07-30 14:59:14.000000000 +0200
+++ parted-1.9.0/libparted/labels/dos.c 2009-07-30 14:59:21.000000000 +0200
@@ -1346,6 +1346,10 @@ msdos_partition_set_flag (PedPartition*
disk = part->disk;
switch (flag) {
@ -22,7 +26,7 @@
case PED_PARTITION_HIDDEN:
if (part->type == PED_PARTITION_EXTENDED) {
ped_exception_throw (
@@ -1350,6 +1350,9 @@
@@ -1443,6 +1447,9 @@ msdos_partition_get_flag (const PedParti
case PED_PARTITION_LBA:
return dos_data->lba;
@ -32,103 +36,110 @@
case PED_PARTITION_PALO:
return dos_data->palo;
@@ -1374,6 +1374,7 @@
@@ -1464,6 +1471,7 @@ msdos_partition_is_flag_available (const
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
case PED_PARTITION_LBA:
+ case PED_PARTITION_TYPE:
case PED_PARTITION_PALO:
case PED_PARTITION_PREP:
return 1;
--- parted-1.6.2/parted/ui.c.type Wed Jul 3 02:59:11 2002
+++ parted-1.6.2/parted/ui.c Wed Jul 24 13:47:58 2002
@@ -891,7 +891,10 @@
Index: parted-1.9.0/parted/ui.c
===================================================================
--- parted-1.9.0.orig/parted/ui.c 2009-07-30 14:59:14.000000000 +0200
+++ parted-1.9.0/parted/ui.c 2009-07-30 14:59:21.000000000 +0200
@@ -908,6 +908,9 @@ command_line_get_integer (const char* pr
NULL, 1);
if (!input)
return 0;
- valid = sscanf (input, "%d", value);
+ if (strstr(input, "0x") == input)
+ valid = sscanf (input, "%x", value);
+ else
+ valid = sscanf (input, "%d", value);
valid = sscanf (input, "%d", value);
free (input);
return valid;
}
--- parted-1.6.11/include/parted/disk.h.type Wed Apr 10 03:23:11 2002
+++ parted-1.6.11/include/parted/disk.h Wed Jul 24 13:47:58 2002
@@ -62,8 +62,9 @@
Index: parted-1.9.0/include/parted/disk.h
===================================================================
--- parted-1.9.0.orig/include/parted/disk.h 2009-07-30 14:59:14.000000000 +0200
+++ parted-1.9.0/include/parted/disk.h 2009-07-30 14:59:21.000000000 +0200
@@ -51,9 +51,10 @@ enum _PedPartitionFlag {
PED_PARTITION_LBA=7,
PED_PARTITION_HPSERVICE=8,
PED_PARTITION_PALO=9,
- PED_PARTITION_PREP=10,
- PED_PARTITION_MSFT_RESERVED=11
+ PED_PARTITION_TYPE=10,
- PED_PARTITION_MSFT_RESERVED=11,
- PED_PARTITION_BIOS_GRUB=12
+ PED_PARTITION_TYPE=10,
+ PED_PARTITION_PREP=11,
+ PED_PARTITION_MSFT_RESERVED=12
+ PED_PARTITION_MSFT_RESERVED=12,
+ PED_PARTITION_BIOS_GRUB=13
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
#define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_RESERVED
--- parted-1.6.2/parted/parted.c.type Wed Jul 24 13:47:58 2002
+++ parted-1.6.2/parted/parted.c Wed Jul 24 14:26:45 2002
@@ -1094,17 +1094,28 @@
#define PED_PARTITION_LAST_FLAG PED_PARTITION_BIOS_GRUB
Index: parted-1.9.0/parted/parted.c
===================================================================
--- parted-1.9.0.orig/parted/parted.c 2009-07-30 14:59:20.000000000 +0200
+++ parted-1.9.0/parted/parted.c 2009-07-30 15:13:40.000000000 +0200
@@ -1164,13 +1164,14 @@ partition_print_flags (PedPartition* par
const char* name;
char* res = ped_malloc(1);
void* _res = res;
+ int xtype;
*res = '\0';
first_flag = 1;
for (flag = ped_partition_flag_next (0); flag;
flag = ped_partition_flag_next (flag)) {
- if (ped_partition_get_flag (part, flag)) {
- if (first_flag)
- first_flag = 0;
- else {
- _res = res;
- ped_realloc (&_res, strlen (res)
- + 1 + 2);
- res = _res;
- strncat (res, ", ", 2);
- }
+ if (xtype = ped_partition_get_flag (part, flag)) {
if (first_flag)
first_flag = 0;
else {
@@ -1180,7 +1181,16 @@ partition_print_flags (PedPartition* par
res = _res;
strncat (res, ", ", 2);
}
-
+ if (first_flag)
+ first_flag = 0;
+ else {
+ _res = res;
+ ped_realloc (&_res, strlen (res)
+ + 1 + 2);
+ res = _res;
+ strncat (res, ", ", 2);
+ }
+ if (flag == PED_PARTITION_TYPE) {
+ int xtype = ped_partition_get_flag (part, flag);
+ if (xtype) {
+ char tmpstr[21];
+ int len = snprintf(tmpstr,sizeof(tmpstr)-1,"type=%02x",xtype);
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 +
+ ((len>sizeof(tmpstr))?sizeof(tmpstr):len) );
+ res = _res;
+ strncat (res, tmpstr, 21);
+ }
+ }
+ else if (ped_partition_get_flag (part, flag)) {
+ if (flag == PED_PARTITION_TYPE) {
+ char tmpstr[21];
+ int len = snprintf(tmpstr,sizeof(tmpstr)-1,"type=%02x",xtype);
+ _res = res;
+ ped_realloc (&_res, strlen (res) + 1 +
+ ((len>sizeof(tmpstr))?sizeof(tmpstr):len) );
+ res = _res;
+ strncat (res, tmpstr, 21);
+ }
+ else {
name = _(ped_partition_flag_get_name (flag));
_res = res;
ped_realloc (&_res, strlen (res) + 1
@@ -1726,12 +1737,19 @@
@@ -1189,6 +1199,7 @@ partition_print_flags (PedPartition* par
strncat (res, name, 21);
}
}
+ }
return res;
}
@@ -1940,12 +1951,19 @@ do_set (PedDevice** dev)
goto error_destroy_disk;
if (!command_line_get_part_flag (_("Flag to Invert?"), part, &flag))
goto error_destroy_disk;
- state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0);
+ if( flag == PED_PARTITION_TYPE )
+ state = ped_partition_get_flag (part, flag);
+ else
+ state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0);
+ if( flag == PED_PARTITION_TYPE )
+ state = ped_partition_get_flag (part, flag);
+ else
state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0);
- if (!is_toggle_mode) {
+ if (!is_toggle_mode && flag != PED_PARTITION_TYPE ) {
if (!command_line_get_state (_("New state?"), &state))
goto error_destroy_disk;
}
+ else if( flag == PED_PARTITION_TYPE ) {
+ if (!command_line_get_integer (_("New type?"), &state))
+ goto error_destroy_disk;
+ }
+ else if( flag == PED_PARTITION_TYPE ) {
+ if (!command_line_get_integer (_("New type?"), &state))
+ goto error_destroy_disk;
+ }
if (!ped_partition_set_flag (part, flag, state))
goto error_destroy_disk;

View File

@ -1,6 +1,8 @@
--- parted-1.6.3/libparted/labels/dos.c 2002-09-23 14:32:38.000000000 +0000
+++ parted-1.6.3/libparted/labels/dos.c 2002-09-23 14:26:07.000000000 +0000
@@ -51,6 +51,8 @@
Index: parted-1.9.0/libparted/labels/dos.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/dos.c 2009-07-29 11:31:18.000000000 +0200
+++ parted-1.9.0/libparted/labels/dos.c 2009-07-29 11:36:43.000000000 +0200
@@ -54,6 +54,8 @@ static const char MBR_BOOT_CODE[] = {
#define MSDOS_MAGIC 0xAA55
#define PARTITION_MAGIC_MAGIC 0xf6f6
@ -9,18 +11,18 @@
#define PARTITION_EMPTY 0x00
#define PARTITION_FAT12 0x01
#define PARTITION_FAT16_SM 0x04
@@ -166,6 +166,10 @@
@@ -193,6 +195,10 @@ msdos_probe (const PedDevice *dev)
if (PED_LE16_TO_CPU (part_table->magic) != MSDOS_MAGIC)
return 0;
goto probe_fail;
+ /* Is this an AIX IPL label? Then just go away. */
+ if (PED_BE32_TO_CPU (*(unsigned int*)(part_table->boot_code)) == AIXIPLRECID)
+ return 0;
+ goto probe_fail;
+
/* if this is a FAT fs, fail here. Note that the Smart Boot Manager
* Loader (SBML) signature indicates a partition table, not a file
* system.
@@ -784,7 +786,10 @@
/* If this is a FAT fs, fail here. Checking for the FAT signature
* has some false positives; instead, do what the Linux kernel does
* and ensure that each partition has a boot indicator that is
@@ -1142,7 +1148,10 @@ msdos_write (const PedDisk* disk)
ped_device_read (disk->dev, &table, 0, 1);
@ -30,5 +32,5 @@
+ (PED_BE32_TO_CPU (*(unsigned int*)(table.boot_code)) == AIXIPLRECID)
+ ) {
memset (table.boot_code, 0, 512);
memcpy (table.boot_code, MBR_BOOT_CODE,
sizeof (MBR_BOOT_CODE));
memcpy (table.boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE));
}

View File

@ -1,3 +1,54 @@
-------------------------------------------------------------------
Fri Jul 31 10:20:05 CEST 2009 - puzel@novell.com
- update to parted-1.9.0
* bugfixes:
* parted now preserves the protective MBR (PMBR) in GPT type
labels.
* gpt_read now uses SizeOfPartitionEntry instead of the size
of GuidPartitionEntry_t. This ensures that *all* of the
partition entries are correctly read.
* mklabel (interactive mode) now correctly asks for
confirmation, when replacing an existent label, without
outputting an error message.
* resize now handles FAT16 file systems with a 64k cluster.
This configuration is not common, but it is possible.
* parted now ignores devices of the type /dev/md* when
probing. These types of devices should be handled by the
device-mapper capabilities of parted.
* The parted documentation now describes the differences in
the options passed to mkpart for the label types.
* changes in behavior
* In libparted, the linux-swap "filesystem" types are now
called "linux-swap(v0)" and "linux-swap(v1)" rather than
"linux-swap(old)" and "linux-swap(new)" as in parted 1.8, or
"linux-swap" as in older versions; "old" and "new" generally
make poor names, and v1 is the only format supported by
current Linux kernels. Aliases for all previous names are
available.
- drop following patches as they were merged upstream/are no
longer needed:
* 2TB_size_overflow.diff
* disable_FAT_check.diff
* do-not-automatically-correct-GPT.patch
* dont-require-dvh-partition-name.patch
* fix-array-overflow.patch
* fix-corrupted-gpt-crash.patch
* fix-dasd-probe.patch
* fix-dvh-update.patch
* fix-improper-data-conversion.patch
* fix-make-install-failure.patch
* gnulib.diff
* parted-cmd-arg-fix.patch
* parted-fdasd-compile-fixes
- remove FAT16 stuff from fat16_hfs_fix.dif, rename it hfs_fix.dif
- add fix-tests.sh
* adjust testsuite so that it succeeds with our patchset
- update all patches to remove fuzz, renumber patches
- change license to GPL v3
- parted-type.patch: fix output of flags
-------------------------------------------------------------------
Wed Jul 1 12:13:42 CEST 2009 - puzel@novell.com

View File

@ -2,13 +2,15 @@
libparted/arch/linux.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -65,15 +65,9 @@
Index: parted-1.9.0/libparted/arch/linux.c
===================================================================
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-07-29 14:01:00.000000000 +0200
+++ parted-1.9.0/libparted/arch/linux.c 2009-07-29 14:07:44.000000000 +0200
@@ -66,15 +66,9 @@
#define HDIO_GETGEO 0x0301 /* get device geometry */
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
-#if defined(O_DIRECT) && (!defined(__s390__) || !defined(__s390x__))
-#if defined(O_DIRECT) && !(defined(__s390__) || defined(__s390x__))
-#define RD_MODE (O_RDONLY | O_DIRECT)
-#define WR_MODE (O_WRONLY | O_DIRECT)
-#define RW_MODE (O_RDWR | O_DIRECT)
@ -20,15 +22,15 @@
struct hd_geometry {
unsigned char heads;
@@ -1253,6 +1247,7 @@ _flush_cache (PedDevice* dev)
@@ -1409,6 +1403,7 @@ _flush_cache (PedDevice* dev)
fd = open (name, WR_MODE, 0);
if (fd > 0) {
ioctl (fd, BLKFLSBUF);
+ fsync (fd);
+ fsync (fd);
close (fd);
}
}
@@ -1315,6 +1310,7 @@ linux_close (PedDevice* dev)
@@ -1471,6 +1466,7 @@ linux_close (PedDevice* dev)
if (dev->dirty)
_flush_cache (dev);

View File

@ -1,5 +1,5 @@
#
# spec file for package parted (Version 1.8.8)
# spec file for package parted (Version 1.9.0)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -26,44 +26,31 @@ BuildRequires: readline-devel
BuildRequires: libsepol-devel
BuildRequires: libselinux-devel
%define aclocaldir /usr/share/aclocal
License: GPL v2 or later
License: GPL v3 or later
Group: System/Filesystems
Summary: GNU partitioner
Version: 1.8.8
Release: 107
Version: 1.9.0
Release: 1
Source0: %{name}-%{version}.tar.bz2
Patch: always-resize-part.dif
Patch0: always-resize-part.dif
Patch1: parted-type.patch
Patch2: parted-mac.patch
Patch3: parted-wipeaix.patch
Patch4: disable_FAT_check.diff
Patch6: etherd_support.diff
Patch7: parted-1.8.3.dif
Patch8: fat16_hfs_fix.dif
Patch9: always_print_geom.diff
Patch10: 2TB_size_overflow.diff
Patch11: fix-function-def.patch
Patch12: gnulib.diff
Patch51: parted.tty.patch
Patch52: parted.no-O_DIRECT.patch
Patch54: parted-gpt-mbr-sync.patch
Patch55: parted-fdasd-compile-fixes
Patch56: parted-no-inttypes-include
Patch57: fix-improper-data-conversion.patch
Patch58: fix-corrupted-gpt-crash.patch
Patch59: fix-dvh-update.patch
Patch60: fix-dasd-probe.patch
Patch62: fix-error-informing-the-kernel.patch
Patch63: do-not-discard-bootcode-in-extended-partition.patch
Patch64: parted-cmd-arg-fix.patch
Patch65: dont-require-dvh-partition-name.patch
Patch66: do-not-automatically-correct-GPT.patch
Patch4: etherd_support.diff
Patch5: parted-1.8.3.dif
Patch6: hfs_fix.dif
Patch7: always_print_geom.diff
Patch8: fix-function-def.patch
Patch9: parted.tty.patch
Patch10: parted.no-O_DIRECT.patch
Patch11: parted-gpt-mbr-sync.patch
Patch12: parted-no-inttypes-include
Patch13: fix-error-informing-the-kernel.patch
Patch14: do-not-discard-bootcode-in-extended-partition.patch
#PATCH-FEATURE-OPENSUSE fix-dm-partition-name.patch bnc471440,447591 petr.uzel@suse.cz
Patch67: fix-dm-partition-name.patch
#PATCH-FIX-UPSTREAM fix-make-install-failure.patch -- fix installation failure with latest automake
Patch68: fix-make-install-failure.patch
#PATCH-FIX-UPSTREAM fix-array-overflow.patch -- fix array access overflow
Patch69: fix-array-overflow.patch
Patch15: fix-dm-partition-name.patch
#PATCH-FEATURE-OPENSUSE fix-tests.sh petr.uzel@suse.cz
Patch16: fix-tests.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.gnu.org/software/parted/
PreReq: %install_info_prereq
@ -71,14 +58,11 @@ PreReq: %install_info_prereq
%ifarch ppc64
Obsoletes: parted-64bit
%endif
#
%description
GNU Parted is a program for creating, destroying, resizing, checking,
and copying partitions, and the file systems on them.
Authors:
--------
Andrew Clausen <clausen@gnu.org>
@ -92,14 +76,11 @@ Requires: e2fsprogs-devel parted = %version device-mapper-devel libreiserf
%ifarch ppc64
Obsoletes: parted-devel-64bit
%endif
#
%description devel
This package contains all necessary include files and libraries needed
to develop applications that require these.
Authors:
--------
Andrew Clausen <clausen@gnu.org>
@ -112,43 +93,32 @@ Authors:
%lang_package
%prep
%setup -q
%patch
%patch0
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4
%patch6 -p0
%patch4 -p0
%patch5
%patch6 -p1
%patch7
%patch8 -p1
%patch9
%patch8
%patch9 -p1
%patch10 -p1
%patch11
%patch12
%patch51 -p1
%patch52 -p1
%patch54
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%build
AUTOPOINT=true autoreconf --force --install
%configure --disable-static --with-pic \
--enable-device-mapper=yes \
--enable-dynamic-loading=no \
--enable-selinux \
--disable-Werror
%configure --disable-static \
--with-pic \
--enable-device-mapper=yes \
--enable-dynamic-loading=no \
--enable-selinux \
--disable-Werror
make %{?jobs:-j%jobs}
%install

View File

@ -1,20 +1,17 @@
Index: parted-1.8.7/parted/ui.c
Index: parted-1.9.0/parted/ui.c
===================================================================
--- parted-1.8.7.orig/parted/ui.c
+++ parted-1.8.7/parted/ui.c
@@ -1374,9 +1374,13 @@ init_ui ()
--- parted-1.9.0.orig/parted/ui.c 2009-07-30 16:28:35.000000000 +0200
+++ parted-1.9.0/parted/ui.c 2009-07-30 16:28:38.000000000 +0200
@@ -1402,9 +1402,13 @@ init_ui ()
ped_exception_set_handler (exception_handler);
#ifdef HAVE_LIBREADLINE
- rl_initialize ();
- rl_attempted_completion_function = (CPPFunction*) complete_function;
- readline_state.in_readline = 0;
+ /* check for tty is favorable here because readline might try to set some
+ * terminal stuff that messes up parsing in non-interactive mode */
+ if( isatty(fileno(stdout)) ) {
+ rl_initialize ();
+ rl_attempted_completion_function = (CPPFunction*) complete_function;
+ readline_state.in_readline = 0;
rl_initialize ();
rl_attempted_completion_function = (CPPFunction*) complete_function;
readline_state.in_readline = 0;
+ }
#endif