crash-reporter: Fix overzealous crash purging in guest mode.

Previously, if crash_sender was invoked during a guest session all crashes that
could be accessed (i.e. that were stored outside of user directories) were
deleted.  This is fixed by re-ordering some of the conditions in send_crashes().

The problem had been introduced by 57f6efa4:
https://chromium-review.googlesource.com/200060

BUG=chromium:393334
TEST=unit tests passed
TEST=try success on amd64-generic-full

Change-Id: I931665891eca8e645135f7f08c15b3086fcb7d73
Reviewed-on: https://chromium-review.googlesource.com/213470
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Thiemo Nagel <tnagel@google.com>
Tested-by: Thiemo Nagel <tnagel@google.com>
This commit is contained in:
Thiemo Nagel 2014-08-21 14:41:12 +02:00 committed by chrome-internal-fetch
parent 84c28d3b00
commit ea3941f630

View file

@ -514,20 +514,6 @@ send_crashes() {
continue
fi
# Remove existing crashes in case user consent has not (yet) been given or
# has been revoked.
if ! ${METRICS_CLIENT} -c; then
lecho "Crash reporting is disabled. Removing crash."
remove_report "${meta_path}"
continue
fi
if ! is_mock && ! is_official_image; then
lecho "Not an official OS version. Removing crash."
remove_report "${meta_path}"
continue
fi
if ! is_complete_metadata "${meta_path}"; then
# This report is incomplete, so if it's old, just remove it.
local old_meta=$(${FIND} "${dir}" -mindepth 1 -name \
@ -541,6 +527,12 @@ send_crashes() {
continue
fi
if ! is_mock && ! is_official_image; then
lecho "Not an official OS version. Removing crash."
remove_report "${meta_path}"
continue
fi
# Don't send crash reports from previous sessions while we're in guest mode
# to avoid the impression that crash reporting was enabled, which it isn't.
# (Don't exit right now because subsequent reports may be candidates for
@ -550,6 +542,15 @@ send_crashes() {
continue
fi
# Remove existing crashes in case user consent has not (yet) been given or
# has been revoked. This must come after the guest mode check because
# ${METRICS_CLIENT} always returns "not consented" in guest mode.
if ! ${METRICS_CLIENT} -c; then
lecho "Crash reporting is disabled. Removing crash."
remove_report "${meta_path}"
continue
fi
# Skip report if the upload rate is exceeded. (Don't exit right now because
# subsequent reports may be candidates for deletion.)
if ! check_rate; then