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...????

Pierre

Reply via email to