From e060f2d5ad353218c79fbd360d03fd239ff3b0fe Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Jun 2016 13:13:38 -0700 Subject: [PATCH] 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. --- doc/projects.inc | 2 +- html/inc/common_defs.inc | 1 + html/inc/db_ops.inc | 19 ------------------- html/inc/result.inc | 21 +++++++++++++++------ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/doc/projects.inc b/doc/projects.inc index 4c55517532..07daa542c9 100644 --- a/doc/projects.inc +++ b/doc/projects.inc @@ -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"), diff --git a/html/inc/common_defs.inc b/html/inc/common_defs.inc index e192ca74b7..6bc085d6e5 100644 --- a/html/inc/common_defs.inc +++ b/html/inc/common_defs.inc @@ -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); diff --git a/html/inc/db_ops.inc b/html/inc/db_ops.inc index d1feaca99f..c16d8baaaf 100644 --- a/html/inc/db_ops.inc +++ b/html/inc/db_ops.inc @@ -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, ""); - $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", "userid\">" . user_name_by_id($result->userid) . " [$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]"); diff --git a/html/inc/result.inc b/html/inc/result.inc index 7a22169094..94d149061a 100644 --- a/html/inc/result.inc +++ b/html/inc/result.inc @@ -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) {