[ostree] static-delta: Ignore symlinks when computing similar objects



commit 43d045309c7d4d72baa889ed4c474ea10f390132
Author: John Hiesey <john hiesey com>
Date:   Tue Aug 25 18:15:53 2015 -0700

    static-delta: Ignore symlinks when computing similar objects
    
    _ostree_delta_compute_similar_objects should not output symlinks.
    Previously, a symlink in the "from" commit could be matched to a
    real file in the "to" commit, since nothing was filtering symlinks
    on the "from" side. This led to failures running the bzdiff
    algorithm.

 ...ostree-repo-static-delta-compilation-analysis.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/libostree/ostree-repo-static-delta-compilation-analysis.c 
b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
index 3364787..876c041 100644
--- a/src/libostree/ostree-repo-static-delta-compilation-analysis.c
+++ b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
@@ -76,20 +76,18 @@ build_content_sizenames_recurse (OstreeRepo                     *repo,
             {
               g_autoptr(GFileInfo) finfo = NULL;
 
-              csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
-              csizenames->checksum = g_strdup (checksum);
-              
-              /* Transfer ownership so things get cleaned up if we
-               * throw an exception below.
-               */
-              g_hash_table_replace (sizenames_map, csizenames->checksum, csizenames);
-
               if (!ostree_repo_load_file (repo, checksum,
                                           NULL, &finfo, NULL,
                                           cancellable, error))
                 goto out;
-              
+
+              if (g_file_info_get_file_type (finfo) != G_FILE_TYPE_REGULAR)
+                continue;
+
+              csizenames = g_new0 (OstreeDeltaContentSizeNames, 1);
+              csizenames->checksum = g_strdup (checksum);
               csizenames->size = g_file_info_get_size (finfo);
+              g_hash_table_replace (sizenames_map, csizenames->checksum, csizenames);
             }
 
           if (!csizenames->basenames)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]