Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349335 - net-dns/pdnsd-1.2.8 init script pdnsd-online fails with dash
Summary: net-dns/pdnsd-1.2.8 init script pdnsd-online fails with dash
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-22 00:34 UTC by René 'Necoro' Neumann
Modified: 2011-03-28 14:10 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
pdnsd.online.1.diff (pdnsd.online.1.diff,448 bytes, patch)
2011-03-28 11:37 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description René 'Necoro' Neumann 2010-12-22 00:34:45 UTC
The /etc/init.d/pdnsd-online script, which is delivered with net-dns/pdnsd-1.2.8 uses a for-loop construct which seems to be not implemented in dash (and thus probably can be counted as 'bashism' :P):

Zakarumiy necoro # dash /etc/init.d/pdnsd-online
/etc/init.d/pdnsd-online: 12: Syntax error: Bad for loop variable

The for-loop is 
  for ((i=0; i < 10; i=$i+1))

This could probably be replaced by
  for i in `seq 10`

But I'm not a shell-expert, so there might be better solutions.
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-03-27 16:17:09 UTC
Hah I somehow missed this one.

Unfortunately using seq is not portable so I don't think that's a good option. I wonder if it makes sense to have it wait at all there..
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2011-03-27 19:34:05 UTC
Fixed in 1.2.8-r1.
Comment 3 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-03-28 11:34:14 UTC
No, this is not really fixed. Now the script is broken for any shell:

lurch:~ # /etc/init.d/pdnsd status
 * status: stopped
lurch:~ # /etc/init.d/pdnsd-online start
 * Starting pdnsd ...                                                     [ ok ]
/etc/init.d/pdnsd-online: line 12: [: too many arguments
 * /var/cache/pdnsd/pdnsd.status socket is missing.
 * ERROR: pdnsd-online failed to start
lurch:~ # 


Fixing this problem just reveals another flaw:


lurch:~ # /etc/init.d/pdnsd status
 * status: stopped
lurch:~ # /etc/init.d/pdnsd-online start
 * Starting pdnsd ...                                                     [ ok ]
/etc/init.d/pdnsd-online: line 12: [: -lt: unary operator expected
 * /var/cache/pdnsd/pdnsd.status socket is missing.
 * ERROR: pdnsd-online failed to start
lurch:~ #


I gonna attach a patch to the init script which fixes both issues and hopefully works for dash, too.
Comment 4 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-03-28 11:37:16 UTC
Created attachment 267517 [details, diff]
pdnsd.online.1.diff
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2011-03-28 14:10:45 UTC
+*pdnsd-1.2.8-r2 (28 Mar 2011)
+
+  28 Mar 2011; Lars Wendler <polynomial-c@gentoo.org> -pdnsd-1.2.8-r1.ebuild,
+  +pdnsd-1.2.8-r2.ebuild, files/pdnsd.online.1:
+  non-maintainer commit: Fixed broken pdnsd-online init script (result of bug
+  #349335). Committed with kind permission from flameeyes.
+

Added a different fix than proposed in my patch. Needs less code and thus should be some nanoseconds faster ;)