commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-65-gcf037d


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-65-gcf037d7
Date: Sun, 26 Jan 2020 09:46:30 -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  cf037d79f05ad4e6b713b44f53ae86f5dd1eac62 (commit)
      from  4b709d0ab1dc39e1f11026dfb6d5ef8c94188383 (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=cf037d79f05ad4e6b713b44f53ae86f5dd1eac62


commit cf037d79f05ad4e6b713b44f53ae86f5dd1eac62
Author: Mats Erik Andersson <address@hidden>
Date:   Sun Jan 26 15:11:40 2020 +0100

    Examination of testing scripts.
    
    Mainly a large case of new indentation.  Some small fixes.

diff --git a/ChangeLog b/ChangeLog
index e772da4..767b8a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2020-01-26  Mats Erik Andersson  <address@hidden>
+
+       Examination of testing scripts.
+
+       * tests/ftp-localhost.sh [TEST_IPV4 && TARGET]: Implement one
+       additional level of indentation in this large text block.
+       Some additional fixes of indentation and improved readability.
+
+       * tests/inetd.sh: Improve regex when refusing test directories.
+       * tests/syslogd.sh: Likewise.
+       * tests/ping-localhost.sh: Use back quotes for portability.
+       * tests/traceroute-localhost.sh: Likewise.
+
 2020-01-24  Mats Erik Andersson  <address@hidden>
 
        runtime-ipv6: Implicit dependency on services file.
diff --git a/tests/ftp-localhost.sh b/tests/ftp-localhost.sh
index 1b9a082..94029cc 100755
--- a/tests/ftp-localhost.sh
+++ b/tests/ftp-localhost.sh
@@ -119,7 +119,7 @@ if test "$TEST_IPV4" = "no" && test "$TEST_IPV6" = "no"; 
then
     exit 77
 fi
 
-if test $(func_id_uid) != 0; then
+if test `func_id_uid` != 0; then
     echo "ftpd needs to run as root" >&2
     exit 77
 fi
@@ -356,144 +356,136 @@ test_report () {
 }
 
 if test "$TEST_IPV4" != "no" && test -n "$TARGET"; then
-### TODO: Fix indentation within this conditional.
+    # Test a passive connection: PASV and IPv4.
+    #
+    echo "PASV to $TARGET (IPv4) using inetd."
+    cat <<-STOP |
+       rstatus
+       dir
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
+       STOP
+    HOME=$TMPDIR \
+       $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 
-# Test a passive connection: PASV and IPv4.
-#
-echo "PASV to $TARGET (IPv4) using inetd."
-cat <<STOP |
-rstatus
-dir
-`$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-`$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
-STOP
-HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
-
-test_report $? "$TMPDIR/ftp.stdout" "PASV/$TARGET"
-
-$do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
-       test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
-       date "+%s" >> "$TMPDIR/$GETME"
-    else
-       echo >&2 'Binary transfer failed.'
-       exit 1
-    fi
+    test_report $? "$TMPDIR/ftp.stdout" "PASV/$TARGET"
 
-# Test an active connection: PORT and IPv4.
-#
-echo "PORT to $TARGET (IPv4) using inetd."
-cat <<STOP |
-rstatus
-dir
-`$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-`$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
-STOP
-HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
-
-test_report $? "$TMPDIR/ftp.stdout" "PORT/$TARGET"
-
-$do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
-       test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
-       date "+%s" >> "$TMPDIR/$GETME"
-    else
-       echo >&2 'Binary transfer failed.'
-       exit 1
-    fi
+    $do_transfer && \
+       if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
+           test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
+           date "+%s" >> "$TMPDIR/$GETME"
+       else
+           echo >&2 'Binary transfer failed.'
+           exit 1
+       fi
 
-# Test a passive connection: EPSV and IPv4.
-#
-echo "EPSV to $TARGET (IPv4) using inetd."
-cat <<STOP |
-rstatus
-epsv4
-dir
-STOP
-HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+    # Test an active connection: PORT and IPv4.
+    #
+    echo "PORT to $TARGET (IPv4) using inetd."
+    cat <<-STOP |
+       rstatus
+       dir
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
+       STOP
+    HOME=$TMPDIR \
+       $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
 
-test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET"
+    test_report $? "$TMPDIR/ftp.stdout" "PORT/$TARGET"
 
-# Test a passive connection: EPSV and IPv4.
-#
-# Set NETRC in environment to regulate login.
-#
-echo "EPSV to $TARGET (IPv4) using inetd, setting NETRC."
-cat <<STOP |
-rstatus
-epsv4
-dir
-`$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-`$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
-STOP
-
-NETRC=$TMPDIR/.netrc \
-  $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
-
-test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET with NETRC"
-
-$do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
-       test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
-       date "+%s" >> "$TMPDIR/$GETME"
-    else
-       echo >&2 'Binary transfer failed.'
-       exit 1
-    fi
+    $do_transfer && \
+       if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
+           test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
+           date "+%s" >> "$TMPDIR/$GETME"
+       else
+           echo >&2 'Binary transfer failed.'
+           exit 1
+       fi
 
-# Test an active connection: EPRT and IPv4.
-#
-echo "EPRT to $TARGET (IPv4) using inetd."
-cat <<STOP |
-rstatus
-epsv4
-dir
-`$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-`$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
-STOP
-HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
-
-test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
-
-$do_transfer && \
-    if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
-       test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
-       date "+%s" >> "$TMPDIR/$GETME"
-    else
-       echo >&2 'Binary transfer failed.'
-       exit 1
-    fi
+    # Test a passive connection: EPSV and IPv4.
+    #
+    echo "EPSV to $TARGET (IPv4) using inetd."
+    cat <<-STOP |
+       rstatus
+       epsv4
+       dir
+       STOP
+    HOME=$TMPDIR \
+       $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 
-# Test an active connection: EPRT and IPv4.
-#
-# Use `-N' to set location of .netrc file.
-#
-echo "EPRT to $TARGET (IPv4) using inetd, apply the switch -N."
-cat <<STOP |
-rstatus
-epsv4
-dir
-STOP
+    test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET"
+
+    # Test a passive connection: EPSV and IPv4.
+    #
+    # Set NETRC in environment to regulate login.
+    #
+    echo "EPSV to $TARGET (IPv4) using inetd, setting NETRC."
+    cat <<-STOP |
+       rstatus
+       epsv4
+       dir
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
+       STOP
+    NETRC=$TMPDIR/.netrc \
+       $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+
+    test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET with NETRC"
+
+    $do_transfer && \
+       if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
+           test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
+           date "+%s" >> "$TMPDIR/$GETME"
+       else
+           echo >&2 'Binary transfer failed.'
+           exit 1
+       fi
+
+    # Test an active connection: EPRT and IPv4.
+    #
+    echo "EPRT to $TARGET (IPv4) using inetd."
+    cat <<-STOP |
+       rstatus
+       epsv4
+       dir
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
+       STOP
+    HOME=$TMPDIR \
+       $FTP "$TARGET" $PORT -4 -v -t >$TMPDIR/ftp.stdout 2>&1
+
+    test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
+
+    $do_transfer && \
+       if cmp -s "$TMPDIR/$GETME" "$FTPHOME$DLDIR/$PUTME"; then
+           test "${VERBOSE+yes}" && echo >&2 'Binary transfer succeeded.'
+           date "+%s" >> "$TMPDIR/$GETME"
+       else
+           echo >&2 'Binary transfer failed.'
+           exit 1
+       fi
 
-$FTP "$TARGET" $PORT -N"$TMPDIR/.netrc" -4 -v -t >$TMPDIR/ftp.stdout 2>&1
+    # Test an active connection: EPRT and IPv4.
+    #
+    # Use `-N' to set location of .netrc file.
+    #
+    echo "EPRT to $TARGET (IPv4) using inetd, apply the switch -N."
+    cat <<-STOP |
+       rstatus
+       epsv4
+       dir
+       STOP
+    $FTP "$TARGET" $PORT -N"$TMPDIR/.netrc" -4 -v -t >$TMPDIR/ftp.stdout 2>&1
 
-test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
+    test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET"
 
 fi # TEST_IPV4 && TARGET
 
@@ -505,7 +497,8 @@ if test "$TEST_IPV6" != "no" && test -n "$TARGET6"; then
        rstatus
        dir
        STOP
-    HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+    HOME=$TMPDIR \
+       $FTP "$TARGET6" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 
     test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET6"
 
@@ -515,14 +508,13 @@ if test "$TEST_IPV6" != "no" && test -n "$TARGET6"; then
     cat <<-STOP |
        rstatus
        dir
-       `$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-       `$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
        STOP
-    HOME=$TMPDIR $FTP "$TARGET6" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
+    HOME=$TMPDIR \
+       $FTP "$TARGET6" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
 
     test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET6"
 
@@ -601,14 +593,13 @@ if test "$TEST_IPV4" != "no" &&test "$TEST_IPV6" != "no" 
&&
     cat <<-STOP |
        rstatus
        dir
-       `$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-       `$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
        STOP
-    HOME=$TMPDIR $FTP "$TARGET46" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+    HOME=$TMPDIR \
+       $FTP "$TARGET46" $PORT -6 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 
     test_report $? "$TMPDIR/ftp.stdout" "EPSV/$TARGET46"
 
@@ -627,14 +618,13 @@ put $GETME $PUTME"`
     cat <<-STOP |
        rstatus
        dir
-       `$do_transfer && test -n "$DLDIR" && echo "\
-cd $DLDIR"`
-       `$do_transfer && echo "\
-lcd $TMPDIR
-image
-put $GETME $PUTME"`
+       `$do_transfer && test -n "$DLDIR" && echo "cd $DLDIR"`
+       `$do_transfer && echo "lcd $TMPDIR
+       image
+       put $GETME $PUTME"`
        STOP
-    HOME=$TMPDIR $FTP "$TARGET46" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
+    HOME=$TMPDIR \
+       $FTP "$TARGET46" $PORT -6 -v -t >$TMPDIR/ftp.stdout 2>&1
 
     test_report $? "$TMPDIR/ftp.stdout" "EPRT/$TARGET46"
 
@@ -665,7 +655,8 @@ if test "$TEST_IPV4" != "no" && test -n "$TARGET" && 
$do_transfer; then
        nmap \$1.\$2.\$3 [\$3,copy].\$1.\$2
        put $GETME
        STOP
-    HOME=$TMPDIR $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
+    HOME=$TMPDIR \
+       $FTP "$TARGET" $PORT -4 -v -p -t >$TMPDIR/ftp.stdout 2>&1
 
     sIFS=$IFS
     IFS=.
diff --git a/tests/inetd.sh b/tests/inetd.sh
index cf76ab7..188c31c 100755
--- a/tests/inetd.sh
+++ b/tests/inetd.sh
@@ -118,8 +118,8 @@ if [ ! -d "$IU_TESTDIR" ]; then
            echo 'Failed at creating test directory.  Aborting.' >&2
            exit 77
        }
