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

Bug#163837: startx: hostname version is displayed



Hi,

The patch suggested in this bug is flawed on Debian -- startx checks for GNU
in the version string and uses hostname -f, else just hostname, which means
it's expecting the FQDN by default, and if it's GNU (a flawed presumption),
then it explicitely states it wants the FQDN.

The correct fix would be to rip out the whole block:

case `uname` in
Linux*)
        if [ -z "`hostname --version | grep GNU`" ]; then
                hostname=`hostname -f`
        else
                hostname=`hostname`
        fi
        ;;
*)
        hostname=`hostname`
        ;;
esac

and replace it with simply hostname=`hostname -f`, which will work properly
on all Debian systems.

(The whole block is redundant anyhow, it can be reduced significantly.)

If you want to send the patch upstream, try something like this:

hostname=`hostname`
case `uname` in Linux*)
  if hostname --help 2>&1 | grep -- -f >/dev/null 2>&1; then
    hostname=`hostname -f`
  fi
  ;;
esac

That means, default to just hostname, and if it's Linux, grep for -f in the
help output -- if there's no help, we can safely assume that there'll be no
-f in the error message and the test will fail; if there's a help and no -f
listed in it, the test will fail as well. Otherwise, it'll succeed and
hostname will be set accordingly.

-- 
     2. That which causes joy or happiness.




Reply to: