[#4102] Exit status is not correct in msh
Submitted By: Jie Zhang
2008-05-14 04:03:56 Close Date
Closed Fixed In Release:
Found In Release:
N/A Silicon Revision:
Is this bug repeatable?:
Uboot version or rev.:
Toolchain version or rev.:
App binary format:
Summary: Exit status is not correct in msh
msh returns wrong exit status for command that cannot execute correctly. According to
The exit status of a command that terminated because it received a signal shall be reported as greater than 128.
The convention of bash is to return (128 + signal number). But msh returns -1 in that case.
If a command is not found, the exit status shall be 127. If the command name is found, but it is not an executable utility, the exit status shall be 126.
But msh returns 255 for both cases.
The first case affects gcc testing. abort is called in toolchain test cases when they fail. A program calls abort kills itself with a SIGABRT signal. In msh, the exit status is -1 for that program. But Dejagnu can only handle exit status larger than or equal to 0. Thus Dejagnu gets 0 for the aborted program, which means success! So there are some tests in toolchain testing which are PASS now, but indeed they should be FAIL. And there are some other tests which are XPASS now, but should be XFAIL.
I'll commit a patch to fix the first case soon. The second case does not affect toolchain testing, I'll leave it open now.
--- Michael Hennerich 2008-05-29 08:34:03
Exit code after signals was already fixed; so we fixed only ENOENT and
"cannot execute" cases to return 127 and 126.
Also has an unrelated fix to the case where ENOEXEC was correctly trying to
exec the shell but was passing incorrect argv.
--- Jie Zhang 2008-07-20 21:05:21
File Name File Type File Size Posted By
No Files Were Found