-elif expr X"$IU_TESTDIR" : X"\.\{1,2\}/\{0,1\}$" >/dev/null; then
-    # Eliminating directories: . ./ .. ../
+elif expr X"$IU_TESTDIR" : X'[./]\{1,\}$' >/dev/null; then
+    # Eliminating directories: all mixtures of . and / only.
     echo 'Dangerous input for test directory.  Aborting.' >&2
     exit 77
 fi
diff --git a/tests/ping-localhost.sh b/tests/ping-localhost.sh
index ad99fd0..97d647e 100755
--- a/tests/ping-localhost.sh
+++ b/tests/ping-localhost.sh
@@ -46,7 +46,7 @@ if test "$TEST_IPV4" = "no" && test "$TEST_IPV6" = "no"; then
     exit 77
 fi
 
-if test $(func_id_uid) != 0; then
+if test `func_id_uid` != 0; then
     echo "ping needs to run as root"
     exit 77
 fi
diff --git a/tests/syslogd.sh b/tests/syslogd.sh
index e46b170..8083a11 100755
--- a/tests/syslogd.sh
+++ b/tests/syslogd.sh
@@ -132,8 +132,8 @@ if [ ! -d "$IU_TESTDIR" ]; then
            echo 'Failed at creating test directory.  Aborting.' >&2
            exit 77
        }
