[sudo-workers] sudo ignores child return code

Todd C. Miller Todd.Miller at courtesan.com
Wed Aug 31 05:26:53 MDT 2016


On Wed, 31 Aug 2016 03:32:47 -0400, Radovan Sroka wrote:

> There is a typo in script
> 
> $ cat test.sh
> #/bin/asdsadsa --> should be #!/bin/asdsadsa
> #useless script
> 
> I'm not talking about unrecognized interpreter line, I'm talking about use ca
> se where
> interpreter doesn't exist.
> 
> Sorry for misunderstanding.
> 
> So if interpreter doesn't exist "bash -c ./test.sh" this will fail.
> 
> What do you think about that?
> Should sudo fail as well?

Sudo does fail in this case:

$ sudo ./test.sh
sudo: unable to execute ./test.sh: No such file or directory

this is because execve(2) returns ENOENT for a missing interpreter,
not ENOEXEC.

 - todd


More information about the sudo-workers mailing list