Sunday, October 21, 2018

Re: 6.4 doas gives "command not found" if no #!/bin/sh up top

Ted Unangst wrote:
> Derek wrote:
> > Just upgraded from 6.3 to 6.4 and the doas behaviour seems to have changed.
> >
> > I finally solved it, but just posting here in case anyone has this problem.
> >
> > I had a few little shell scripts in /usr/local/sbin/ - intended to be run
> > by doas : one-liners like bioctl mounting a USB stick or whatever.
> >
> > After upgrading to OpenBSD 6.4, all of them returned a "command not found"
> > error. I tried moving them to different paths in $PATH, but no luck.
> > Yet they'd work if I was root - just not via doas.
> >
> > Adding a "#!/bin/sh" at the top of the scripts made them all work again.
>
> i don't believe this is a change; that's how it should always work.

sorry, this appears wrong. doas actually uses execvpe() from libc, which is
supposed to do the sh interpretation thing, except now it doesn't work right.
this is a behavior change.


>
> execve() returns ENOEXEC if the file doesn't have the right magic header. sh
> will attempt to interpret the file as a script after that error, but i don't
> think doas should have such a fallback. it may not be a sh script, and then
> weird and possibly bad things will happen (has happened before).

No comments:

Post a Comment