[pacman-dev] bash-3 only error trap activation

Andres P aepd87 at gmail.com
Tue Jun 22 00:23:25 EDT 2010


Ok, after actually taking the time to install bash3...

$ env -i HOME="$HOME" TERM="$TERM" bash3 <<\!

  set -o errexit
  set -o errtrace

  TRIGGERED_ERR() { return $?; }

  trap 'TRIGGERED_ERR' ERR

  set -o xtrace

  var=$(false) || true
  echo $?

  var=$(false || true) # only way of not triggering it...
  echo $?

!

++ false           # Subshell false
+++ TRIGGERED_ERR  # Ignores outer "|| true"
+++ return 1
+ var=
+ true
+ echo 0
0                  # But the entire command line does
                   # not set off errexit
++ false
++ true            # Predictable second subshell...
+ var=
+ echo 0
0


So, if you want to keep the ERR trap then you'll have to modify check_deps so
that it always returns true.

Then you'd have to parse its output, similar to how in_opt_array works.


Horrible kludge, lets drop set -E.

Andres P


More information about the pacman-dev mailing list