Bug#204894: dpkg-dev breaks if _POSIX2_VERSION=200111 with recent coreutils
Package: dpkg-dev
Version: 1.10.10
POSIX 1003.1-2001 has removed support for commands like
"head -1" (you are supposed to use "head -n 1") and
"tail -40" (you are supposed to use "tail -n 40").
dpkg-dev still uses the old forms, which don't work any more on some
strict POSIX hosts (e.g., GNU coreutils with _POSIX2_VERSION=200111
in your environment).
Also, I noticed that dpkg-dev uses the -a option of test. This isn't
allowed on strict POSIX 1003.1-2001 hosts; you're supposed to use &&
in the shell instead. Similarly, dpkg-dev uses egrep, even though
POSIX has removed that command (you're supposed to use "grep -E").
This stuff still works with Debian but I figured I could submit
patches for that too, while I was at it.
diff -pru dpkg-1.10.10/automake/tools.m4 dpkg-1.10.10-fix/automake/tools.m4
--- dpkg-1.10.10/automake/tools.m4 1999-01-29 00:53:59.000000000 -0800
+++ dpkg-1.10.10-fix/automake/tools.m4 2003-08-10 21:43:21.000000000 -0700
@@ -18,13 +18,13 @@ AC_BEFORE([AC_CANONICAL_HOST])
AC_BEFORE([AC_CANONICAL_BUILD])
dnl Quick check
if test "$host_alias" = ""; then
- if test $host = NONE -a $build != NONE; then
+ if test $host = NONE && test $build != NONE; then
thost=$nonopt
else
thost=$host
fi
- if test $thost != $build -a $thost != NONE; then
+ if test $thost != $build && test $thost != NONE; then
ac_tool_prefix=${thost}-
ac_tool_dir=${thost}
else
@@ -54,8 +54,8 @@ AC_DEFUN(tl_CHECK_TOOL,
AC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2,
ifelse([$3], , [$2], ), $4, $5)
if test "$ac_tool_dir" != ""; then
- if test -z "$ac_cv_prog_$1" -a "$5" != "/usr/${ac_tool_dir}/bin/$2" -a \
- "$5" != "/usr/local/${ac_tool_dir}/bin/$2"; then
+ if test -z "$ac_cv_prog_$1" && test "$5" != "/usr/${ac_tool_dir}/bin/$2" &&
+ test "$5" != "/usr/local/${ac_tool_dir}/bin/$2"; then
if test -f /usr/${ac_tool_dir}/bin/$2; then $1="/usr/${ac_tool_dir}/bin/$2"
elif test -f /usr/local/${ac_tool_dir}/bin/$2; then $1="/usr/local/${ac_tool_dir}/bin/$2"
fi
@@ -100,8 +100,9 @@ if test -z "$CC"; then
AC_CHECK_TOOL(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
-if test -n "$ac_tool_prefix" -a "`echo $CC | grep '$ac_tool_prefix'`" = "" \
- -a "`echo $CC | grep -- '-b'`" = ""; then
+if test -n "$ac_tool_prefix" &&
+ test "`echo $CC | grep '$ac_tool_prefix'`" = "" &&
+ test "`echo $CC | grep -- '-b'`" = ""; then
if $CC -v 2>&1 | grep -q gcc; then
AC_CACHE_CHECK([if $CC -b${ac_tool_dir} works], tl_cv_prog_cc_bhost,[
old_cc="${CC}"
@@ -151,8 +152,9 @@ AC_DEFUN(tl_PROG_CXX,
AC_PROVIDE([AC_PROG_CXX])dnl
tl_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
if test -n "$CXX"; then
- if test -n "$ac_tool_prefix" -a "`echo $CXX | grep '$ac_tool_prefix'`" = "" \
- -a "`echo $CXX | grep -- '-b'`" = ""; then
+ if test -n "$ac_tool_prefix" &&
+ test "`echo $CXX | grep '$ac_tool_prefix'`" = "" &&
+ test "`echo $CXX | grep -- '-b'`" = ""; then
if $CXX -v 2>&1 | grep -q gcc; then
AC_CACHE_CHECK([if $CXX -b${ac_tool_dir} works], tl_cv_prog_cxx_bhost,[
old_cxx="${CXX}"
diff -pru dpkg-1.10.10/dselect/Makefile.in dpkg-1.10.10-fix/dselect/Makefile.in
--- dpkg-1.10.10/dselect/Makefile.in 2002-05-19 21:40:26.000000000 -0700
+++ dpkg-1.10.10-fix/dselect/Makefile.in 2003-08-10 21:37:54.000000000 -0700
@@ -58,7 +58,7 @@ $(srcdir)/helpmsgs.h $(srcdir)/helpmsgs.
curkeys.h: keyoverride $(srcdir)/mkcurkeys.pl
cursesfile=`echo '#include <curses.h>' | \
- $(CC) -E - | grep 'curses.h' | head -1 | \
+ $(CC) -E - | grep 'curses.h' | head -n 1 | \
$(SED) -e 's/^[^"]*"//; s/".*$$//'`; \
if [ "$$cursesfile" = "" ]; then echo "can't find curses file"; exit 1; fi; \
perl $(srcdir)/mkcurkeys.pl $< $$cursesfile > $@
diff -pru dpkg-1.10.10/methods/disk.setup dpkg-1.10.10-fix/methods/disk.setup
--- dpkg-1.10.10/methods/disk.setup 2000-12-24 00:41:48.000000000 -0800
+++ dpkg-1.10.10-fix/methods/disk.setup 2003-08-10 21:43:21.000000000 -0700
@@ -166,7 +166,7 @@ then
do
echo \
'Several CD-ROMs (or other ISO9660 filesystems) are mounted:'
- egrep 'type iso9660 \([^)]*\)$' <$tp.m | nl
+ grep 'type iso9660 ([^)]*)$' <$tp.m | nl
echo -n \
'Is it any of these ? Type a number, or `n'\'' for none. '
read response
@@ -422,7 +422,7 @@ check_binary () {
fi
if ! ( find "$mountpoint$2/" -follow -name '*.deb' -print \
- | head -1 ) 2>/dev/null | grep . >/dev/null
+ | head -n 1 ) 2>/dev/null | grep . >/dev/null
then
echo "\`$2' does not contain any *.deb packages. Hmmpf."
return
diff -pru dpkg-1.10.10/scripts/dpkg-parsechangelog.pl dpkg-1.10.10-fix/scripts/dpkg-parsechangelog.pl
--- dpkg-1.10.10/scripts/dpkg-parsechangelog.pl 2001-03-04 06:39:06.000000000 -0800
+++ dpkg-1.10.10-fix/scripts/dpkg-parsechangelog.pl 2003-08-10 21:38:06.000000000 -0700
@@ -51,7 +51,7 @@ $changelogfile= "./$changelogfile" if $c
if (not $force and $changelogfile ne "-") {
open(STDIN,"< $changelogfile") ||
&error("cannot open $changelogfile to find format: $!");
- open(P,"tail -40 |") || die "cannot fork: $!\n";
+ open(P,"tail -n 40 |") || die "cannot fork: $!\n";
while(<P>) {
next unless m/\schangelog-format:\s+([0-9a-z]+)\W/;
$format=$1;
diff -pru dpkg-1.10.10/scripts/dpkg-source.pl dpkg-1.10.10-fix/scripts/dpkg-source.pl
--- dpkg-1.10.10/scripts/dpkg-source.pl 2002-07-04 17:36:28.000000000 -0700
+++ dpkg-1.10.10-fix/scripts/dpkg-source.pl 2003-08-10 21:43:21.000000000 -0700
@@ -1005,7 +1005,7 @@ sub extracttar {
}
sub cpiostderr {
- open(STDERR,"| egrep -v '^[0-9]+ blocks\$' >&2") ||
+ open(STDERR,"| grep -E -v '^[0-9]+ blocks\$' >&2") ||
&syserr("reopen stderr for tar to grep out blocks message");
}
Reply to: