summaryrefslogtreecommitdiffstats
path: root/08-exit-codes.txt
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-07-08 17:52:14 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-07-08 17:55:18 +0200
commit5672b034498334e9d183faed0a59bfd18fe87bb9 (patch)
tree594749095dc1181b9d58a6201446c313699ab20e /08-exit-codes.txt
parent99bada06048d41bfc5baae8099097a31c0720bf2 (diff)
downloadtips-tricks-5672b034498334e9d183faed0a59bfd18fe87bb9.tar.gz
tips-tricks-5672b034498334e9d183faed0a59bfd18fe87bb9.tar.xz
tips-tricks-5672b034498334e9d183faed0a59bfd18fe87bb9.zip
08-exit-codes.txt: trying to systematically map common exit codes
Especially aiming bash. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to '08-exit-codes.txt')
-rw-r--r--08-exit-codes.txt62
1 files changed, 62 insertions, 0 deletions
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