web: fix display of exit codes

Exit codes (32 bits) with the high order bit set (e.g. 0xc0000005)
were being displayed as 0xffffffffc0000005.

Also: fix some confusion between exit codes and error numbers.
BOINC doesn't use error numbers as exit codes.
This commit is contained in:
David Anderson 2016-06-01 13:13:38 -07:00
parent 4312c6c3bc
commit e060f2d5ad
4 changed files with 17 additions and 26 deletions

View File

@ -597,7 +597,7 @@ $math = array(
),
array(
"Collatz Conjecture",
"http://boinc.thesonntags.com/collatz/",
"https://boinc.thesonntags.com/collatz/",
tra("Private"),
tra("Mathematics"),
tra("Study the Collatz Conjecture, an unsolved conjecture in mathematics"),

View File

@ -81,6 +81,7 @@ define('RESULT_ABORTED', 6);
define('RESULT_UPLOAD_FAILED', 7);
// from lib/error_numbers.h
// returned by some web RPCs
//
define('ERR_XML_PARSE', -112);
define('ERR_DB_NOT_FOUND', -136);

View File

@ -389,22 +389,6 @@ function link_results($n, $mq, $query, $clauses) {
}
}
// Determines if in stderr_out is an error reported and prints as human readable String
// @return String A human readable string if error otherwise FALSE
// @param String $stderr_out the stderr_out value to parse
function stderr_error_string($stderr_out){
$y = parse_element($stderr_out, "<error_code>");
$x = 0;
if ($y) {
$x = (int)$y;
}
if (0<=$x && $x<=9) {
return FALSE;
} else {
return "$x ".result_error_mask_str($x);
}
}
function show_result_summary() {
$ntotal =0; // TODO: how to count $result?
@ -1071,9 +1055,6 @@ function show_result_ops($result) {
row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
row("CPU time", $result->cpu_time);
row("Elapsed time", $result->elapsed_time);
if($error=stderr_error_string($result->stderr_out)) {
row("error in stderr out", $error);
}
row("Batch", $result->batch);
row("File delete state", file_delete_state_str($result->file_delete_state)." [$result->file_delete_state]");
row("Validate state", validate_state_str($result)." [$result->validate_state]");

View File

@ -478,12 +478,10 @@ function version_string($version_num) {
}
}
// Decode ErrorNumber into semi-human-readable,
// taken from lib/error_numbers.h keep this up to date
// @return String A human readable error message
// @param Integer $x An error number
// convert an exit code to a string.
// TODO: handle Windows-specific codes like 0xc0000005
//
function result_error_mask_str($x){
function exit_code_str($x){
switch($x){
case 0: return "";
case 192: return "EXIT_STATEFILE_WRITE";
@ -503,6 +501,16 @@ function result_error_mask_str($x){
case 206: return "EXIT_INIT_FAILURE";
case 207: return "EXIT_NO_SUB_TASKS";
case 208: return "EXIT_SUB_TASK_FAILURE";
default: return "Unknown error number";
}
}
// convert an error code to a string.
// NOTE: error codes are different from exit codes
// NOTE: not used. can remove
//
function error_str($errnum) {
switch($errnum) {
case -100: return "ERR_SELECT";
case -102: return "ERR_READ";
case -103: return "ERR_WRITE";
@ -642,7 +650,8 @@ function result_error_mask_str($x){
}
function exit_status_string($x) {
return sprintf("%d (0x%x)", $x, $x). " ".result_error_mask_str($x);
$x = $x & 0xffffffff;
return sprintf("%d (0x%x)", $x, $x). " ".exit_code_str($x);
}
function show_result($result, $show_outfile_links=false) {