baxtersa opened a new issue #312: awk script in init.sh matches wrong lines in 
/etc/resolv.conf
URL: https://github.com/apache/incubator-openwhisk-apigateway/issues/312
 
 
   I'm on RHEL 7.5, and my `/etc/resolv.conf` file contains the following 
comment
   
   > \# NOTE: the libc resolver may not support more than 3 nameservers.
   > \# The nameservers listed below may not be recognized.
   
   **Expected Behavior**
   
   The `awk` script in `init.sh` matches only lines of the pattern `nameserver 
<ip-address>`.
   
   **Actual Behavior**
   
   The `awk` script matches both lines in the comment, injecting invalid syntax 
into the generated `conf.d/includes/resolvers.conf` file:
   
   ```bash
   $ cat conf.d/includes/resolvers.conf
   resolver <ip-address> <ip-address> <ip-address> NOTE: The <ip-address>;
   ```
   
   **Proposed Solution**
   
   In `init.sh`, the `awk` command matches lines containing the string 
`nameserver`
   
   ```bash
   echo resolver $(awk 'BEGIN{ORS=" "} /nameserver/{print $2}' /etc/resolv.conf 
[...]
   ```
   
   This should be changed to only match lines _beginning_ with the string 
`nameserver`
   
   ```bash
   echo resolver $(awk 'BEGIN{ORS=" "} /^nameserver/{print $2}' 
/etc/resolv.conf [...]
   ```
   
   I'm happy to open up a PR with this minor change if people agree with it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to