[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Wed Sep 28 21:02:04 UTC 2011


 NEWS                         |    5 +++++
 cfg.mk                       |    3 +++
 gnulib                       |    2 +-
 libparted/arch/linux.c       |    9 +++++++++
 libparted/fs/nilfs2/nilfs2.c |    5 +++--
 tests/Makefile.am            |    1 +
 tests/t4300-nilfs2-tiny.sh   |   32 ++++++++++++++++++++++++++++++++
 7 files changed, 54 insertions(+), 3 deletions(-)

New commits:
commit 128d66406040287399df5e87dce774c3da40699a
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed Sep 28 15:19:52 2011 +0200

    build: update gnulib to latest; adapt use of _GL_ATTRIBUTE_FORMAT
    
    * libparted/arch/linux.c (_GL_ATTRIBUTE_FORMAT): Define here,
    now that it's no longer defined by gnulib.

diff --git a/gnulib b/gnulib
index 3532d15..bd35a4e 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 3532d15484ebc37feded387216d716bc1c3533f6
+Subproject commit bd35a4e10e52b9fbe25b7280c3c4d9ef4b144c8a
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index bc42750..3792b19 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -56,6 +56,15 @@
 #  define _(String) (String)
 #endif /* ENABLE_NLS */
 
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+#endif
+
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 
 #ifndef __NR__llseek

commit 5ac53ea3cb0455eee63b1171602acb6a4730e259
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed Sep 28 21:46:56 2011 +0200

    build: avoid new syntax-check failure
    
    * cfg.mk: Exempt libparted/arch/beos.c from the PATH_MAX check.
    I suspect that this is ok, because parted compiles only on systems
    that define PATH_MAX to something reasonable.

diff --git a/cfg.mk b/cfg.mk
index 621ef6f..f49a57e 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -68,3 +68,6 @@ exclude_file_name_regexp--sc_cross_check_PATH_usage_in_tests = \
 
 exclude_file_name_regexp--sc_prohibit_always-defined_macros = \
   ^parted/(strlist|table)\.h$$
+
+exclude_file_name_regexp--sc_prohibit_path_max_allocation = \
+  ^libparted/arch/beos\.c$$

commit 22bfa0d6e301b1c6da08d1e37227c2666b6a1e92
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Jun 25 08:52:04 2011 +0200

    doc: mention the origin of the other two bugs
    
    * NEWS: Mention that the other two bugs were introduced long ago.

diff --git a/NEWS b/NEWS
index e2258ca..6c55ec9 100644
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,10 @@ GNU parted NEWS                                    -*- outline -*-
   [bug introduced in parted-2.4 with the addition of nilfs2 support]
 
   libparted: no longer aborts when reading a truncated GPT-formatted device
+  [bug present at least as far back as RHEL4's parted-1.6.19]
 
   libparted: works with a two-component linux kernel version number like 3.0
+  [bug present since the beginning]
 
 
 * Noteworthy changes in release 3.0 (2011-05-30) [stable]

commit 196364e9c02ef349632a682a852ce114ed31c869
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed Sep 28 19:43:40 2011 +0200

    tests: test for the nilfs2 bug
    
    * tests/t4300-nilfs2-tiny.sh: New test.
    * tests/Makefile.am (TESTS): Add it.

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

commit 2147402b83b27a35011cad032d0519c4a0672280
Author: Jim Meyering <meyering at redhat.com>
Date:   Sat Jun 25 08:49:58 2011 +0200

    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

diff --git a/NEWS b/NEWS
index cb61ac1..e2258ca 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
 
   libparted: works with a two-component linux kernel version number like 3.0
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;



More information about the Parted-commits mailing list