From bfdf4a8913c805bd74723aa1daf9eeeaa971e590 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 14 Mar 2014 09:31:33 -0400 Subject: [PATCH] user_collector: use %P instead of %p The latter will give us the PID as seen in the current PID namespace, but since the crash handler always runs in the top most PID namespace, that is meaningless to us. Instead, use the %P option so we see the PID in the top most namespace. BUG=chromium:351568 TEST=`cbuildbot amd64-generic-full` passes # linux-3.10 TEST=`cbuildbot x86-alex-release` passes # linux-3.4 TEST=`cbuildbot link-release` passes # linux-3.8 CQ-DEPEND=CL:190011 CQ-DEPEND=CL:190020 CQ-DEPEND=CL:190012 CQ-DEPEND=CL:190021 Change-Id: Ic619c4e7514e2824f7ba31b73cb9e11ec4092774 Reviewed-on: https://chromium-review.googlesource.com/190010 Reviewed-by: Ben Chan Commit-Queue: Mike Frysinger Tested-by: Mike Frysinger --- crash_reporter/user_collector.cc | 2 +- crash_reporter/user_collector_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc index 4afad4356..f6841e623 100644 --- a/crash_reporter/user_collector.cc +++ b/crash_reporter/user_collector.cc @@ -107,7 +107,7 @@ std::string UserCollector::GetPattern(bool enabled) const { // the size of the invocation line for crash_reporter, since the kernel // has a fixed-sized (128B) buffer for it (before parameter expansion). // Note that the kernel does not support quoted arguments in core_pattern. - return StringPrintf("|%s --user=%%p:%%s:%%u:%%e", our_path_.c_str()); + return StringPrintf("|%s --user=%%P:%%s:%%u:%%e", our_path_.c_str()); } else { return "core"; } diff --git a/crash_reporter/user_collector_test.cc b/crash_reporter/user_collector_test.cc index d416a7bbd..eed6dafa0 100644 --- a/crash_reporter/user_collector_test.cc +++ b/crash_reporter/user_collector_test.cc @@ -71,7 +71,7 @@ class UserCollectorTest : public ::testing::Test { TEST_F(UserCollectorTest, EnableOK) { ASSERT_TRUE(collector_.Enable()); - ExpectFileEquals("|/my/path --user=%p:%s:%u:%e", "test/core_pattern"); + ExpectFileEquals("|/my/path --user=%P:%s:%u:%e", "test/core_pattern"); ExpectFileEquals("4", "test/core_pipe_limit"); ASSERT_EQ(s_crashes, 0); EXPECT_TRUE(FindLog("Enabling user crash handling"));