Subject: Re: bug#6235: hostname and -b option

From: Eric Blake <[email-masked]>
Date: Thu, 20 May 2010 16:31:14 -0600

On 05/20/2010 03:45 PM, Nelson H. F. Beebe wrote:
> We noticed recently that Ubuntu's /bin/hostname has this option
> 
>     -b, --boot            set default hostname if none available
> 
> and uses it in /etc/init/hostname.conf.
> 
> However, the GNU version from coreutils-1.8 lacks that option.

coreutils 1.8 doesn't exist.  Did you mean coreutils 8.5?

> 
> Unfortunately, Ubuntu's startup script puts /usr/local/bin ahead of
> /bin and /usr/bin, thus getting a version of hostname that chokes on
> the -b option.  We patched the configuration file to force an explicit
> path:
> 
>     exec /bin/hostname -b -F /etc/hostname

Correct - Ubuntu's script is buggy if it uses non-standard options
without an explicit path to a version of the utility known to provide
those options.

> 
> Would it be reasonable to consider adding support in coreutils for the -b option?

How would we (portably) implement it?  The problem is that coreutils'
hostname has to compile on many more platforms than just Ubuntu, and
there are just too many distro-specific actions (or even lack of OS
interfaces altogether) for setting a default hostname.

> [I'm not urging that this be done, merely that it be discussed.  In my
> view, Ubuntu is at fault for introducing nonstandard options, and
> messing up the boot PATH, and failing to use explicit paths on
> critical boot-time commands.

Your view is correct.

-- 
Eric Blake   [email-masked]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org