Bug 62156 - ifup-post writes too many "search" lines in resolv.conf
ifup-post writes too many "search" lines in resolv.conf
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2002-03-27 18:34 EST by Zenon Mousmoulas
Modified: 2014-03-16 22:26 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-29 15:46:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Zenon Mousmoulas 2002-03-27 18:34:36 EST
Description of Problem:
Upon execution, /etc/sysconfig/network-scripts/ifup-post will write a "search" 
line in resolv.conf (if DOMAIN is defined in a ifcfg file, e.g. ifcfg-eth0) 
for every line it will find in an existing resolv.conf file, plus 2 more times 
at the end. 3 lines are misplaced in this file:

--- ifup-post.old       Thu Mar 28 01:06:17 2002
+++ ifup-post.fixed     Thu Mar 28 01:05:10 2002
@@ -62,10 +62,10 @@
                echo "$answer" >> $tr
-       if [ -n "$DOMAIN" ]; then
-           echo "search $DOMAIN $search" >> $tr
-       fi
+    if [ -n "$DOMAIN" ]; then
+       echo "search $DOMAIN $search" >> $tr
+    fi
     # backup resolv.conf
     cp -af /etc/resolv.conf /etc/resolv.conf.save

The if statement above checks if DOMAIN is null, If not, it writes a "search" 
line to the temporary resolv.conf it is compiling. The search line should be 
perhaps a "domain" line (considering the DOMAIN variable), but anyway that's 
not such a big issue.
Since this if statement is placed within the while loop, it is executed for 
every line that is read from the existing /etc/resolv.conf, plus two more 
times at the end (because EOF is echoed twice):

<line 35>
    (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do


       if [ -n "$DOMAIN" ]; then
           echo "search $DOMAIN $search" >> $tr

As shown above, it should be placed after the end of the loop.

That will fix this tiny little problem :)

Version-Release number of selected component (if applicable):
Comment 1 Bill Nottingham 2005-09-29 15:46:07 EDT
Closing bugs on older, no longer supported, releases. Apologies for any lack of

If this persists on a current release, such as Fedora Core 4, please open a new bug.

Note You need to log in before you can comment on or make changes to this bug.