From d24164e2558095239c8a10a1817476db1079a38b Mon Sep 17 00:00:00 2001 From: "B. simonnet" Date: Tue, 18 Feb 2014 17:41:17 -0800 Subject: [PATCH] Use GOOGLE_CRASH_ID as the default crash report id crash_sender will use crash id and crash version id, in order: * the product name and product version in the meta file if present or * GOOGLE_CRASH_ID and GOOGLE_CRASH_VERSION_ID from /etc/os-release or * ID and VERSION_ID from /etc/os-release * ChromeOS and chrome os version otherwise BUG=chromium:343615 TEST=Built chromeos-base/platform2 and deployed it to a Chromebook. Added a test report in /var/spool/crash. Ran crash_sender in MOCK_CRASH_SENDING mode Changed the values of variable in /etc/os-release and observed that the sent values were correct TEST=Set GOOGLE_CRASH_ID to Brillo, remove protection for test images, observe that the crashes got logged in the Brillo bucket. TEST=trybot on x86, amd64, daisy and duck Change-Id: I30b87a344e7868e4a937c79b89c6d07ff0fcc6e4 Reviewed-on: https://chromium-review.googlesource.com/187035 Reviewed-by: Mike Frysinger Commit-Queue: Bertrand Simonnet Tested-by: Bertrand Simonnet --- crash_reporter/crash_sender | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/crash_reporter/crash_sender b/crash_reporter/crash_sender index 1764ba832..3b4f18361 100755 --- a/crash_reporter/crash_sender +++ b/crash_reporter/crash_sender @@ -6,7 +6,7 @@ set -e -# Product ID in crash report +# Default product ID in crash report (used if GOOGLE_CRASH_* is undefined). CHROMEOS_PRODUCT=ChromeOS # Should remove the run file when this process finishes. We don't want @@ -336,10 +336,31 @@ send_crash() { done # When uploading Chrome reports we need to report the right product and - # version, so allow the meta file to override these values. + # version. If the meta file does not specify it, use GOOGLE_CRASH_ID + # as the product and GOOGLE_CRASH_VERSION_ID as the version. if [ "${product}" = "undefined" ]; then - product=${CHROMEOS_PRODUCT} - version=${chromeos_version} + product="$(get_key_value /etc/os-release 'GOOGLE_CRASH_ID')" + fi + if [ "${version}" = "undefined" ]; then + version="$(get_key_value /etc/os-release 'GOOGLE_CRASH_VERSION_ID')" + fi + + # If GOOGLE_CRASH_* is undefined, we look for ID and VERSION_ID in + # /etc/os-release. + if [ "${product}" = "undefined" ]; then + product="$(get_key_value /etc/os-release 'ID')" + fi + if [ "${version}" = "undefined" ]; then + version="$(get_key_value /etc/os-release 'VERSION_ID')" + fi + + # If ID or VERSION_ID is undefined, we use the default product name + # and CHROMEOS_RELEASE_VERSION from /etc/lsb-release. + if [ "${product}" = "undefined" ]; then + product="${CHROMEOS_PRODUCT}" + fi + if [ "${version}" = "undefined" ]; then + version="${chromeos_version}" fi local image_type