[ostree] core: Fix regression when committing symlinks in archive mode



commit 16c0cfe9b59e2c619d4c57be9c995849af9f659f
Author: Colin Walters <walters verbum org>
Date:   Fri Feb 24 09:58:45 2012 -0500

    core: Fix regression when committing symlinks in archive mode
    
    Commit 802959f398bfc0c7acac9252e7a8f1a021884ce8 broke this because it
    made all archived content files be S_IFREG, which is clearly wrong.

 src/libostree/ostree-core.c |    5 ++++-
 src/libostree/ostree-repo.c |    3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 9f48c31..30bda71 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -684,9 +684,12 @@ ostree_create_file_from_input (GFile            *dest_file,
   if (g_cancellable_set_error_if_cancelled (cancellable, error))
     return FALSE;
 
-  if (finfo != NULL && !is_archived_content)
+  if (finfo != NULL)
     {
       mode = g_file_info_get_attribute_uint32 (finfo, "unix::mode");
+      /* Archived content files should always be 0644 */
+      if (is_archived_content)
+        mode = (mode & S_IFMT) | 0644;
     }
   else
     {
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 3dbdc4d..67057d5 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -938,8 +938,9 @@ impl_stage_archive_file_object_from_raw (OstreeRepo         *self,
                                            cancellable, error))
     goto out;
 
-  if (ret_checksum)
+  if (out_checksum)
     {
+      g_assert (ret_checksum);
       ostree_checksum_update_stat (ret_checksum,
                                    g_file_info_get_attribute_uint32 (file_info, "unix::uid"),
                                    g_file_info_get_attribute_uint32 (file_info, "unix::gid"),



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