[Pdns-dev] Patch: fix use of 'cut' in suffix detection in pdns/pdns.in

Peter van Dijk peter.van.dijk at netherlabs.nl
Mon Jan 2 20:13:25 CET 2012


Hello Brielle,

On Jan 1, 2012, at 23:26 , Brielle Bruns wrote:

> Noticed a problem with the initscript included in the latest pdns server svn trunk - when starting the service, it improperly detects there being a suffix (/etc/init.d/pdns).
> 
> In the older pdns init script which uses:
> 
> suffix=`basename $0 | awk -F- '{print $2}'`
> 
> The script starts pdns with the following options:
> 
> /usr/sbin/pdns_server --daemon --guardian=yes
> 
> With the newer initscript, the suffix detection uses:
> 
> suffix=`basename $0 | cut -d- -f2-`
> 
> Which starts pdns with:
> 
> /usr/sbin/pdns_server --config-name=pdns --daemon --guardian=yes
> 
> And causes pdns to not read its config file in /etc/pdns/pdns.conf cause its looking for the wrong file.
> 
> Fix is pretty easy - either go back to using awk, or use the attached patch which fixes the issue:
> 
> suffix=`basename $0 | cut -d- -f2- -s --output-delimiter=`

The patch that broke this, was meant to add support for dashes inside the config name. Reverting to the old awk version would break that again.

I propose making it:
suffix=$(basename $0 | cut -d- -f2- -s)

as I believe that this covers all options: no suffix, a simple suffix, or a suffix with dashes.

Marc Haber, can you confirm that this would work for you too?

Kind regards,
Peter van Dijk



More information about the Pdns-dev mailing list