In some embedded environments, instead of using GNU Bash for size reasons, the Ash (shell provided by busybox) is used. But init.d/network and init.d/functions are not very well adapted for Ash. Here are the two problems I found:
1) Use killproc to kill the given service process
Steps:
run this testcase returns an error, and sleep is not killed:
./test_killproc.sh: line 126: remainning+=2039 : not found
This is because Ash cannot use "+=" for string concatenation.
2) I found out that here string(<<<) and c-style for-loop( for (( ; ; )) ) are
used in network-scripts. But Ash doesn't support them either. So when I run:
"/etc/rc.d/init.d/network status" gives these errors:
# /etc/rc.d/init.d/network: ./network-functions: line 166: syntax error: unexpected redirection
# /etc/rc.d/init.d/network: ./network-functions: line 575: syntax error: bad for loop variable
The last two patches are used to fix this problem.
The problems mentioned above can all be verified simply on busybox v1.32.1. For example:
$ /bin/busybox bash -c "str+=$char"
bash: str+=: not found
$ /bin/busybox bash -c "grep hello <<< "hello world""
world: line 1: syntax error: unexpected redirection
$ /bin/busybox bash -c "for (( idx=0; idx<5; idx++ )); do date; done"
bash: syntax error: bad for loop variable
396
In some embedded environments, instead of using GNU Bash for size reasons, the Ash (shell provided by busybox) is used. But init.d/network and init.d/functions are not very well adapted for Ash. Here are the two problems I found:
1) Use killproc to kill the given service process Steps:
run this testcase returns an error, and sleep is not killed:
./test_killproc.sh: line 126: remainning+=2039 : not found
This is because Ash cannot use "+=" for string concatenation.
2) I found out that here string(<<<) and c-style for-loop( for (( ; ; )) ) are used in network-scripts. But Ash doesn't support them either. So when I run: "/etc/rc.d/init.d/network status" gives these errors:
The last two patches are used to fix this problem.
The problems mentioned above can all be verified simply on busybox v1.32.1. For example:
Thanks in advance.