Created attachment 156221 [details]
Patch service.sh replacing rcorder with /sbin/rcorder
The /usr/sbin/service script uses rcorder without specifying the path. If called from an environment without /sbin in the path the -e option (and presumably -r and -R) will fail. Adding /sbin/ to the two references to rcorder will avoid this. Use of /sbin/sysctl within service already uses this form.
Attached patch against Revision 268098 (stable) which should also apply to 268773 (head).
Well that is a bug, but you are dealing with only part of the real problem.
The tool should work with empty PATH.
(In reply to Mateusz Guzik from comment #1)
That seems to require either adding a PATH statement to the top or patching both service and rc.subr (find_local_scripts_new) to include the fully qualified path to grep.
rc.subr has other functions which appear to assume a path will have been set, e.g. mount_critical_filesystems uses 'mount' not '/sbin/mount'. Would it be sensible to attempt to make all of rc.subr safe to use without a path or should it be left as the risk of breaking something is too great? My first pass at this found about 30 instances to consider.
Setting PATH in service should be fine.
I don't recommend playing with rc.subr. That's a can of worms and I'm definitely not up to reviewing patches to that file (but someone else might).
Although this patch is not directly wrong, I'm not sure about the use of the bin vs sbin distinction. In most cases, both bin and sbin are in PATH, and there seems little benefit in removing sbin.
Where does the PATH without /sbin come from, in your case? Perhaps we should add /sbin and /usr/sbin there instead of trying to make the world work without /sbin and /usr/sbin in PATH. One such definition is _PATH_DEFPATH in include/paths.h.
Is there anything to do with this PR?