[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Fri Aug 8 13:36:30 UTC 2008
bootstrap | 65 ++++++++++++++++++++++++++-----------------------
libparted/arch/linux.c | 14 ++++++++--
maint.mk | 31 +++++++++++++++++++++++
tests/Makefile.am | 3 +-
tests/t8000-loop.sh | 55 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 134 insertions(+), 34 deletions(-)
New commits:
commit 6d554314e220166680f3db5ec372f2df0e7a8976
Author: Jim Meyering <meyering at redhat.com>
Date: Thu Aug 7 22:32:17 2008 +0200
update build/test infrastructure from coreutils
* bootstrap: Update from coreutils.
* maint.mk: Likewise.
diff --git a/bootstrap b/bootstrap
index 52d63f2..c834c59 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,7 +2,7 @@
# Bootstrap this package from checked-out sources.
-# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003-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
@@ -26,6 +26,8 @@ nl='
LC_ALL=C
export LC_ALL
+local_gl_dir=gl
+
# Temporary directory names.
bt='._bootmp'
bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
@@ -94,6 +96,11 @@ package=`sed -n "$extract_package_name" configure.ac` || exit
gnulib_name=lib$package
build_aux=build-aux
+source_base=lib
+m4_base=m4
+doc_base=doc
+tests_base=tests
+
# Extra files from gnulib, which override files from other sources.
gnulib_extra_files="
$build_aux/install-sh
@@ -119,6 +126,9 @@ XGETTEXT_OPTIONS='\\\
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
'
+# Package bug report address for gettext files
+MSGID_BUGS_ADDRESS=bug-$package at gnu.org
+
# Files we don't want to import.
excluded_files=
@@ -155,7 +165,7 @@ do
usage
exit;;
--gnulib-srcdir=*)
- GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
+ GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
--skip-po)
SKIP_PO=t;;
--force)
@@ -223,7 +233,7 @@ case ${GNULIB_SRCDIR--} in
trap cleanup_gnulib 1 2 13 15
- git clone --depth 1 git://git.sv.gnu.org/gnulib ||
+ git clone --depth 2 git://git.sv.gnu.org/gnulib ||
cleanup_gnulib
trap - 1 2 13 15
@@ -263,7 +273,7 @@ update_po_files() {
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
test "$langs" = '*' && langs=x
- for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
+ for po in $langs; do
case $po in x) continue;; esac
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
@@ -404,7 +414,9 @@ version_controlled_file() {
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
elif test -d .git; then
- git-rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
+ git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
+ elif test -d .svn; then
+ svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
else
echo "$0: no version control for $dir/$file?" >&2
fi
@@ -486,11 +498,11 @@ gnulib_tool_options="\
--import\
--no-changelog\
--aux-dir $bt/$build_aux\
- --doc-base $bt/doc\
+ --doc-base $bt/$doc_base\
--lib $gnulib_name\
- --m4-base $bt/m4/\
- --source-base $bt/lib/\
- --tests-base $bt/tests\
+ --m4-base $bt/$m4_base/\
+ --source-base $bt/$source_base/\
+ --tests-base $bt/$tests_base\
--local-dir $local_gl_dir\
$gnulib_tool_option_extras\
"
@@ -513,28 +525,21 @@ if test $with_gettext = yes; then
cp configure.ac $bt2 &&
(cd $bt2 && autopoint && rm configure.ac) &&
slurp $bt2 $bt || exit
-
- rm -fr $bt $bt2 || exit
fi
+rm -fr $bt $bt2 || exit
+
+# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
+# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
+# The following requires GNU find 4.2.3 or newer. Considering the usual
+# portability constraints of this script, that may seem a very demanding
+# requirement, but it should be ok. Ignore any failure, which is fine,
+# since this is only a convenience to help developers avoid the relatively
+# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
+# between successive runs of this script.
+find "$m4_base" "$source_base" \
+ -depth \( -name '*.m4' -o -name '*.[ch]' \) \
+ -type l -xtype l -delete > /dev/null 2>&1
-# Coreutils is unusual in that it generates some of its test-related
-# Makefile.am files. That must be done before invoking automake.
-mam_template=tests/Makefile.am.in
-if test -f $mam_template; then
- PERL=perl
- for tool in cut head join pr sort tac tail test tr uniq wc; do
- m=tests/$tool/Makefile.am
- t=${m}t
- rm -f $m $t
- sed -n '1,/^##test-files-begin/p' $mam_template > $t
- echo "x = $tool" >> $t
- srcdir=tests/$tool
- $PERL -I$srcdir -w -- tests/mk-script $srcdir --list >> $t
- sed -n '/^##test-files-end/,$p' $mam_template >> $t
- chmod -w $t
- mv $t $m
- done
-fi
# Reconfigure, getting other files.
@@ -571,7 +576,7 @@ if test $with_gettext = yes; then
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
- /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
+ /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
diff --git a/maint.mk b/maint.mk
index 19b0f3d..64e8deb 100644
--- a/maint.mk
+++ b/maint.mk
@@ -667,6 +667,7 @@ cvs-check: vc-diff-check
maintainer-distcheck:
$(MAKE) distcheck
+ $(MAKE) taint-distcheck
$(MAKE) my-distcheck
@@ -697,6 +698,36 @@ TMPDIR ?= /tmp
t=$(TMPDIR)/$(PACKAGE)/test
pfx=$(t)/i
+# More than once, tainted build and source directory names would
+# have caused at least one "make check" test to apply "chmod 700"
+# to all directories under $HOME. Make sure it doesn't happen again.
+tp := $(shell echo "$(TMPDIR)/$(PACKAGE)-$$$$")
+t_prefix = $(tp)/a
+t_taint = '$(t_prefix) b'
+fake_home = $(tp)/home
+
+# Ensure that tests run from tainted build and src dir names work,
+# and don't affect anything in $HOME. Create witness files in $HOME,
+# record their attributes, and build/test. Then ensure that the
+# witnesses were not affected.
+taint-distcheck: $(DIST_ARCHIVES)
+ test -d $(t_taint) && chmod -R 700 $(t_taint) || :
+ -rm -rf $(t_taint) $(fake_home)
+ mkdir -p $(t_prefix) $(t_taint) $(fake_home)
+ GZIP=$(GZIP_ENV) $(AMTAR) -C $(t_taint) -zxf $(distdir).tar.gz
+ mkfifo $(fake_home)/fifo
+ touch $(fake_home)/f
+ mkdir -p $(fake_home)/d/e
+ ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-before
+ cd $(t_taint)/$(distdir) \
+ && ./configure \
+ && $(MAKE) \
+ && HOME=$(fake_home) $(MAKE) check \
+ && ls -lR $(fake_home) $(t_prefix) > $(tp)/.ls-after \
+ && diff $(tp)/.ls-before $(tp)/.ls-after \
+ && test -d $(t_prefix)
+ rm -rf $(tp)
+
# Verify that a twisted use of --program-transform-name=PROGRAM works.
define install-transform-check
echo running install-transform-check \
commit e5dd3b175ae3bffe6aa436a1ff41d5c2d6f36672
Author: Soren Hansen <soren at canonical.com>
Date: Wed Aug 6 20:15:00 2008 +0200
add a test for recently introduced loop-dev-based bug
This also checks for the current behavior when trying to partition
a device that may not be partitioned, like loop devices.
* tests/Makefile.am (TESTS): Add tests/t8000-loop.sh.
* tests/t8000-loop.sh: New file. Test for the above fix.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b9db0b1..1c8c753 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,7 +14,8 @@ TESTS = \
t4200-partprobe.sh \
t5000-tags.sh \
t6000-dm.sh \
- t7000-scripting.sh
+ t7000-scripting.sh \
+ t8000-loop.sh
EXTRA_DIST = \
$(TESTS) test-lib.sh lvm-utils.sh
diff --git a/tests/t8000-loop.sh b/tests/t8000-loop.sh
new file mode 100755
index 0000000..016c715
--- /dev/null
+++ b/tests/t8000-loop.sh
@@ -0,0 +1,55 @@
+#!/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='Test usage of loop devices'
+
+privileges_required_=1
+device_mapper_required_=1
+
+: ${srcdir=.}
+. $srcdir/test-lib.sh
+
+cleanup_() {
+ test -n "$d1" && losetup -d "$d1"
+ rm -f "$f1";
+}
+
+emit_expected_diagnostic()
+{
+ printf '%s\n' \
+ 'Error: Error informing the kernel about modifications to partiti' \
+ 'Warning: The kernel was unable to re-read the partition table on'
+}
+
+test_expect_success \
+ "setup: create loop devices" \
+ 'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1")'
+
+test_expect_success \
+ 'run parted -s "$d1" mklabel msdos' \
+ 'parted -s $d1 mklabel msdos > out 2>&1'
+test_expect_success 'check for empty output' '$compare out /dev/null'
+
+test_expect_failure \
+ 'run parted -s "$d1" mkpart primary 1 10' \
+ 'parted -s $d1 mkpart primary 1 10 > out 2>&1'
+test_expect_success 'prepare actual/expected output' \
+ 'emit_expected_diagnostic > exp &&
+ cut -b1-64 out > k && mv k out'
+test_expect_success 'check for expected output' '$compare exp out'
+
+test_done
commit 1742b051d78493b90bcb801e68a2be0277bcf72f
Author: Jim Meyering <meyering at redhat.com>
Date: Wed Aug 6 19:31:16 2008 +0200
don't exhaust virtual memory for mklabel on a loopback device
Report and analysis by Soren Hansen <soren at canonical.com>:
"""When ped_disk_get_last_partition_num(disk) fails (which it does if
disk is a loopback device), it returns -1. This in turn would cause
_disk_sync_part_table and _dm_reread_part_table to attempt to malloc
a sizeof(int)*-1, which instantly causes a 'Fatal: Out of memory'."""
* libparted/arch/linux.c (_disk_sync_part_table): Handle the case in
which ped_disk_get_last_partition_num(disk) fails.
(_dm_reread_part_table): Likewise.
This bug was introduced by f6bd20573e3ecfb63f62d88c52a0870fb8851b59.
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 75e709b..333f818 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2211,11 +2211,15 @@ _blkpg_remove_partition (PedDisk* disk, int n)
static int
_disk_sync_part_table (PedDisk* disk)
{
- int i;
- int last = PED_MIN (ped_disk_get_last_partition_num (disk), 16);
+ int largest_partnum = ped_disk_get_last_partition_num (disk);
+ if (largest_partnum <= 0)
+ return 1;
+
+ int last = PED_MIN (largest_partnum, 16);
int* rets = ped_malloc(sizeof(int) * last);
int* errnums = ped_malloc(sizeof(int) * last);
int ret = 1;
+ int i;
for (i = 1; i <= last; i++) {
rets[i - 1] = _blkpg_remove_partition (disk, i);
@@ -2433,8 +2437,12 @@ err:
static int
_dm_reread_part_table (PedDisk* disk)
{
+ int largest_partnum = ped_disk_get_last_partition_num (disk);
+ if (largest_partnum <= 0)
+ return 1;
+
int rc = 1;
- int last = PED_MIN (ped_disk_get_last_partition_num (disk), 16);
+ int last = PED_MIN (largest_partnum, 16);
int i;
sync();
More information about the Parted-commits
mailing list