New upstream version 2022.3

This commit is contained in:
Dan Nicholson committed 2022-06-08 16:32:57 +00:00
commit 14fbcf3f31
73 files changed
+4210 -2294

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Copyright (C) 2022 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
[Unit]
Description=OSTree Complete Boot
Documentation=man:ostree(1)
# For now, this is the only condition on which we start, but it's
# marked as a triggering condition in case in the future we want
# to do something else.
ConditionPathExists=|/boot/ostree/finalize-failure.stamp
RequiresMountsFor=/boot
# Ensure that we propagate the failure into the current boot before
# any further finalization attempts.
Before=ostree-finalize-staged.service
[Service]
Type=oneshot
# To write to /boot while keeping it read-only
MountFlags=slave
RemainAfterExit=yes
ExecStart=/usr/bin/ostree admin boot-complete
+2
View File
@@ -13,5 +13,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
# ostree runtime configuration
d /run/ostree 0755 root root -
# https://github.com/ostreedev/ostree/issues/393
R! /var/tmp/ostree-unlock-ovl.*
+4 -7
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -26,13 +27,13 @@ enum {
PROP_STREAMS
};
G_DEFINE_TYPE (OstreeChainInputStream, ostree_chain_input_stream, G_TYPE_INPUT_STREAM)
struct _OstreeChainInputStreamPrivate {
GPtrArray *streams;
guint index;
};
G_DEFINE_TYPE_WITH_PRIVATE (OstreeChainInputStream, ostree_chain_input_stream, G_TYPE_INPUT_STREAM)
static void ostree_chain_input_stream_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -56,8 +57,6 @@ ostree_chain_input_stream_class_init (OstreeChainInputStreamClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (OstreeChainInputStreamPrivate));
gobject_class->get_property = ostree_chain_input_stream_get_property;
gobject_class->set_property = ostree_chain_input_stream_set_property;
@@ -137,9 +136,7 @@ ostree_chain_input_stream_finalize (GObject *object)
static void
ostree_chain_input_stream_init (OstreeChainInputStream *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OSTREE_TYPE_CHAIN_INPUT_STREAM,
OstreeChainInputStreamPrivate);
self->priv = ostree_chain_input_stream_get_instance_private (self);
}
+4 -8
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -26,12 +27,12 @@ enum {
PROP_CHECKSUM
};
G_DEFINE_TYPE (OstreeChecksumInputStream, ostree_checksum_input_stream, G_TYPE_FILTER_INPUT_STREAM)
struct _OstreeChecksumInputStreamPrivate {
GChecksum *checksum;
};
G_DEFINE_TYPE_WITH_PRIVATE (OstreeChecksumInputStream, ostree_checksum_input_stream, G_TYPE_FILTER_INPUT_STREAM)
static void ostree_checksum_input_stream_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -51,8 +52,6 @@ ostree_checksum_input_stream_class_init (OstreeChecksumInputStreamClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (OstreeChecksumInputStreamPrivate));
gobject_class->get_property = ostree_checksum_input_stream_get_property;
gobject_class->set_property = ostree_checksum_input_stream_set_property;
@@ -118,10 +117,7 @@ ostree_checksum_input_stream_get_property (GObject *object,
static void
ostree_checksum_input_stream_init (OstreeChecksumInputStream *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OSTREE_TYPE_CHECKSUM_INPUT_STREAM,
OstreeChecksumInputStreamPrivate);
self->priv = ostree_checksum_input_stream_get_instance_private (self);
}
OstreeChecksumInputStream *
+1
View File
@@ -51,6 +51,7 @@ ostree_cmd__private__ (void)
_ostree_repo_static_delta_delete,
_ostree_repo_verify_bindings,
_ostree_sysroot_finalize_staged,
_ostree_sysroot_boot_complete,
};
return &table;
+1
View File
@@ -33,6 +33,7 @@ typedef struct {
gboolean (* ostree_static_delta_delete) (OstreeRepo *repo, const char *delta_id, GCancellable *cancellable, GError **error);
gboolean (* ostree_repo_verify_bindings) (const char *collection_id, const char *ref_name, GVariant *commit, GError **error);
gboolean (* ostree_finalize_staged) (OstreeSysroot *sysroot, GCancellable *cancellable, GError **error);
gboolean (* ostree_boot_complete) (OstreeSysroot *sysroot, GCancellable *cancellable, GError **error);
} OstreeCmdPrivateVTable;
/* Note this not really "public", we just export the symbol, but not the header */
+23 -15
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -1031,19 +1032,22 @@ typedef struct {
} ChecksumFileAsyncData;
static void
checksum_file_async_thread (GSimpleAsyncResult *res,
checksum_file_async_thread (GTask *task,
GObject *object,
gpointer datap,
GCancellable *cancellable)
{
GError *error = NULL;
ChecksumFileAsyncData *data;
ChecksumFileAsyncData *data = datap;
guchar *csum = NULL;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!ostree_checksum_file (data->f, data->objtype, &csum, cancellable, &error))
g_simple_async_result_take_error (res, error);
g_task_return_error (task, error);
else
data->csum = csum;
{
data->csum = csum;
g_task_return_pointer (task, data, NULL);
}
}
static void
@@ -1076,18 +1080,18 @@ ostree_checksum_file_async (GFile *f,
GAsyncReadyCallback callback,
gpointer user_data)
{
GSimpleAsyncResult *res;
g_autoptr(GTask) task = NULL;
ChecksumFileAsyncData *data;
data = g_new0 (ChecksumFileAsyncData, 1);
data->f = g_object_ref (f);
data->objtype = objtype;
res = g_simple_async_result_new (G_OBJECT (f), callback, user_data, ostree_checksum_file_async);
g_simple_async_result_set_op_res_gpointer (res, data, (GDestroyNotify)checksum_file_async_data_free);
g_simple_async_result_run_in_thread (res, checksum_file_async_thread, io_priority, cancellable);
g_object_unref (res);
task = g_task_new (G_OBJECT (f), cancellable, callback, user_data);
g_task_set_task_data (task, data, (GDestroyNotify)checksum_file_async_data_free);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, ostree_checksum_file_async);
g_task_run_in_thread (task, (GTaskThreadFunc)checksum_file_async_thread);
}
/**
@@ -1106,15 +1110,19 @@ ostree_checksum_file_async_finish (GFile *f,
guchar **out_csum,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
ChecksumFileAsyncData *data;
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_checksum_file_async);
g_return_val_if_fail (G_IS_FILE (f), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (g_task_is_valid (result, f), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, ostree_checksum_file_async), FALSE);
if (g_simple_async_result_propagate_error (simple, error))
data = g_task_propagate_pointer (G_TASK (result), error);
if (data == NULL)
return FALSE;
data = g_simple_async_result_get_op_res_gpointer (simple);
/* Transfer ownership */
*out_csum = data->csum;
data->csum = NULL;
+89 -47
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -50,8 +51,6 @@
#include "ostree-repo-private.h"
#include "otutil.h"
#include "ostree-soup-uri.h"
typedef struct FetcherRequest FetcherRequest;
typedef struct SockInfo SockInfo;
@@ -183,13 +182,13 @@ _ostree_fetcher_finalize (GObject *object)
g_free (self->cookie_jar_path);
g_free (self->proxy);
g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0);
g_clear_pointer (&self->extra_headers, (GDestroyNotify)curl_slist_free_all);
g_clear_pointer (&self->extra_headers, curl_slist_free_all);
g_hash_table_unref (self->outstanding_requests);
g_hash_table_unref (self->sockets);
g_clear_pointer (&self->timer_event, (GDestroyNotify)destroy_and_unref_source);
g_clear_pointer (&self->timer_event, destroy_and_unref_source);
if (self->mainctx)
g_main_context_unref (self->mainctx);
g_clear_pointer (&self->custom_user_agent, (GDestroyNotify)g_free);
g_clear_pointer (&self->custom_user_agent, g_free);
G_OBJECT_CLASS (_ostree_fetcher_parent_class)->finalize (object);
}
@@ -266,11 +265,11 @@ destroy_and_unref_source (GSource *source)
}
static char *
request_get_uri (FetcherRequest *req, SoupURI *baseuri)
request_get_uri (FetcherRequest *req, GUri *baseuri)
{
if (!req->filename)
return soup_uri_to_string (baseuri, FALSE);
{ g_autofree char *uristr = soup_uri_to_string (baseuri, FALSE);
return g_uri_to_string_partial (baseuri, G_URI_HIDE_PASSWORD);
{ g_autofree char *uristr = g_uri_to_string_partial (baseuri, G_URI_HIDE_PASSWORD);
return g_build_filename (uristr, req->filename, NULL);
}
}
@@ -424,7 +423,7 @@ static gboolean
timer_cb (gpointer data)
{
OstreeFetcher *fetcher = data;
g_clear_pointer (&fetcher->timer_event, (GDestroyNotify)destroy_and_unref_source);
g_clear_pointer (&fetcher->timer_event, destroy_and_unref_source);
(void)curl_multi_socket_action (fetcher->multi, CURL_SOCKET_TIMEOUT, 0, &fetcher->curl_running);
check_multi_info (fetcher);
@@ -437,7 +436,7 @@ update_timeout_cb (CURLM *multi, long timeout_ms, void *userp)
{
OstreeFetcher *fetcher = userp;
g_clear_pointer (&fetcher->timer_event, (GDestroyNotify)destroy_and_unref_source);
g_clear_pointer (&fetcher->timer_event, destroy_and_unref_source);
if (timeout_ms != -1)
{
@@ -479,7 +478,7 @@ sock_unref (SockInfo *f)
return;
if (--f->refcount != 0)
return;
g_clear_pointer (&f->ch, (GDestroyNotify)destroy_and_unref_source);
g_clear_pointer (&f->ch, destroy_and_unref_source);
g_free (f);
}
@@ -492,7 +491,7 @@ setsock (SockInfo*f, curl_socket_t s, int act, OstreeFetcher *fetcher)
f->sockfd = s;
f->action = act;
g_clear_pointer (&f->ch, (GDestroyNotify)destroy_and_unref_source);
g_clear_pointer (&f->ch, destroy_and_unref_source);
/* TODO - investigate new g_source_modify_unix_fd() so changing the poll
* flags involves less allocation.
*/
@@ -648,7 +647,7 @@ request_unref (FetcherRequest *req)
g_string_free (req->output_buf, TRUE);
g_free (req->if_none_match);
g_free (req->out_etag);
g_clear_pointer (&req->req_headers, (GDestroyNotify)curl_slist_free_all);
g_clear_pointer (&req->req_headers, curl_slist_free_all);
curl_easy_cleanup (req->easy);
g_free (req);
@@ -705,7 +704,7 @@ _ostree_fetcher_set_extra_headers (OstreeFetcher *self,
const char *key;
const char *value;
g_clear_pointer (&self->extra_headers, (GDestroyNotify)curl_slist_free_all);
g_clear_pointer (&self->extra_headers, curl_slist_free_all);
g_variant_iter_init (&viter, extra_headers);
while (g_variant_iter_loop (&viter, "(&s&s)", &key, &value))
@@ -719,7 +718,7 @@ void
_ostree_fetcher_set_extra_user_agent (OstreeFetcher *self,
const char *extra_user_agent)
{
g_clear_pointer (&self->custom_user_agent, (GDestroyNotify)g_free);
g_clear_pointer (&self->custom_user_agent, g_free);
if (extra_user_agent)
{
self->custom_user_agent =
@@ -763,13 +762,15 @@ initiate_next_curl_request (FetcherRequest *req,
g_assert_cmpint (req->idx, <, req->mirrorlist->len);
SoupURI *baseuri = req->mirrorlist->pdata[req->idx];
GUri *baseuri = req->mirrorlist->pdata[req->idx];
{ g_autofree char *uri = request_get_uri (req, baseuri);
curl_easy_setopt (req->easy, CURLOPT_URL, uri);
rc = curl_easy_setopt (req->easy, CURLOPT_URL, uri);
g_assert_cmpint (rc, ==, CURLM_OK);
}
(void) curl_easy_setopt (req->easy, CURLOPT_USERAGENT,
rc = curl_easy_setopt (req->easy, CURLOPT_USERAGENT,
self->custom_user_agent ?: OSTREE_FETCHER_USERAGENT_STRING);
g_assert_cmpint (rc, ==, CURLM_OK);
/* Set caching request headers */
if (req->if_none_match != NULL)
@@ -792,7 +793,10 @@ initiate_next_curl_request (FetcherRequest *req,
req->req_headers = curl_slist_append (req->req_headers, l->data);
if (req->req_headers != NULL)
curl_easy_setopt (req->easy, CURLOPT_HTTPHEADER, req->req_headers);
{
rc = curl_easy_setopt (req->easy, CURLOPT_HTTPHEADER, req->req_headers);
g_assert_cmpint (rc, ==, CURLM_OK);
}
if (self->cookie_jar_path)
{
@@ -809,10 +813,17 @@ initiate_next_curl_request (FetcherRequest *req,
}
if (self->tls_ca_db_path)
curl_easy_setopt (req->easy, CURLOPT_CAINFO, self->tls_ca_db_path);
{
rc = curl_easy_setopt (req->easy, CURLOPT_CAINFO, self->tls_ca_db_path);
g_assert_cmpint (rc, ==, CURLM_OK);
}
if ((self->config_flags & OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE) > 0)
curl_easy_setopt (req->easy, CURLOPT_SSL_VERIFYPEER, 0L);
{
rc = curl_easy_setopt (req->easy, CURLOPT_SSL_VERIFYPEER, 0L);
g_assert_cmpint (rc, ==, CURLM_OK);
}
if (self->tls_client_cert_path)
{
@@ -827,28 +838,43 @@ initiate_next_curl_request (FetcherRequest *req,
*/
if (g_str_has_prefix (self->tls_client_key_path, "pkcs11:"))
{
curl_easy_setopt (req->easy, CURLOPT_SSLENGINE, "pkcs11");
curl_easy_setopt (req->easy, CURLOPT_SSLENGINE_DEFAULT, 1L);
curl_easy_setopt (req->easy, CURLOPT_SSLKEYTYPE, "ENG");
rc = curl_easy_setopt (req->easy, CURLOPT_SSLENGINE, "pkcs11");
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_SSLENGINE_DEFAULT, 1L);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_SSLKEYTYPE, "ENG");
g_assert_cmpint (rc, ==, CURLM_OK);
}
if (g_str_has_prefix (self->tls_client_cert_path, "pkcs11:"))
curl_easy_setopt (req->easy, CURLOPT_SSLCERTTYPE, "ENG");
{
rc = curl_easy_setopt (req->easy, CURLOPT_SSLCERTTYPE, "ENG");
g_assert_cmpint (rc, ==, CURLM_OK);
}
curl_easy_setopt (req->easy, CURLOPT_SSLCERT, self->tls_client_cert_path);
curl_easy_setopt (req->easy, CURLOPT_SSLKEY, self->tls_client_key_path);
rc = curl_easy_setopt (req->easy, CURLOPT_SSLCERT, self->tls_client_cert_path);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_SSLKEY, self->tls_client_key_path);
g_assert_cmpint (rc, ==, CURLM_OK);
}
if ((self->config_flags & OSTREE_FETCHER_FLAGS_TRANSFER_GZIP) > 0)
curl_easy_setopt (req->easy, CURLOPT_ACCEPT_ENCODING, "");
{
rc = curl_easy_setopt (req->easy, CURLOPT_ACCEPT_ENCODING, "");
g_assert_cmpint (rc, ==, CURLM_OK);
}
/* If we have e.g. basic auth in the URL string, let's honor that */
const char *username = soup_uri_get_user (baseuri);
curl_easy_setopt (req->easy, CURLOPT_USERNAME, username);
const char *password = soup_uri_get_password (baseuri);
curl_easy_setopt (req->easy, CURLOPT_PASSWORD, password);
const char *username = g_uri_get_user (baseuri);
rc = curl_easy_setopt (req->easy, CURLOPT_USERNAME, username);
g_assert_cmpint (rc, ==, CURLM_OK);
const char *password = g_uri_get_password (baseuri);
rc = curl_easy_setopt (req->easy, CURLOPT_PASSWORD, password);
g_assert_cmpint (rc, ==, CURLM_OK);
/* We should only speak HTTP; TODO: only enable file if specified */
curl_easy_setopt (req->easy, CURLOPT_PROTOCOLS, (long)(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
rc = curl_easy_setopt (req->easy, CURLOPT_PROTOCOLS, (long)(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
g_assert_cmpint (rc, ==, CURLM_OK);
/* Picked the current version in F25 as of 20170127, since
* there are numerous HTTP/2 fixes since the original version in
* libcurl 7.43.0.
@@ -856,25 +882,37 @@ initiate_next_curl_request (FetcherRequest *req,
if (!(self->config_flags & OSTREE_FETCHER_FLAGS_DISABLE_HTTP2))
{
#if CURL_AT_LEAST_VERSION(7, 51, 0)
curl_easy_setopt (req->easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
rc = curl_easy_setopt (req->easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
g_assert_cmpint (rc, ==, CURLM_OK);
#endif
/* https://github.com/curl/curl/blob/curl-7_53_0/docs/examples/http2-download.c */
#if (CURLPIPE_MULTIPLEX > 0)
/* wait for pipe connection to confirm */
curl_easy_setopt (req->easy, CURLOPT_PIPEWAIT, 1L);
rc = curl_easy_setopt (req->easy, CURLOPT_PIPEWAIT, 1L);
g_assert_cmpint (rc, ==, CURLM_OK);
#endif
}
curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt (req->easy, CURLOPT_HEADERFUNCTION, response_header_cb);
rc = curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_HEADERFUNCTION, response_header_cb);
g_assert_cmpint (rc, ==, CURLM_OK);
if (g_getenv ("OSTREE_DEBUG_HTTP"))
curl_easy_setopt (req->easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt (req->easy, CURLOPT_ERRORBUFFER, req->error);
{
rc = curl_easy_setopt (req->easy, CURLOPT_VERBOSE, 1L);
g_assert_cmpint (rc, ==, CURLM_OK);
}
rc = curl_easy_setopt (req->easy, CURLOPT_ERRORBUFFER, req->error);
g_assert_cmpint (rc, ==, CURLM_OK);
/* Note that the "easy" object's privdata is the task */
curl_easy_setopt (req->easy, CURLOPT_NOPROGRESS, 1L);
curl_easy_setopt (req->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
curl_easy_setopt (req->easy, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt (req->easy, CURLOPT_CONNECTTIMEOUT, 30L);
rc = curl_easy_setopt (req->easy, CURLOPT_NOPROGRESS, 1L);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_FOLLOWLOCATION, 1L);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_CONNECTTIMEOUT, 30L);
g_assert_cmpint (rc, ==, CURLM_OK);
/* We used to set CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME
* here, but see https://github.com/ostreedev/ostree/issues/878#issuecomment-347228854
* basically those options don't play well with HTTP2 at the moment
@@ -884,10 +922,14 @@ initiate_next_curl_request (FetcherRequest *req,
*/
/* closure bindings -> task */
curl_easy_setopt (req->easy, CURLOPT_PRIVATE, task);
curl_easy_setopt (req->easy, CURLOPT_WRITEDATA, task);
curl_easy_setopt (req->easy, CURLOPT_HEADERDATA, task);
curl_easy_setopt (req->easy, CURLOPT_PROGRESSDATA, task);
rc = curl_easy_setopt (req->easy, CURLOPT_PRIVATE, task);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_WRITEDATA, task);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_HEADERDATA, task);
g_assert_cmpint (rc, ==, CURLM_OK);
rc = curl_easy_setopt (req->easy, CURLOPT_PROGRESSDATA, task);
g_assert_cmpint (rc, ==, CURLM_OK);
CURLMcode multi_rc = curl_multi_add_handle (self->multi, req->easy);
g_assert (multi_rc == CURLM_OK);
+9 -4
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -153,7 +154,7 @@ thread_closure_unref (ThreadClosure *thread_closure)
g_clear_pointer (&thread_closure->main_context, g_main_context_unref);
g_clear_pointer (&thread_closure->extra_headers, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&thread_closure->extra_headers, g_variant_unref);
g_clear_pointer (&thread_closure->output_stream_set, g_hash_table_unref);
g_mutex_clear (&thread_closure->output_stream_set_lock);
@@ -329,7 +330,7 @@ session_thread_set_headers_cb (ThreadClosure *thread_closure,
{
GVariant *headers = data;
g_clear_pointer (&thread_closure->extra_headers, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&thread_closure->extra_headers, g_variant_unref);
thread_closure->extra_headers = g_variant_ref (headers);
}
@@ -431,11 +432,15 @@ create_pending_soup_request (OstreeFetcherPendingURI *pending,
next_mirror = g_ptr_array_index (pending->mirrorlist, pending->mirrorlist_idx);
if (pending->filename)
uri = _ostree_fetcher_uri_new_subpath (next_mirror, pending->filename);
if (!uri)
uri = (OstreeFetcherURI*)g_uri_ref ((GUri*)next_mirror);
g_clear_object (&pending->request);
pending->request = soup_session_request_uri (pending->thread_closure->session,
(SoupURI*)(uri ? uri : next_mirror), error);
{
g_autofree gchar *uri_str = g_uri_to_string ((GUri*)uri);
pending->request = soup_session_request (pending->thread_closure->session, uri_str, error);
}
/* Add caching headers. */
if (SOUP_IS_REQUEST_HTTP (pending->request) && pending->if_none_match != NULL)
+60 -26
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011,2017 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -21,15 +22,7 @@
#include "config.h"
#ifdef HAVE_LIBCURL
#include "ostree-soup-uri.h"
#else
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
#include <libsoup/soup.h>
#include <libsoup/soup-requester.h>
#include <libsoup/soup-request-http.h>
#endif
#include <glib.h>
#include "ostree-fetcher.h"
@@ -39,21 +32,52 @@ void
_ostree_fetcher_uri_free (OstreeFetcherURI *uri)
{
if (uri)
soup_uri_free ((SoupURI*)uri);
g_uri_unref ((GUri*)uri);
}
OstreeFetcherURI *
_ostree_fetcher_uri_parse (const char *str,
GError **error)
{
SoupURI *soupuri = soup_uri_new (str);
if (soupuri == NULL)
GUri *uri = NULL;
#if GLIB_CHECK_VERSION(2, 68, 0)
uri = g_uri_parse (str, G_URI_FLAGS_HAS_PASSWORD | G_URI_FLAGS_ENCODED | G_URI_FLAGS_SCHEME_NORMALIZE, error);
#else
/* perform manual scheme normalization for older glib */
uri = g_uri_parse (str, G_URI_FLAGS_HAS_PASSWORD | G_URI_FLAGS_ENCODED, error);
if (uri)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to parse uri: %s", str);
return NULL;
GUri *nuri = NULL;
switch (g_uri_get_port (uri))
{
case 21:
if (!strcmp (g_uri_get_scheme (uri), "ftp"))
break;
return (OstreeFetcherURI*)uri;
case 80:
if (!strcmp (g_uri_get_scheme (uri), "http"))
break;
return (OstreeFetcherURI*)uri;
case 443:
if (!strcmp (g_uri_get_scheme (uri), "https"))
break;
return (OstreeFetcherURI*)uri;
default:
return (OstreeFetcherURI*)uri;
}
nuri = g_uri_build_with_user (g_uri_get_flags (uri), "http",
g_uri_get_user (uri),
g_uri_get_password (uri),
NULL,
g_uri_get_host (uri), -1,
g_uri_get_path (uri),
g_uri_get_query (uri),
g_uri_get_fragment (uri));
g_uri_unref (uri);
uri = nuri;
}
return (OstreeFetcherURI*)soupuri;
#endif
return (OstreeFetcherURI*)uri;
}
static OstreeFetcherURI *
@@ -61,21 +85,31 @@ _ostree_fetcher_uri_new_path_internal (OstreeFetcherURI *uri,
gboolean extend,
const char *path)
{
SoupURI *newuri = soup_uri_copy ((SoupURI*)uri);
GUri *guri = (GUri*)uri;
const char *opath = g_uri_get_path (guri);
g_autofree char *newpath = NULL;
if (path)
{
if (extend)
{
const char *origpath = soup_uri_get_path ((SoupURI*)uri);
g_autofree char *newpath = g_build_filename (origpath, path, NULL);
soup_uri_set_path (newuri, newpath);
newpath = g_build_filename (opath, path, NULL);
opath = newpath;
}
else
{
soup_uri_set_path (newuri, path);
opath = path;
}
}
return (OstreeFetcherURI*)newuri;
return (OstreeFetcherURI*)g_uri_build_with_user (g_uri_get_flags (guri),
g_uri_get_scheme (guri),
g_uri_get_user (guri),
g_uri_get_password (guri),
NULL,
g_uri_get_host (guri),
g_uri_get_port (guri),
opath,
g_uri_get_query (guri),
g_uri_get_fragment (guri));
}
OstreeFetcherURI *
@@ -101,19 +135,19 @@ _ostree_fetcher_uri_clone (OstreeFetcherURI *uri)
char *
_ostree_fetcher_uri_get_scheme (OstreeFetcherURI *uri)
{
return g_strdup (soup_uri_get_scheme ((SoupURI*)uri));
return g_strdup (g_uri_get_scheme ((GUri*)uri));
}
char *
_ostree_fetcher_uri_get_path (OstreeFetcherURI *uri)
{
return g_strdup (soup_uri_get_path ((SoupURI*)uri));
return g_strdup (g_uri_get_path ((GUri*)uri));
}
char *
_ostree_fetcher_uri_to_string (OstreeFetcherURI *uri)
{
return soup_uri_to_string ((SoupURI*)uri, FALSE);
return g_uri_to_string_partial ((GUri*)uri, G_URI_HIDE_PASSWORD);
}
@@ -124,7 +158,7 @@ _ostree_fetcher_uri_to_string (OstreeFetcherURI *uri)
gboolean
_ostree_fetcher_uri_validate (OstreeFetcherURI *uri, GError **error)
{
const char *scheme = soup_uri_get_scheme ((SoupURI*)uri);
const char *scheme = g_uri_get_scheme ((GUri*)uri);
// TODO only allow file if explicitly requested by a higher level
if (!(g_str_equal (scheme, "http") || g_str_equal (scheme, "https") || g_str_equal (scheme, "file")))
{
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -124,7 +125,7 @@ _ostree_fetcher_mirrored_request_to_membuf_once (OstreeFetcher *fe
out:
if (mainctx)
g_main_context_pop_thread_default (mainctx);
g_clear_pointer (&data.result_buf, (GDestroyNotify)g_bytes_unref);
g_clear_pointer (&data.result_buf, g_bytes_unref);
g_clear_pointer (&data.result_etag, g_free);
return ret;
}
+2 -1
View File
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2013 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -53,7 +54,7 @@ ostree_gpg_verifier_finalize (GObject *object)
g_list_free_full (self->keyrings, g_object_unref);
if (self->key_ascii_files)
g_ptr_array_unref (self->key_ascii_files);
g_clear_pointer (&self->keyring_data, (GDestroyNotify)g_ptr_array_unref);
g_clear_pointer (&self->keyring_data, g_ptr_array_unref);
G_OBJECT_CLASS (_ostree_gpg_verifier_parent_class)->finalize (object);
}
@@ -134,6 +134,8 @@ require_internal_units (const char *normal_dir,
return FALSE;
if (symlinkat (SYSTEM_DATA_UNIT_PATH "/ostree-finalize-staged.path", normal_dir_dfd, "multi-user.target.wants/ostree-finalize-staged.path") < 0)
return glnx_throw_errno_prefix (error, "symlinkat");
if (symlinkat (SYSTEM_DATA_UNIT_PATH "/ostree-boot-complete.service", normal_dir_dfd, "multi-user.target.wants/ostree-boot-complete.service") < 0)
return glnx_throw_errno_prefix (error, "symlinkat");
return TRUE;
#else
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -29,12 +30,12 @@ enum {
PROP_ARCHIVE
};
G_DEFINE_TYPE (OstreeLibarchiveInputStream, _ostree_libarchive_input_stream, G_TYPE_INPUT_STREAM)
struct _OstreeLibarchiveInputStreamPrivate {
struct archive *archive;
};
G_DEFINE_TYPE_WITH_PRIVATE (OstreeLibarchiveInputStream, _ostree_libarchive_input_stream, G_TYPE_INPUT_STREAM)
static void ostree_libarchive_input_stream_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -63,8 +64,6 @@ _ostree_libarchive_input_stream_class_init (OstreeLibarchiveInputStreamClass *kl
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (OstreeLibarchiveInputStreamPrivate));
gobject_class->get_property = ostree_libarchive_input_stream_get_property;
gobject_class->set_property = ostree_libarchive_input_stream_set_property;
@@ -132,10 +131,7 @@ ostree_libarchive_input_stream_get_property (GObject *object,
static void
_ostree_libarchive_input_stream_init (OstreeLibarchiveInputStream *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
OSTREE_TYPE_LIBARCHIVE_INPUT_STREAM,
OstreeLibarchiveInputStreamPrivate);
self->priv = _ostree_libarchive_input_stream_get_instance_private (self);
}
GInputStream *
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -66,7 +67,7 @@ _ostree_lzma_compressor_finalize (GObject *object)
OstreeLzmaCompressor *self = OSTREE_LZMA_COMPRESSOR (object);
lzma_end (&self->lstream);
g_clear_pointer (&self->params, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&self->params, g_variant_unref);
G_OBJECT_CLASS (_ostree_lzma_compressor_parent_class)->finalize (object);
}
+43 -41
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -640,8 +641,8 @@ _ostree_repo_bare_content_cleanup (OstreeRepoBareContent *regwrite)
return;
glnx_tmpfile_clear (&real->tmpf);
ot_checksum_clear (&real->checksum);
g_clear_pointer (&real->expected_checksum, (GDestroyNotify)g_free);
g_clear_pointer (&real->xattrs, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&real->expected_checksum, g_free);
g_clear_pointer (&real->xattrs, g_variant_unref);
real->initialized = FALSE;
}
@@ -1688,10 +1689,10 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
g_debug ("Preparing transaction in repository %p", self);
/* Set up to abort the transaction if we return early from this function.
* This needs to be manually built here due to a circular dependency. */
g_autoptr(OstreeRepoAutoTransaction) txn = g_malloc(sizeof(OstreeRepoAutoTransaction));
* We can't call _ostree_repo_auto_transaction_start() here, because that
* would be a circular dependency; use the lower-level version instead. */
g_autoptr(OstreeRepoAutoTransaction) txn = _ostree_repo_auto_transaction_new (self);
g_assert (txn != NULL);
txn->repo = self;
memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats));
@@ -2584,8 +2585,6 @@ typedef struct {
char *expected_checksum;
GVariant *object;
GCancellable *cancellable;
GSimpleAsyncResult *result;
guchar *result_csum;
} WriteMetadataAsyncData;
@@ -2603,19 +2602,21 @@ write_metadata_async_data_free (gpointer user_data)
}
static void
write_metadata_thread (GSimpleAsyncResult *res,
write_metadata_thread (GTask *task,
GObject *object,
gpointer datap,
GCancellable *cancellable)
{
GError *error = NULL;
WriteMetadataAsyncData *data;
WriteMetadataAsyncData *data = datap;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!ostree_repo_write_metadata (data->repo, data->objtype, data->expected_checksum,
data->object,
&data->result_csum,
cancellable, &error))
g_simple_async_result_take_error (res, error);
g_task_return_error (task, error);
else
g_task_return_pointer (task, data, NULL);
}
/**
@@ -2640,6 +2641,7 @@ ostree_repo_write_metadata_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
WriteMetadataAsyncData *asyncdata;
asyncdata = g_new0 (WriteMetadataAsyncData, 1);
@@ -2649,14 +2651,10 @@ ostree_repo_write_metadata_async (OstreeRepo *self,
asyncdata->object = g_variant_ref (object);
asyncdata->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
asyncdata->result = g_simple_async_result_new ((GObject*) self,
callback, user_data,
ostree_repo_write_metadata_async);
g_simple_async_result_set_op_res_gpointer (asyncdata->result, asyncdata,
write_metadata_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, write_metadata_thread, G_PRIORITY_DEFAULT, cancellable);
g_object_unref (asyncdata->result);
task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_task_data (task, asyncdata, write_metadata_async_data_free);
g_task_set_source_tag (task, ostree_repo_write_metadata_async);
g_task_run_in_thread (task, (GTaskThreadFunc)write_metadata_thread);
}
/**
@@ -2674,15 +2672,18 @@ ostree_repo_write_metadata_finish (OstreeRepo *self,
guchar **out_csum,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
WriteMetadataAsyncData *data;
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_write_metadata_async);
g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, ostree_repo_write_metadata_async), FALSE);
if (g_simple_async_result_propagate_error (simple, error))
data = g_task_propagate_pointer (G_TASK (result), error);
if (data == NULL)
return FALSE;
data = g_simple_async_result_get_op_res_gpointer (simple);
/* Transfer ownership */
*out_csum = data->result_csum;
data->result_csum = NULL;
@@ -2920,7 +2921,6 @@ typedef struct {
GInputStream *object;
guint64 file_object_length;
GCancellable *cancellable;
GSimpleAsyncResult *result;
guchar *result_csum;
} WriteContentAsyncData;
@@ -2939,19 +2939,21 @@ write_content_async_data_free (gpointer user_data)
}
static void
write_content_thread (GSimpleAsyncResult *res,
write_content_thread (GTask *task,
GObject *object,
gpointer datap,
GCancellable *cancellable)
{
GError *error = NULL;
WriteContentAsyncData *data;
WriteContentAsyncData *data = datap;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!ostree_repo_write_content (data->repo, data->expected_checksum,
data->object, data->file_object_length,
&data->result_csum,
cancellable, &error))
g_simple_async_result_take_error (res, error);
g_task_return_error (task, error);
else
g_task_return_pointer (task, data, NULL);
}
/**
@@ -2976,6 +2978,7 @@ ostree_repo_write_content_async (OstreeRepo *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
WriteContentAsyncData *asyncdata;
asyncdata = g_new0 (WriteContentAsyncData, 1);
@@ -2985,14 +2988,10 @@ ostree_repo_write_content_async (OstreeRepo *self,
asyncdata->file_object_length = length;
asyncdata->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
asyncdata->result = g_simple_async_result_new ((GObject*) self,
callback, user_data,
ostree_repo_write_content_async);
g_simple_async_result_set_op_res_gpointer (asyncdata->result, asyncdata,
write_content_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, write_content_thread, G_PRIORITY_DEFAULT, cancellable);
g_object_unref (asyncdata->result);
task = g_task_new (G_OBJECT (self), cancellable, callback, user_data);
g_task_set_task_data (task, asyncdata, (GDestroyNotify)write_content_async_data_free);
g_task_set_source_tag (task, ostree_repo_write_content_async);
g_task_run_in_thread (task, (GTaskThreadFunc)write_content_thread);
}
/**
@@ -3010,15 +3009,18 @@ ostree_repo_write_content_finish (OstreeRepo *self,
guchar **out_csum,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
WriteContentAsyncData *data;
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == ostree_repo_write_content_async);
g_return_val_if_fail (OSTREE_IS_REPO (self), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, ostree_repo_write_content_async), FALSE);
if (g_simple_async_result_propagate_error (simple, error))
data = g_task_propagate_pointer (G_TASK (result), error);
if (data == NULL)
return FALSE;
data = g_simple_async_result_get_op_res_gpointer (simple);
ot_transfer_out_value (out_csum, &data->result_csum);
return TRUE;
}
@@ -4336,7 +4338,7 @@ ostree_repo_commit_modifier_unref (OstreeRepoCommitModifier *modifier)
if (modifier->xattr_destroy)
modifier->xattr_destroy (modifier->xattr_user_data);
g_clear_pointer (&modifier->devino_cache, (GDestroyNotify)g_hash_table_unref);
g_clear_pointer (&modifier->devino_cache, g_hash_table_unref);
g_clear_object (&modifier->sepolicy);
+11 -10
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -55,8 +56,8 @@ ostree_repo_file_finalize (GObject *object)
self = OSTREE_REPO_FILE (object);
g_clear_pointer (&self->tree_contents, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&self->tree_metadata, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&self->tree_contents, g_variant_unref);
g_clear_pointer (&self->tree_metadata, g_variant_unref);
g_free (self->cached_file_checksum);
g_free (self->tree_contents_checksum);
g_free (self->tree_metadata_checksum);
@@ -236,7 +237,7 @@ do_resolve_nonroot (OstreeRepoFile *self,
files_variant = g_variant_get_child_value (self->parent->tree_contents, 0);
self->index = g_variant_n_children (files_variant) + i;
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&files_variant, g_variant_unref);
g_variant_get_child (container, i, "(&s@ay@ay)",
&name, &contents_csum_v, &metadata_csum_v);
@@ -337,7 +338,7 @@ ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
const char *checksum,
GVariant *metadata)
{
g_clear_pointer (&self->tree_metadata, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&self->tree_metadata, g_variant_unref);
self->tree_metadata = g_variant_ref (metadata);
g_free (self->tree_metadata_checksum);
self->tree_metadata_checksum = g_strdup (checksum);
@@ -414,8 +415,8 @@ ostree_repo_file_get_checksum (OstreeRepoFile *self)
g_variant_get_child (files_variant, n,
"(@s@ay)", NULL, &csum_bytes);
}
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&dirs_variant, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&files_variant, g_variant_unref);
g_clear_pointer (&dirs_variant, g_variant_unref);
self->cached_file_checksum = ostree_checksum_from_bytes_v (csum_bytes);
@@ -775,9 +776,9 @@ ostree_repo_file_tree_find_child (OstreeRepoFile *self,
*out_container = ret_container;
ret_container = NULL;
}
g_clear_pointer (&ret_container, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&files_variant, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&dirs_variant, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&ret_container, g_variant_unref);
g_clear_pointer (&files_variant, g_variant_unref);
g_clear_pointer (&dirs_variant, g_variant_unref);
return i;
}
@@ -969,7 +970,7 @@ ostree_repo_file_read (GFile *file,
return g_file_read (dest, cancellable, error);
}
return g_steal_pointer (&ret_stream);
return (GFileInputStream *)g_steal_pointer (&ret_stream);
}
static void
+6 -10
View File
@@ -1,6 +1,7 @@
/*
* Copyright © 2016 Kinvolk GmbH
* Copyright © 2017 Endless Mobile, Inc.
* Copyright © 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -53,7 +54,6 @@
#include "ostree-repo-private.h"
#include "ostree-repo.h"
#include "ostree-repo-finder-avahi-private.h"
#include "ostree-soup-uri.h"
#include "otutil.h"
#endif /* HAVE_AVAHI */
@@ -490,7 +490,7 @@ fill_refs_and_checksums_from_summary (GVariant *summary,
return FALSE;
}
g_clear_pointer (&ref_map, (GDestroyNotify) g_variant_iter_free);
g_clear_pointer (&ref_map, g_variant_iter_free);
/* Repeat for the other collections listed in the summary. */
if (g_variant_dict_lookup (&additional_metadata, OSTREE_SUMMARY_COLLECTION_MAP, "a{sa(s(taya{sv}))}", &collection_map))
@@ -705,7 +705,7 @@ ostree_avahi_service_build_repo_finder_result (OstreeAvahiService
g_autoptr(GVariant) repo_index = NULL;
g_autofree gchar *repo_path = NULL;
g_autoptr(GPtrArray) possible_refs = NULL; /* (element-type OstreeCollectionRef) */
SoupURI *_uri = NULL;
GUri *_uri = NULL;
g_autofree gchar *uri = NULL;
g_autoptr(GError) error = NULL;
gsize i;
@@ -772,13 +772,9 @@ ostree_avahi_service_build_repo_finder_result (OstreeAvahiService
repo_to_refs = g_hash_table_new_full (uri_and_keyring_hash, uri_and_keyring_equal,
(GDestroyNotify) uri_and_keyring_free, (GDestroyNotify) g_hash_table_unref);
_uri = soup_uri_new (NULL);
soup_uri_set_scheme (_uri, "http");
soup_uri_set_host (_uri, service->address);
soup_uri_set_port (_uri, service->port);
soup_uri_set_path (_uri, repo_path);
uri = soup_uri_to_string (_uri, FALSE);
soup_uri_free (_uri);
_uri = g_uri_build (G_URI_FLAGS_ENCODED, "http", NULL, service->address, service->port, repo_path, NULL, NULL);
uri = g_uri_to_string (_uri);
g_uri_unref (_uri);
for (i = 0; i < possible_refs->len; i++)
{
+6 -2
View File
@@ -146,8 +146,12 @@ file_info_from_archive_entry (struct archive_entry *entry)
g_autoptr(GFileInfo) info = _ostree_stbuf_to_gfileinfo (&stbuf);
if (S_ISLNK (stbuf.st_mode))
g_file_info_set_attribute_byte_string (info, "standard::symlink-target",
archive_entry_symlink (entry));
{
const char *target = archive_entry_symlink (entry);
if (target != NULL)
g_file_info_set_attribute_byte_string (info, "standard::symlink-target",
target);
}
return g_steal_pointer (&info);
}
+4
View File
@@ -554,4 +554,8 @@ GType _ostree_repo_auto_transaction_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoAutoTransaction, _ostree_repo_auto_transaction_unref);
/* Internal function to break a circular dependency:
* should not be made into public API, even if the rest is */
OstreeRepoAutoTransaction *_ostree_repo_auto_transaction_new (OstreeRepo *repo);
G_END_DECLS
+39 -38
View File
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011,2012,2013 Colin Walters <walters@verbum.org>
* Copyright © 2017 Endless Mobile, Inc.
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -435,7 +436,7 @@ idle_worker (gpointer user_data)
scan_data = g_queue_pop_head (&pull_data->scan_object_queue);
if (!scan_data)
{
g_clear_pointer (&pull_data->idle_src, (GDestroyNotify) g_source_destroy);
g_clear_pointer (&pull_data->idle_src, g_source_destroy);
return G_SOURCE_REMOVE;
}
@@ -4020,7 +4021,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
&pull_data->signapi_commit_verifiers,
&pull_data->signapi_summary_verifiers,
error))
return FALSE;
goto out;
}
pull_data->phase = OSTREE_PULL_PHASE_FETCHING_REFS;
@@ -4476,7 +4477,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
pull_data->remote_name);
summary_from_cache = FALSE;
g_clear_pointer (&bytes_summary, (GDestroyNotify)g_bytes_unref);
g_clear_pointer (&bytes_summary, g_bytes_unref);
g_clear_pointer (&summary_etag, g_free);
summary_last_modified = 0;
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
@@ -4544,7 +4545,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
pull_data->remote_name);
summary_from_cache = FALSE;
g_clear_pointer (&bytes_summary, (GDestroyNotify)g_bytes_unref);
g_clear_pointer (&bytes_summary, g_bytes_unref);
g_clear_pointer (&summary_etag, g_free);
summary_last_modified = 0;
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
@@ -5153,46 +5154,46 @@ ostree_repo_pull_with_options (OstreeRepo *self,
g_source_destroy (update_timeout);
g_strfreev (configured_branches);
g_clear_object (&pull_data->fetcher);
g_clear_pointer (&pull_data->extra_headers, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&pull_data->extra_headers, g_variant_unref);
g_clear_object (&pull_data->cancellable);
g_clear_pointer (&pull_data->localcache_repos, (GDestroyNotify)g_ptr_array_unref);
g_clear_pointer (&pull_data->localcache_repos, g_ptr_array_unref);
g_clear_object (&pull_data->remote_repo_local);
g_free (pull_data->remote_refspec_name);
g_free (pull_data->remote_name);
g_free (pull_data->append_user_agent);
g_clear_pointer (&pull_data->signapi_commit_verifiers, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->signapi_summary_verifiers, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->meta_mirrorlist, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->content_mirrorlist, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->summary_data, (GDestroyNotify) g_bytes_unref);
g_clear_pointer (&pull_data->signapi_commit_verifiers, g_ptr_array_unref);
g_clear_pointer (&pull_data->signapi_summary_verifiers, g_ptr_array_unref);
g_clear_pointer (&pull_data->meta_mirrorlist, g_ptr_array_unref);
g_clear_pointer (&pull_data->content_mirrorlist, g_ptr_array_unref);
g_clear_pointer (&pull_data->summary_data, g_bytes_unref);
g_clear_pointer (&pull_data->summary_etag, g_free);
g_clear_pointer (&pull_data->summary_data_sig, (GDestroyNotify) g_bytes_unref);
g_clear_pointer (&pull_data->summary_data_sig, g_bytes_unref);
g_clear_pointer (&pull_data->summary_sig_etag, g_free);
g_clear_pointer (&pull_data->summary, (GDestroyNotify) g_variant_unref);
g_clear_pointer (&pull_data->static_delta_superblocks, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&pull_data->commit_to_depth, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->expected_commit_sizes, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->scanned_metadata, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->fetched_detached_metadata, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->summary_deltas_checksums, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->ref_original_commits, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->summary, g_variant_unref);
g_clear_pointer (&pull_data->static_delta_superblocks, g_ptr_array_unref);
g_clear_pointer (&pull_data->commit_to_depth, g_hash_table_unref);
g_clear_pointer (&pull_data->expected_commit_sizes, g_hash_table_unref);
g_clear_pointer (&pull_data->scanned_metadata, g_hash_table_unref);
g_clear_pointer (&pull_data->fetched_detached_metadata, g_hash_table_unref);
g_clear_pointer (&pull_data->summary_deltas_checksums, g_hash_table_unref);
g_clear_pointer (&pull_data->ref_original_commits, g_hash_table_unref);
g_free (pull_data->timestamp_check_from_rev);
g_clear_pointer (&pull_data->verified_commits, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->signapi_verified_commits, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->ref_keyring_map, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->requested_content, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->requested_fallback_content, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->requested_metadata, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_content, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_metadata, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_delta_indexes, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_delta_superblocks, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_deltaparts, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&pull_data->verified_commits, g_hash_table_unref);
g_clear_pointer (&pull_data->signapi_verified_commits, g_hash_table_unref);
g_clear_pointer (&pull_data->ref_keyring_map, g_hash_table_unref);
g_clear_pointer (&pull_data->requested_content, g_hash_table_unref);
g_clear_pointer (&pull_data->requested_fallback_content, g_hash_table_unref);
g_clear_pointer (&pull_data->requested_metadata, g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_content, g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_metadata, g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_delta_indexes, g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_delta_superblocks, g_hash_table_unref);
g_clear_pointer (&pull_data->pending_fetch_deltaparts, g_hash_table_unref);
g_queue_foreach (&pull_data->scan_object_queue, (GFunc) scan_object_queue_data_free, NULL);
g_queue_clear (&pull_data->scan_object_queue);
g_clear_pointer (&pull_data->idle_src, (GDestroyNotify) g_source_destroy);
g_clear_pointer (&pull_data->dirs, (GDestroyNotify) g_ptr_array_unref);
g_clear_pointer (&remote_config, (GDestroyNotify) g_key_file_unref);
g_clear_pointer (&pull_data->idle_src, g_source_destroy);
g_clear_pointer (&pull_data->dirs, g_ptr_array_unref);
g_clear_pointer (&remote_config, g_key_file_unref);
return ret;
}
@@ -5838,7 +5839,7 @@ find_remotes_cb (GObject *obj,
{
g_debug ("%s: Failed to download summary for result ‘%s’. Ignoring. %s",
G_STRFUNC, result->remote->name, error->message);
g_clear_pointer (&g_ptr_array_index (results, i), (GDestroyNotify) ostree_repo_finder_result_free);
g_clear_pointer (&g_ptr_array_index (results, i), ostree_repo_finder_result_free);
g_clear_error (&error);
continue;
}
@@ -5847,7 +5848,7 @@ find_remotes_cb (GObject *obj,
g_debug ("%s: Failed to download summary for result ‘%s’. Ignoring. %s",
G_STRFUNC, result->remote->name,
"No summary file exists on server");
g_clear_pointer (&g_ptr_array_index (results, i), (GDestroyNotify) ostree_repo_finder_result_free);
g_clear_pointer (&g_ptr_array_index (results, i), ostree_repo_finder_result_free);
continue;
}
@@ -5869,7 +5870,7 @@ find_remotes_cb (GObject *obj,
if (!find_remotes_process_refs (self, refs, result, i, summary_collection_id, summary_refs,
commit_metadatas, refs_and_remotes_table))
{
g_clear_pointer (&g_ptr_array_index (results, i), (GDestroyNotify) ostree_repo_finder_result_free);
g_clear_pointer (&g_ptr_array_index (results, i), ostree_repo_finder_result_free);
continue;
}
}
@@ -5890,7 +5891,7 @@ find_remotes_cb (GObject *obj,
if (!find_remotes_process_refs (self, refs, result, i, summary_collection_id, summary_refs,
commit_metadatas, refs_and_remotes_table))
{
g_clear_pointer (&g_ptr_array_index (results, i), (GDestroyNotify) ostree_repo_finder_result_free);
g_clear_pointer (&g_ptr_array_index (results, i), ostree_repo_finder_result_free);
invalid_result = TRUE;
break;
}
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013,2014 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -285,7 +286,6 @@ typedef struct {
GVariant *header;
GVariant *part;
GCancellable *cancellable;
GSimpleAsyncResult *result;
} StaticDeltaPartExecuteAsyncData;
static void
@@ -301,20 +301,22 @@ static_delta_part_execute_async_data_free (gpointer user_data)
}
static void
static_delta_part_execute_thread (GSimpleAsyncResult *res,
static_delta_part_execute_thread (GTask *task,
GObject *object,
gpointer datap,
GCancellable *cancellable)
{
GError *error = NULL;
StaticDeltaPartExecuteAsyncData *data;
StaticDeltaPartExecuteAsyncData *data = datap;
data = g_simple_async_result_get_op_res_gpointer (res);
if (!_ostree_static_delta_part_execute (data->repo,
data->header,
data->part,
FALSE, NULL,
cancellable, &error))
g_simple_async_result_take_error (res, error);
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
}
void
@@ -325,6 +327,7 @@ _ostree_static_delta_part_execute_async (OstreeRepo *repo,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
StaticDeltaPartExecuteAsyncData *asyncdata;
asyncdata = g_new0 (StaticDeltaPartExecuteAsyncData, 1);
@@ -333,14 +336,10 @@ _ostree_static_delta_part_execute_async (OstreeRepo *repo,
asyncdata->part = g_variant_ref (part);
asyncdata->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
asyncdata->result = g_simple_async_result_new ((GObject*) repo,
callback, user_data,
_ostree_static_delta_part_execute_async);
g_simple_async_result_set_op_res_gpointer (asyncdata->result, asyncdata,
static_delta_part_execute_async_data_free);
g_simple_async_result_run_in_thread (asyncdata->result, static_delta_part_execute_thread, G_PRIORITY_DEFAULT, cancellable);
g_object_unref (asyncdata->result);
task = g_task_new (G_OBJECT (repo), cancellable, callback, user_data);
g_task_set_task_data (task, asyncdata, (GDestroyNotify)static_delta_part_execute_async_data_free);
g_task_set_source_tag (task, _ostree_static_delta_part_execute_async);
g_task_run_in_thread (task, (GTaskThreadFunc)static_delta_part_execute_thread);
}
gboolean
@@ -348,13 +347,13 @@ _ostree_static_delta_part_execute_finish (OstreeRepo *repo,
GAsyncResult *result,
GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
g_return_val_if_fail (OSTREE_IS_REPO (repo), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
g_return_val_if_fail (g_task_is_valid (result, repo), FALSE);
g_return_val_if_fail (g_async_result_is_tagged (result, _ostree_static_delta_part_execute_async), FALSE);
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == _ostree_static_delta_part_execute_async);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
return TRUE;
return g_task_propagate_boolean (G_TASK (result), error);
}
static gboolean
+34 -11
View File
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2015 Red Hat, Inc.
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -709,6 +710,32 @@ ostree_repo_auto_lock_cleanup (OstreeRepoAutoLock *auto_lock)
}
}
/**
* _ostree_repo_auto_transaction_new:
* @repo: (not nullable): an #OsreeRepo object
* @cancellable: Cancellable
* @error: a #GError
*
* Return a guard for a transaction in @repo.
*
* Do not call this function outside the OstreeRepo transaction implementation.
* Use _ostree_repo_auto_transaction_start() instead.
*
* Returns: (transfer full): an #OstreeRepoAutoTransaction guard on success,
* %NULL otherwise.
*/
OstreeRepoAutoTransaction *
_ostree_repo_auto_transaction_new (OstreeRepo *repo)
{
g_assert (repo != NULL);
OstreeRepoAutoTransaction *txn = g_malloc(sizeof(OstreeRepoAutoTransaction));
txn->atomic_refcount = 1;
txn->repo = g_object_ref (repo);
return g_steal_pointer (&txn);
}
/**
* _ostree_repo_auto_transaction_start:
* @repo: (not nullable): an #OsreeRepo object
@@ -730,11 +757,7 @@ _ostree_repo_auto_transaction_start (OstreeRepo *repo,
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
return NULL;
OstreeRepoAutoTransaction *txn = g_malloc(sizeof(OstreeRepoAutoTransaction));
txn->atomic_refcount = 1;
txn->repo = g_object_ref (repo);
return g_steal_pointer (&txn);
return _ostree_repo_auto_transaction_new (repo);
}
/**
@@ -1208,8 +1231,8 @@ ostree_repo_finalize (GObject *object)
g_clear_pointer (&self->txn.refs, g_hash_table_destroy);
g_clear_pointer (&self->txn.collection_refs, g_hash_table_destroy);
g_clear_error (&self->writable_error);
g_clear_pointer (&self->object_sizes, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&self->dirmeta_cache, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&self->object_sizes, g_hash_table_unref);
g_clear_pointer (&self->dirmeta_cache, g_hash_table_unref);
g_mutex_clear (&self->cache_lock);
g_mutex_clear (&self->txn_lock);
g_free (self->collection_id);
@@ -2306,7 +2329,7 @@ ostree_repo_remote_gpg_import (OstreeRepo *self,
goto out;
}
g_clear_pointer (&data_buffer, (GDestroyNotify) gpgme_data_release);
g_clear_pointer (&data_buffer, gpgme_data_release);
}
/* Retrieve all keys or specific keys from the source GPGME context.
@@ -3179,7 +3202,7 @@ reload_core_config (OstreeRepo *self,
gboolean is_archive;
gsize len;
g_clear_pointer (&self->config, (GDestroyNotify)g_key_file_unref);
g_clear_pointer (&self->config, g_key_file_unref);
self->config = g_key_file_new ();
contents = glnx_file_get_contents_utf8_at (self->repo_dir_fd, "config", &len,
@@ -6274,7 +6297,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
g_autoptr(GHashTable) collection_map = NULL; /* (element-type utf8 GHashTable) */
g_hash_table_iter_init (&iter, collection_refs);
collection_map = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
(GDestroyNotify) g_hash_table_unref);
(GDestroyNotify)g_hash_table_unref);
const OstreeCollectionRef *c_ref;
const char *checksum;
@@ -6594,7 +6617,7 @@ _ostree_repo_memory_cache_ref_destroy (OstreeRepoMemoryCacheRef *state)
g_mutex_lock (lock);
repo->dirmeta_cache_refcount--;
if (repo->dirmeta_cache_refcount == 0)
g_clear_pointer (&repo->dirmeta_cache, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&repo->dirmeta_cache, g_hash_table_unref);
g_mutex_unlock (lock);
g_object_unref (repo);
}
-140
View File
@@ -1,140 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* soup-form.c : utility functions for HTML forms */
/*
* Copyright 2008 Red Hat, Inc.
*/
/* This one is stripped down to only have soup_form_encode_hash()
* and soup_form_encode_valist() which are the only bits that soup-uri.c
* calls.
*/
#include <config.h>
#include <string.h>
#include "ostree-soup-uri.h"
/**
* SECTION:soup-form
* @short_description: HTML form handling
* @see_also: #SoupMultipart
*
* libsoup contains several help methods for processing HTML forms as
* defined by <ulink
* url="http://www.w3.org/TR/html401/interact/forms.html#h-17.13">the
* HTML 4.01 specification</ulink>.
**/
/**
* SOUP_FORM_MIME_TYPE_URLENCODED:
*
* A macro containing the value
* <literal>"application/x-www-form-urlencoded"</literal>; the default
* MIME type for POSTing HTML form data.
*
* Since: 2.26
**/
/**
* SOUP_FORM_MIME_TYPE_MULTIPART:
*
* A macro containing the value
* <literal>"multipart/form-data"</literal>; the MIME type used for
* posting form data that contains files to be uploaded.
*
* Since: 2.26
**/
#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10)
#define HEXCHAR(s) ((XDIGIT (s[1]) << 4) + XDIGIT (s[2]))
static void
append_form_encoded (GString *str, const char *in)
{
const unsigned char *s = (const unsigned char *)in;
while (*s) {
if (*s == ' ') {
g_string_append_c (str, '+');
s++;
} else if (!g_ascii_isalnum (*s) && (*s != '-') && (*s != '_')
&& (*s != '.'))
g_string_append_printf (str, "%%%02X", (int)*s++);
else
g_string_append_c (str, *s++);
}
}
static void
encode_pair (GString *str, const char *name, const char *value)
{
g_return_if_fail (name != NULL);
g_return_if_fail (value != NULL);
if (str->len)
g_string_append_c (str, '&');
append_form_encoded (str, name);
g_string_append_c (str, '=');
append_form_encoded (str, value);
}
/**
* soup_form_encode_hash:
* @form_data_set: (element-type utf8 utf8) (transfer none): a hash table containing
* name/value pairs (as strings)
*
* Encodes @form_data_set into a value of type
* "application/x-www-form-urlencoded", as defined in the HTML 4.01
* spec.
*
* Note that the HTML spec states that "The control names/values are
* listed in the order they appear in the document." Since this method
* takes a hash table, it cannot enforce that; if you care about the
* ordering of the form fields, use soup_form_encode_datalist().
*
* Return value: the encoded form
**/
char *
soup_form_encode_hash (GHashTable *form_data_set)
{
GString *str = g_string_new (NULL);
GHashTableIter iter;
gpointer name, value;
g_hash_table_iter_init (&iter, form_data_set);
while (g_hash_table_iter_next (&iter, &name, &value))
encode_pair (str, name, value);
return g_string_free (str, FALSE);
}
/**
* soup_form_encode_valist:
* @first_field: name of the first form field
* @args: pointer to additional values, as in soup_form_encode()
*
* See soup_form_encode(). This is mostly an internal method, used by
* various other methods such as soup_uri_set_query_from_fields() and
* soup_form_request_new().
*
* Return value: the encoded form
**/
char *
soup_form_encode_valist (const char *first_field, va_list args)
{
GString *str = g_string_new (NULL);
const char *name, *value;
name = first_field;
value = va_arg (args, const char *);
while (name && value) {
encode_pair (str, name, value);
name = va_arg (args, const char *);
if (name)
value = va_arg (args, const char *);
}
return g_string_free (str, FALSE);
}
File diff suppressed because it is too large. Load diff
-147
View File
@@ -1,147 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright 1999-2002 Ximian, Inc.
*/
/* NOTE - taken from the libsoup codebase for use by the ostree curl backend
* (yes, ironically enough).
*
* Please watch for future changes in libsoup.
*/
#ifndef SOUP_URI_H
#define SOUP_URI_H 1
/* OSTREECHANGE: make struct private
* Only include gio, and skip available definitions.
*/
#include <gio/gio.h>
#define SOUP_AVAILABLE_IN_2_4
#define SOUP_AVAILABLE_IN_2_28
#define SOUP_AVAILABLE_IN_2_32
G_BEGIN_DECLS
/* OSTREECHANGE: make struct private */
typedef struct _SoupURI SoupURI;
/* OSTREECHANGE: import soup-misc's interning */
#define SOUP_VAR extern
#define _SOUP_ATOMIC_INTERN_STRING(variable, value) ((const char *)(g_atomic_pointer_get (&(variable)) ? (variable) : (g_atomic_pointer_set (&(variable), (gpointer)g_intern_static_string (value)), (variable))))
#define SOUP_URI_SCHEME_HTTP _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTP, "http")
#define SOUP_URI_SCHEME_HTTPS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_HTTPS, "https")
#define SOUP_URI_SCHEME_FTP _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_FTP, "ftp")
#define SOUP_URI_SCHEME_FILE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_FILE, "file")
#define SOUP_URI_SCHEME_DATA _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_DATA, "data")
#define SOUP_URI_SCHEME_RESOURCE _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_RESOURCE, "resource")
#define SOUP_URI_SCHEME_WS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WS, "ws")
#define SOUP_URI_SCHEME_WSS _SOUP_ATOMIC_INTERN_STRING (_SOUP_URI_SCHEME_WSS, "wss")
/* OSTREECHANGE: import soup-form bits */
SOUP_AVAILABLE_IN_2_4
char *soup_form_encode_hash (GHashTable *form_data_set);
SOUP_AVAILABLE_IN_2_4
char *soup_form_encode_valist (const char *first_field,
va_list args);
SOUP_VAR gpointer _SOUP_URI_SCHEME_HTTP, _SOUP_URI_SCHEME_HTTPS;
SOUP_VAR gpointer _SOUP_URI_SCHEME_FTP;
SOUP_VAR gpointer _SOUP_URI_SCHEME_FILE, _SOUP_URI_SCHEME_DATA, _SOUP_URI_SCHEME_RESOURCE;
SOUP_VAR gpointer _SOUP_URI_SCHEME_WS, _SOUP_URI_SCHEME_WSS;
SOUP_AVAILABLE_IN_2_4
SoupURI *soup_uri_new_with_base (SoupURI *base,
const char *uri_string);
SOUP_AVAILABLE_IN_2_4
SoupURI *soup_uri_new (const char *uri_string);
SOUP_AVAILABLE_IN_2_4
char *soup_uri_to_string (SoupURI *uri,
gboolean just_path_and_query);
SOUP_AVAILABLE_IN_2_4
SoupURI *soup_uri_copy (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
gboolean soup_uri_equal (SoupURI *uri1,
SoupURI *uri2);
SOUP_AVAILABLE_IN_2_4
void soup_uri_free (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
char *soup_uri_encode (const char *part,
const char *escape_extra);
SOUP_AVAILABLE_IN_2_4
char *soup_uri_decode (const char *part);
SOUP_AVAILABLE_IN_2_4
char *soup_uri_normalize (const char *part,
const char *unescape_extra);
SOUP_AVAILABLE_IN_2_4
gboolean soup_uri_uses_default_port (SoupURI *uri);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_scheme (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_scheme (SoupURI *uri,
const char *scheme);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_user (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_user (SoupURI *uri,
const char *user);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_password (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_password (SoupURI *uri,
const char *password);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_host (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_host (SoupURI *uri,
const char *host);
SOUP_AVAILABLE_IN_2_32
guint soup_uri_get_port (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_port (SoupURI *uri,
guint port);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_path (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_path (SoupURI *uri,
const char *path);
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_query (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_query (SoupURI *uri,
const char *query);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_query_from_form (SoupURI *uri,
GHashTable *form);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_query_from_fields (SoupURI *uri,
const char *first_field,
...) G_GNUC_NULL_TERMINATED;
SOUP_AVAILABLE_IN_2_32
const char *soup_uri_get_fragment (SoupURI *uri);
SOUP_AVAILABLE_IN_2_4
void soup_uri_set_fragment (SoupURI *uri,
const char *fragment);
SOUP_AVAILABLE_IN_2_28
SoupURI *soup_uri_copy_host (SoupURI *uri);
SOUP_AVAILABLE_IN_2_28
guint soup_uri_host_hash (gconstpointer key);
SOUP_AVAILABLE_IN_2_28
gboolean soup_uri_host_equal (gconstpointer v1,
gconstpointer v2);
#define SOUP_URI_IS_VALID(uri) ((uri) && (uri)->scheme && (uri)->path)
#define SOUP_URI_VALID_FOR_HTTP(uri) ((uri) && ((uri)->scheme == SOUP_URI_SCHEME_HTTP || (uri)->scheme == SOUP_URI_SCHEME_HTTPS) && (uri)->host && (uri)->path)
G_END_DECLS
#endif /*SOUP_URI_H*/
+178 -4
View File
@@ -2830,6 +2830,121 @@ get_var_dfd (OstreeSysroot *self,
return glnx_opendirat (base_dfd, base_path, TRUE, ret_fd, error);
}
#ifdef HAVE_SELINUX
static void
child_setup_fchdir (gpointer data)
{
int fd = (int) (uintptr_t) data;
int rc __attribute__((unused));
rc = fchdir (fd);
}
/*
* Derived from rpm-ostree's rust/src/bwrap.rs
*/
static gboolean
run_in_deployment (int deployment_dfd,
const gchar * const *child_argv,
gsize child_argc,
gint *exit_status,
gchar **stdout,
GError **error)
{
static const gchar * const COMMON_ARGV[] = {
"/usr/bin/bwrap",
"--dev", "/dev", "--proc", "/proc", "--dir", "/run", "--dir", "/tmp",
"--chdir", "/",
"--die-with-parent",
"--unshare-pid",
"--unshare-uts",
"--unshare-ipc",
"--unshare-cgroup-try",
"--ro-bind", "/sys/block", "/sys/block",
"--ro-bind", "/sys/bus", "/sys/bus",
"--ro-bind", "/sys/class", "/sys/class",
"--ro-bind", "/sys/dev", "/sys/dev",
"--ro-bind", "/sys/devices", "/sys/devices",
"--bind", "usr", "/usr",
"--bind", "etc", "/etc",
"--bind", "var", "/var",
"--symlink", "/usr/lib", "/lib",
"--symlink", "/usr/lib32", "/lib32",
"--symlink", "/usr/lib64", "/lib64",
"--symlink", "/usr/bin", "/bin",
"--symlink", "/usr/sbin", "/sbin",
};
static const gsize COMMON_ARGC = sizeof (COMMON_ARGV) / sizeof (*COMMON_ARGV);
gsize i;
GPtrArray *args = g_ptr_array_sized_new (COMMON_ARGC + child_argc + 1);
g_autofree gchar **args_raw = NULL;
for (i = 0; i < COMMON_ARGC; i++)
g_ptr_array_add (args, (gchar *) COMMON_ARGV[i]);
for (i = 0; i < child_argc; i++)
g_ptr_array_add (args, (gchar *) child_argv[i]);
g_ptr_array_add (args, NULL);
args_raw = (gchar **) g_ptr_array_free (args, FALSE);
return g_spawn_sync (NULL, args_raw, NULL, 0, &child_setup_fchdir,
(gpointer) (uintptr_t) deployment_dfd,
stdout, NULL, exit_status, error);
}
/*
* Run semodule to check if the module content changed after merging /etc
* and rebuild the policy if needed.
*/
static gboolean
sysroot_finalize_selinux_policy (int deployment_dfd, GError **error)
{
struct stat stbuf;
gint exit_status;
g_autofree gchar *stdout = NULL;
if (!glnx_fstatat_allow_noent (deployment_dfd, "etc/selinux/config", &stbuf,
AT_SYMLINK_NOFOLLOW, error))
return FALSE;
/* Skip the SELinux policy refresh if /etc/selinux/config doesn't exist. */
if (errno != 0)
return TRUE;
/*
* Skip the SELinux policy refresh if the --rebuild-if-modules-changed
* flag is not supported by semodule.
*/
static const gchar * const SEMODULE_HELP_ARGV[] = {
"semodule", "--help"
};
static const gsize SEMODULE_HELP_ARGC = sizeof (SEMODULE_HELP_ARGV) / sizeof (*SEMODULE_HELP_ARGV);
if (!run_in_deployment (deployment_dfd, SEMODULE_HELP_ARGV,
SEMODULE_HELP_ARGC, &exit_status, &stdout, error))
return FALSE;
if (!g_spawn_check_exit_status (exit_status, error))
return glnx_prefix_error (error, "failed to run semodule");
if (!strstr(stdout, "--rebuild-if-modules-changed"))
{
ot_journal_print (LOG_INFO, "semodule does not have --rebuild-if-modules-changed");
return TRUE;
}
static const gchar * const SEMODULE_REBUILD_ARGV[] = {
"semodule", "-N", "--rebuild-if-modules-changed"
};
static const gsize SEMODULE_REBUILD_ARGC = sizeof (SEMODULE_REBUILD_ARGV) / sizeof (*SEMODULE_REBUILD_ARGV);
if (!run_in_deployment (deployment_dfd, SEMODULE_REBUILD_ARGV,
SEMODULE_REBUILD_ARGC, &exit_status, NULL, error))
return FALSE;
return g_spawn_check_exit_status (exit_status, error);
}
#endif /* HAVE_SELINUX */
static gboolean
sysroot_finalize_deployment (OstreeSysroot *self,
OstreeDeployment *deployment,
@@ -2866,6 +2981,11 @@ sysroot_finalize_deployment (OstreeSysroot *self,
return FALSE;
}
#ifdef HAVE_SELINUX
if (!sysroot_finalize_selinux_policy(deployment_dfd, error))
return FALSE;
#endif /* HAVE_SELINUX */
const char *osdeploypath = glnx_strjoina ("ostree/deploy/", ostree_deployment_get_osname (deployment));
glnx_autofd int os_deploy_dfd = -1;
if (!glnx_opendirat (self->sysroot_fd, osdeploypath, TRUE, &os_deploy_dfd, error))
@@ -3255,10 +3375,10 @@ ostree_sysroot_stage_tree_with_options (OstreeSysroot *self,
}
/* Invoked at shutdown time by ostree-finalize-staged.service */
gboolean
_ostree_sysroot_finalize_staged (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
static gboolean
_ostree_sysroot_finalize_staged_inner (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
{
/* It's totally fine if there's no staged deployment; perhaps down the line
* though we could teach the ostree cmdline to tell systemd to activate the
@@ -3355,9 +3475,63 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
if (!ostree_sysroot_prepare_cleanup (self, cancellable, error))
return FALSE;
// Cleanup will have closed some FDs, re-ensure writability
if (!_ostree_sysroot_ensure_writable (self, error))
return FALSE;
return TRUE;
}
/* Invoked at shutdown time by ostree-finalize-staged.service */
gboolean
_ostree_sysroot_finalize_staged (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GError) finalization_error = NULL;
if (!_ostree_sysroot_ensure_boot_fd (self, error))
return FALSE;
if (!_ostree_sysroot_finalize_staged_inner (self, cancellable, &finalization_error))
{
g_autoptr(GError) writing_error = NULL;
g_assert_cmpint (self->boot_fd, !=, -1);
if (!glnx_file_replace_contents_at (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH,
(guint8*)finalization_error->message, -1,
0, cancellable, &writing_error))
{
// We somehow failed to write the failure message...that's not great. Maybe ENOSPC on /boot.
g_printerr ("Failed to write %s: %s\n", _OSTREE_FINALIZE_STAGED_FAILURE_PATH, writing_error->message);
}
g_propagate_error (error, g_steal_pointer (&finalization_error));
return FALSE;
}
return TRUE;
}
/* Invoked at bootup time by ostree-boot-complete.service */
gboolean
_ostree_sysroot_boot_complete (OstreeSysroot *self,
GCancellable *cancellable,
GError **error)
{
if (!_ostree_sysroot_ensure_boot_fd (self, error))
return FALSE;
glnx_autofd int failure_fd = -1;
if (!ot_openat_ignore_enoent (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH, &failure_fd, error))
return FALSE;
// If we didn't find a failure log, then there's nothing to do right now.
// (Actually this unit shouldn't even be invoked, but we may do more in the future)
if (failure_fd == -1)
return TRUE;
g_autofree char *failure_data = glnx_fd_readall_utf8 (failure_fd, NULL, cancellable, error);
if (failure_data == NULL)
return glnx_prefix_error (error, "Reading from %s", _OSTREE_FINALIZE_STAGED_FAILURE_PATH);
// Remove the file; we don't want to continually error out.
(void) unlinkat (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH, 0);
return glnx_throw (error, "ostree-finalize-staged.service failed on previous boot: %s", failure_data);
}
/**
* ostree_sysroot_deployment_set_kargs:
* @self: Sysroot
+7
View File
@@ -96,6 +96,9 @@ struct OstreeSysroot {
#define _OSTREE_SYSROOT_BOOT_INITRAMFS_OVERLAYS "ostree/initramfs-overlays"
#define _OSTREE_SYSROOT_INITRAMFS_OVERLAYS "boot/" _OSTREE_SYSROOT_BOOT_INITRAMFS_OVERLAYS
// Relative to /boot, consumed by ostree-boot-complete.service
#define _OSTREE_FINALIZE_STAGED_FAILURE_PATH "ostree/finalize-failure.stamp"
gboolean
_ostree_sysroot_ensure_writable (OstreeSysroot *self,
GError **error);
@@ -142,6 +145,10 @@ gboolean
_ostree_sysroot_finalize_staged (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);
gboolean
_ostree_sysroot_boot_complete (OstreeSysroot *self,
GCancellable *cancellable,
GError **error);
OstreeDeployment *
_ostree_sysroot_deserialize_deployment_from_variant (GVariant *v,
+5 -2
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -82,7 +83,7 @@ ostree_sysroot_finalize (GObject *object)
g_clear_pointer (&self->deployments, g_ptr_array_unref);
g_clear_object (&self->booted_deployment);
g_clear_object (&self->staged_deployment);
g_clear_pointer (&self->staged_deployment_data, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&self->staged_deployment_data, g_variant_unref);
glnx_release_lock_file (&self->lock);
@@ -356,6 +357,8 @@ _ostree_sysroot_ensure_writable (OstreeSysroot *self,
ostree_sysroot_unload (self);
if (!ensure_sysroot_fd (self, error))
return FALSE;
if (!_ostree_sysroot_ensure_boot_fd (self, error))
return FALSE;
return TRUE;
}
@@ -1016,7 +1019,7 @@ _ostree_sysroot_reload_staged (OstreeSysroot *self,
g_assert (self->booted_deployment);
g_clear_object (&self->staged_deployment);
g_clear_pointer (&self->staged_deployment_data, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&self->staged_deployment_data, g_variant_unref);
/* Read the staged state from disk */
glnx_autofd int fd = -1;
+3 -3
View File
@@ -41,7 +41,7 @@
*
* Since: 2017.4
*/
#define OSTREE_RELEASE_VERSION (2)
#define OSTREE_RELEASE_VERSION (3)
/**
* OSTREE_VERSION
@@ -50,7 +50,7 @@
*
* Since: 2017.4
*/
#define OSTREE_VERSION (2022.2)
#define OSTREE_VERSION (2022.3)
/**
* OSTREE_VERSION_S:
@@ -60,7 +60,7 @@
*
* Since: 2017.4
*/
#define OSTREE_VERSION_S "2022.2"
#define OSTREE_VERSION_S "2022.3"
#define OSTREE_ENCODE_VERSION(year,release) \
((year) << 16 | (release))
+2 -2
View File
@@ -1,5 +1,5 @@
#!/usr/bin/bash
# This script creates new initramdisk with LUKS config within
#!/bin/bash
# This script creates new initramdisk with LUKS config within
set -euo pipefail
old_initrd=$1
+4 -5
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -22,12 +23,12 @@
#include "ot-checksum-instream.h"
#include "ot-checksum-utils.h"
G_DEFINE_TYPE (OtChecksumInstream, ot_checksum_instream, G_TYPE_FILTER_INPUT_STREAM)
struct _OtChecksumInstreamPrivate {
OtChecksum checksum;
};
G_DEFINE_TYPE_WITH_PRIVATE (OtChecksumInstream, ot_checksum_instream, G_TYPE_FILTER_INPUT_STREAM)
static gssize ot_checksum_instream_read (GInputStream *stream,
void *buffer,
gsize count,
@@ -50,8 +51,6 @@ ot_checksum_instream_class_init (OtChecksumInstreamClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
g_type_class_add_private (klass, sizeof (OtChecksumInstreamPrivate));
object_class->finalize = ot_checksum_instream_finalize;
stream_class->read_fn = ot_checksum_instream_read;
}
@@ -59,7 +58,7 @@ ot_checksum_instream_class_init (OtChecksumInstreamClass *klass)
static void
ot_checksum_instream_init (OtChecksumInstream *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, OT_TYPE_CHECKSUM_INSTREAM, OtChecksumInstreamPrivate);
self->priv = ot_checksum_instream_get_instance_private (self);
}
OtChecksumInstream *
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 Red Hat, Inc.
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -129,7 +130,7 @@ ot_gpgme_ctx_tmp_home_dir (gpgme_ctx_t gpgme_ctx,
goto out;
/* Sneaky cast from GFileOutputStream to GOutputStream. */
*out_pubring_stream = g_steal_pointer (&pubring_stream);
*out_pubring_stream = (GOutputStream *)g_steal_pointer (&pubring_stream);
}
if (out_tmp_home_dir != NULL)
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2022 Red Hat, Inc.
*
* SPDX-License-Identifier: LGPL-2.0+
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdlib.h>
#include "ot-main.h"
#include "ot-admin-builtins.h"
#include "ot-admin-functions.h"
#include "ostree.h"
#include "otutil.h"
#include "ostree-cmdprivate.h"
static GOptionEntry options[] = {
{ NULL }
};
gboolean
ot_admin_builtin_boot_complete (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
/* Just a sanity check; we shouldn't be called outside of the service though.
*/
struct stat stbuf;
if (fstatat (AT_FDCWD, OSTREE_PATH_BOOTED, &stbuf, 0) < 0)
return TRUE;
// We must have been invoked via systemd which should have set up a mount namespace.
g_assert (getenv ("INVOCATION_ID"));
g_autoptr(GOptionContext) context = g_option_context_new ("");
g_autoptr(OstreeSysroot) sysroot = NULL;
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
invocation, &sysroot, cancellable, error))
return FALSE;
if (!ostree_cmd__private__()->ostree_boot_complete (sysroot, cancellable, error))
return FALSE;
return TRUE;
}
+1
View File
@@ -39,6 +39,7 @@ BUILTINPROTO(deploy);
BUILTINPROTO(cleanup);
BUILTINPROTO(pin);
BUILTINPROTO(finalize_staged);
BUILTINPROTO(boot_complete);
BUILTINPROTO(unlock);
BUILTINPROTO(status);
BUILTINPROTO(set_origin);
+3
View File
@@ -43,6 +43,9 @@ static OstreeCommand admin_subcommands[] = {
{ "finalize-staged", OSTREE_BUILTIN_FLAG_NO_REPO | OSTREE_BUILTIN_FLAG_HIDDEN,
ot_admin_builtin_finalize_staged,
"Internal command to run at shutdown time" },
{ "boot-complete", OSTREE_BUILTIN_FLAG_NO_REPO | OSTREE_BUILTIN_FLAG_HIDDEN,
ot_admin_builtin_boot_complete,
"Internal command to run at boot after an update was applied" },
{ "init-fs", OSTREE_BUILTIN_FLAG_NO_REPO,
ot_admin_builtin_init_fs,
"Initialize a root filesystem" },
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -419,7 +420,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
}
}
g_clear_pointer (&objects, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&objects, g_hash_table_unref);
if (!opt_quiet)
g_print ("Verifying content integrity of %u commit objects...\n",
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
* SPDX-License-Identifier: LGPL-2.0+
*
@@ -133,7 +134,7 @@ traverse_keep_younger_than (OstreeRepo *repo, const char *checksum,
g_free (next_checksum);
next_checksum = ostree_commit_get_parent (commit);
if (next_checksum)
g_clear_pointer (&commit, (GDestroyNotify)g_variant_unref);
g_clear_pointer (&commit, g_variant_unref);
else
break; /* No parent, we're done */
}