Bug 62156 - ifup-post writes too many "search" lines in resolv.conf
Summary: ifup-post writes too many "search" lines in resolv.conf
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-27 23:34 UTC by Zenon Mousmoulas
Modified: 2014-03-17 02:26 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-09-29 19:46:07 UTC
Embargoed:


Attachments (Terms of Use)

Description Zenon Mousmoulas 2002-03-27 23:34:36 UTC
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
                ;;
        esac
-       if [ -n "$DOMAIN" ]; then
-           echo "search $DOMAIN $search" >> $tr
-       fi
     done
+    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
       fi
     done

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):
initscripts-6.43-1

Comment 1 Bill Nottingham 2005-09-29 19:46:07 UTC
Closing bugs on older, no longer supported, releases. Apologies for any lack of
response.

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.