[pkg-dhcp-devel] Bug#609851: summary

Wolfram Gloger bugzilla1 at malloc.de
Tue May 15 13:01:35 UTC 2012

Julien Cristau wrote:

>That seems fixed (at least to some extent) in 4.2.2-2:
>        if [ -z "$current_hostname" ] ||
>           [ "$current_hostname" = '(none)' ] ||
>           [ "$current_hostname" = 'localhost' ] ||
>           [ "$current_hostname" = "$old_host_name" ]; then

This looks good and correct, to satisfy all those who _don't_ want their
hostname to be set from dhcp.

>           if [ "$new_host_name" != "$old_host_name" ]; then
>               hostname "$new_host_name"
>           fi

However, these 3 lines (*) break for me, see below.

>        fi
>I.e. if the current host name doesn't match the previous one from dhcp
>then don't change it.

Indeed, that works fine in 4.2.2.dfsg.1.

However, if you _do_ want to set the hostname from dhcp, the (*)
condition can easily be false at boot time, because old_host_name is
obtained from the previous lease stored on disk, and if new_host_name is
not changed in the new lease, the hostname is never set and remains at

I would suggest to replace the above 3 lines with:

           if [ "$new_host_name" != "$current_host_name" ]; then
               hostname "$new_host_name"

or simply
           hostname "$new_host_name"

Sorry, I could not decide between reopening this report #609851,
appending to


or file yet another bug.

If you do implement my suggested change, I am sure #604883 could be
closed as well.


More information about the pkg-dhcp-devel mailing list