RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1252152 - grep-2.20-3.el6.x86_64 patch breaks dhclient's build of /etc/resolv.conf
Summary: grep-2.20-3.el6.x86_64 patch breaks dhclient's build of /etc/resolv.conf
Keywords:
Status: CLOSED DUPLICATE of bug 1210310
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: dhcp
Version: 6.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jiri Popelka
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-10 20:15 UTC by marco
Modified: 2015-08-11 08:29 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-11 08:29:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description marco 2015-08-10 20:15:11 UTC
Description of problem:

I am using Scientific Linux 6.6 

An EL6 desktop boots up crippled (no DNS) when an "options" line is present in /etc/resolv.conf, since the recent patch of grep to grep-2.20-3.el6.x86_64. 

The fix regarding the "-F" option to grep appears to interact poorly with the way it is used by the function "change_resolv_conf" in /etc/sysconfig/network-scripts/network-functions. In particular, the code checks for an "options" line in /etc/resolv.conf, and if one is found, keeps it, and replaces the rest of the file with the contents of the temporary file (created by the function "make_resolv_conf" in /sbin/dhclient-script) *MINUS* any matching options line(s) in the temporary file. 

The problem is that the output from this command (which is used to remove the options line from the temporary file): 

/bin/grep -vF "options ndots:2 
" /tmp/TMPFILENAME 

used to return the rest of the file (e.g.): 
   nameserver 132.205.96.93 
   nameserver 132.205.96.94 
   search encs.concordia.ca concordia.ca 

but now returns nothing. As a result, resolv.conf contains *only* the options line - no nameservers or search list, so of course no hostnames can be resolved, LDAP fails, automounting fails, etc., etc. 

It seems that the "second" (empty) line of the expression being searched for now matches anything, so the reverse match matches nothing. The grep expression can be made to "work" by making sure that the second line is not empty: 

/bin/grep -vF "options ndots:2 trash_do_not_match" /etc/resolv.conf 

nameserver 132.205.96.93 
nameserver 132.205.96.94 
search encs.concordia.ca admin.private concordia.ca 

... but this is the wrong fix for the code as it stands, because the "s" variable is re-used for various purposes, such that the "trash" string then ends up in the generated resolv.conf. For now, we've worked around the problem with this patch: ----------------------------------------------------------------------------- --- /etc/sysconfig/network-scripts/.old/network-functions.20150810.140031 2014-07-22 09:56:28.000000000 -0400 +++ /etc/sysconfig/network-scripts/network-functions 2015-08-10 14:33:49.000000000 -0400 @@ -503,9 +503,9 @@ change_resolv_conf () 
{ 
     s=$(/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null); 
-    if [ "x$s" != "x" ]; then 
-       s="$s"$'\n'; 
-    fi; 
+#   if [ "x$s" != "x" ]; then 
+#      s="$s"$'\n'; 
+#   fi; 
     if [ $# -gt 1 ]; then 
        n_args=$#; 
        while [ $n_args -gt 0 ]; 
@@ -524,7 +524,7 @@ 
          done; 
     elif [ $# -eq 1 ]; then 
        if [ "x$s" != "x" ]; then 
-         s="$s"$(/bin/grep -vF "$s" $1); 
+         s=$(/bin/grep -v "$s" $1)$'\n'"$s"; 
        else 
          s=$(cat $1); 
     fi; ----------------------------------------------------------------------------- ... but the above doesn't cover all code paths, and may not be correct under all circumstances. Still, we hope it's a starting point for you, and at least we can boot our workstation properly again!


Version-Release number of selected component (if applicable):

seems to break with grep-2.20-3.el6.x86_64


How reproducible:
- add an options line to /etc/resolv.conf
- reboot or restart dhclient to rebuild /etc/resolv.conf

Comment 2 Jiri Popelka 2015-08-11 08:29:18 UTC
Should be fixed with initscripts-9.03.49-1.el6

*** This bug has been marked as a duplicate of bug 1210310 ***


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