If oe tries to rc-update add <script> <runlevel> and <script> contains an empty depend() {} funtion, /mnt/init.d/depcach is reported as being corrupt. Reproducible: Always Steps to Reproduce: 1. copy the vcron to foo 2. remove contents of depend() in foo 3. rc-update add foo default 4. read output Actual Results: a syntax error in /mnt/.init.d/depcache is reported, along with reported failure to find dependencies of three packages. Two of these packages have their dependencies recorded immediately before foo. The syntax error is "Unexpected }" on the line after the second depend(). See transcript: quadii init.d # rc-update add tleds default * tleds already installed in runlevel default; skipping * Caching service dependencies... /mnt/.init.d/depcache: line 446: syntax error near unexpected token `}' /mnt/.init.d/depcache: line 446: `}' * NEED: can't find service modules needed by crypto-loop; * continuing... * NEED: can't find service hostname needed by sysklogd; * continuing... * NEED: can't find service checkfs needed by localmount; * continuing... [ ok ] * rc-update complete. Expected Results: When reading the depcache, rc-update should be aware that the depend() function can be empty, and therefore be aware that the lie directly after depend() { can be a }. If all startups require a dependency, this should be reported as the error, and not an unsecified syntax error. If a dependency is added, and the rc-update add <...> is run again, no error is reported. The /mnt/.init.d/depcache is unchanged though. Deinstalling and reinstalling produces a correct depcache.
It is a bash limitation, so not much I can do about it. -------------------------------- nosferatu tmp # cat foo.sh #!/bin/sh source /etc/init.d/functions.sh blah() { } dolisting "/mnt/.init.d/started/net.*" nosferatu tmp # bash foo.sh foo.sh: line 6: syntax error near unexpected token `}' foo.sh: line 6: `}' nosferatu tmp #
Bash limitation that cannot be fixed.
Bash limitation? It's a syntax error! :-) depend() { return 0 } # Actual depend() { return 0 } # Actual depend() function ... depend() { use net return 0 } Note the "# Actual depend() {" line? Two lines below it is a closing brace that looks like it expects to close the block opened in the commented out line. Where does /var/lib/init.d/depcache come from anyway? qpkg -f can't find it, so I assume it's generated, but apparently not by rc-update. If I could find its creator, I could probably send you a patch.
Or syntax error. Point being, you cannot have an empty bash function (or if statement, etc for that matter). If the script was valid in the first place, it would have been Ok.