[Pkg-sysvinit-devel] Bug#460463: initscripts: white space after "auto lo" breaks ifup because of broken mountnfs script

Markus Nentwig M_Nentwig at gmx.de
Sat Jan 12 22:15:24 UTC 2008


Package: initscripts
Version: 2.86.ds1-47
Severity: important
Tags: patch

*** Please type your report below this line ***
Additional white space or tab characters on an "auto lo" or "auto eth0" 
(etc.)
line in /etc/network/interfaces break ifup completly.

| acertux:~# ifup eth0
| if-up.d/mountnfs[eth0]: waiting for interface  before doing NFS mounts

The reason is a bug in mountnfs. This line tries to delete white space 
and tab
characters but fails with trailing since a newline is added.
    sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]/\n/g' | while read i; do

To reproduce make sure that /etc/network/interfaces has one line "auto 
lo " (the
trailing white space is very important) and "auto eth0". "auto eth0" must be
below the "auto lo " line.

This is again from mountnfs
      grep "^[:space:]*auto" /etc/network/interfaces  | \
      -	sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]/\n/g' | while read i; do

After the call to grep the output looks like (note again the white space
following lo )
| auto lo
| auto eth0
The sed call substitutes this to
| lo
|
| eth0
The additional newline doesent pass the grep test in the next line
     if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then

This patch fixes the problem:
--- /etc/network/if-up.d/mountnfs	2007-12-27 10:56:44.000000000 +0100
+++ mountnfs.new	2008-01-12 22:34:14.000000000 +0100
@@ -115,7 +115,7 @@

  exit_unless_last_interface() {
      grep "^[:space:]*auto" /etc/network/interfaces  | \
-	sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]/\n/g' | while read i; do
+	sed -e 's/[ \t]*auto[ \t]*//;s/[ \t]//g' | while read i; do
  	if [ `grep -c $i /etc/network/run/ifstate` -eq "0" ]; then
  	    msg="if-up.d/mountnfs[$IFACE]: waiting for interface $i before 
doing NFS mounts"
  	    log_warning_msg "$msg"

Hope that helps,
Markus

As a side note: instead of the mkdir .../mountnfs_earlyexit (on the 
following
lines) one could use and exit 0 statement right away.

-- System Information:
Debian Release: lenny/sid
   APT prefers testing
   APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  debianutils                  2.28.2      Miscellaneous utilities 
specific t
ii  e2fsprogs                    1.40.3-1    ext2 file system utilities 
and lib
ii  libc6                        2.7-5       GNU C Library: Shared libraries
ii  lsb-base                     3.1-24      Linux Standard Base 3.1 
init scrip
ii  mount                        2.13-8      Tools for mounting and 
manipulatin
ii  sysvinit-utils               2.86.ds1-47 System-V-like utilities

Versions of packages initscripts recommends:
ii  psmisc                        22.6-1     Utilities that use the proc 
filesy

-- no debconf information





More information about the Pkg-sysvinit-devel mailing list