Hi! I got failures from tests/hostname on one machine:
Failed to get same hostname as uname does (runner-z3wu8uu--project-23901891 vs
runner-z3wu8uu--project-23901891-concurrent-0).
The self-test compares output from our hostname with that from the
system's uname -n. Quoting uname(2):
NOTES
This is a system call, and the operating system presumably knows its
name, release and version. It
also knows what hardware it runs on. So, four of the fields of the
struct are meaningful. On the
other hand, the field nodename is meaningless: it gives the name of the
present machine in some un‐
defined network, but typically machines are in more than one network and
have several names. More‐
over, the kernel has no way of knowing about such things, so it has to
be told what to answer here.
The same holds for the additional domainname field.
To this end, Linux uses the system calls sethostname(2) and
setdomainname(2). Note that there is no
standard that says that the hostname set by sethostname(2) is the same
string as the nodename field
of the struct returned by uname() (indeed, some systems allow a
256-byte hostname and an 8-byte
nodename), but this is true on Linux. The same holds for
setdomainname(2) and the domainname field.
So using uname nodename seems just wrong. Thoughts?
I pushed this change, to use the system's hostname binary for comparison
instead.
/Simon
From f88570bae1dc1aab658dc138fa874f63d63ee7eb Mon Sep 17 00:00:00 2001 From: Simon Josefsson <[email protected]> Date: Thu, 28 Jan 2021 09:27:14 +0100 Subject: [PATCH] tests/hostname.sh: Use system hostname, not system uname, for comparison. --- ChangeLog | 5 +++++ tests/hostname.sh | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 203f11c8..b58669ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-01-28 Simon Josefsson <[email protected]> + + * tests/hostname.sh: Use system hostname, not system uname, for + comparison. + 2021-01-28 Simon Josefsson <[email protected]> * configure.ac: Don't call gl_FUNC_READLINE. Not needed since we diff --git a/tests/hostname.sh b/tests/hostname.sh index 70b06063..56720610 100755 --- a/tests/hostname.sh +++ b/tests/hostname.sh @@ -45,8 +45,8 @@ $hostname || errno=$? test $errno -eq 0 || echo "Failed to get hostname." >&2 test $errno -eq 0 || exit $errno -test `$hostname` = `uname -n` || errno=$? -test $errno -eq 0 || echo "Failed to get same hostname as uname does (`$hostname` vs `uname -n`)." >&2 +test `$hostname` = `hostname` || errno=$? +test $errno -eq 0 || echo "Failed to get same hostname as system (`$hostname` vs `hostname`)." >&2 test $errno -eq 0 || exit $errno if test `func_id_uid` != 0; then -- 2.20.1
signature.asc
Description: PGP signature
