[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Mon Nov 23 22:04:30 UTC 2009
cfg.mk | 4 +--
libparted/labels/dasd.c | 8 ++++++
libparted/labels/pt-tools.c | 4 +--
tests/Makefile.am | 1
tests/t3200-type-change.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 65 insertions(+), 4 deletions(-)
New commits:
commit b5310d6391332aad5d297288f202d7c0c124ec4c
Author: Jim Meyering <meyering at redhat.com>
Date: Mon Nov 23 21:46:17 2009 +0100
dasd: avoid NULL-dereference via disk->type->ops->partition_check
Commit f387fee8 added the new ops->partition_check() function,
and a <type>_partition_check function for each partition table
format _except_ dasd. This change adds one for dasd, too.
* libparted/labels/dasd.c: Include "pt-tools.h".
(dasd_partition_check): New function.
* libparted/labels/pt-tools.c (ptt_partition_max_start_len): Add "dasd"
to the list of partition table type names for which the 32-bit
limits on starting sector and partition length apply.
Correct a comment.
Considering the 32-bit fields in "struct fdasd_hd_geometry",
it is safe to assume that larger offset or size is not possible.
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 3f8147d..fc0695c 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -48,6 +48,7 @@
#endif /* ENABLE_NLS */
#include "misc.h"
+#include "pt-tools.h"
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
@@ -106,6 +107,12 @@ static int dasd_partition_set_system (PedPartition* part,
const PedFileSystemType* fs_type);
static int dasd_alloc_metadata (PedDisk* disk);
+static bool
+dasd_partition_check (const PedPartition *part)
+{
+ return ptt_partition_max_start_len ("dasd", part);
+}
+
static PedDiskOps dasd_disk_ops = {
probe: dasd_probe,
clobber: dasd_clobber,
@@ -132,6 +139,7 @@ static PedDiskOps dasd_disk_ops = {
get_max_primary_partition_count: dasd_get_max_primary_partition_count,
get_max_supported_partition_count: dasd_get_max_supported_partition_count,
get_partition_alignment: dasd_get_partition_alignment,
+ partition_check: dasd_partition_check,
};
static PedDiskType dasd_disk_type = {
diff --git a/libparted/labels/pt-tools.c b/libparted/labels/pt-tools.c
index 622cedd..8afec77 100644
--- a/libparted/labels/pt-tools.c
+++ b/libparted/labels/pt-tools.c
@@ -98,14 +98,14 @@ ptt_clear_sectors (PedDevice *dev, PedSector start, PedSector n)
int
ptt_partition_max_start_len (char const *label_type, const PedPartition *part)
{
- static char const *const max_32[] = {"msdos", "dvh"};
+ static char const *const max_32[] = {"msdos", "dvh", "dasd"};
unsigned int i;
for (i = 0; i < sizeof max_32 / sizeof *max_32; i++)
{
if (strcmp (label_type, max_32[i]) == 0)
{
- /* The starting sector length must fit in 32 bytes. */
+ /* The length (in sectors) must fit in 32 bytes. */
if (part->geom.length > UINT32_MAX)
{
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
commit f6ab25ae82095fb5133194779d21cb1a71a1acc8
Author: Jim Meyering <meyering at redhat.com>
Date: Wed Nov 18 21:46:07 2009 +0100
build: "make stable" emitted an invalid gnupload command
* cfg.mk (gnu_ftp_host-stable): Rename from gnu_ftp_host-major.
diff --git a/cfg.mk b/cfg.mk
index 1ce37f7..ce0dfc1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -15,10 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Use alpha.gnu.org for alpha and beta releases.
-# Use ftp.gnu.org for major releases.
+# Use ftp.gnu.org for stable releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
-gnu_ftp_host-major = ftp.gnu.org
+gnu_ftp_host-stable = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
url_dir_list = \
commit a50520d9fc11a455498ef2e3ab9eb0908b002415
Author: Jim Meyering <meyering at redhat.com>
Date: Tue Nov 17 11:27:29 2009 +0100
test for partition-type-changing bug
* tests/t3200-type-change.sh: New file.
* tests/Makefile.am (TESTS): Add it.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ece3f64..159dc69 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,6 +17,7 @@ TESTS = \
t2200-dos-label-recog.sh \
t2300-dos-label-extended-bootcode.sh \
t3000-resize-fs.sh \
+ t3200-type-change.sh \
t4000-sun-raid-type.sh \
t4100-msdos-partition-limits.sh \
t4100-dvh-partition-limits.sh \
diff --git a/tests/t3200-type-change.sh b/tests/t3200-type-change.sh
new file mode 100755
index 0000000..5f77f8b
--- /dev/null
+++ b/tests/t3200-type-change.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Ensure parted doesn't change the type of a partition to match its FS.
+
+# Copyright (C) 2009 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/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ parted --version
+fi
+
+: ${srcdir=.}
+. $srcdir/t-lib.sh
+
+require_root_
+require_scsi_debug_module_
+
+# check for scsi_debug module
+modprobe -n scsi_debug ||
+ skip_test_ "you lack the scsi_debug kernel module"
+
+grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
+ skip_test_ 'this system lacks a new-enough libblkid'
+
+# create memory-backed device
+scsi_debug_setup_ dev_size_mb=550 > dev-name ||
+ skip_test_ 'failed to create scsi_debug device'
+scsi_dev=$(cat dev-name)
+
+# Create an empty partition of "type fat32", and then create an actual
+# ext2 partition in it. Then "unset" the already unset LVM flag on that
+# partition and ensure that parted doesn't "helpfully" change the partition
+# type to match the newly-detected FS type.
+
+fail=0
+parted -s $scsi_dev mklabel msdos mkpart primary fat32 64s 80000s || fail=1
+
+compare out exp || fail=1
+
+Exit $fail
More information about the Parted-commits
mailing list