From 5672b034498334e9d183faed0a59bfd18fe87bb9 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Mon, 8 Jul 2013 17:52:14 +0200 Subject: 08-exit-codes.txt: trying to systematically map common exit codes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Especially aiming bash. Signed-off-by: Jan Pokorný --- 08-exit-codes.txt | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 08-exit-codes.txt (limited to '08-exit-codes.txt') diff --git a/08-exit-codes.txt b/08-exit-codes.txt new file mode 100644 index 0000000..bdc406e --- /dev/null +++ b/08-exit-codes.txt @@ -0,0 +1,62 @@ +Model situation: +complex bash script has failed with some non-obvious exit code while +the subsequent runs are as expected (i.e., intermittent error or +something of that kind) + +Solution #1: quick web search +Solution #2: study all the functions and program invocations on all/guessed + code paths wrt. their return codes (not always properly + documented!) + add some bash runtime considerations +Solution #3: grep this document and pray it will help you :) + + +2 +* bash:* + - incorrect use of builtins + $ [ + bash: [: missing `]' + +126 +* bash + - command found but not executable + $ /etc + bash: /etc: Is a directory + +127 +* general + - cannot dynamically link in run-time (TODO: who is responsible here, exactly?): + $ ./testfoo + ./testfoo: error while loading shared libraries: libgetfoo.so: cannot open shared object file: No such file or directory +* bash + - unknown function/command + $ foo + bash: foo: command not found +* bash:wait + - waiting for nonexistent process/job + $ /bin/true & { sleep 1; wait $(($! - 1));} + bash: wait: pid 2864 is not a child of this shell + +254 +* bash + - when cannot fork so as to perform the command due to hitting number + of user processes limit, it will (IIUIC, first it will keep looping + over emitting "fork: retry: No child processes" and "fork: Resource + temporarily unavailable" messages, until it is eventually able to do + a fork to get outside of this loop, and then it will...) will + yield such exit status: + $ ulimit -u $(($(ps --no-headers -mu $(id -u) | wc -l) + 1)) + $ sleep 1 & sleep 1 + bash: fork: retry: No child processes + bash: fork: retry: No child processes + bash: fork: retry: No child processes + bash: fork: retry: No child processes + bash: fork: Resource temporarily unavailable + [...] + bash: fork: retry: No child processes + bash: fork: retry: No child processes + bash: fork: retry: No child processes + bash: fork: retry: No child processes + - see also [1] + + +[1] http://unix.stackexchange.com/questions/19113/fork-negative-return-value/19119#19119 -- cgit