[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-54-g522101
From: |
Mats Erik Andersson |
Subject: |
[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-54-g522101f |
Date: |
Sat, 11 Jan 2020 06:05:08 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".
The branch, master has been updated
via 522101f499c0262d702e6aaf2f1165b1616bc45e (commit)
from 1480573a908254662074865406ac6fbde4694e5d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=522101f499c0262d702e6aaf2f1165b1616bc45e
commit 522101f499c0262d702e6aaf2f1165b1616bc45e
Author: Mats Erik Andersson <address@hidden>
Date: Sat Jan 11 12:01:02 2020 +0100
Consistent use of grep tools in scripts.
Lack of consistency surfaced as a portability issue for Solaris 11.
Reported by Bruno Haible for release candidate.
diff --git a/ChangeLog b/ChangeLog
index 18f4c04..d1e49ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2020-01-11 Mats Erik Andersson <address@hidden>
+
+ Consistent use of `grep' tools in scripts.
+
+ * configure.ac (EGREP, FGREP): New and precious variables.
+ * tests/Makefile.am (tools_subst): Replace @EGREP@ and @FGREP@.
+ * tests/ftp-parser.sh (reply): Use $EGREP to detect size in answer,
+ and apply a single, alternating regex.
+ * tests/ifconfig_modes.sh: Replace all `grep' by $GREP.
+ * tests/inetd.sh: Likewise.
+ * tests/libls.sh: Likewise. Drop unused `-e' flag.
+ * tests/syslogd.sh: Likewise. Use `$FGREP -f' instead of
+ non-portable `$GREP -f'. In two cases where `grep' needed
+ multiple regexes, use $EGREP and alternating regexes.
+ * tests/tools.sh.in (EGREP, FGREP): New variables.
+
2020-01-01 Simon Josefsson <address@hidden>
telnet: Validate supplied environment variables. CVE-2019-0053
diff --git a/configure.ac b/configure.ac
index e92c816..0a45381 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,6 +135,8 @@ AC_PATH_PROG(MKTEMP, mktemp, mktemp)
AC_PATH_PROG(NETSTAT, netstat, netstat)
AC_PATH_PROG(RM, rm, rm)
AC_PROG_CPP
+AC_PROG_EGREP
+AC_PROG_FGREP
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB
@@ -143,6 +145,8 @@ AC_PROG_LN_S
AC_PROG_SED
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
AC_ARG_VAR(GREP, [Location of preferred 'grep' utility.])
+AC_ARG_VAR(EGREP, [Location of preferred 'egrep' utility.])
+AC_ARG_VAR(FGREP, [Location of preferred 'fgrep' utility.])
AC_ARG_VAR(SED, [Location of preferred 'sed' utility.])
AC_ARG_VAR(DD, [Location of 'dd'.])
AC_ARG_VAR(MKTEMP, [Location of 'mktemp'.])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8dd6324..817a808 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -97,6 +97,8 @@ BUILT_SOURCES = tools.sh
CLEANFILES = tools.sh
tools_subst = sed -e 's,[@]GREP[@],$(GREP),g' \
+ -e 's,[@]EGREP[@],$(EGREP),g' \
+ -e 's,[@]FGREP[@],$(FGREP),g' \
-e 's,[@]SED[@],$(SED),g' \
-e 's,[@]DD[@],$(DD),g' \
-e 's,[@]MKTEMP[@],$(MKTEMP),g' \
diff --git a/tests/ftp-parser.sh b/tests/ftp-parser.sh
index eec6c2c..e95bc5d 100755
--- a/tests/ftp-parser.sh
+++ b/tests/ftp-parser.sh
@@ -77,7 +77,7 @@ test $reply -eq 0 || { errno=1
#
tell='hash 7M
hash 12k'
-reply=`echo "$tell" | $FTP -v | $GREP -c -e 12288 -e 7340032`
+reply=`echo "$tell" | $FTP -v | $EGREP -c '12288|7340032'`
test $reply -eq 2 || { errno=1
echo >&2 'Failed to parse step sizes for hash printing.'; }
diff --git a/tests/ifconfig_modes.sh b/tests/ifconfig_modes.sh
index 3ea8dcf..cbd8521 100644
--- a/tests/ifconfig_modes.sh
+++ b/tests/ifconfig_modes.sh
@@ -127,7 +127,7 @@ make_setup () {
# Change setup whenever the address is in use.
get_gnu_output |
- grep "inet address $ADDRESS1_PATTERN" >/dev/null 2>&1 &&
+ $GREP "inet address $ADDRESS1_PATTERN" >/dev/null 2>&1 &&
ADDRESS=$ADDRESS2 ADDRESS_PATTERN=$ADDRESS2_PATTERN \
BRDADDR=$BRDADDR2 BRDADDR_PATTERN=$BRDADDR2_PATTERN \
NETMASK=$NETMASK2 NETMASK_HEX=$NETMASK2_HEX \
@@ -148,7 +148,7 @@ increase_status () {
check_output () {
echo "$OUTPUT" |
- grep "$1" > /dev/null || { echo >&2 "$2"; increase_status; }
+ $GREP "$1" > /dev/null || { echo >&2 "$2"; increase_status; }
}
#
@@ -162,8 +162,8 @@ $silence cat <<-HERE
$IFCONFIG -i $IFACE --down >/dev/null
OUTPUT=`get_gnu_output`
-echo "$OUTPUT" | grep flags |
- grep -v "flags UP" >/dev/null ||
+echo "$OUTPUT" | $GREP flags |
+ $GREP -v "flags UP" >/dev/null ||
{ echo >&2 'Failed to bring interface down with switch.'
increase_status
}
@@ -197,7 +197,7 @@ check_output "flags UP" \
# Diagnose a failure to implicitly bring the interface up.
#
echo "$OUTPUT" |
- grep "flags UP" >/dev/null 2>&1 ||
+ $GREP "flags UP" >/dev/null 2>&1 ||
{
$silence cat <<-HERE
** Set only address and explicit 'up' switches:
@@ -212,7 +212,7 @@ echo "$OUTPUT" |
# As a last resort, try a single imperative 'up'.
echo "$OUTPUT" |
- grep "flags UP" >/dev/null 2>&1 ||
+ $GREP "flags UP" >/dev/null 2>&1 ||
{
$silence cat <<-HERE
** Apply a single switch:
@@ -222,7 +222,7 @@ echo "$OUTPUT" |
$IFCONFIG --interface=$IFACE --up >/dev/null
OUTPUT=`get_gnu_output`
- if echo "$OUTPUT" | grep "flags UP" >/dev/null 2>&1
+ if echo "$OUTPUT" | $GREP "flags UP" >/dev/null 2>&1
then
echo >&2 '!!! This platform needs "--up" in splendid isolation.'
else
@@ -263,8 +263,8 @@ $IFCONFIG --interface=$IFACE --down >/dev/null
OUTPUT=`get_gnu_output`
# The absence of the flag UP indicates success.
-echo "$OUTPUT" | grep flags |
- grep -v "flags UP" >/dev/null ||
+echo "$OUTPUT" | $GREP flags |
+ $GREP -v "flags UP" >/dev/null ||
{ echo >&2 'Failed to bring interface down with "--down".'
increase_status
}
@@ -293,8 +293,8 @@ $silence cat <<-HERE
$IFCONFIG $IFACE down >/dev/null
OUTPUT=`get_gnu_output`
-echo "$OUTPUT" | grep flags |
- grep -v "flags UP" >/dev/null ||
+echo "$OUTPUT" | $GREP flags |
+ $GREP -v "flags UP" >/dev/null ||
{ echo >&2 'Failed to bring interface down with directive.'
increase_status
}
@@ -327,7 +327,7 @@ check_output "flags UP" \
# Diagnose this last failure.
#
echo "$OUTPUT" |
- grep "flags UP" >/dev/null 2>&1 ||
+ $GREP "flags UP" >/dev/null 2>&1 ||
{
$silence cat <<-HERE
** Set only address and explicit 'up' switches:
@@ -342,7 +342,7 @@ echo "$OUTPUT" |
# As a last resort, try a single imperative 'up'.
echo "$OUTPUT" |
- grep "flags UP" >/dev/null 2>&1 ||
+ $GREP "flags UP" >/dev/null 2>&1 ||
{
$silence cat <<-HERE
** Apply a single switch:
@@ -352,7 +352,7 @@ echo "$OUTPUT" |
$IFCONFIG $IFACE up >/dev/null
OUTPUT=`get_gnu_output`
- if echo "$OUTPUT" | grep "flags UP" >/dev/null 2>&1
+ if echo "$OUTPUT" | $GREP "flags UP" >/dev/null 2>&1
then
echo >&2 '!!! This platform needs specific "ifconfig '$IFACE'
up".'
else
diff --git a/tests/inetd.sh b/tests/inetd.sh
index fe39360..e1d78ba 100755
--- a/tests/inetd.sh
+++ b/tests/inetd.sh
@@ -170,7 +170,7 @@ else
for nn in 1 2 3 4 5; do
# Check for response at chosen port.
$TCPGET $TARGET $PORT 2>/dev/null |
- grep "Your address is $TARGET." >/dev/null 2>&1 || errno=1
+ $GREP "Your address is $TARGET." >/dev/null 2>&1 || errno=1
test $errno -eq 0 ||
{ cat >&2 <<-EOT
diff --git a/tests/libls.sh b/tests/libls.sh
index 64902cb..d379cdb 100755
--- a/tests/libls.sh
+++ b/tests/libls.sh
@@ -85,7 +85,7 @@ errno=0
diff=`{ echo "$REPLY_a1"; echo "$REPLY_A1"; } | sort | uniq -u`
test `echo "$diff" | wc -l` -eq 2 &&
-test `echo "$diff" | grep -c -v -e '^\.\{1,2\}$'` -eq 0 ||
+test `echo "$diff" | $GREP -c -v '^[.]\{1,2\}$'` -eq 0 ||
{ errno=1; echo >&2 'Failed to tell switch -a apart from -A.'
# Attempt a diagnosis.
if test -z "$diff"; then
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index 8a1e964..563b516 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -591,7 +591,7 @@ COUNT=`$GREP -c "$TAG" "$OUT"`
# All notices in $OUT_NOTICE should be present also in $OUT.
# Assign value 1 to full outcome.
COUNT_NOTICE=`$SED -n '$=' "$OUT_NOTICE"`
-wrapped=`$GREP -c -f "$OUT_NOTICE" "$OUT"`
+wrapped=`$FGREP -c -f "$OUT_NOTICE" "$OUT"`
COUNT_WRAP=0
if $do_unix_socket || $do_inet_socket; then
@@ -601,9 +601,7 @@ fi
# Second set-up after SIGHUP.
COUNT2=`$GREP -c "$TAG2" "$OUT_USER"`
COUNT3=`$GREP -c "$TAG2" "$OUT_DEBUG"`
-COUNT4=`$GREP -c -e "$TAG2.*Default facility" \
- -e "$TAG2.*Fake kern facility" \
- -e "$TAG2.*Illegal facility" \
+COUNT4=`$EGREP -c "$TAG2.*(Default|Fake kern|Illegal) facility" \
"$OUT_UNOTICE"`
COUNT5=`$GREP -c "$TAG2" "$OUT_LOCAL0"`
@@ -614,7 +612,7 @@ COUNT2_debug=`$GREP -c "$TAG2.*user.debug" "$OUT_USER"`
COUNT3_info=`$GREP -c "$TAG2.*user.info" "$OUT_DEBUG"`
# No info or debug message should enter with selector 'user.=notice'.
-COUNT4_notice=`$GREP -c -e "$TAG2.*user.info" -e "$TAG2.*user.debug" \
+COUNT4_notice=`$EGREP -c "$TAG2.*user.(info|debug)" \
"$OUT_UNOTICE"`
# Undefined facility should overwrite also the priority.
COUNT4_illegal=`$GREP -c "$TAG2.*Illegal facility" "$OUT_USER"`
@@ -670,12 +668,12 @@ else
# local socket transport
if $do_unix_socket; then
- if grep "$TAG2.*info.*BSD" "$OUT_USER" >/dev/null 2>&1; then
+ if $GREP "$TAG2.*info.*BSD" "$OUT_USER" >/dev/null 2>&1; then
:
else
echo >&2 '** UDP socket did not convey info msg after HUP.'
fi
- if grep "$TAG2.*debug.*BSD" "$OUT_DEBUG" >/dev/null 2>&1; then
+ if $GREP "$TAG2.*debug.*BSD" "$OUT_DEBUG" >/dev/null 2>&1; then
:
else
echo >&2 '** UDP socket did not convey debug msg after HUP.'
@@ -684,12 +682,12 @@ else
# UDP transport
if $do_inet_socket; then
- if grep "$TAG2.*info.*IPv" "$OUT_USER" >/dev/null 2>&1; then
+ if $GREP "$TAG2.*info.*IPv" "$OUT_USER" >/dev/null 2>&1; then
:
else
echo >&2 '** IP socket did not convey info msg after HUP.'
fi
- if grep "$TAG2.*debug.*IPv" "$OUT_DEBUG" >/dev/null 2>&1; then
+ if $GREP "$TAG2.*debug.*IPv" "$OUT_DEBUG" >/dev/null 2>&1; then
:
else
echo >&2 '** IP socket did not convey debug msg after HUP.'
diff --git a/tests/tools.sh.in b/tests/tools.sh.in
index 258d4eb..9d4217a 100644
--- a/tests/tools.sh.in
+++ b/tests/tools.sh.in
@@ -18,6 +18,8 @@
# Helpers and supporting functionality for test scripts.
GREP=${GREP:-@GREP@}
+EGREP=${EGREP:-@EGREP@}
+FGREP=${FGREP:-@FGREP@}
SED=${SED:-@SED@}
DD=${DD:-@DD@}
MKTEMP=${MKTEMP:-@MKTEMP@}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 16 ++++++++++++++++
configure.ac | 4 ++++
tests/Makefile.am | 2 ++
tests/ftp-parser.sh | 2 +-
tests/ifconfig_modes.sh | 28 ++++++++++++++--------------
tests/inetd.sh | 2 +-
tests/libls.sh | 2 +-
tests/syslogd.sh | 16 +++++++---------
tests/tools.sh.in | 2 ++
9 files changed, 48 insertions(+), 26 deletions(-)
hooks/post-receive
--
GNU Inetutils
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-54-g522101f,
Mats Erik Andersson <=