Your message dated Sat, 18 Feb 2012 15:36:11 +0100
with message-id <[email protected]>
and subject line Re: Bug#609851: summary
has caused the Debian Bug report #609851,
regarding isc-dhcp-client: Debian dhclient-script hostname logic broken (tests 
unset $host_name)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
609851: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609851
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: isc-dhcp-client
Version: 4.1.1-P1-15+squeeze2
Severity: normal
Tags: patch

The logic in Debian's dhclient-script as when to set hostname to the DHCP 
supplied new_host_name seems completly broken. It uses an now unset variable 
``host_name''; since that will always be empty, the test always fails and the 
hostname ist never set.

The idea behind the test in the upstream original dhclient-script seems to be
-- if the current hostname is different from what the last invocation of DHCP 
gave, it was probably set by the user, so leave it alone.
-- otherwise, if the hostname obtained by DHCP this time is the same as it was 
last time, there's no need to change is, so leave it alone.
-- else, set the hostname to what DHCP supplied.

The attached patch implements this logic (or so I hope).

-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.38.2.wap (SMP w/1 CPU core)
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/dash

Versions of packages isc-dhcp-client depends on:
ii  debianutils         3.4                  Miscellaneous utilities specific t
ii  iproute             20100519-3           networking and traffic control too
ii  isc-dhcp-common     4.1.1-P1-15+squeeze2 common files used by all the isc-d
ii  libc6               2.11.2-10            Embedded GNU C Library: Shared lib

isc-dhcp-client recommends no packages.

Versions of packages isc-dhcp-client suggests:
pn  avahi-autoipd                 <none>     (no description available)
pn  resolvconf                    <none>     (no description available)

-- no debconf information
Index: files/usr/local/sbin/dhclient-script/DHCPC
===================================================================
--- files/usr/local/sbin/dhclient-script/DHCPC	(revision 2131)
+++ files/usr/local/sbin/dhclient-script/DHCPC	(revision 2132)
@@ -152,8 +152,16 @@
         ;;
     BOUND|RENEW|REBIND|REBOOT)
 
-	if [ -n "$old_host_name" -a -n "$host_name" -a \
-     	     "$host_name" != "$old_host_name" ]; then
+	host_name=$(hostname)
+	# Linux uses '(none)' for an unassigned hostname
+	# Debian /etc/init.d/hostname.sh sets it to 'localhost'
+	# Treat both as unassigned, e.g. empty
+	if [ "$host_name" = "(none)" -o "$host_name" = "localhost" ]; then
+		host_name=""
+	fi
+	# set the hostname only if the current one is either empty
+	#  or is the one DHCP gave us last time and now it has changed.
+	if [ -z "$host_name" -o \( "$host_name" = "$old_host_name" -a "$new_host_name" != "$old_host_name" \) ]; then
     	    hostname "$new_host_name"
 	fi
 

--- End Message ---
--- Begin Message ---
Version: 4.2.2-2

On Sun, Dec  4, 2011 at 00:00:06 +0100, Helmut Grohne wrote:

> This is a summary for those attempting to squash rc bugs.
> 
> As of 4.2.2-1 /sbin/dhclient-script implements a set_hostname function
> that unconditionally updates the host name if request host-name is set
> in /etc/dhcp/dhclient.conf which is the default. This means that in a
> default setup of dhcp any dhcp server can change the hostname. It is
> known that this break (among other things) X11. It also contradicts the
> documentation (man dhcp-options) "This option is only honored by
> dhclient-script(8) if the hostname for the client machine is not set."
> 
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
           if [ "$new_host_name" != "$old_host_name" ]; then
               hostname "$new_host_name"
           fi
        fi

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

Cheers,
Julien

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to