Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bfddbd2 authored by Felipe Leme's avatar Felipe Leme
Browse files

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
parent 1a955faa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ class BugreportStandardStreamsCallback : public StandardStreamsCallbackInterface
            std::vector<const char*> 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"
+11 −11
Original line number Diff line number Diff line
@@ -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"};