From dd6cc4d7eee1669a44cbe1f72ce3325aba2bf0f9 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 30 Nov 2015 10:21:25 -0800 Subject: [PATCH 1/3] adb: correctly count skipped files in push/pull Bug: http://b/25650207 Change-Id: I055b08216938640c4f7c5e96a7ea3719bf90ba70 --- adb/file_sync_client.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index e109e3eef..320891de1 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -552,11 +552,12 @@ static bool local_build_list(SyncConnection& sc, std::vector* filelist } else { if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) { sc.Error("skipping special file '%s'", lpath.c_str()); + ci.skip = true; } else { ci.time = st.st_mtime; ci.size = st.st_size; - filelist->push_back(ci); } + filelist->push_back(ci); } } @@ -723,8 +724,7 @@ static bool remote_build_list(SyncConnection& sc, bool empty_dir = true; // Put the files/dirs in rpath on the lists. - auto callback = [&](unsigned mode, unsigned size, unsigned time, - const char* name) { + auto callback = [&](unsigned mode, unsigned size, unsigned time, const char* name) { if (IsDotOrDotDot(name)) { return; } @@ -735,12 +735,15 @@ static bool remote_build_list(SyncConnection& sc, copyinfo ci = mkcopyinfo(lpath, rpath, name, mode); if (S_ISDIR(mode)) { dirlist.push_back(ci); - } else if (S_ISREG(mode) || S_ISLNK(mode)) { - ci.time = time; - ci.size = size; - filelist->push_back(ci); } else { - sc.Warning("skipping special file '%s'\n", name); + if (S_ISREG(mode) || S_ISLNK(mode)) { + ci.time = time; + ci.size = size; + } else { + sc.Warning("skipping special file '%s'\n", name); + ci.skip = true; + } + filelist->push_back(ci); } }; From d3266e058e9b4c609491e4115887407446d8ace1 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 30 Nov 2015 10:27:54 -0800 Subject: [PATCH 2/3] adb: remove extraneous newline from skip message Change-Id: I12314da589bf0db14b37ae4c1f526665182f4776 --- adb/file_sync_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index 320891de1..d284f084a 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -740,7 +740,7 @@ static bool remote_build_list(SyncConnection& sc, ci.time = time; ci.size = size; } else { - sc.Warning("skipping special file '%s'\n", name); + sc.Warning("skipping special file '%s'", name); ci.skip = true; } filelist->push_back(ci); From 7b284b2f22a3c1076bbb483d6ab49afe191adc3d Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 30 Nov 2015 10:28:15 -0800 Subject: [PATCH 3/3] adb: don't pull symlinks when pulling a directory The previous change to do this (f96dc73b) only skipped individually named symlinks, not symlinks inside of a directory that was being pulled. Bug: http://b/25601283 Change-Id: I25bdcbc546a9d3a0dbd8dacdb065fb134d96022b --- adb/file_sync_client.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adb/file_sync_client.cpp b/adb/file_sync_client.cpp index d284f084a..bd0e6c41e 100644 --- a/adb/file_sync_client.cpp +++ b/adb/file_sync_client.cpp @@ -736,9 +736,12 @@ static bool remote_build_list(SyncConnection& sc, if (S_ISDIR(mode)) { dirlist.push_back(ci); } else { - if (S_ISREG(mode) || S_ISLNK(mode)) { + if (S_ISREG(mode)) { ci.time = time; ci.size = size; + } else if (S_ISLNK(mode)) { + sc.Warning("skipping symlink '%s'", name); + ci.skip = true; } else { sc.Warning("skipping special file '%s'", name); ci.skip = true;