8 Matching Annotations
  1. Last 7 days
    1. There has been an attempt to systematize exit status numbers (see /usr/include/sysexits.h), but this is intended for C and C++ programmers. A similar standard for scripting might be appropriate. The author of this document proposes restricting user-defined exit codes to the range 64 - 113 (in addition to 0, for success), to conform with the C/C++ standard.

      It sounds like he's proposing aligning with the sysexits.h standard?

      But I'm not clear why he refers to "exit codes to the range 64 - 113 (in addition to 0, for success)" as user-defined. To me, these seem the complete opposite: those are reserved for pre-defined, standard exit codes — with 0 for success being the most standard (and least user-defined) of all!

      Why to use exit codes from 1-63 for user-defined errors??

    2. This seems awfully incomplete! What about errors like "The command was used incorrectly, e.g., with the wrong number of arguments, a bad flag, a bad syn- tax in a parameter, or whatever."?

      This is where a standard like

      https://man.freebsd.org/cgi/man.cgi?query=sysexits&sektion=3

      steps in and is useful to have!

    1. This interface has been deprecated and is retained only for compatibility. Its use is discouraged.

      This is great!!

      So... Why is this deprecated and what should be used instead?? Standardizing this stuff would be good, and this de facto standard seems as good as any!!

    1. BSD-derived OS's have defined an extensive set of preferred interpretations: Meanings for 15 status codes 64 through 78 are defined in sysexits.h.[15] These historically derive from sendmail and other message transfer agents, but they have since found use in many other programs.[16] It has been deprecated and its use is discouraged.

      [duplicate of https://hyp.is/12j9KjELEfCQc79IbTwQnQ/man.freebsd.org/cgi/man.cgi?query=sysexits&sektion=3 ]

      Why is this deprecated and what should be used instead?? Standardizing this stuff would be good, and this de facto standard seems as good as any!!

  2. Feb 2021
    1. Now this probably won't make difference in the real world (e.g. because the exit codes are not portable and on top of that not always unambiguous as discussed in Default exit code when process is terminated?)
    1. However, because so many shells follow that convention of having 128 + signal_number, programs know to avoid using those values above 128 for their exit code (or when they do exit(130), it's to report the death of a child that dies of a signal 2 like some shells do under some circumstances).