-elif expr X"$IU_TESTDIR" : X'\.\{1,2\}/\{0,1\}$' >/dev/null; then
-    # Eliminating directories: . ./ .. ../
+elif expr X"$IU_TESTDIR" : X'[./]\{1,\}$' >/dev/null; then
+    # Eliminating directories: all mixtures of . and / only.
     echo 'Dangerous input for test directory.  Aborting.' >&2
     exit 77
 fi
diff --git a/tests/traceroute-localhost.sh b/tests/traceroute-localhost.sh
index df98ffe..7965384 100755
--- a/tests/traceroute-localhost.sh
+++ b/tests/traceroute-localhost.sh
@@ -43,7 +43,7 @@ if test "$TEST_IPV4" = "no"; then
     exit 77
 fi
 
-if test $(func_id_uid) != 0; then
+if test `func_id_uid` != 0; then
     echo "traceroute needs to run as root"
     exit 77
 fi

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                     |  13 ++
 tests/ftp-localhost.sh        | 297 ++++++++++++++++++++----------------------
 tests/inetd.sh                |   4 +-
 tests/ping-localhost.sh       |   2 +-
 tests/syslogd.sh              |   4 +-
 tests/traceroute-localhost.sh |   2 +-
 6 files changed, 163 insertions(+), 159 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]