[Pkg-sysvinit-devel] Bug#628140: initscripts: /etc/init.d/hostname.sh fails if /etc/hostname not present

Edgar Fuss ef at math.uni-bonn.de
Fri May 27 14:52:45 UTC 2011


Package: initscripts
Version: 2.88dsf-13.1
Severity: normal
Tags: patch

If /etc/hostname is not present, /etc/init.d/hostname.sh will pick up the kernel supplied hostname ``(none)'' and try to set this via hostname(1), wich fails.
The obvious fix is to treat a hostname of ``(none)'' as, ehm, none, e.g. empty.
This will give you a hostname of ``localhost''.

-- 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 at euro, LC_CTYPE=de_DE at euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils               8.5-1            GNU core utilities
ii  debianutils             3.4              Miscellaneous utilities specific t
ii  libc6                   2.11.2-10        Embedded GNU C Library: Shared lib
ii  lsb-base                3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip
ii  mount                   2.17.2-9         Tools for mounting and manipulatin
ii  sysv-rc                 2.88dsf-13.1     System-V-like runlevel change mech
ii  sysvinit-utils          2.88dsf-13.1     System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.12-2  ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.11-1    utilities that use the proc file s

initscripts suggests no packages.

-- Configuration Files:
/etc/default/tmpfs changed [not included]

-- no debconf information
-------------- next part --------------
--- /etc/init.d/hostname.sh	2011-01-01 06:34:59.000000000 +0100
+++ /tmp/hostname.sh	2011-05-27 16:50:18.603839959 +0200
@@ -24,6 +24,7 @@
 
 	# Keep current name if /etc/hostname is missing.
 	[ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
+	[ "$HOSTNAME" = "(none)" ] && unset HOSTNAME
 
 	# And set it to 'localhost' if no setting was found
 	[ -z "$HOSTNAME" ] && HOSTNAME=localhost


More information about the Pkg-sysvinit-devel mailing list