[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Wed Jun 27 09:33:37 UTC 2007
configure.ac | 39 ++++++++++++++++++++++++++++++++++++---
parted/ui.c | 10 ++++++++--
tests/t0000-basic.sh | 2 +-
tests/t0100-print.sh | 10 ++++++++--
4 files changed, 53 insertions(+), 8 deletions(-)
New commits:
commit 4ddfb17fb12cde5802545b6fcdae08300341be27
Author: Jim Meyering <jim at meyering.net>
Date: Fri Jun 22 19:44:27 2007 +0200
Avoid test failure on Linux-2.6.8 due to too small underlying file.
Overwrite the label creating a 4KB file; 1KB was too small and would
trigger the failure. Reported by Bob Proulx.
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 83abcea..317ba03 100755
--- a/tests/t0000-basic.sh
+++ b/tests/t0000-basic.sh
@@ -50,7 +50,7 @@ test_expect_success 'expect no output' '$compare out /dev/null'
test_expect_success \
'erase the left-over label' \
- 'dd if=/dev/zero of=$dev bs=1K count=1 2> /dev/null'
+ 'dd if=/dev/zero of=$dev bs=4K count=1 2> /dev/null'
# First iteration works with no prompting, since there is no preexisting label.
test_expect_success \
commit 27feb3d008c637ed96d1d77bd017cbc6a8070157
Author: Jim Meyering <jim at meyering.net>
Date: Fri Jun 22 16:30:16 2007 +0200
Work around test failures caused by inadequate libreadline.
* configure.ac: Reject an inadequate libreadline5.0.
* parted/ui.c (_readline) [!HAVE_LIBREADLINE]: Echo each
just-read line, to be consistent with libreadline5.2.
Signed-off-by: Jim Meyering <jim at meyering.net>
diff --git a/configure.ac b/configure.ac
index b21be56..6d1b93f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -307,13 +307,13 @@ fi
dnl Check for readline
dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
-dnl Fedora) is left with
+dnl Fedora) is left with
if test "$with_readline" = yes; then
OLD_LIBS="$LIBS"
LIBS="$LIBS $PARTED_LIBS"
+ found_working_libreadline=no
AC_CHECK_LIB(readline, readline,
- PARTED_LIBS="-lreadline $PARTED_LIBS"
- AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline]),
+ found_working_libreadline=yes,
AC_MSG_ERROR(
GNU Readline could not be found which is required for the
--with-readline (which is enabled by default). Either disable readline support with
@@ -326,6 +326,39 @@ package as well (which may be called readline-devel or something similar).
$PARTED_LIBS
)
LIBS="$OLD_LIBS"
+
+ # See if libreadline is too old to be used.
+ # The readline function in Debian's libreadline5 5.0-10 fails to
+ # print to stdout the response (from stdin) to a prompt, when stdout
+ # is redirected, while 5.2-3 works fine. That failure would cause
+ # several of parted's tests to failure.
+ # The purist approach would be to write a run-test, but that's
+ # not friendly to cross-compilers, so here's a compromise:
+ #
+ # See if libreadline defines one of these symbols:
+ # [this is the list of public symbols that are in 5.2, but not 5.0]
+ #
+ # $ diff -u /tmp/readline-5.[02]|grep '+T.[^_]'
+ # +T rl_vi_rubout
+ # +T rl_variable_value
+ # +T rl_reset_screen_size
+ # +T alloc_history_entry
+ # +T copy_history_entry
+ # +T replace_history_data
+ #
+ # If not, then reject this readline lib.
+ AC_CHECK_LIB([readline], [rl_variable_value],
+ ,
+ AC_MSG_ERROR(
+Your version of libreadline is too old to be used.
+Consider upgrading to version 5.2 or newer.)
+ found_working_libreadline=no,
+ $PARTED_LIBS)
+
+ if test $found_working_libreadline = yes; then
+ PARTED_LIBS="-lreadline $PARTED_LIBS"
+ AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline]),
+ fi
fi
AC_SUBST(PARTED_LIBS)
diff --git a/parted/ui.c b/parted/ui.c
index 58e4563..9828b1a 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -563,9 +563,15 @@ _readline (const char* prompt, const StrList* possibilities)
fputs (prompt, stdout);
fflush (stdout);
line = (char*) malloc (256);
- if (fgets (line, 256, stdin) && strcmp (line, "") != 0)
+ if (fgets (line, 256, stdin) && strcmp (line, "") != 0) {
+#ifndef HAVE_LIBREADLINE
+ /* Echo the input line, to be consistent with
+ how readline-5.2 works. */
+ fputs (line, stdout);
+ fflush (stdout);
+#endif
line [strlen (line) - 1] = 0; /* kill trailing CR */
- else {
+ } else {
free (line);
line = NULL;
}
commit a508e9e46a173252e34a150968e899ad7d766792
Author: Jim Meyering <jim at meyering.net>
Date: Fri Jun 22 16:01:59 2007 +0200
Avoid mklabel test failure with very small file on Linux-2.6.8.
Signed-off-by: Jim Meyering <jim at meyering.net>
diff --git a/tests/t0100-print.sh b/tests/t0100-print.sh
index 74c478e..cbb7f75 100755
--- a/tests/t0100-print.sh
+++ b/tests/t0100-print.sh
@@ -25,9 +25,15 @@ dev=loop-file
msdos_magic='\x55\xaa'
+# The extra 3KB+ zero bytes at the end are to avoid triggering a failure
+# on linux-2.6.8 that's probably related to opening with O_DIRECT.
+# Note that the minimum number of appended zero bytes required to avoid
+# the failure was 3465. Here, we append a little more to make the resulting
+# file have a total size of exactly 4kB.
test_expect_success \
"setup: create the most basic partition table, manually" \
- '{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"; } > $dev'
+ '{ dd if=/dev/zero bs=510 count=1; printf "$msdos_magic"
+ dd if=/dev/zero bs=3584 count=1; } > $dev'
test_expect_success \
'print the empty table' \
@@ -39,7 +45,7 @@ fail=0
{
cat <<EOF
Model: (file)
-Disk .../$dev: 512B
+Disk .../$dev: 4096B
Sector size (logical/physical): 512B/512B
Partition Table: msdos
More information about the Parted-commits
mailing list