Project

General

Profile

Bug #8823

art exit codes

Added by Andrei Gaponenko about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Application
Target version:
Start date:
05/15/2015
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Occurs In:
Scope:
Internal
Experiment:
Mu2e
SSI Package:
art
Duration:

Description

Hello,

Art attempts to use values outside of the legal range, such as 7002,
as exit codes. "man 3 exit" specifies that only the 8 least
significant bits of an integer are used, so the caller gets a stripped
value:

#----------------------------------------------------------------
$ mu2e -c /nofile; echo "The caller got exit code $?" 
Failed to parse the configuration file '/nofile' with exception
---- Can't locate or can't open specified file: BEGIN
  /nofile => /nofile
---- Can't locate or can't open specified file: END

Art has completed and will exit with status 7002.
The caller got exit code 90
#----------------------------------------------------------------

This may lead to unintended 0 exit codes seen by the caller after an
art abnormal termination.

Per our discussion one current "source" of exit code values is an enum
mapping of exceptions. This approach does not allow for a reliable
detection of abnormal program termination from a script, because enums
can start at zero and can contain values outside of the allowed range.

Please sanitize exit codes of art.

Note that while return codes above 128 may be used with exit(), they
have special meaning. Bash uses them to report process termination by
signals. If art exits after catching a signal it should use
128+signal_number.

Codes 126 and 127 also have special meaning in bash (see e.g.
http://www.tldp.org/LDP/abs/html/exitcodes.html ) therefore I propose
to restrict possible non-signal exit codes of art to the 0-125 range.
The file /usr/include/sysexits.h defines a possible set of "safe" exit
code values.

Andrei


Related issues

Related to art - Feature #8602: wrong exit status after a signalClosed2015-05-05

Associated revisions

Revision 7c471168 (diff)
Added by Kyle Knoepfel almost 4 years ago

Implement fix for issue #8823 - exit code modifications

History

#1 Updated by Christopher Green about 4 years ago

  • Category set to Application
  • Status changed from New to Accepted
  • Target version set to 1.18.00
  • Estimated time set to 2.00 h
  • SSI Package art added
  • SSI Package deleted ()

#2 Updated by Kyle Knoepfel almost 4 years ago

  • Related to Feature #8602: wrong exit status after a signal added

#3 Updated by Kyle Knoepfel almost 4 years ago

  • Status changed from Accepted to Resolved
  • Assignee set to Kyle Knoepfel
  • % Done changed from 0 to 100

All non-SIGINT return codes are now in the range [0 (success), 125]. Any handled signals result in an art return code of 128+n. Implemented with commit art:7c471168b2eb48fb8fab26be75c156339c03dbd4.

#4 Updated by Kyle Knoepfel over 3 years ago

  • Target version changed from 1.18.00 to 1.16.00

#5 Updated by Christopher Green over 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF