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

Jim Meyering meyering at alioth.debian.org
Wed May 26 19:59:08 UTC 2010


 .x-sc_prohibit_always-defined_macros |    2 +
 Makefile.am                          |    1 
 bootstrap                            |    6 ++-
 bootstrap.conf                       |    2 -
 configure.ac                         |    2 -
 gnulib                               |    2 -
 libparted/fs/xfs/platform_defs.h     |    6 ---
 libparted/labels/dos.c               |    2 -
 parted/parted.c                      |   24 +++++++++---
 parted/strlist.c                     |    8 ----
 parted/table.c                       |    4 --
 tests/help-version                   |   13 +++++--
 tests/init.sh                        |   65 +++++++++++++++++++++++++----------
 tests/t9040-many-partitions.sh       |    2 -
 14 files changed, 88 insertions(+), 51 deletions(-)

New commits:
commit 52e07a55b46900212e9219d4da35005b7c87e30b
Author: Petr Uzel <petr.uzel at suse.cz>
Date:   Wed May 26 14:29:01 2010 +0200

    parted: make align-check work in interactive mode
    
    * parted/parted.c (do_align_check): rework the function so that
    it reports partition alignment in interactive mode as described in
    documentation.

diff --git a/parted/parted.c b/parted/parted.c
index 830075b..7723d18 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2078,18 +2078,29 @@ do_align_check (PedDevice **dev)
 {
   PedDisk *disk = ped_disk_new (*dev);
   if (!disk)
-    return 0;
+    goto error;
 
   enum AlignmentType align_type = PA_OPTIMUM;
   PedPartition *part = NULL;
-  bool aligned =
-    (command_line_get_align_type (_("alignment type(min/opt)"), &align_type)
-     && command_line_get_partition (_("Partition number?"), disk, &part)
-     && partition_align_check (disk, part, align_type));
+
+  if (!command_line_get_align_type (_("alignment type(min/opt)"), &align_type))
+    goto error_destroy_disk;
+  if (!command_line_get_partition (_("Partition number?"), disk, &part))
+    goto error_destroy_disk;
+
+  bool aligned = partition_align_check (disk, part, align_type);
+  if (!opt_script_mode)
+    printf(aligned ? _("%d aligned\n") : _("%d not aligned\n"), part->num);
 
   ped_disk_destroy (disk);
 
+  /* FIXME: perhaps we should always return 1 when in interactive mode???  */
   return aligned ? 1 : 0;
+
+error_destroy_disk:
+  ped_disk_destroy (disk);
+error:
+  return 0;
 }
 
 static int

commit c0ca1f474d843a071fdc908d66bbe36eac3be0c4
Author: Petr Uzel <petr.uzel at suse.cz>
Date:   Wed May 26 14:27:07 2010 +0200

    parted: initialize align_type to default value
    
    * parted/parted.c (do_align_check): Initialize align_type to
    default alignment; this prevents reading of uninitialized memory
    later in command_line_get_align_type()

diff --git a/parted/parted.c b/parted/parted.c
index 04d765c..830075b 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2080,7 +2080,7 @@ do_align_check (PedDevice **dev)
   if (!disk)
     return 0;
 
