Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: delta_diff_generator.cc

Issue 6528006: AU: tolerate files that are symlinks in src image, yet not in new image. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fix cleanup Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | delta_performer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_diff_generator.cc
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index 0d1e4cef2360af47c1004c256f762b01d97b646b..e113f7b91734816a1172f803ac25c0485c67c1bd 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -141,6 +141,7 @@ bool DeltaReadFiles(Graph* graph,
int data_fd,
off_t* data_file_size) {
set<ino_t> visited_inodes;
+ set<ino_t> visited_src_inodes;
for (FilesystemIterator fs_iter(new_root,
utils::SetWithValue<string>("/lost+found"));
!fs_iter.IsEnd(); fs_iter.Increment()) {
@@ -156,10 +157,22 @@ bool DeltaReadFiles(Graph* graph,
LOG(INFO) << "Encoding file " << fs_iter.GetPartialPath();
+ bool should_diff_from_source = true;
+ string src_path = old_root + fs_iter.GetPartialPath();
+ if (utils::FileExists(src_path.c_str())) {
+ struct stat src_stbuf;
+ TEST_AND_RETURN_FALSE_ERRNO(0 == stat(src_path.c_str(), &src_stbuf));
+ should_diff_from_source = !utils::SetContainsKey(visited_src_inodes,
petkov 2011/02/15 06:01:38 Add a comment what this is trying to catch and wha
+ src_stbuf.st_ino);
+ visited_src_inodes.insert(src_stbuf.st_ino);
+ }
+
TEST_AND_RETURN_FALSE(DeltaReadFile(graph,
Vertex::kInvalidIndex,
blocks,
- old_root,
+ (should_diff_from_source ?
+ old_root :
+ "/-!@:&*nonexistent_path"),
petkov 2011/02/15 06:01:38 This feels a bit of a hack. Maybe use an empty str
new_root,
fs_iter.GetPartialPath(),
data_fd,
« no previous file with comments | « no previous file | delta_performer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698