Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 117196

Summary: net-dns/bind init script (named) should remove commented text for pid-file directive
Product: Gentoo Linux Reporter: Pontus Viking <meradan>
Component: [OLD] ServerAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: 2005.0   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Pontus Viking 2005-12-30 07:11:11 UTC
The net-dns/bind-9.2.5-r6 init script parses the config file for the directive "pid-file". When extracting the string for this directive, care is not taken to ensure that lines containing comments ( //... ) are extracted correctly. The current extraction looks like this:

PIDFILE=$(grep "pid-file" ${CHROOT}/etc/bind/named.conf | \
                egrep -v ".*[#,//].*pid-file" | \
                head -n 1 | \
                sed -ne 's:.*pid-file\(.*\)\"\(.*\)\";:\2:p')
        [ -n "$PIDFILE" ] || PIDFILE=/var/run/named/named.pid

With a config line looking like this:

  pid-file "/var/run/named/named.pid"; // location of pid file

the above code will produce the faulty PIDFILE variable of

  /var/run/named/named.pid // location of pid file

If the sed command is changed to 

sed -ne 's:.*pid-file\(.*\)\"\(.*\)\";\(.*\):\2:p'

the result will be the correct

  /var/run/named/named.pid


Reproducible: Always
Steps to Reproduce:
1. In named.conf, declare pid-file "/var/run/named/named.pid"; //comment
2. Run /etc/init.d/named start

Actual Results:  
 * Starting named ... 
usage: named [-c conffile] [-d debuglevel] [-f|-g] [-n number_of_cpus]
             [-p port] [-s] [-t chrootdir] [-u username]
named: extra command line arguments [ !! ]

Expected Results:  
 * Starting named ... [ ok ]
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-12-30 07:13:13 UTC

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