Csaba Ringhofer has posted comments on this change. ( http://gerrit.cloudera.org:8080/17386 )
Change subject: IMPALA-10694: Improve the error handling of setup-ranger ...................................................................... Patch Set 2: (1 comment) http://gerrit.cloudera.org:8080/#/c/17386/2/testdata/bin/create-load-data.sh File testdata/bin/create-load-data.sh: http://gerrit.cloudera.org:8080/#/c/17386/2/testdata/bin/create-load-data.sh@344 PS2, Line 344: res=$? : if test "$res" != "0"; then : echo "Error occurred when the group of \"owner\" was created." : exit 1 : fi I am not too experienced with shell and may miss something, but I think that we won't get to this point in case of errors because if wget returns with non 0 result then we'll exit immediately due to "set -e". The gotcha here is that "export" has an effect on error handling. So in the original version the error occurred inside an export var=${...} command, and while the variable substitution would normally fail due to "set -euo pipefail" with export var=... it succeeds. See https://unix.stackexchange.com/questions/426943/bash-export-ignores-set-ex If you really want to handle errors in a situation like this I think that easiest solution is to turn it off temporarily: set +e wget ... res=$? set -e if test "$res" != "0"; then ... I am not sure that we need the extra error handling though - simply moving export GROUP_ID_OWNER to a separate line would allow set -e to do its job: GROUP_ID_OWNER=$(wget ...) export GROUP_ID_OWNER -- To view, visit http://gerrit.cloudera.org:8080/17386 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I45605d1a7441b734cf80249626638cde3adce28b Gerrit-Change-Number: 17386 Gerrit-PatchSet: 2 Gerrit-Owner: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Quanlong Huang <[email protected]> Gerrit-Comment-Date: Mon, 03 May 2021 06:45:01 +0000 Gerrit-HasComments: Yes
