lib/repo: Properly handle NULL homedir when signing commit
authorDan Nicholson <nicholson@endlessm.com>
Tue, 24 Oct 2017 19:27:17 +0000 (19:27 +0000)
committerSimon McVittie <smcv@debian.org>
Thu, 26 Oct 2017 23:19:45 +0000 (00:19 +0100)
Without this, ostree_repo_sign_commit throws a critical message when no
homedir is provided:

(ostree gpg-sign:5034): GLib-GIO-CRITICAL **: g_file_new_for_path: assertion 'path != NULL' failed

Closes: #1305
Approved by: cgwalters
Origin: upstream, 2017.13, commit:63ce86d5977ebfbedd2cdfba1e4f6bd400a3a1b8

Gbp-Pq: Topic 2017.13
Gbp-Pq: Name lib-repo-Properly-handle-NULL-homedir-when-signing-commit.patch

src/libostree/ostree-repo.c

index 1e336e9098530b5a7389a89848d7780f4a511175..0632ee2d8d19da5de59ce2ced4533191ce17b342 100644 (file)
@@ -4119,7 +4119,9 @@ ostree_repo_sign_commit (OstreeRepo     *self,
    * pass the homedir so that the signing key can be imported, allowing
    * subkey signatures to be recognised. */
   g_autoptr(GError) local_error = NULL;
-  g_autoptr(GFile) verify_keydir = g_file_new_for_path (homedir);
+  g_autoptr(GFile) verify_keydir = NULL;
+  if (homedir != NULL)
+    verify_keydir = g_file_new_for_path (homedir);
   g_autoptr(OstreeGpgVerifyResult) result
     =_ostree_repo_gpg_verify_with_metadata (self, commit_data, old_metadata,
                                             NULL, verify_keydir, NULL,