tags 574858 +moreinfo
thanks

Bob Proulx wrote:
 > I believe what was intended was the following:

  # Hostname either fully qualified or not.
  if [ $FQDN -eq 1 ]; then
          HOSTNAME="$(hostname --fqdn 2>/dev/null)"
  else
          HOSTNAME="$(hostname --short 2>/dev/null)"
  fi


Fixed in 1.3.8.

However this will still fail to produce a correct hostnames in the
face of an unresolvable hostname in DNS.  And I will guess that the
short hostname is the more typical case these days since it is the
default in Debian.  Therefore it would be better if for the short case
the hostname is received and then truncated at the first dot if one
exists.  This will avoid this error for the short case entirely.
Because the script is already a #!/bin/bash script it is safe to use a
POSIX shell parameter expansion construct.  Here is an improvement.

  # Hostname either fully qualified or not.
  if [ $FQDN -eq 1 ]; then
          HOSTNAME=$(hostname --fqdn 2>/dev/null)
          test -z "$HOSTNAME" && HOSTNAME=$(hostname)
  else
          HOSTNAME=$(hostname)
          HOSTNAME=${HOSTNAME%%.*}
  fi


With the above fix the error message shouldn't occur any longer. Why
should logcheck bypass an unresolvable hostname? Wouldn't it be better
if the administrator fixed the hostname issue instead?

Greetings

Hannes







--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to