[llvm-commits] [llvm] r75665-/llvm/trunk/tools/bugpoint/ToolRunner.cpp

Dan Gohman gohman at apple.com
Wed Jul 15 14:58:59 PDT 2009


On Jul 15, 2009, at 2:21 PM, Viktor Kutuzov wrote:


>> If #2 is non-zero have RemoteRunSafely.sh print a message and return
>>
>> 127.
>>
>> Otherwise have it return #1.
>>
>
> I have been thinking of it and decided to not go that way because of  
> the following reasons.
> This tied up the bugpoint to the script (this dependency does not  
> exist yet, and user could use any remote client which deliver the
> test program to a target, run it and deliver the result back). Any  
> other remote client will not be aware of this cconvention and
> could miss-lead the bugpoint returning "reserved" codes.
> This is a hack.
> It still have overlapped status codes - 127 (and 126) which makes  
> the original problem remain open. Nothing prevents the test
> program returning 127 (126, or any other status code). In this case  
> bugpoint will miss-handle the result.
>
> However we could end up with this. :)
>
> It is obvious that we need to make some convention unless we want to  
> implement/control a remote client inside the bugpoint (I don't
> think this is a good idea).
> But we should not enforce this convention and act reasonably if the  
> remote client does not follow it.

I picked 127 because it's reserved by POSIX for "command not found",
but that is something of a hack.

However, looking around some more, it looks like 255 would be a better
number, since this is what OpenSSH uses for this exact purpose. OpenSSH
is probably what most everyone here will be using underneath their
RunProgramRemotely.sh scripts anyway, so it's a reasonable precedent
to follow.

>
> There is another option (I'm not crazy about it either, but it  
> solves some problems the above option has).
> We could require the test program exit code to be optionally placed  
> at the end of the output in "exit <return code>" format.
> In this case the test program status code could be extracted from  
> there (it will be removed from the output so the output itself
> will look exactly like the test program produces it) and returned  
> back as a result of the run.
> Any error code the remote client returns will be escalated. The  
> missing return code will be defaulted to 0.
> This seems reasonable convention to me.
>
> What do you think?

If you're worried about infringing on the program's possible
use of crazy error codes like 127, what about infringing on the
program's use of "exit <number>" as part of its normal output? :-)

Picking a special exit status is much simpler than printing
a value and having bugpoint parse it. And OpenSSH has already
picked a number for this purpose (255), so we can expect that
reasonable programs will stay out of trouble.

Dan




More information about the llvm-commits mailing list