After updating to openrc-0.9.4, I can no longer start and stop services from the /etc/init.d directory. Instead, this happens: dactyl init.d # ./dovecot restart /lib64/rc/sh/runscript.sh: line 13: ./dovecot: No such file or directory * ERROR: dovecot failed to stop dactyl init.d # However, typing the command as /etc/init.d/dovecot restart works fine. I didn't see this behavior with openrc-0.8.4-r2 Reproducible: Always Steps to Reproduce: 1. upgrade to openrc-0.9.4 2. cd /etc/init.d 3. try to start or stop a service Actual Results: Error from /lib64/rc/sh/runscript.sh Expected Results: the service should have started/stopped/whatever
confirmed here
confirmed
I confirm this as well on i686 (32-bit) OpenRC 0.9.4. Adding `pwd' to the start of runscript.sh, it appears that the pwd is set to the root directory when runscript calls runscript.sh. This is the cause of the error that occurs. Line 1129 of runscript.c shows why this is happening: 1128 /* Change dir to / to ensure all init scripts don't use stuff in pwd */ 1129 if (chdir("/") == -1) 1130 eerror("chdir: %s", strerror(errno)); Obviously this breaks scripts called using a relative path. To fix this, I propose: --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -1122,1 +1122,1 @@ runscript(int argc, char **argv) - service = xstrdup(argv[1]); + service = realpath(argv[1], NULL);
(In reply to comment #3) > I confirm this as well on i686 (32-bit) OpenRC 0.9.4. > > Adding `pwd' to the start of runscript.sh, it appears that the pwd is set to > the root directory when runscript calls runscript.sh. This is the cause of the > error that occurs. > > Line 1129 of runscript.c shows why this is happening: > 1128 /* Change dir to / to ensure all init scripts don't use stuff in > pwd */ > 1129 if (chdir("/") == -1) > 1130 eerror("chdir: %s", strerror(errno)); > > Obviously this breaks scripts called using a relative path. To fix this, I > propose: > --- a/src/rc/runscript.c > +++ b/src/rc/runscript.c > @@ -1122,1 +1122,1 @@ runscript(int argc, char **argv) > - service = xstrdup(argv[1]); > + service = realpath(argv[1], NULL); I just tested this, and it breaks any script in /etc/init.d that is a symbolic link, e.g. net.eth0. So we can't use this proposal.
This is fixed in git, commit 5e01051. Thanks for the report.