le jeu 15-11-2001 � 02:01, Pierre Fortin a �crit : > In another thread, I alluded to upcoming threads whose theme is "Stay out of my > config files!"... > > I've been having problems with a remote host getting its /etc/hosts file reset > from: > > > 127.0.0.1 mountains mountains.bellsouth.net localhost.localdomain localhost > > to: > > > 127.0.0.1 localhost.localdomain localhost > > and just found that /etc/init.d/cups contains this code: > > > # Check whether the loopback device entry (127.0.0.1) in the > > # /etc/hosts file is correct > > # Is there an /etc/hosts file? > > if (! [ -f /etc/hosts ]); then > > echo "Creating /etc/hosts ..."; > > touch /etc/hosts > > fi > > # Is there a correct "localhost" line? > > if !(/bin/egrep >"^127\.0\.0\.1[[:space:]]+localhost\.localdomain[[:space:]]+localhost$" /etc/hosts > >/dev/null 2>&1); then > > echo "Correcting \"localhost\" line in /etc/hosts ..."; > > # Correct "localhost" line with wrong IP > > perl -p -i -e >"s/^\s*[\d\.]+\s+.*localhost.*$/127.0.0.1\t\tlocalhost.localdomain\tlocalhost/" >/etc/hosts > > # Correct line with address "127.0.0.1" but wrong name > > perl -p -i -e >"s/^\s*127.0.0.1\s+.*$/127.0.0.1\t\tlocalhost.localdomain\tlocalhost/" /etc/hosts > > # Add "localhost" line if missing > > if !(/bin/egrep "^127\.0\.0\.1" /etc/hosts > /dev/null 2>&1); then > > echo -en "127.0.0.1\t\tlocalhost.localdomain\tlocalhost\n" >> /etc/hosts > > fi > > fi > > This means that making any change to the 127-line will result in TOTAL LOSS of > the /etc/hosts file contents!! > > WTF is CUPS doing messing with network configurations...????
Besides the fact that CUPS should not modify /etc/hosts in a so harder way, could you try this line ? 127.0.0.1 localhost.localdomain localhost mountains mountains.bellsouth.net i.e put the name at the end. If you look at the script you see that it looked for 127.0.0.1[space]localhost.localdomain[space]localhost -- http://perso.wanadoo.fr/linux_wizard/index.html - L'intelligence achev�e est la facult� de fabriquer et d'employer des instruments... Henri Bergson, L'�volution Cr�ative
