[ostree] Don't fail "ostree remote refs" if writing the summary cache is not permitted



commit cb60de0f95fe15d8803842d5addefcdcb87b434c
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 18 10:00:58 2016 +0100

    Don't fail "ostree remote refs" if writing the summary cache is not permitted
    
    It used to be allowed to run something like "ostree remote refs" on
    a read-only (e.g. system) repo. However, the summary cache caused that to
    break. This commit just makes it not save the cache if we get some kind
    of permission error when writing it. It'll still work, even without the
    cache.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763855

 src/libostree/ostree-repo.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 2d6db1f..2a0a2bc 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -1818,13 +1818,23 @@ repo_remote_fetch_summary (OstreeRepo    *self,
 
   if (!from_cache && *out_summary && *out_signatures)
     {
+      g_autoptr(GError) temp_error = NULL;
+
       if (!_ostree_repo_cache_summary (self,
                                        name,
                                        *out_summary,
                                        *out_signatures,
                                        cancellable,
-                                       error))
-        goto out;
+                                       &temp_error))
+        {
+          if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
+            g_debug ("No permissions to save summary cache");
+          else
+            {
+              g_propagate_error (error, g_steal_pointer (&temp_error));
+              goto out;
+            }
+        }
     }
 
   ret = TRUE;


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