d/patches: Drop all patches

This commit is contained in:
Simon McVittie 2017-11-04 12:24:08 +00:00
parent 6c2b536280
commit ff25ef2d23
17 changed files with 1 additions and 1111 deletions

1
debian/changelog vendored
View File

@ -1,6 +1,7 @@
ostree (2017.13-1) UNRELEASED; urgency=medium
* New upstream release
- d/patches: Drop all patches
* d/control: Require dh-exec 0.23~, for build-profile support.
Strictly speaking we might only need 0.15, but I'm not going to
test versions older than the jessie backport.

View File

@ -1,66 +0,0 @@
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 16 Oct 2017 12:51:04 +0100
Subject: Cope with xattr syscalls raising EOPNOTSUPP
ENOTSUP and EOPNOTSUPP are numerically equal on most Linux ports,
but inexplicably differ on PA-RISC (hppa) and possibly other
rare architectures.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #1275
Approved by: cgwalters
Applied-upstream: 2017.13, commit:a4723dafed722008ed1ee3c952b7ff8e3d9b9a45
---
src/ostree/ot-builtin-create-usb.c | 2 +-
tests/libostreetest.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ostree/ot-builtin-create-usb.c b/src/ostree/ot-builtin-create-usb.c
index c77dbcb..742a6c2 100644
--- a/src/ostree/ot-builtin-create-usb.c
+++ b/src/ostree/ot-builtin-create-usb.c
@@ -113,7 +113,7 @@ ostree_builtin_create_usb (int argc,
OstreeRepoMode mode = OSTREE_REPO_MODE_BARE_USER;
if (TEMP_FAILURE_RETRY (fgetxattr (mount_root_dfd, "user.test", NULL, 0)) < 0 &&
- errno == ENOTSUP)
+ (errno == ENOTSUP || errno == EOPNOTSUPP))
mode = OSTREE_REPO_MODE_ARCHIVE;
g_debug ("%s: Creating repository in mode %u", G_STRFUNC, mode);
diff --git a/tests/libostreetest.c b/tests/libostreetest.c
index 496ff74..11949c9 100644
--- a/tests/libostreetest.c
+++ b/tests/libostreetest.c
@@ -85,8 +85,10 @@ ot_check_relabeling (gboolean *can_relabel,
g_autoptr(GBytes) bytes = glnx_fgetxattr_bytes (tmpf.fd, "security.selinux", &local_error);
if (!bytes)
{
- /* libglnx preserves errno */
- if (G_IN_SET (errno, ENOTSUP, ENODATA))
+ /* libglnx preserves errno. The EOPNOTSUPP case can't be part of a
+ * 'case' statement because on most but not all architectures,
+ * it's numerically equal to ENOTSUP. */
+ if (G_IN_SET (errno, ENOTSUP, ENODATA) || errno == EOPNOTSUPP)
{
*can_relabel = FALSE;
return TRUE;
@@ -99,7 +101,7 @@ ot_check_relabeling (gboolean *can_relabel,
const guint8 *data = g_bytes_get_data (bytes, &data_len);
if (fsetxattr (tmpf.fd, "security.selinux", data, data_len, 0) < 0)
{
- if (errno == ENOTSUP)
+ if (errno == ENOTSUP || errno == EOPNOTSUPP)
{
*can_relabel = FALSE;
return TRUE;
@@ -122,7 +124,7 @@ ot_check_user_xattrs (gboolean *has_user_xattrs,
if (fsetxattr (tmpf.fd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
{
- if (errno == ENOTSUP)
+ if (errno == ENOTSUP || errno == EOPNOTSUPP)
{
*has_user_xattrs = FALSE;
return TRUE;

View File

@ -1,60 +0,0 @@
From: Jonathan Lebon <jlebon@redhat.com>
Date: Fri, 6 Oct 2017 21:26:41 +0000
Subject: fdio: allow NULL for fstatat_allow_noent stbuf
Often, the caller doesn't actually care about the details of the stat
struct itself, but just whether the entry exists or not. It does work
to just pass `NULL` directly to glibc in a quick test, but given that
the argument is tagged as `__nonnull` and that the documentation does
not explicitly specify this is supported, let's do this safely.
Origin: upstream (submodule libglnx), 2017.13, commit:5362f6bc3ff3e30f379e767b203d15c9e56d6f08
---
libglnx/glnx-fdio.h | 5 +++--
libglnx/tests/test-libglnx-fdio.c | 10 ++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/libglnx/glnx-fdio.h b/libglnx/glnx-fdio.h
index 518135c..1aa0c43 100644
--- a/libglnx/glnx-fdio.h
+++ b/libglnx/glnx-fdio.h
@@ -299,7 +299,7 @@ glnx_fstatat (int dfd,
* glnx_fstatat_allow_noent:
* @dfd: Directory FD to stat beneath
* @path: Path to stat beneath @dfd
- * @buf: (out caller-allocates): Return location for stat details
+ * @buf: (out caller-allocates) (allow-none): Return location for stat details
* @flags: Flags to pass to fstatat()
* @error: Return location for a #GError, or %NULL
*
@@ -318,7 +318,8 @@ glnx_fstatat_allow_noent (int dfd,
int flags,
GError **error)
{
- if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf, flags)) != 0)
+ struct stat stbuf;
+ if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf ?: &stbuf, flags)) != 0)
{
if (errno != ENOENT)
{
diff --git a/libglnx/tests/test-libglnx-fdio.c b/libglnx/tests/test-libglnx-fdio.c
index bf973b9..350294c 100644
--- a/libglnx/tests/test-libglnx-fdio.c
+++ b/libglnx/tests/test-libglnx-fdio.c
@@ -161,6 +161,16 @@ test_fstatat (void)
return;
g_assert_cmpint (errno, ==, ENOENT);
g_assert_no_error (local_error);
+
+ /* test NULL parameter for stat */
+ if (!glnx_fstatat_allow_noent (AT_FDCWD, ".", NULL, 0, error))
+ return;
+ g_assert_cmpint (errno, ==, 0);
+ g_assert_no_error (local_error);
+ if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchfile", NULL, 0, error))
+ return;
+ g_assert_cmpint (errno, ==, ENOENT);
+ g_assert_no_error (local_error);
}
static void

View File

@ -1,34 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Wed, 4 Oct 2017 10:22:05 -0400
Subject: lib/core: Init struct stat buffer
Regression from d57410a7e62dcb89321807dcb2d91c85f9d26df7
Fixes Coverity CID #1457316
Closes: #1249
Approved by: jlebon
Origin: upstream, 2017.13, commit:e80efe0b0668a351361bb0a218a809434dd33d63
---
src/libostree/ostree-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 08c2892..7fa051f 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -1614,10 +1614,13 @@ _ostree_gfileinfo_equal (GFileInfo *a, GFileInfo *b)
return TRUE;
}
+/* Many parts of libostree only care about mode,uid,gid - this creates
+ * a new GFileInfo with those fields see.
+ */
GFileInfo *
_ostree_mode_uidgid_to_gfileinfo (mode_t mode, uid_t uid, gid_t gid)
{
- struct stat stbuf;
+ struct stat stbuf = { 0, };
stbuf.st_mode = mode;
stbuf.st_uid = uid;
stbuf.st_gid = gid;

View File

@ -1,28 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Thu, 12 Oct 2017 10:46:25 -0400
Subject: lib/deltas: Check cancellable during processing
Let's react to `Ctrl-C` faster here. Noticed while I was doing an update on my
desktop and playing with cancellation.
Closes: #1266
Approved by: jlebon
Origin: upstream, 2017.13, commit:a1986b1a8083ef4f840973f1c73d932a52e43644
---
src/libostree/ostree-repo-static-delta-processing.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/libostree/ostree-repo-static-delta-processing.c b/src/libostree/ostree-repo-static-delta-processing.c
index 844de2c..78bf7e1 100644
--- a/src/libostree/ostree-repo-static-delta-processing.c
+++ b/src/libostree/ostree-repo-static-delta-processing.c
@@ -229,6 +229,9 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
state->oplen--;
state->opdata++;
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ goto out;
+
switch (opcode)
{
case OSTREE_STATIC_DELTA_OP_OPEN_SPLICE_AND_CLOSE:

View File

@ -1,60 +0,0 @@
From: Dan Nicholson <nicholson@endlessm.com>
Date: Wed, 11 Oct 2017 14:03:10 +0000
Subject: lib/deploy: Ignore FIFREEZE/FITHAW errors when already in state
If the filesystem is already frozen, FIFREEZE returns EBUSY, and if the
filesystem is already thawed, FITHAW returns EINVAL. It's very unlikely
these issues would arise on a real ostree system since the sysroot would
be locked during the freeze/thaw cycle.
However, when multiple fake sysroots are used during the test suite (run
as root), the tests could race to run the freeze/thaw cycle without
locking. Furthermore, there's no reason why an independent process might
be trying to freeze the filesystem while ostree was deploying. Ignore
but warn for these errors since there's not much ostree can do about it,
anyways.
Closes: #1260
Approved by: cgwalters
Origin: upstream, 2017.13, commit:a5b7660c940a200adac1a7d217e4a1cd72719021
---
src/libostree/ostree-sysroot-deploy.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index a89711f..e37db39 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -1321,11 +1321,15 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
/* Do a freeze/thaw cycle; TODO add a FIFREEZETHAW ioctl */
if (ioctl (rootfs_dfd, FIFREEZE, 0) != 0)
{
- /* Not supported, or we're running in the unit tests (as non-root)?
+ /* Not supported, we're running in the unit tests (as non-root), or
+ * the filesystem is already frozen (EBUSY).
* OK, let's just do a syncfs.
*/
- if (G_IN_SET (errno, EOPNOTSUPP, EPERM))
+ if (G_IN_SET (errno, EOPNOTSUPP, EPERM, EBUSY))
{
+ /* Warn if the filesystem was already frozen */
+ if (errno == EBUSY)
+ g_debug ("Filesystem already frozen, falling back to syncfs");
if (TEMP_FAILURE_RETRY (syncfs (rootfs_dfd)) != 0)
return glnx_throw_errno_prefix (error, "syncfs");
/* Write the completion, and return */
@@ -1338,7 +1342,13 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
}
/* And finally thaw, then signal our completion to the watchdog */
if (TEMP_FAILURE_RETRY (ioctl (rootfs_dfd, FITHAW, 0)) != 0)
- return glnx_throw_errno_prefix (error, "ioctl(FITHAW)");
+ {
+ /* Warn but don't error if the filesystem was already thawed */
+ if (errno == EINVAL)
+ g_debug ("Filesystem already thawed");
+ else
+ return glnx_throw_errno_prefix (error, "ioctl(FITHAW)");
+ }
if (write (sock_parent, &c, sizeof (c)) != sizeof (c))
return glnx_throw_errno_prefix (error, "write(watchdog FITHAW complete)");
}

View File

@ -1,35 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Wed, 11 Oct 2017 17:02:02 -0400
Subject: lib/deploy: Use _exit() for FIFREEZE watchdog
This works around an (IMO) SpiderMonkey bug - it tries to
clean up in a shared library destructor, but doesn't install a
`pthread_atfork()` handler to unset its state.
Closes: https://github.com/ostreedev/ostree/issues/1262
Closes: #1264
Approved by: dbnicholson
Origin: upstream, 2017.13, commit:8f6ec62bfb149ec8dfb6076228dd64e5df27a76b
---
src/libostree/ostree-sysroot-deploy.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index e37db39..d46d5c3 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -1291,7 +1291,12 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
}
if (debug_fifreeze)
g_printerr ("fifreeze watchdog was run\n");
- exit (EXIT_SUCCESS);
+ /* We use _exit() rather than exit() to avoid tripping over any shared
+ * libraries in process that aren't fork() safe; for example gjs/spidermonkey:
+ * https://github.com/ostreedev/ostree/issues/1262
+ * This doesn't help for the err()/errx() calls above, but eh...
+ */
+ _exit (EXIT_SUCCESS);
}
else /* Parent process. */
{

View File

@ -1,90 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Mon, 2 Oct 2017 11:24:05 -0400
Subject: lib/pull: Fix regression with pull-local for nonexistent refs
I was reading the pull code for the last release, and spotted
a bug in commit f923c2e1eaebe0c781f07d34ae1a03f94357bccd - in
the case where the ref doesn't exist, we don't set an error,
tripping an assertion in the main code.
The previous code wanted the ref to always exist, so just flip back the boolean
for "ignore noent". I moved the `g_strchomp()` just into the HTTP path - if a
local repo is corrupted in this way it's something to fix in that repo.
Closes: #1238
Approved by: pwithnall
Origin: upstream, 2017.13, commit:b8c15ae859de7a353b99c98c6266ee626cd94e7e
---
src/libostree/ostree-repo-pull.c | 13 ++++++-------
tests/pull-test.sh | 10 +++++++++-
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 8a699ca..d5062e0 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -844,7 +844,7 @@ fetch_ref_contents (OtPullData *pull_data,
{
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
if (!ostree_repo_resolve_collection_ref (pull_data->remote_repo_local,
- ref, TRUE /* ignore enoent */,
+ ref, FALSE,
OSTREE_REPO_RESOLVE_REV_EXT_NONE,
&ret_contents, cancellable, error))
return FALSE;
@@ -855,7 +855,7 @@ fetch_ref_contents (OtPullData *pull_data,
else if (pull_data->remote_repo_local != NULL)
{
if (!ostree_repo_resolve_rev_ext (pull_data->remote_repo_local,
- ref->ref_name, TRUE /* ignore enoent */,
+ ref->ref_name, FALSE,
OSTREE_REPO_RESOLVE_REV_EXT_NONE,
&ret_contents, error))
return FALSE;
@@ -874,14 +874,13 @@ fetch_ref_contents (OtPullData *pull_data,
filename, &ret_contents,
cancellable, error))
return FALSE;
+
+ g_strchomp (ret_contents);
}
- /* Validate and return. */
- if (ret_contents != NULL)
- g_strchomp (ret_contents);
+ g_assert (ret_contents);
- if (ret_contents == NULL ||
- !ostree_validate_checksum_string (ret_contents, error))
+ if (!ostree_validate_checksum_string (ret_contents, error))
return glnx_prefix_error (error, "Fetching checksum for ref (%s, %s)",
ref->collection_id ? ref->collection_id : "(empty)",
ref->ref_name);
diff --git a/tests/pull-test.sh b/tests/pull-test.sh
index 7d4b57f..2afc0ac 100644
--- a/tests/pull-test.sh
+++ b/tests/pull-test.sh
@@ -35,7 +35,7 @@ function verify_initial_contents() {
assert_file_has_content baz/cow '^moo$'
}
-echo "1..31"
+echo "1..32"
# Try both syntaxes
repo_init --no-gpg-verify
@@ -238,6 +238,14 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo-local rev-parse localbranch
${CMD_PREFIX} ostree --repo=mirrorrepo-local fsck
echo "ok pull-local mirror errors with mixed refs"
+rm -f otherrepo/summary
+if ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull-local otherrepo nosuchbranch 2>err.txt; then
+ fatal "pulled nonexistent branch"
+fi
+# So true
+assert_file_has_content_literal err.txt "error: Refspec 'nosuchbranch' not found"
+echo "ok pull-local nonexistent branch"
+
cd ${test_tmpdir}
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u

View File

@ -1,125 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Wed, 25 Oct 2017 13:13:17 -0400
Subject: lib/repo: Fix loading commitstate with parent repos
This makes the code nicer too. Properly unit testing this though really wants
like a whole set of stuff around parent repos...but we do have coverage of the
non-parent path in the current pull tests.
Closes: https://github.com/ostreedev/ostree/issues/1306
Closes: #1308
Approved by: alexlarsson
Origin: upstream, 2017.13, commit:90ebd48f6aaf45c47b48c44354359f973dcf22a8
---
src/libostree/ostree-repo.c | 52 +++++++++++++++++++--------------------------
1 file changed, 22 insertions(+), 30 deletions(-)
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 0632ee2..eac5610 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2807,6 +2807,7 @@ load_metadata_internal (OstreeRepo *self,
GVariant **out_variant,
GInputStream **out_stream,
guint64 *out_size,
+ OstreeRepoCommitState *out_state,
GCancellable *cancellable,
GError **error)
{
@@ -2817,6 +2818,7 @@ load_metadata_internal (OstreeRepo *self,
g_autoptr(GVariant) ret_variant = NULL;
g_return_val_if_fail (OSTREE_OBJECT_TYPE_IS_META (objtype), FALSE);
+ g_return_val_if_fail (objtype == OSTREE_OBJECT_TYPE_COMMIT || out_state == NULL, FALSE);
/* Special caching for dirmeta objects, since they're commonly referenced many
* times.
@@ -2904,11 +2906,24 @@ load_metadata_internal (OstreeRepo *self,
if (out_size)
*out_size = stbuf.st_size;
+
+ if (out_state)
+ {
+ g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (sha256);
+ *out_state = 0;
+
+ if (!glnx_fstatat_allow_noent (self->repo_dir_fd, commitpartial_path, NULL, 0, error))
+ return FALSE;
+ if (errno == 0)
+ *out_state |= OSTREE_REPO_COMMIT_STATE_PARTIAL;
+ }
}
else if (self->parent_repo)
{
- if (!ostree_repo_load_variant (self->parent_repo, objtype, sha256, &ret_variant, error))
- return FALSE;
+ /* Directly recurse to simplify out parameters */
+ return load_metadata_internal (self->parent_repo, objtype, sha256, error_if_not_found,
+ out_variant, out_stream, out_size, out_state,
+ cancellable, error);
}
else if (error_if_not_found)
{
@@ -3220,7 +3235,7 @@ ostree_repo_load_object_stream (OstreeRepo *self,
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
{
if (!load_metadata_internal (self, objtype, checksum, TRUE, NULL,
- &ret_input, &size,
+ &ret_input, &size, NULL,
cancellable, error))
return FALSE;
}
@@ -3516,7 +3531,7 @@ ostree_repo_load_variant_if_exists (OstreeRepo *self,
GError **error)
{
return load_metadata_internal (self, objtype, sha256, FALSE,
- out_variant, NULL, NULL, NULL, error);
+ out_variant, NULL, NULL, NULL, NULL, error);
}
/**
@@ -3538,7 +3553,7 @@ ostree_repo_load_variant (OstreeRepo *self,
GError **error)
{
return load_metadata_internal (self, objtype, sha256, TRUE,
- out_variant, NULL, NULL, NULL, error);
+ out_variant, NULL, NULL, NULL, NULL, error);
}
/**
@@ -3561,31 +3576,8 @@ ostree_repo_load_commit (OstreeRepo *self,
OstreeRepoCommitState *out_state,
GError **error)
{
- if (out_variant)
- {
- if (!load_metadata_internal (self, OSTREE_OBJECT_TYPE_COMMIT, checksum, TRUE,
- out_variant, NULL, NULL, NULL, error))
- return FALSE;
- }
-
- if (out_state)
- {
- g_autofree char *commitpartial_path = _ostree_get_commitpartial_path (checksum);
- struct stat stbuf;
-
- *out_state = 0;
-
- if (fstatat (self->repo_dir_fd, commitpartial_path, &stbuf, 0) == 0)
- {
- *out_state |= OSTREE_REPO_COMMIT_STATE_PARTIAL;
- }
- else if (errno != ENOENT)
- {
- return glnx_throw_errno_prefix (error, "fstatat(%s)", commitpartial_path);
- }
- }
-
- return TRUE;
+ return load_metadata_internal (self, OSTREE_OBJECT_TYPE_COMMIT, checksum, TRUE,
+ out_variant, NULL, NULL, out_state, NULL, error);
}
/**

View File

@ -1,31 +0,0 @@
From: Dan Nicholson <nicholson@endlessm.com>
Date: Tue, 24 Oct 2017 19:27:17 +0000
Subject: lib/repo: Properly handle NULL homedir when signing commit
Without this, ostree_repo_sign_commit throws a critical message when no
homedir is provided:
(ostree gpg-sign:5034): GLib-GIO-CRITICAL **: g_file_new_for_path: assertion 'path != NULL' failed
Closes: #1305
Approved by: cgwalters
Origin: upstream, 2017.13, commit:63ce86d5977ebfbedd2cdfba1e4f6bd400a3a1b8
---
src/libostree/ostree-repo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 1e336e9..0632ee2 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -4119,7 +4119,9 @@ ostree_repo_sign_commit (OstreeRepo *self,
* pass the homedir so that the signing key can be imported, allowing
* subkey signatures to be recognised. */
g_autoptr(GError) local_error = NULL;
- g_autoptr(GFile) verify_keydir = g_file_new_for_path (homedir);
+ g_autoptr(GFile) verify_keydir = NULL;
+ if (homedir != NULL)
+ verify_keydir = g_file_new_for_path (homedir);
g_autoptr(OstreeGpgVerifyResult) result
=_ostree_repo_gpg_verify_with_metadata (self, commit_data, old_metadata,
NULL, verify_keydir, NULL,

View File

@ -1,30 +0,0 @@
From: Philip Withnall <withnall@endlessm.com>
Date: Tue, 3 Oct 2017 15:45:34 +0100
Subject: lib/repo-commit: Import detached metadata even if hardlink exists
Spotted while reading through the code, it looks like the
copy_detached_metadata() call is accidentally omitted if a hardlink
already exists for the .commit object.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1242
Approved by: cgwalters
Origin: upstream, 2017.13, commit:86e072bdbe48a4f16efb05c00eb79114e5fdbf61
---
src/libostree/ostree-repo-commit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index c4484f4..76bc187 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -3255,7 +3255,7 @@ import_one_object_direct (OstreeRepo *dest_repo,
if (linkat (src_repo->objects_dir_fd, loose_path_buf, dest_dfd, loose_path_buf, 0) != 0)
{
if (errno == EEXIST)
- return TRUE;
+ did_hardlink = TRUE;
else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
{
/* EMLINK, EXDEV and EPERM shouldn't be fatal; we just can't do

View File

@ -1,57 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Mon, 16 Oct 2017 15:29:38 -0400
Subject: lib/sysroot: Fix error handling when mounting overlayfs fails
This isn't perfect, but at least we fix an error-overwrite error, and in
practice `ostree admin unlock` isn't wrapped by `rpm-ostree` yet, so spew to
stderr is OK.
Closes: https://github.com/ostreedev/ostree/issues/1273
Closes: #1279
Approved by: guyshapiro
Origin: upstream, 2017.13, commit:464965e6b4897f9c6d4487ca10eb5bc60ad9a670
---
src/libostree/ostree-sysroot.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c
index 2ee5eb5..16f76f7 100644
--- a/src/libostree/ostree-sysroot.c
+++ b/src/libostree/ostree-sysroot.c
@@ -22,6 +22,7 @@
#include "otutil.h"
#include <sys/file.h>
#include <sys/mount.h>
+#include <err.h>
#include <sys/wait.h>
#include "ostree.h"
@@ -1763,11 +1764,15 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
return glnx_throw_errno_prefix (error, "fork");
else if (mount_child == 0)
{
- /* Child process. Do NOT use any GLib API here. */
+ /* Child process. Do NOT use any GLib API here; it's not generally fork() safe.
+ *
+ * TODO: report errors across a pipe (or use the journal?) rather than
+ * spewing to stderr.
+ */
if (fchdir (deployment_dfd) < 0)
- exit (EXIT_FAILURE);
+ err (1, "fchdir");
if (mount ("overlay", "/usr", "overlay", 0, ovl_options) < 0)
- exit (EXIT_FAILURE);
+ err (1, "mount");
exit (EXIT_SUCCESS);
}
else
@@ -1778,7 +1783,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
if (TEMP_FAILURE_RETRY (waitpid (mount_child, &estatus, 0)) < 0)
return glnx_throw_errno_prefix (error, "waitpid() on mount helper");
if (!g_spawn_check_exit_status (estatus, error))
- return glnx_throw_errno_prefix (error, "overlayfs mount helper");
+ return glnx_prefix_error (error, "Failed overlayfs mount");
}
}

View File

@ -1,33 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Wed, 4 Oct 2017 10:24:21 -0400
Subject: lib/sysroot: Fix pointer going out of scope in unlock code
Fixes Coverity CID #1457317
Closes: #1249
Approved by: jlebon
Origin: upstream, 2017.13, commit:351ffdb9778436b193ba9d2fbeebe2358e55004f
---
src/libostree/ostree-sysroot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c
index fe61a12..2ee5eb5 100644
--- a/src/libostree/ostree-sysroot.c
+++ b/src/libostree/ostree-sysroot.c
@@ -1698,6 +1698,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
return FALSE;
const char *ovl_options = NULL;
+ static const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work";
switch (unlocked_state)
{
case OSTREE_DEPLOYMENT_UNLOCKED_NONE:
@@ -1705,7 +1706,6 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self,
break;
case OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX:
{
- const char hotfix_ovl_options[] = "lowerdir=usr,upperdir=.usr-ovl-upper,workdir=.usr-ovl-work";
/* Create the overlayfs directories in the deployment root
* directly for hotfixes. The ostree-prepare-root.c helper
* is also set up to detect and mount these.

View File

@ -1,58 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Thu, 26 Oct 2017 12:08:15 +0100
Subject: lib/utils: Check for invalid UTF-8 in filenames
In case a filename contains invalid UTF-8 characters, libostree will
pass it to g_variant_builder_add() in create_tree_variant_from_hashes()
anyway, which leads to a critical warning from glib and an invalid
commit. This commit makes ostree print a useful error and exit instead.
Closes: #1271
Approved by: cgwalters
Origin: upstream, 2017.13, commit:2a9c5efe1d10b79681b0ee638994ead375be6597
---
src/libotutil/ot-unix-utils.c | 2 ++
tests/basic-test.sh | 10 +++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/libotutil/ot-unix-utils.c b/src/libotutil/ot-unix-utils.c
index d6c5ee6..1446cde 100644
--- a/src/libotutil/ot-unix-utils.c
+++ b/src/libotutil/ot-unix-utils.c
@@ -50,6 +50,8 @@ ot_util_filename_validate (const char *name,
{
return glnx_throw (error, "Invalid / in filename %s", name);
}
+ if (!g_utf8_validate (name, -1, NULL))
+ return glnx_throw (error, "Invalid UTF-8 in filename %s", name);
return TRUE;
}
diff --git a/tests/basic-test.sh b/tests/basic-test.sh
index a01f437..52bbe52 100644
--- a/tests/basic-test.sh
+++ b/tests/basic-test.sh
@@ -19,7 +19,7 @@
set -euo pipefail
-echo "1..$((73 + ${extra_basic_tests:-0}))"
+echo "1..$((74 + ${extra_basic_tests:-0}))"
CHECKOUT_U_ARG=""
CHECKOUT_H_ARGS="-H"
@@ -334,6 +334,14 @@ echo "ok commit from ref with modifier"
$OSTREE commit ${COMMIT_ARGS} -b trees/test2 -s 'ref with / in it' --tree=ref=test2
echo "ok commit ref with /"
+mkdir badutf8
+echo "invalid utf8 filename" > badutf8/$(printf '\x80')
+if $OSTREE commit ${COMMIT_ARGS} -b badutf8 --tree=dir=badutf8 2>err.txt; then
+ assert_not_reached "commit filename with invalid UTF-8"
+fi
+assert_file_has_content err.txt "Invalid UTF-8 in filename"
+echo "ok commit bad UTF-8"
+
old_rev=$($OSTREE rev-parse test2)
$OSTREE ls -R -C test2
$OSTREE commit ${COMMIT_ARGS} --skip-if-unchanged -b trees/test2 -s 'should not be committed' --tree=ref=test2

View File

@ -1,281 +0,0 @@
From: Colin Walters <walters@verbum.org>
Date: Fri, 13 Oct 2017 18:14:17 -0400
Subject: tests: Add test-pull-bareuseronly
I was going to fix a bug in the static deltas code and I noticed
we were missing `pull-test.sh` coverage for bareuseronly.
Obviously fixing this requires duplicating some of the bits we have in
`basic-test.sh`; need to hoist that into `libtest.sh`. For now though let's get
the coverage.
Closes: #1270
Approved by: jlebon
Origin: upstream, 2017.13, commit:95afe2848d65a8062f4a76adb1ab80b6bcc4d79e
---
Makefile-tests.am | 1 +
tests/pull-test.sh | 69 +++++++++++++++++++++++++++--------------
tests/test-pull-bareuseronly.sh | 28 +++++++++++++++++
3 files changed, 75 insertions(+), 23 deletions(-)
create mode 100755 tests/test-pull-bareuseronly.sh
diff --git a/Makefile-tests.am b/Makefile-tests.am
index 7cf2b19..42e73fa 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -69,6 +69,7 @@ _installed_or_uninstalled_test_scripts = \
tests/test-parent.sh \
tests/test-pull-bare.sh \
tests/test-pull-bareuser.sh \
+ tests/test-pull-bareuseronly.sh \
tests/test-pull-commit-only.sh \
tests/test-pull-depth.sh \
tests/test-pull-mirror-summary.sh \
diff --git a/tests/pull-test.sh b/tests/pull-test.sh
index 2afc0ac..b2613fc 100644
--- a/tests/pull-test.sh
+++ b/tests/pull-test.sh
@@ -27,9 +27,26 @@ function repo_init() {
${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo "$@"
}
+repo_init --no-gpg-verify
+
+# See also the copy of this in basic-test.sh
+COMMIT_ARGS=""
+CHECKOUT_U_ARG=""
+CHECKOUT_H_ARGS="-H"
+if is_bare_user_only_repo repo; then
+ COMMIT_ARGS="--canonical-permissions"
+ # Also, since we can't check out uid=0 files we need to check out in user mode
+ CHECKOUT_U_ARG="-U"
+ CHECKOUT_H_ARGS="-U -H"
+else
+ if grep -E -q '^mode=bare-user' repo/config; then
+ CHECKOUT_H_ARGS="-U -H"
+ fi
+fi
+
function verify_initial_contents() {
rm checkout-origin-main -rf
- $OSTREE checkout origin/main checkout-origin-main
+ $OSTREE checkout ${CHECKOUT_H_ARGS} origin/main checkout-origin-main
cd checkout-origin-main
assert_file_has_content firstfile '^first$'
assert_file_has_content baz/cow '^moo$'
@@ -61,7 +78,7 @@ echo "ok pull mirror"
mkdir otherbranch
echo someothercontent > otherbranch/someothercontent
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b otherbranch --tree=dir=otherbranch
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b otherbranch --tree=dir=otherbranch
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
rm mirrorrepo -rf
# All refs
@@ -88,9 +105,9 @@ echo "ok pull mirror (ref subset with summary)"
cd ${test_tmpdir}
rm checkout-origin-main -rf
-$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
+$OSTREE --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main checkout-origin-main
echo moomoo > checkout-origin-main/baz/cow
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "" --tree=dir=checkout-origin-main
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s "" --tree=dir=checkout-origin-main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo fsck
@@ -115,11 +132,12 @@ ${CMD_PREFIX} ostree --repo=mirrorrepo pull --bareuseronly-files origin main
echo "ok pull (bareuseronly, safe)"
rm checkout-origin-main -rf
-$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
+$OSTREE --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main checkout-origin-main
cat > statoverride.txt <<EOF
2048 /some-setuid
EOF
echo asetuid > checkout-origin-main/some-setuid
+# Don't use ${COMMIT_ARGS} as we don't want --canonical-permissions with bare-user-only
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b content-with-suid --statoverride=statoverride.txt --tree=dir=checkout-origin-main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
# Verify we reject it both when unpacking and when mirroring
@@ -140,7 +158,8 @@ echo "ok pull (bareuseronly mirror)"
# Corruption tests <https://github.com/ostreedev/ostree/issues/1211>
cd ${test_tmpdir}
repo_init --no-gpg-verify
-if ! is_bare_user_only_repo repo && ! skip_one_without_user_xattrs; then
+if ! is_bare_user_only_repo repo; then
+if ! skip_one_without_user_xattrs; then
if is_bare_user_only_repo repo; then
cacherepomode=bare-user-only
else
@@ -193,15 +212,19 @@ if ! is_bare_user_only_repo repo && ! skip_one_without_user_xattrs; then
repo_init --no-gpg-verify
echo "ok corruption"
fi
+else
+# bareuseronly case, we don't mark it as SKIP at the moment
+echo "ok corruption (skipped)"
+fi
cd ${test_tmpdir}
rm mirrorrepo/refs/remotes/* -rf
${CMD_PREFIX} ostree --repo=mirrorrepo prune --refs-only
${CMD_PREFIX} ostree --repo=mirrorrepo pull origin main
rm checkout-origin-main -rf
-$OSTREE --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
+$OSTREE --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main checkout-origin-main
echo yetmorecontent > checkout-origin-main/baz/cowtest
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "" --tree=dir=checkout-origin-main
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s "" --tree=dir=checkout-origin-main
rev=$(${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo rev-parse main)
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
@@ -223,8 +246,8 @@ cd ${test_tmpdir}
rm otherrepo -rf
ostree_repo_init otherrepo --mode=archive
rm checkout-origin-main -rf
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main checkout-origin-main
-${CMD_PREFIX} ostree --repo=otherrepo commit -b localbranch --tree=dir=checkout-origin-main
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main checkout-origin-main
+${CMD_PREFIX} ostree --repo=otherrepo commit ${COMMIT_ARGS} -b localbranch --tree=dir=checkout-origin-main
${CMD_PREFIX} ostree --repo=otherrepo remote add --set=gpg-verify=false origin file://$(pwd)/ostree-srv/gnomerepo
${CMD_PREFIX} ostree --repo=otherrepo pull origin main
rm mirrorrepo-local -rf
@@ -247,7 +270,7 @@ assert_file_has_content_literal err.txt "error: Refspec 'nosuchbranch' not found
echo "ok pull-local nonexistent branch"
cd ${test_tmpdir}
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s "Metadata string" --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
${CMD_PREFIX} ostree --repo=repo pull origin main
${CMD_PREFIX} ostree --repo=repo fsck
@@ -278,13 +301,13 @@ origrev=$(${CMD_PREFIX} ostree --repo=repo rev-parse main)
# Check we can pull the same commit with timestamp checking enabled
${CMD_PREFIX} ostree --repo=repo pull -T origin main
assert_streq ${origrev} "$(${CMD_PREFIX} ostree --repo=repo rev-parse main)"
-newrev=$(${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit -b main --tree=ref=main)
+newrev=$(${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main --tree=ref=main)
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
# New commit with timestamp checking
${CMD_PREFIX} ostree --repo=repo pull -T origin main
assert_not_streq "${origrev}" "${newrev}"
assert_streq ${newrev} "$(${CMD_PREFIX} ostree --repo=repo rev-parse main)"
-newrev2=$(${CMD_PREFIX} ostree --timestamp="October 25 1985" --repo=ostree-srv/gnomerepo commit -b main --tree=ref=main)
+newrev2=$(${CMD_PREFIX} ostree --timestamp="October 25 1985" --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main --tree=ref=main)
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
if ${CMD_PREFIX} ostree --repo=repo pull -T origin main 2>err.txt; then
fatal "pulled older commit with timestamp checking enabled?"
@@ -304,12 +327,12 @@ ${CMD_PREFIX} ostree --repo=repo fsck
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main
rm main-files -rf
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main main-files
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main main-files
cd main-files
echo "an added file for static deltas" > added-file
echo "modified file for static deltas" > baz/cow
rm baz/saucer
-${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s 'static delta test'
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s 'static delta test'
cd ..
rm main-files -rf
# Generate delta that we'll use
@@ -353,7 +376,7 @@ ${CMD_PREFIX} ostree --repo=repo pull --disable-static-deltas origin main
${CMD_PREFIX} ostree --repo=repo fsck
rm checkout-origin-main -rf
-$OSTREE checkout origin:main checkout-origin-main
+$OSTREE checkout ${CHECKOUT_H_ARGS} origin:main checkout-origin-main
cd checkout-origin-main
assert_file_has_content firstfile '^first$'
assert_file_has_content baz/cow "modified file for static deltas"
@@ -405,10 +428,10 @@ echo "ok delta required for revision"
cd ${test_tmpdir}
rm main-files -rf
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main main-files
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main main-files
cd main-files
echo "more added files for static deltas" > added-file2
-${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s 'inline static delta test'
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s 'inline static delta test'
cd ..
rm main-files -rf
# Generate new delta that we'll use
@@ -420,7 +443,7 @@ ${CMD_PREFIX} ostree --repo=repo pull origin main
${CMD_PREFIX} ostree --repo=repo fsck
rm checkout-origin-main -rf
-$OSTREE checkout origin:main checkout-origin-main
+$OSTREE checkout ${CHECKOUT_H_ARGS} origin:main checkout-origin-main
cd checkout-origin-main
assert_file_has_content added-file2 "more added files for static deltas"
@@ -428,12 +451,12 @@ echo "ok inline static delta"
cd ${test_tmpdir}
rm main-files -rf
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout main main-files
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo checkout ${CHECKOUT_U_ARG} main main-files
cd main-files
# Make a file larger than 16M for testing
dd if=/dev/zero of=test-bigfile count=1 seek=42678
echo "further modified file for static deltas" > baz/cow
-${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s '2nd static delta test'
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit ${COMMIT_ARGS} -b main -s '2nd static delta test'
cd ..
rm main-files -rf
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo static-delta generate main
@@ -444,7 +467,7 @@ ${CMD_PREFIX} ostree --repo=repo pull origin main
${CMD_PREFIX} ostree --repo=repo fsck
rm checkout-origin-main -rf
-$OSTREE checkout origin:main checkout-origin-main
+$OSTREE checkout ${CHECKOUT_H_ARGS} origin:main checkout-origin-main
cd checkout-origin-main
assert_has_file test-bigfile
stat --format=%s test-bigfile > bigfile-size
@@ -496,7 +519,7 @@ echo "ok pull repo 404 on dirtree object"
cd ${test_tmpdir}
repo_init --set=gpg-verify=true
-${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit \
+${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo commit ${COMMIT_ARGS} \
--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1} -b main \
-s "A signed commit" --tree=ref=main
${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo summary -u
diff --git a/tests/test-pull-bareuseronly.sh b/tests/test-pull-bareuseronly.sh
new file mode 100755
index 0000000..f5c06c4
--- /dev/null
+++ b/tests/test-pull-bareuseronly.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Colin Walters <walters@verbum.org>
+#
+# 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, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+skip_without_user_xattrs
+setup_fake_remote_repo1 "archive" "--canonical-permissions"
+
+repo_mode=bare-user-only
+. ${test_srcdir}/pull-test.sh

View File

@ -1,108 +0,0 @@
From: Simon McVittie <smcv@debian.org>
Date: Tue, 3 Oct 2017 21:30:36 +0100
Subject: Add missing test-libglnx-shutil
Because we re-run autogen.sh, we'll regenerate Makefile-libglnx.am.inc
(which results in the version after this patch, including
test-libglnx-shutil, being present) and then try to build
test-libglnx-shutil; but its source code wasn't included in the upstream
tarball, because Makefile-libglnx.am.inc wasn't up to date at
"make dist" time.
Signed-off-by: Simon McVittie <smcv@debian.org>
---
libglnx/Makefile-libglnx.am.inc | 6 +++-
libglnx/tests/test-libglnx-shutil.c | 63 +++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 1 deletion(-)
create mode 100644 libglnx/tests/test-libglnx-shutil.c
diff --git a/libglnx/Makefile-libglnx.am.inc b/libglnx/Makefile-libglnx.am.inc
index 8766e63..ff2700c 100644
--- a/libglnx/Makefile-libglnx.am.inc
+++ b/libglnx/Makefile-libglnx.am.inc
@@ -53,7 +53,7 @@ libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic
libglnx_la_LIBADD = $(libglnx_libs)
-libglnx_tests = test-libglnx-xattrs test-libglnx-fdio test-libglnx-errors test-libglnx-macros
+libglnx_tests = test-libglnx-xattrs test-libglnx-fdio test-libglnx-errors test-libglnx-macros test-libglnx-shutil
TESTS += $(libglnx_tests)
check_PROGRAMS += $(libglnx_tests)
@@ -72,3 +72,7 @@ test_libglnx_errors_LDADD = $(libglnx_libs) libglnx.la
test_libglnx_macros_SOURCES = libglnx/tests/test-libglnx-macros.c
test_libglnx_macros_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_macros_LDADD = $(libglnx_libs) libglnx.la
+
+test_libglnx_shutil_SOURCES = libglnx/tests/test-libglnx-shutil.c
+test_libglnx_shutil_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
+test_libglnx_shutil_LDADD = $(libglnx_libs) libglnx.la
diff --git a/libglnx/tests/test-libglnx-shutil.c b/libglnx/tests/test-libglnx-shutil.c
new file mode 100644
index 0000000..39f261b
--- /dev/null
+++ b/libglnx/tests/test-libglnx-shutil.c
@@ -0,0 +1,63 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright © 2017 Endless Mobile, 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "libglnx.h"
+#include <glib.h>
+#include <stdlib.h>
+#include <gio/gio.h>
+#include <err.h>
+#include <string.h>
+
+#include "libglnx-testlib.h"
+
+static void
+test_mkdir_p_enoent (void)
+{
+ _GLNX_TEST_DECLARE_ERROR(local_error, error);
+ glnx_fd_close int dfd = -1;
+
+ if (!glnx_ensure_dir (AT_FDCWD, "test", 0755, error))
+ return;
+ if (!glnx_opendirat (AT_FDCWD, "test", FALSE, &dfd, error))
+ return;
+ if (rmdir ("test") < 0)
+ return (void) glnx_throw_errno_prefix (error, "rmdir(%s)", "test");
+
+ /* This should fail with ENOENT. */
+ glnx_shutil_mkdir_p_at (dfd, "blah/baz", 0755, NULL, error);
+ g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND);
+ g_clear_error (&local_error);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ int ret;
+
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/mkdir-p/enoent", test_mkdir_p_enoent);
+
+ ret = g_test_run();
+
+ return ret;
+}

15
debian/patches/series vendored
View File

@ -1,15 +0,0 @@
dist/Add-missing-test-libglnx-shutil.patch
2017.13/lib-pull-Fix-regression-with-pull-local-for-nonexistent-r.patch
2017.13/lib-repo-commit-Import-detached-metadata-even-if-hardlink.patch
2017.13/lib-core-Init-struct-stat-buffer.patch
2017.13/lib-sysroot-Fix-pointer-going-out-of-scope-in-unlock-code.patch
2017.13/lib-deploy-Ignore-FIFREEZE-FITHAW-errors-when-already-in-.patch
2017.13/lib-deploy-Use-_exit-for-FIFREEZE-watchdog.patch
2017.13/lib-deltas-Check-cancellable-during-processing.patch
2017.13/lib-utils-Check-for-invalid-UTF-8-in-filenames.patch
2017.13/Cope-with-xattr-syscalls-raising-EOPNOTSUPP.patch
2017.13/lib-sysroot-Fix-error-handling-when-mounting-overlayfs-fa.patch
2017.13/tests-Add-test-pull-bareuseronly.patch
2017.13/lib-repo-Properly-handle-NULL-homedir-when-signing-commit.patch
2017.13/fdio-allow-NULL-for-fstatat_allow_noent-stbuf.patch
2017.13/lib-repo-Fix-loading-commitstate-with-parent-repos.patch