From 4bfddbd20e3bf11ffc31c8c4177a13ed14ab1a11 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 15 Aug 2017 18:09:54 -0700 Subject: [PATCH] Don't preserve file attributes when pulling bugreport file... ...otherwise it could have weird dates when the device clock is wrong. Test: m -j32 adb && ./out/host/linux-x86/bin/adb bugreport test.zip && ls -l test.zip Test: m -j32 adb_test && ./out/host/linux-x86/nativetest64/adb_test/adb_test Fixes: 63927360 Change-Id: I3f87277f1acb97212a87b89639e42b6d7d300faa --- adb/bugreport.cpp | 2 +- adb/bugreport_test.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/adb/bugreport.cpp b/adb/bugreport.cpp index 372a3b4aa..544c56616 100644 --- a/adb/bugreport.cpp +++ b/adb/bugreport.cpp @@ -102,7 +102,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface std::vector srcs{src_file_.c_str()}; SetLineMessage("pulling"); status_ = - br_->DoSyncPull(srcs, destination.c_str(), true, line_message_.c_str()) ? 0 : 1; + br_->DoSyncPull(srcs, destination.c_str(), false, line_message_.c_str()) ? 0 : 1; if (status_ != 0) { fprintf(stderr, "Bug report finished but could not be copied to '%s'.\n" diff --git a/adb/bugreport_test.cpp b/adb/bugreport_test.cpp index d3787b40a..896db1fe1 100644 --- a/adb/bugreport_test.cpp +++ b/adb/bugreport_test.cpp @@ -187,7 +187,7 @@ TEST_F(BugreportTest, NoArgumentsNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), - true, StrEq("pulling da_bugreport.zip"))) + false, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; @@ -207,7 +207,7 @@ TEST_F(BugreportTest, NoArgumentsPostNDevice) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), - true, StrEq("pulling da_bugreport.zip"))) + false, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport"}; @@ -221,7 +221,7 @@ TEST_F(BugreportTest, OkNDevice) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; @@ -237,7 +237,7 @@ TEST_F(BugreportTest, OkNDeviceSplitBuffer) { WithArg<4>(WriteOnStdout("/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; @@ -273,7 +273,7 @@ TEST_F(BugreportTest, OkProgress) { WithArg<4>(ReturnCallbackDone()))); // clang-format on EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; @@ -304,7 +304,7 @@ TEST_F(BugreportTest, OkProgressAlwaysForward) { WithArg<4>(ReturnCallbackDone()))); // clang-format on EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; @@ -327,7 +327,7 @@ TEST_F(BugreportTest, OkProgressZeroPercentIsNotIgnored) { WithArg<4>(ReturnCallbackDone()))); // clang-format on EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file.zip"}; @@ -346,7 +346,7 @@ TEST_F(BugreportTest, OkDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), - true, StrEq("pulling da_bugreport.zip"))) + false, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; @@ -360,7 +360,7 @@ TEST_F(BugreportTest, OkNoExtension) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip\n")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, StrEq("pulling file.zip"))) + false, StrEq("pulling file.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", "file"}; @@ -379,7 +379,7 @@ TEST_F(BugreportTest, OkNDeviceDirectory) { WithArg<4>(WriteOnStdout("OK:/device/da_bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/da_bugreport.zip")), StrEq(dest_file), - true, StrEq("pulling da_bugreport.zip"))) + false, StrEq("pulling da_bugreport.zip"))) .WillOnce(Return(true)); const char* args[] = {"bugreport", td.path}; @@ -462,7 +462,7 @@ TEST_F(BugreportTest, PullFails) { .WillOnce(DoAll(WithArg<4>(WriteOnStdout("OK:/device/bugreport.zip")), WithArg<4>(ReturnCallbackDone()))); EXPECT_CALL(br_, DoSyncPull(ElementsAre(StrEq("/device/bugreport.zip")), StrEq("file.zip"), - true, HasSubstr("file.zip"))) + false, HasSubstr("file.zip"))) .WillOnce(Return(false)); const char* args[] = {"bugreport", "file.zip"};