Re: sudo ignores child return code

Radovan Sroka <[email protected]>
Newsgroups gmane.comp.tools.sudo.devel
Message-ID <[email protected]>
> $ 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.

Yes, but sudo also returns 0.

---------------------------------------------------------

Radovan Sroka
Security Technologies | Red hat, Inc.

----- Original Message -----
From: "Todd C. Miller" <[email protected]>
To: "Radovan Sroka" <[email protected]>
Cc: [email protected]
Sent: Wednesday, August 31, 2016 1:26:53 PM
Subject: Re: [sudo-workers] sudo ignores child return code

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
____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
https://www.sudo.ws/mailman/listinfo/sudo-workers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.