Comment 15 for bug 109917

Revision history for this message
Jeff Greene (jeffgreene) wrote :

Hi! I have some great news (I think).
I am not sure what is the standard for choosing a host name, but Ubuntu let me pick:
foobar
I assumed that this is an acceptable host name. I know that on Mac OS X, it would look like this:
foobal.local

The problem is how hostname parses names from the /etc/hosts file.
In the configuration script for netatalk, this command is called:
hostname --short

In the man pages, it states that the --short option makes it return the host name in /etc/hosts, but cut after the first dot.
Obviously, since foobar has no dot, it returns an error.

I am not sure if this is a bug or not with hostname. Are you supposed to have a hostname with no dot? What is the significance of it?

Anyways, if it is acceptable to have a hostname with no dot, I was able to find a good workaround for the configuration script to allow both cases to work.

The line of code in one (or more) of the configuration files has this:
ATALK_NAME=`/bin/hostname --short`

This can be changed to:
ATALK_NAME=`/bin/hostname | /bin/grep -v "\." || /bin/hostname --short`

With the revised line it takes into account hostnames that come with or without dots and should solve the problem.

So now either hostname, netatalk, or some Ubuntu package which allows the user to pick a hostname needs to be fixed given the circumstances.

I'm not entirely sure how hostnames/domains work and if it varies from Linux to Mac OS X.

I hope this was helpful. Can anyone else add input? Should I or someone else try to make a patch?