[sudo-workers] sudo ignores child return code

Radovan Sroka rsroka at redhat.com
Tue Aug 30 09:20:23 MDT 2016


What shell are you using?

I'm using ZSH mostly.

$ ./test.sh; echo $?;
zsh: ./test.sh: bad interpreter: /bin/dsadas: no such file or directory
127

When I run this command via bash/sh result will be:

$ sh|bash ./test.sh
$ echo $?
0

But in this use case bash|sh will not exec our script just interpret it.

"bash -c ./test.sh" exec it and will fail.

So I still think that if sudo exec this script it should fail too.

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

Radovan Sroka
Security Technologies | Red hat, Inc.

----- Original Message -----
From: "Todd C. Miller" <Todd.Miller at courtesan.com>
To: "Radovan Sroka" <rsroka at redhat.com>
Cc: sudo-workers at sudo.ws
Sent: Tuesday, August 30, 2016 4:47:04 PM
Subject: Re: [sudo-workers] sudo ignores child return code

I don't think this is a bug, the shell behaves the same way:

$ cat test.sh
#/bin/asdsadsa
#useless script

$ ./test.sh; echo $?
0

If the interpreter is not found, the script is passed through sh.

 - todd


More information about the sudo-workers mailing list