{"action":"created","comment":{"url":"https://api.github.com/repos/ostreedev/ostree/pulls/comments/177153203","pull_request_review_id":106977213,"id":177153203,"diff_hunk":"@@ -2127,147 +2211,73 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot     *self,\n \n       deployment_root = ostree_sysroot_get_deployment_directory (self, deployment);\n       if (!g_file_query_exists (deployment_root, NULL))\n-        {\n-          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,\n-                       \"Unable to find expected deployment root: %s\",\n-                       gs_file_get_path_cached (deployment_root));\n-          goto out;\n-        }\n+        return glnx_throw (error, \"Unable to find expected deployment root: %s\",\n+                           gs_file_get_path_cached (deployment_root));\n \n       ostree_deployment_set_index (deployment, i);\n     }\n \n   if (self->booted_deployment && !found_booted_deployment)\n-    {\n-      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, \"Attempting to remove booted deployment\");\n-      goto out;\n-    }\n+    return glnx_throw (error, \"Attempting to remove booted deployment\");\n \n   gboolean bootloader_is_atomic = FALSE;\n   SyncStats syncstats = { 0, };\n+  g_autoptr(OstreeBootloader) bootloader = NULL;\n   if (!requires_new_bootversion)\n     {\n       if (!create_new_bootlinks (self, self->bootversion,\n                                  new_deployments,\n                                  cancellable, error))\n-        goto out;\n+        return FALSE;\n \n       if (!full_system_sync (self, &syncstats, cancellable, error))\n-        {\n-          g_prefix_error (error, \"Full sync: \");\n-          goto out;\n-        }\n+        return FALSE;\n \n       if (!swap_bootlinks (self, self->bootversion,\n                            new_deployments,\n                            cancellable, error))\n-        goto out;\n+        return FALSE;\n \n       bootloader_is_atomic = TRUE;\n     }\n   else\n     {\n-      int new_bootversion = self->bootversion ? 0 : 1;\n-      g_autofree char* new_loader_entries_dir = NULL;\n-      g_autoptr(OstreeRepo) repo = NULL;\n-      gboolean show_osname = FALSE;\n-\n+      gboolean boot_was_ro_mount = FALSE;\n       if (self->booted_deployment)\n         boot_was_ro_mount = is_ro_mount (\"/boot\");\n \n       g_debug (\"boot is ro: %s\", boot_was_ro_mount ? \"yes\" : \"no\");\n \n       if (boot_was_ro_mount)\n         {\n+          /* TODO: Use new mount namespace.  https://github.com/ostreedev/ostree/issues/1265 */\n           if (mount (\"/boot\", \"/boot\", NULL, MS_REMOUNT | MS_SILENT, NULL) < 0)\n-            {\n-              glnx_set_prefix_error_from_errno (error, \"%s\", \"Remounting /boot read-write\");\n-              goto out;\n-            }\n+            return glnx_throw_errno_prefix (error, \"Remounting /boot read-write\");\n         }\n \n       if (!_ostree_sysroot_query_bootloader (self, &bootloader, cancellable, error))\n-        goto out;\n-\n-      new_loader_entries_dir = g_strdup_printf (\"boot/loader.%d/entries\", new_bootversion);\n-      if (!glnx_shutil_rm_rf_at (self->sysroot_fd, new_loader_entries_dir, cancellable, error))\n-        goto out;\n-      if (!glnx_shutil_mkdir_p_at (self->sysroot_fd, new_loader_entries_dir, 0755,\n-                                   cancellable, error))\n-        goto out;\n-\n-      /* Need the repo to try and extract the versions for deployments.\n-       * But this is a \"nice-to-have\" for the bootloader UI, so failure\n-       * here is not fatal to the whole operation.  We just gracefully\n-       * fall back to the deployment index. */\n-      (void) ostree_sysroot_get_repo (self, &repo, cancellable, NULL);\n-\n-      /* Only show the osname in bootloader titles if there are multiple\n-       * osname's among the new deployments.  Check for that here. */\n-      for (guint i = 1; i < new_deployments->len; i++)\n-        {\n-          const char *osname_0 = ostree_deployment_get_osname (new_deployments->pdata[0]);\n-          const char *osname_i = ostree_deployment_get_osname (new_deployments->pdata[i]);\n-          if (!g_str_equal (osname_0, osname_i))\n-            {\n-              show_osname = TRUE;\n-              break;\n-            }\n-        }\n-\n-      for (guint i = 0; i < new_deployments->len; i++)\n-        {\n-          OstreeDeployment *deployment = new_deployments->pdata[i];\n-          if (!install_deployment_kernel (self, repo, new_bootversion,\n-                                          deployment, new_deployments->len,\n-                                          show_osname, cancellable, error))\n-            goto out;\n-        }\n-\n-      /* Create and swap bootlinks for *new* version */\n-      if (!create_new_bootlinks (self, new_bootversion,\n-                                 new_deployments,\n-                                 cancellable, error))\n-        goto out;\n-      if (!swap_bootlinks (self, new_bootversion, new_deployments,\n-                           cancellable, error))\n-        goto out;\n-\n-      g_debug (\"Using bootloader: %s\", bootloader ?\n-               g_type_name (G_TYPE_FROM_INSTANCE (bootloader)) : \"(none)\");\n-\n-      if (bootloader)\n-        bootloader_is_atomic = _ostree_bootloader_is_atomic (bootloader);\n+        return FALSE;\n+      bootloader_is_atomic = bootloader != NULL && _ostree_bootloader_is_atomic (bootloader);\n \n-      if (bootloader)\n+      /* Note equivalent of try/finally here */\n+      gboolean success = write_deployments_bootswap (self, new_deployments, opts, bootloader,\n+                                                     &syncstats, cancellable, error);\n+      /* Below here don't set GError until the if (!success) check */\n+      if (boot_was_ro_mount)\n         {\n-          if (!_ostree_bootloader_write_config (bootloader, new_bootversion,\n-                                                cancellable, error))\n+          if (mount (\"/boot\", \"/boot\", NULL, MS_REMOUNT | MS_RDONLY | MS_SILENT, NULL) < 0)\n             {\n-              g_prefix_error (error, \"Bootloader write config: \");\n-              goto out;\n+              /* Only make this a warning because we don't want to\n+               * completely bomb out if some other process happened to\n+               * jump in and open a file there.  See above TODO\n+               * around doing this in a new mount namespace.\n+               */\n+              int errsv = errno;","path":"src/libostree/ostree-sysroot-deploy.c","position":279,"original_position":279,"commit_id":"d65af1959acdb27a331c565fd960cb701c4e15e8","original_commit_id":"d65af1959acdb27a331c565fd960cb701c4e15e8","user":{"login":"cgwalters","id":244096,"avatar_url":"https://avatars0.githubusercontent.com/u/244096?v=4","gravatar_id":"","url":"https://api.github.com/users/cgwalters","html_url":"https://github.com/cgwalters","followers_url":"https://api.github.com/users/cgwalters/followers","following_url":"https://api.github.com/users/cgwalters/following{/other_user}","gists_url":"https://api.github.com/users/cgwalters/gists{/gist_id}","starred_url":"https://api.github.com/users/cgwalters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgwalters/subscriptions","organizations_url":"https://api.github.com/users/cgwalters/orgs","repos_url":"https://api.github.com/users/cgwalters/repos","events_url":"https://api.github.com/users/cgwalters/events{/privacy}","received_events_url":"https://api.github.com/users/cgwalters/received_events","type":"User","site_admin":false},"body":"I think it's more that in the past I've been bitten by the error handling functions themselves overwriting `errno`.  Imagine if e.g. you want to do `g_strdup_printf()` to format an error message, and then go on to reference `errno`..  But in this case it's safe to drop.","created_at":"2018-03-26T16:24:29Z","updated_at":"2018-03-26T16:24:30Z","html_url":"https://github.com/ostreedev/ostree/pull/1515#discussion_r177153203","pull_request_url":"https://api.github.com/repos/ostreedev/ostree/pulls/1515","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/comments/177153203"},"html":{"href":"https://github.com/ostreedev/ostree/pull/1515#discussion_r177153203"},"pull_request":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/1515"}},"in_reply_to_id":177149289},"pull_request":{"url":"https://api.github.com/repos/ostreedev/ostree/pulls/1515","id":177173362,"html_url":"https://github.com/ostreedev/ostree/pull/1515","diff_url":"https://github.com/ostreedev/ostree/pull/1515.diff","patch_url":"https://github.com/ostreedev/ostree/pull/1515.patch","issue_url":"https://api.github.com/repos/ostreedev/ostree/issues/1515","number":1515,"state":"open","locked":false,"title":"lib/deploy: Port final bootconfig writing to new style","user":{"login":"cgwalters","id":244096,"avatar_url":"https://avatars0.githubusercontent.com/u/244096?v=4","gravatar_id":"","url":"https://api.github.com/users/cgwalters","html_url":"https://github.com/cgwalters","followers_url":"https://api.github.com/users/cgwalters/followers","following_url":"https://api.github.com/users/cgwalters/following{/other_user}","gists_url":"https://api.github.com/users/cgwalters/gists{/gist_id}","starred_url":"https://api.github.com/users/cgwalters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgwalters/subscriptions","organizations_url":"https://api.github.com/users/cgwalters/orgs","repos_url":"https://api.github.com/users/cgwalters/repos","events_url":"https://api.github.com/users/cgwalters/events{/privacy}","received_events_url":"https://api.github.com/users/cgwalters/received_events","type":"User","site_admin":false},"body":"The main blocker for doing this before was the `goto out` handling\r\nfor remounting `/boot`.  Handle that by factoring out the bits that\r\nrequire it to a helper function, and do the C/GError equivalent of\r\n\"try/finally\".\r\n\r\nNot prep for anything right now, just decided to do this since I had the file\r\nopen.","created_at":"2018-03-23T20:12:54Z","updated_at":"2018-03-26T16:24:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"494987cf442ed7024e9b1dfa3bd1a5e5b3dbaae0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ostreedev/ostree/pulls/1515/commits","review_comments_url":"https://api.github.com/repos/ostreedev/ostree/pulls/1515/comments","review_comment_url":"https://api.github.com/repos/ostreedev/ostree/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ostreedev/ostree/issues/1515/comments","statuses_url":"https://api.github.com/repos/ostreedev/ostree/statuses/d65af1959acdb27a331c565fd960cb701c4e15e8","head":{"label":"cgwalters:deploy-more-style","ref":"deploy-more-style","sha":"d65af1959acdb27a331c565fd960cb701c4e15e8","user":{"login":"cgwalters","id":244096,"avatar_url":"https://avatars0.githubusercontent.com/u/244096?v=4","gravatar_id":"","url":"https://api.github.com/users/cgwalters","html_url":"https://github.com/cgwalters","followers_url":"https://api.github.com/users/cgwalters/followers","following_url":"https://api.github.com/users/cgwalters/following{/other_user}","gists_url":"https://api.github.com/users/cgwalters/gists{/gist_id}","starred_url":"https://api.github.com/users/cgwalters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgwalters/subscriptions","organizations_url":"https://api.github.com/users/cgwalters/orgs","repos_url":"https://api.github.com/users/cgwalters/repos","events_url":"https://api.github.com/users/cgwalters/events{/privacy}","received_events_url":"https://api.github.com/users/cgwalters/received_events","type":"User","site_admin":false},"repo":{"id":28151296,"name":"ostree","full_name":"cgwalters/ostree","owner":{"login":"cgwalters","id":244096,"avatar_url":"https://avatars0.githubusercontent.com/u/244096?v=4","gravatar_id":"","url":"https://api.github.com/users/cgwalters","html_url":"https://github.com/cgwalters","followers_url":"https://api.github.com/users/cgwalters/followers","following_url":"https://api.github.com/users/cgwalters/following{/other_user}","gists_url":"https://api.github.com/users/cgwalters/gists{/gist_id}","starred_url":"https://api.github.com/users/cgwalters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgwalters/subscriptions","organizations_url":"https://api.github.com/users/cgwalters/orgs","repos_url":"https://api.github.com/users/cgwalters/repos","events_url":"https://api.github.com/users/cgwalters/events{/privacy}","received_events_url":"https://api.github.com/users/cgwalters/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cgwalters/ostree","description":null,"fork":true,"url":"https://api.github.com/repos/cgwalters/ostree","forks_url":"https://api.github.com/repos/cgwalters/ostree/forks","keys_url":"https://api.github.com/repos/cgwalters/ostree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cgwalters/ostree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cgwalters/ostree/teams","hooks_url":"https://api.github.com/repos/cgwalters/ostree/hooks","issue_events_url":"https://api.github.com/repos/cgwalters/ostree/issues/events{/number}","events_url":"https://api.github.com/repos/cgwalters/ostree/events","assignees_url":"https://api.github.com/repos/cgwalters/ostree/assignees{/user}","branches_url":"https://api.github.com/repos/cgwalters/ostree/branches{/branch}","tags_url":"https://api.github.com/repos/cgwalters/ostree/tags","blobs_url":"https://api.github.com/repos/cgwalters/ostree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cgwalters/ostree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cgwalters/ostree/git/refs{/sha}","trees_url":"https://api.github.com/repos/cgwalters/ostree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cgwalters/ostree/statuses/{sha}","languages_url":"https://api.github.com/repos/cgwalters/ostree/languages","stargazers_url":"https://api.github.com/repos/cgwalters/ostree/stargazers","contributors_url":"https://api.github.com/repos/cgwalters/ostree/contributors","subscribers_url":"https://api.github.com/repos/cgwalters/ostree/subscribers","subscription_url":"https://api.github.com/repos/cgwalters/ostree/subscription","commits_url":"https://api.github.com/repos/cgwalters/ostree/commits{/sha}","git_commits_url":"https://api.github.com/repos/cgwalters/ostree/git/commits{/sha}","comments_url":"https://api.github.com/repos/cgwalters/ostree/comments{/number}","issue_comment_url":"https://api.github.com/repos/cgwalters/ostree/issues/comments{/number}","contents_url":"https://api.github.com/repos/cgwalters/ostree/contents/{+path}","compare_url":"https://api.github.com/repos/cgwalters/ostree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cgwalters/ostree/merges","archive_url":"https://api.github.com/repos/cgwalters/ostree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cgwalters/ostree/downloads","issues_url":"https://api.github.com/repos/cgwalters/ostree/issues{/number}","pulls_url":"https://api.github.com/repos/cgwalters/ostree/pulls{/number}","milestones_url":"https://api.github.com/repos/cgwalters/ostree/milestones{/number}","notifications_url":"https://api.github.com/repos/cgwalters/ostree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cgwalters/ostree/labels{/name}","releases_url":"https://api.github.com/repos/cgwalters/ostree/releases{/id}","deployments_url":"https://api.github.com/repos/cgwalters/ostree/deployments","created_at":"2014-12-17T19:09:35Z","updated_at":"2016-03-24T15:34:07Z","pushed_at":"2018-03-25T20:11:24Z","git_url":"git://github.com/cgwalters/ostree.git","ssh_url":"git@github.com:cgwalters/ostree.git","clone_url":"https://github.com/cgwalters/ostree.git","svn_url":"https://github.com/cgwalters/ostree","homepage":"http://live.gnome.org/OSTree","size":17285,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ostreedev:master","ref":"master","sha":"0b1d3b87e363e548546f2a39e7edb59f783e429c","user":{"login":"ostreedev","id":17928213,"avatar_url":"https://avatars1.githubusercontent.com/u/17928213?v=4","gravatar_id":"","url":"https://api.github.com/users/ostreedev","html_url":"https://github.com/ostreedev","followers_url":"https://api.github.com/users/ostreedev/followers","following_url":"https://api.github.com/users/ostreedev/following{/other_user}","gists_url":"https://api.github.com/users/ostreedev/gists{/gist_id}","starred_url":"https://api.github.com/users/ostreedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ostreedev/subscriptions","organizations_url":"https://api.github.com/users/ostreedev/orgs","repos_url":"https://api.github.com/users/ostreedev/repos","events_url":"https://api.github.com/users/ostreedev/events{/privacy}","received_events_url":"https://api.github.com/users/ostreedev/received_events","type":"Organization","site_admin":false},"repo":{"id":4614541,"name":"ostree","full_name":"ostreedev/ostree","owner":{"login":"ostreedev","id":17928213,"avatar_url":"https://avatars1.githubusercontent.com/u/17928213?v=4","gravatar_id":"","url":"https://api.github.com/users/ostreedev","html_url":"https://github.com/ostreedev","followers_url":"https://api.github.com/users/ostreedev/followers","following_url":"https://api.github.com/users/ostreedev/following{/other_user}","gists_url":"https://api.github.com/users/ostreedev/gists{/gist_id}","starred_url":"https://api.github.com/users/ostreedev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ostreedev/subscriptions","organizations_url":"https://api.github.com/users/ostreedev/orgs","repos_url":"https://api.github.com/users/ostreedev/repos","events_url":"https://api.github.com/users/ostreedev/events{/privacy}","received_events_url":"https://api.github.com/users/ostreedev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ostreedev/ostree","description":"Operating system and container binary deployment and upgrades","fork":false,"url":"https://api.github.com/repos/ostreedev/ostree","forks_url":"https://api.github.com/repos/ostreedev/ostree/forks","keys_url":"https://api.github.com/repos/ostreedev/ostree/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ostreedev/ostree/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ostreedev/ostree/teams","hooks_url":"https://api.github.com/repos/ostreedev/ostree/hooks","issue_events_url":"https://api.github.com/repos/ostreedev/ostree/issues/events{/number}","events_url":"https://api.github.com/repos/ostreedev/ostree/events","assignees_url":"https://api.github.com/repos/ostreedev/ostree/assignees{/user}","branches_url":"https://api.github.com/repos/ostreedev/ostree/branches{/branch}","tags_url":"https://api.github.com/repos/ostreedev/ostree/tags","blobs_url":"https://api.github.com/repos/ostreedev/ostree/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ostreedev/ostree/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ostreedev/ostree/git/refs{/sha}","trees_url":"https://api.github.com/repos/ostreedev/ostree/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ostreedev/ostree/statuses/{sha}","languages_url":"https://api.github.com/repos/ostreedev/ostree/languages","stargazers_url":"https://api.github.com/repos/ostreedev/ostree/stargazers","contributors_url":"https://api.github.com/repos/ostreedev/ostree/contributors","subscribers_url":"https://api.github.com/repos/ostreedev/ostree/subscribers","subscription_url":"https://api.github.com/repos/ostreedev/ostree/subscription","commits_url":"https://api.github.com/repos/ostreedev/ostree/commits{/sha}","git_commits_url":"https://api.github.com/repos/ostreedev/ostree/git/commits{/sha}","comments_url":"https://api.github.com/repos/ostreedev/ostree/comments{/number}","issue_comment_url":"https://api.github.com/repos/ostreedev/ostree/issues/comments{/number}","contents_url":"https://api.github.com/repos/ostreedev/ostree/contents/{+path}","compare_url":"https://api.github.com/repos/ostreedev/ostree/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ostreedev/ostree/merges","archive_url":"https://api.github.com/repos/ostreedev/ostree/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ostreedev/ostree/downloads","issues_url":"https://api.github.com/repos/ostreedev/ostree/issues{/number}","pulls_url":"https://api.github.com/repos/ostreedev/ostree/pulls{/number}","milestones_url":"https://api.github.com/repos/ostreedev/ostree/milestones{/number}","notifications_url":"https://api.github.com/repos/ostreedev/ostree/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ostreedev/ostree/labels{/name}","releases_url":"https://api.github.com/repos/ostreedev/ostree/releases{/id}","deployments_url":"https://api.github.com/repos/ostreedev/ostree/deployments","created_at":"2012-06-10T11:22:40Z","updated_at":"2018-03-26T14:24:38Z","pushed_at":"2018-03-26T14:24:32Z","git_url":"git://github.com/ostreedev/ostree.git","ssh_url":"git@github.com:ostreedev/ostree.git","clone_url":"https://github.com/ostreedev/ostree.git","svn_url":"https://github.com/ostreedev/ostree","homepage":"https://ostree.readthedocs.org/en/latest/","size":16426,"stargazers_count":230,"watchers_count":230,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":100,"mirror_url":null,"archived":false,"open_issues_count":149,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":100,"open_issues":149,"watchers":230,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/1515"},"html":{"href":"https://github.com/ostreedev/ostree/pull/1515"},"issue":{"href":"https://api.github.com/repos/ostreedev/ostree/issues/1515"},"comments":{"href":"https://api.github.com/repos/ostreedev/ostree/issues/1515/comments"},"review_comments":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/1515/comments"},"review_comment":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ostreedev/ostree/pulls/1515/commits"},"statuses":{"href":"https://api.github.com/repos/ostreedev/ostree/statuses/d65af1959acdb27a331c565fd960cb701c4e15e8"}},"author_association":"OWNER"}}
{"actor":{"display_login":"cgwalters"}}