On Thu, Jul 22, 2010 at 6:52 PM, Daniel Dickman <didick...@gmail.com> wrote: > sure. let me try. the problem is that right now i think env on OpenBSD > can return 4 ambiguous values: 0, 1, 126, 127. if any of these values > are returned i don't think it's possible to know if the value was > returned from env itself or from the underlying utility. (and in fact
The only thing close to ambiguous is running env with a bad command line, in which case you get usage and exit 1. Don't do that. If you get back a 0 it means, tada, it worked! If you get back 127, it means env didn't find the command. Unless you did something retarded like run env env env env diddly, and then it's not env returning 127 but the inner inner inner env. I really hope this is not the kind of problem you are facing when writing a shell script. > the second problem, is that according to (my reading of posix) > something that uses env will expect a return value in the range of > 1-125 to mean "something went wrong in env" and 126 to mean "something > went wrong with invoking utility". but at the moment there are 2 > places in the code where 126 is returned where something went wrong in > env. You are clearly reading this exactly backwards. Of all the possible bugs in OpenBSD to worry about, this one strikes me as the teensiest of mole hills. Please move on to a real problem.