From: lzwind Date: Wed, 5 Aug 2026 00:59:56 +0000 (+0800) Subject: find-remotes: Don't require write access to repo unless pulling X-Git-Tag: archive/raspbian/2026.4-1+rpi1^2~9^2~1^2~3^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2a71b8f897e716abea7db82552c381463182d4d5;p=ostree.git find-remotes: Don't require write access to repo unless pulling ostree find-remotes is a read-only operation that searches for remotes which have a given collection-ref. It should not require write access to the repository. Only when --pull is used does the command actually write to the repo. Move the ostree_ensure_repo_writable() check to just before the pull phase so that read-only find-remotes works on read-only repositories. Closes #3585 --- diff --git a/src/ostree/ot-builtin-find-remotes.c b/src/ostree/ot-builtin-find-remotes.c index 7475aaa6..600f3769 100644 --- a/src/ostree/ot-builtin-find-remotes.c +++ b/src/ostree/ot-builtin-find-remotes.c @@ -190,9 +190,6 @@ ostree_builtin_find_remotes (int argc, char **argv, OstreeCommandInvocation *inv error)) return FALSE; - if (!ostree_ensure_repo_writable (repo, error)) - return FALSE; - if (argc < 3) { ot_util_usage_error (context, "At least one COLLECTION-ID REF pair must be specified", error); @@ -363,6 +360,10 @@ ostree_builtin_find_remotes (int argc, char **argv, OstreeCommandInvocation *inv if (!opt_pull) return TRUE; + /* Pulling requires write access to the repository. */ + if (!ostree_ensure_repo_writable (repo, error)) + return FALSE; + { GVariantBuilder builder; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));