bug-inetutils
[Top][All Lists]
Advanced

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

[bug-inetutils] netstat


From: Simon Josefsson
Subject: [bug-inetutils] netstat
Date: Tue, 29 Nov 2011 19:31:25 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)

I noticed this comment in the hydra-recipe for InetUtils:

    # Ironically, net-tools is needed to run the tests, which expect
    # `netstat'.
    (lib.optional stdenv.isLinux nettools);

It seems highly undesirable that InetUtils self-checks requires
Net-tools.

These two self tests uses netstat:

tests/syslogd.sh
tests/tftp.sh

Looking at the first one, syslogd.sh contains:

        # Is the INET port already in use? If so,
        # skip the test in its entirety.
        netstat -na | grep -q -E "^$PROTO(4|6|46)? .*$PORT "
        if [ $? -eq 0 ]; then
                echo "The INET port $PORT/$PROTO is already in use."
                echo "No reliable test is possible."
                exit 77
        fi

Can't we rely on InetUtils syslogd failing to start, with some expected
error message when it is because the port is already bound, instead?

Further, the script seems to use predictable temporary filenames for
several things, and since InetUtils 'make check' is sometimes run by
root, I fear this may be abused by someone who wants to get root access
on the system.  It can also fail when you are doing multiple parallel
builds.  The right approach is to create a new directory with 'mktemp'
and do everything in that directory.  Could someone take a look?

The tftp.sh script seems to have the same issue, but fortunately netstat
is only used to check if a port is listened too there as well.

If we can't rely on error messages (which seems like the best approach
-- then we will test this aspect of the tool as well), we should be able
to write a small tool that tries to bind a particular port.  This tool
could replace InetUtils' use of netstat.

/Simon



reply via email to

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