-  enum AlignmentType align_type;
+  enum AlignmentType align_type = PA_OPTIMUM;
   PedPartition *part = NULL;
   bool aligned =
     (command_line_get_align_type (_("alignment type(min/opt)"), &align_type)

commit 6f11884372056020511f223db2fbcb37c1d28794
Author: Petr Uzel <petr.uzel at suse.cz>
Date:   Wed May 26 14:10:04 2010 +0200

    parted: plug memory leak
    
    * parted/parted.c (_done_messages): Free unit_msg.

diff --git a/parted/parted.c b/parted/parted.c
index edf3249..04d765c 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2318,6 +2318,7 @@ static void
 _done_messages ()
 {
         free (flag_msg);
+        free (unit_msg);
         free (mkfs_fs_type_msg);
         free (mkpart_fs_type_msg);
         free (resize_fs_type_msg);

commit 53f87006bb430d91ae696d7395d2d8b462a22699
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed May 26 12:19:07 2010 +0200

    tests: avoid spurious failure of the root-only many-partitions test
    
    * tests/t9040-many-partitions.sh: When creating a scsi_debug
    device, honor the block size suggested by the PARTED_SECTOR_SIZE
    environment variable, and thus required in expected output.

diff --git a/tests/t9040-many-partitions.sh b/tests/t9040-many-partitions.sh
index c41ecfc..4c0b7ea 100644
--- a/tests/t9040-many-partitions.sh
+++ b/tests/t9040-many-partitions.sh
@@ -45,7 +45,7 @@ n_sectors=$(($start + n_partitions * partition_sectors + gpt_slop))
 sectors_per_MiB=$((1024 * 1024 / ss))
 n_MiB=$(((n_sectors + sectors_per_MiB - 1) / sectors_per_MiB))
 # create memory-backed device
-scsi_debug_setup_ dev_size_mb=$n_MiB > dev-name ||
+scsi_debug_setup_ sector_size=$ss dev_size_mb=$n_MiB > dev-name ||
   skip_test_ 'failed to create scsi_debug device'
 scsi_dev=$(cat dev-name)
 

commit d5c302adc7165a61a0f1d1f2d4b673daa5d507d1
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed May 26 11:30:02 2010 +0200

    build: update gnulib submodule to latest

diff --git a/gnulib b/gnulib
index e2843e3..c268320 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit e2843e30e8c2885eb8cbc77e20c4e0f4d562d44d
+Subproject commit c2683209a653dfe553739c586911137b4ef692a7

commit d97fbdfd21c1fd80cddc83329a81794d60c2010a
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed May 26 11:43:09 2010 +0200

    maint: remove useless definitions
    
    * libparted/fs/xfs/platform_defs.h [__sparc__] (O_DIRECT):
    Remove now-unneeded definition.
    * parted/table.c (wchar_t): Remove definition.
    * parted/strlist.c (wchar_t): Likewise.
    * .x-sc_prohibit_always-defined_macros: New file.
    Exempt two files from this syntax-check rule.
    * Makefile.am (EXTRA_DIST): Add it here.

diff --git a/.x-sc_prohibit_always-defined_macros b/.x-sc_prohibit_always-defined_macros
new file mode 100644
index 0000000..3590338
--- /dev/null
+++ b/.x-sc_prohibit_always-defined_macros
@@ -0,0 +1,2 @@
+^parted/strlist\.h$
+^parted/table\.h$
diff --git a/Makefile.am b/Makefile.am
index d5a32ef..70ca26b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,6 +9,7 @@ EXTRA_DIST =				\
   parted.spec.in			\
   parted.spec				\
   .x-sc_GPL_version			\
+  .x-sc_prohibit_always-defined_macros	\
   scripts/data/abi/baseline_symbols.txt \
   scripts/extract_symvers		\
   cfg.mk				\
diff --git a/libparted/fs/xfs/platform_defs.h b/libparted/fs/xfs/platform_defs.h
index 16ba1c5..2b55752 100644
--- a/libparted/fs/xfs/platform_defs.h
+++ b/libparted/fs/xfs/platform_defs.h
@@ -51,12 +51,6 @@
 # define constpp	char * const *
 #endif
 
-#ifdef __sparc__
-# ifndef O_DIRECT
-#  define O_DIRECT	0x100000
-# endif
-#endif
-
 typedef loff_t		xfs_off_t;
 typedef uint64_t	xfs_ino_t;
 typedef uint32_t	xfs_dev_t;
diff --git a/parted/strlist.c b/parted/strlist.c
index 310ff01..e20dc04 100644
--- a/parted/strlist.c
+++ b/parted/strlist.c
@@ -38,14 +38,6 @@
 #include <wchar.h>
 #include <wctype.h>
 
-#else /* ENABLE_NLS */
-
-#ifdef wchar_t
-#undef wchar_t
-#endif
-
-#define wchar_t char
-
 #endif /* !ENABLE_NLS */
 
 #include "strlist.h"
diff --git a/parted/table.c b/parted/table.c
index 48202dd..d184a5f 100644
--- a/parted/table.c
+++ b/parted/table.c
@@ -36,10 +36,6 @@
 #	define L_(str) L##str
 #else
 #	define L_(str) str
-#       ifdef wchar_t
-#               undef wchar_t
-#       endif
-#       define wchar_t char
 #       define wcslen strlen
 #       define wcswidth strnlen
 #       define wcscat strcat

commit c5bf4e515c46fc2427cb4476ad13c7da333892fa
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed May 26 11:32:56 2010 +0200

    maint: update helper scripts
    
    * tests/help-version: Update from coreutils.
    * bootstrap: Update from gnulib.
    * tests/init.sh: Likewise.

diff --git a/bootstrap b/bootstrap
index a9a778a..2422549 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-04-30.16; # UTC
+scriptversion=2010-05-17.18; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -409,6 +409,7 @@ git_modules_config () {
 }
 
 gnulib_path=`git_modules_config submodule.gnulib.path`
+: ${gnulib_path=gnulib}
 
 # Get gnulib files.
 
@@ -424,7 +425,8 @@ case ${GNULIB_SRCDIR--} in
 
     trap cleanup_gnulib 1 2 13 15
 
-    git clone -h|grep -- --depth > /dev/null && shallow='--depth 2' || shallow=
+    shallow=
+    git clone -h 2>&1 | grep -- --depth > /dev/null && shallow='--depth 2'
     git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
       cleanup_gnulib
 
diff --git a/tests/help-version b/tests/help-version
index 9d04a49..f644f8d 100755
--- a/tests/help-version
+++ b/tests/help-version
@@ -23,8 +23,7 @@
 test "x$SHELL" = x && SHELL=/bin/sh
 export SHELL
 
-: ${srcdir=.}
-. $srcdir/init.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted
 
 expected_failure_status_chroot=125
 expected_failure_status_env=125
@@ -184,6 +183,16 @@ shred_setup () { args=$tmp_in; }
 touch_setup () { args=$tmp_in2; }
 truncate_setup () { args="--reference=$tmp_in $tmp_in2"; }
 
+mkid_setup () { printf 'f(){}\ntypedef int t;\n' > f.c; args=. ; }
+lid_setup () { args=; }
+fid_setup () { args=f.c; }
+fnid_setup () { args=; }
+xtokid_setup () { args=; }
+aid_setup () { args=f; }
+eid_setup () { args=--version; }
+gid_setup () { args=f; }
+defid_setup () { args=t; }
+
 basename_setup () { args=$tmp_in; }
 dirname_setup () { args=$tmp_in; }
 expr_setup () { args=foo; }
diff --git a/tests/init.sh b/tests/init.sh
index 512e876..ef0957c 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -21,11 +21,16 @@
 # The typical skeleton of a test looks like this:
 #
 #   #!/bin/sh
-#   : ${srcdir=.}
-#   . "$srcdir/init.sh"; path_prepend_ .
+#   . "${srcdir=.}/init.sh"; path_prepend_ .
 #   Execute some commands.
 #   Note that these commands are executed in a subdirectory, therefore you
 #   need to prepend "../" to relative filenames in the build directory.
+#   Note that the "path_prepend_ ." is useful only if the body of your
+#   test invokes programs residing in the initial directory.
+#   For example, if the programs you want to test are in src/, and this test
+#   script is named tests/test-1, then you would use "path_prepend_ ../src",
+#   or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"
+#   to all tests via automake's TESTS_ENVIRONMENT.
 #   Set the exit code 0 for success, 77 for skipped, or 1 or other for failure.
 #   Use the skip_ and fail_ functions to print a diagnostic and then exit
 #   with the corresponding exit code.
@@ -58,37 +63,61 @@
 # - hyphen-containing alias names
 # - we prefer to use ${var#...} substitution, rather than having
 #   to work around lack of support for that feature.
-# The following code attempts to find a shell with support for these features
-# and re-exec's it.  If not, it skips the current test.
+# The following code attempts to find a shell with support for these features.
+# If the current shell passes the test, we're done.  Otherwise, test other
+# shells until we find one that passes.  If one is found, re-exec it.
+# If no acceptable shell is found, skip the current test.
+#
+# Use "9" to indicate success (rather than 0), in case some shell acts
+# like Solaris 10's /bin/sh but exits successfully instead of with status 2.
 
 gl_shell_test_script_='
 test $(echo y) = y || exit 1
-test -z "$EXEEXT" && exit 0
+test -z "$EXEEXT" && exit 9
 shopt -s expand_aliases
 alias a-b="echo zoo"
 v=abx
      test ${v%x} = ab \
   && test ${v#a} = bx \
-  && test $(a-b) = zoo
+  && test $(a-b) = zoo \
+  && exit 9
 '
 
 if test "x$1" = "x--no-reexec"; then
   shift
 else
-  for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
-  do
-    test "$re_shell_" = no_shell && continue
-    test "$re_shell_" = fail && skip_ failed to find an adequate shell
-    if "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null; then
-      exec "$re_shell_" "$0" --no-reexec "$@"
-      echo "$ME_: exec failed" 1>&2
-      exit 127
-    fi
-  done
+  # 'eval'ing the above code makes Solaris 10's /bin/sh exit with $? set to 2.
+  # It does not evaluate any of the code after the "unexpected" `('.  Thus,
+  # we must run it in a subshell.
+  ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1
+  if test $? = 9; then
+    : # The current shell is adequate.  No re-exec required.
+  else
+    # Search for a shell that meets our requirements.
+    for re_shell_ in "${CONFIG_SHELL:-no_shell}" /bin/sh bash dash zsh pdksh fail
+    do
+      test "$re_shell_" = no_shell && continue
+      test "$re_shell_" = fail && skip_ failed to find an adequate shell
+      "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null
+      if test $? = 9; then
+        # Found an acceptable shell.
+        exec "$re_shell_" "$0" --no-reexec "$@"
+        echo "$ME_: exec failed" 1>&2
+        exit 127
+      fi
+    done
+  fi
 fi
 
 test -n "$EXEEXT" && shopt -s expand_aliases
 
+# Enable glibc's malloc-perturbing option.
+# This is cheap and useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+: ${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
 # We use a trap below for cleanup.  This requires us to go through
 # hoops to get the right exit status transported through the handler.
 # So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
@@ -114,9 +143,9 @@ framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 1; }
 # a partition, or to undo any other global state changes.
 cleanup_() { :; }
 
-if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
   compare() { diff -u "$@"; }
-elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then
   compare() { cmp -s "$@"; }
 else
   compare() { cmp "$@"; }

commit bd5754769fa6435a0166192ca1cca531c500694b
Author: Jim Meyering <meyering at redhat.com>
Date:   Wed May 26 11:29:56 2010 +0200

    build: use gettext-0.17
    
    * configure.ac: Use gettext-0.17.
    * bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
    since the latter drags in a depedency on gettext 0.18.

diff --git a/bootstrap.conf b/bootstrap.conf
index 4ca51a7..9907304 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -34,7 +34,7 @@ gnulib_modules="
 	dirname
 	fdl
 	fsync
-	gettext
+	gettext-h
 	git-version-gen
 	gitlog-to-changelog
 	gnu-web-doc-update
diff --git a/configure.ac b/configure.ac
index ceecacf..9ae5783 100644
--- a/configure.ac
+++ b/configure.ac
@@ -295,7 +295,7 @@ libraries.)
 fi
 AM_PROG_LIBTOOL
 
-AM_GNU_GETTEXT_VERSION([0.15])
+AM_GNU_GETTEXT_VERSION([0.18])
 AM_GNU_GETTEXT([external])
 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
 	AC_MSG_ERROR([

commit 656833e1548f455939df72d6c6769ba5ce90538e
Author: Jim Meyering <meyering at redhat.com>
Date:   Tue May 25 15:42:35 2010 +0200

    fix typo in comment

diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index cb51491..f66ca47 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1852,7 +1852,7 @@ _logical_min_start_head (const PedPartition* part,
 
 /* Shamelessly copied and adapted from _partition_get_overlap_constraint
  * (in disk.c)
- * This should get ride of the infamous Assertion (metadata_length > 0) failed
+ * This should get rid of the infamous Assertion (metadata_length > 0) failed
  * bug for extended msdos disklabels generated by Parted.
  * 1) There always is a partition table at the start of ext_part, so we leave
  *    a one sector gap there.



More information about the Parted-commits mailing list