From df2a1e2bd41f700179e38ef4aa68b0f0d9e88859 Mon Sep 17 00:00:00 2001 From: Michael Krebs Date: Tue, 29 May 2012 18:57:51 -0700 Subject: [PATCH] scripts: Fix possible cause of cros_generate_breakpad_symbols crash Use the ":" builtin command to prevent the increment of $ERROR_COUNT from ever failing under strict mode (i.e. "set -e"). cros_generate_breakpad_symbols failed for some reason, and this is my best guess as to the cause. That is, the post-increment would otherwise fail when $ERROR_COUNT is zero because it would have a non-zero exit status. BUG=chromium-os:31332 TEST=Manually ran script Change-Id: Iec7fd9358c339414ccd3c2ca1fd598f124375f0b Reviewed-on: https://gerrit.chromium.org/gerrit/23979 Reviewed-by: Mike Frysinger Reviewed-by: Brian Harring Commit-Ready: Michael Krebs Tested-by: Michael Krebs --- cros_generate_breakpad_symbols | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cros_generate_breakpad_symbols b/cros_generate_breakpad_symbols index fd835f24f2..249d03c0ea 100755 --- a/cros_generate_breakpad_symbols +++ b/cros_generate_breakpad_symbols @@ -81,7 +81,7 @@ finish_job() { # can throw an error; doesn't matter, thus this form. ! wait ${finished} &> /dev/null if [ "${result-1}" -ne "0" ]; then - (( ERROR_COUNT++ )) + : $(( ++ERROR_COUNT )) fi # Bit of a hack, but it works well enough. debug "finished ${finished} with result ${result-1}" @@ -173,7 +173,7 @@ dump_file() { if ! cmp --quiet "${installed_sym}" "${SYM_FILE}"; then error "${installed_sym} differ from current sym file:" error "$(diff "${installed_sym}" "${SYM_FILE}")" - (( ERROR_COUNT++ )) + : $(( ++ERROR_COUNT )) exit 1 fi fi @@ -266,7 +266,7 @@ main() { either_file=${either_file%\'} if [ ! -h "${either_file}" -a ! -f "${either_file}" ]; then error "Specified file ${either_file} does not exist" - (( ERROR_COUNT++ )) + : $(( ++ERROR_COUNT )) continue fi if [ "${either_file##*.}" == "debug" ]; then @@ -290,7 +290,7 @@ main() { if [[ ${ERROR_COUNT} == 0 ]]; then return 0 fi - die "Encountered ${ERROR_COUNT} problems" + die_notrace "Encountered ${ERROR_COUNT} problems" } main "$@"