From 455cc5e8926350cf4386792090068ff71af08f15 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 24 Mar 2017 10:35:59 -0400 Subject: [PATCH] repo+tests: Add [core]disable-xattrs=true, use it on overlayfs There are a lot of things suboptimal about this approach, but on the other hand we need to get our CI back up and running. The basic approach is to - in the test suite, detect if we're on overlayfs. If so, set a flag in the repo, which gets picked up by a few strategic places in the core to turn on "ignore xattrs". I also had to add a variant of this for the sysroot work. The core problem here is while overlayfs will let us read and see the SELinux labels, it won't let us write them. Down the line, we should improve this so that we can selectively ignore e.g. `security.*` attributes but not `user.*` say. Closes: https://github.com/ostreedev/ostree/issues/758 Closes: #759 Approved by: jlebon --- .../static-delta-generate-crosscheck.sh | 2 +- src/libostree/ostree-diff.c | 14 +++++ src/libostree/ostree-repo-commit.c | 3 +- src/libostree/ostree-repo-private.h | 1 + src/libostree/ostree-repo.c | 24 ++++--- src/libostree/ostree-sysroot-deploy.c | 63 ++++++++++++------- src/libostree/ostree-sysroot-private.h | 4 +- src/libostree/ostree-sysroot.c | 3 +- tests/archive-test.sh | 2 +- tests/basic-test.sh | 16 ++--- tests/libostreetest.c | 20 +++++- tests/libtest.sh | 46 ++++++++++---- tests/pull-test.sh | 8 +-- tests/test-archivez.sh | 2 +- tests/test-commit-sign.sh | 12 ++-- tests/test-delta.sh | 12 ++-- tests/test-demo-buildsystem.sh | 4 +- tests/test-local-pull-depth.sh | 2 +- tests/test-local-pull.sh | 12 ++-- tests/test-oldstyle-partial.sh | 2 +- tests/test-parent.sh | 2 +- tests/test-prune.sh | 10 +-- tests/test-pull-commit-only.sh | 2 +- tests/test-pull-contenturl.sh | 2 +- tests/test-pull-corruption.sh | 2 +- tests/test-pull-depth.sh | 2 +- tests/test-pull-large-metadata.sh | 2 +- tests/test-pull-metalink.sh | 6 +- tests/test-pull-mirror-summary.sh | 13 ++-- tests/test-pull-mirrorlist.sh | 6 +- tests/test-pull-override-url.sh | 4 +- tests/test-pull-repeated.sh | 2 +- tests/test-pull-resume.sh | 2 +- tests/test-pull-subpath.sh | 4 +- tests/test-pull-summary-sigs.sh | 4 +- tests/test-pull-untrusted.sh | 6 +- tests/test-refs.sh | 2 +- tests/test-remote-cookies.sh | 2 +- tests/test-remote-headers.sh | 2 +- tests/test-xattrs.sh | 3 + 40 files changed, 208 insertions(+), 122 deletions(-) diff --git a/manual-tests/static-delta-generate-crosscheck.sh b/manual-tests/static-delta-generate-crosscheck.sh index 831e0b62..fd8f2189 100755 --- a/manual-tests/static-delta-generate-crosscheck.sh +++ b/manual-tests/static-delta-generate-crosscheck.sh @@ -43,7 +43,7 @@ assert_streq() { validate_delta_options() { mkdir testrepo - ostree --repo=testrepo init --mode=bare-user + ostree_repo_init testrepo --mode=bare-user ostree --repo=testrepo remote add --set=gpg-verify=false local file://${repo} ostree --repo=${repo} static-delta generate $@ --from=${from} --to=${to} ostree --repo=testrepo pull --require-static-deltas local ${branch}@${from} diff --git a/src/libostree/ostree-diff.c b/src/libostree/ostree-diff.c index 5537ee87..b428fb44 100644 --- a/src/libostree/ostree-diff.c +++ b/src/libostree/ostree-diff.c @@ -24,6 +24,7 @@ #include "libglnx.h" #include "ostree.h" +#include "ostree-repo-private.h" #include "otutil.h" static gboolean @@ -269,6 +270,19 @@ ostree_diff_dirs_with_options (OstreeDiffFlags flags, if (!options) options = &default_opts; + /* If we're diffing versus a repo, and either of them have xattrs disabled, + * then disable for both. + */ + OstreeRepo *repo; + if (OSTREE_IS_REPO_FILE (a)) + repo = ostree_repo_file_get_repo ((OstreeRepoFile*)a); + else if (OSTREE_IS_REPO_FILE (b)) + repo = ostree_repo_file_get_repo ((OstreeRepoFile*)b); + else + repo = NULL; + if (repo != NULL && repo->disable_xattrs) + flags |= OSTREE_DIFF_FLAGS_IGNORE_XATTRS; + if (a == NULL) { if (!diff_add_dir_recurse (b, added, cancellable, error)) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 3848a03c..7a641de8 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -2304,7 +2304,8 @@ get_modified_xattrs (OstreeRepo *self, ret_xattrs = modifier->xattr_callback (self, relpath, file_info, modifier->xattr_user_data); } - else if (!(modifier && (modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS) > 0)) + else if (!(modifier && (modifier->flags & OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS) > 0) + && !self->disable_xattrs) { if (path && OSTREE_IS_REPO_FILE (path)) { diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h index f1e00f27..b1a58d61 100644 --- a/src/libostree/ostree-repo-private.h +++ b/src/libostree/ostree-repo-private.h @@ -100,6 +100,7 @@ struct OstreeRepo { GError *writable_error; gboolean in_transaction; gboolean disable_fsync; + gboolean disable_xattrs; guint zlib_compression_level; GHashTable *loose_object_devino_hash; GHashTable *updated_uncompressed_dirs; diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index 733db27b..3fa32336 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1584,8 +1584,9 @@ ostree_repo_remote_gpg_import (OstreeRepo *self, if (fstatat (self->repo_dir_fd, remote->keyring, &stbuf, AT_SYMLINK_NOFOLLOW) == 0) { + GLnxFileCopyFlags copyflags = self->disable_xattrs ? GLNX_FILE_COPY_NOXATTRS : 0; if (!glnx_file_copy_at (self->repo_dir_fd, remote->keyring, - &stbuf, target_temp_fd, "pubring.gpg", 0, + &stbuf, target_temp_fd, "pubring.gpg", copyflags, cancellable, error)) { g_prefix_error (error, "Unable to copy remote's keyring: "); @@ -2067,6 +2068,11 @@ reload_core_config (OstreeRepo *self, ostree_repo_set_disable_fsync (self, TRUE); } + /* See https://github.com/ostreedev/ostree/issues/758 */ + if (!ot_keyfile_get_boolean_with_default (self->config, "core", "disable-xattrs", + TRUE, &self->disable_xattrs, error)) + return FALSE; + { g_autofree char *tmp_expiry_seconds = NULL; /* 86400 secs = one day */ @@ -2920,8 +2926,10 @@ ostree_repo_load_file (OstreeRepo *self, if (out_xattrs) { - if (!glnx_fd_get_all_xattrs (fd, &ret_xattrs, - cancellable, error)) + if (self->disable_xattrs) + ret_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0)); + else if (!glnx_fd_get_all_xattrs (fd, &ret_xattrs, + cancellable, error)) goto out; } @@ -2934,15 +2942,17 @@ ostree_repo_load_file (OstreeRepo *self, else if (g_file_info_get_file_type (ret_file_info) == G_FILE_TYPE_SYMBOLIC_LINK && out_xattrs) { - if (!glnx_dfd_name_get_all_xattrs (self->objects_dir_fd, loose_path_buf, - &ret_xattrs, - cancellable, error)) + if (self->disable_xattrs) + ret_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0)); + else if (!glnx_dfd_name_get_all_xattrs (self->objects_dir_fd, loose_path_buf, + &ret_xattrs, + cancellable, error)) goto out; } } } } - + if (!found) { if (self->parent_repo) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index acbf4619..d12e47b2 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -88,6 +88,15 @@ symlink_at_replace (const char *oldpath, return ret; } +static GLnxFileCopyFlags +sysroot_flags_to_copy_flags (GLnxFileCopyFlags defaults, + OstreeSysrootDebugFlags sysrootflags) +{ + if (sysrootflags & OSTREE_SYSROOT_DEBUG_NO_XATTRS) + defaults |= GLNX_FILE_COPY_NOXATTRS; + return defaults; +} + /* Try a hardlink if we can, otherwise fall back to copying. Used * right now for kernels/initramfs in /boot, where we can just * hardlink if we're on the same partition. @@ -97,6 +106,7 @@ hardlink_or_copy_at (int src_dfd, const char *src_subpath, int dest_dfd, const char *dest_subpath, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -106,7 +116,8 @@ hardlink_or_copy_at (int src_dfd, { if (errno == EMLINK || errno == EXDEV) { - return glnx_file_copy_at (src_dfd, src_subpath, NULL, dest_dfd, dest_subpath, 0, + return glnx_file_copy_at (src_dfd, src_subpath, NULL, dest_dfd, dest_subpath, + sysroot_flags_to_copy_flags (0, flags), cancellable, error); } else @@ -126,6 +137,7 @@ dirfd_copy_attributes_and_xattrs (int src_parent_dfd, const char *src_name, int src_dfd, int dest_dfd, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -136,13 +148,16 @@ dirfd_copy_attributes_and_xattrs (int src_parent_dfd, /* Clone all xattrs first, so we get the SELinux security context * right. This will allow other users access if they have ACLs, but * oh well. - */ - if (!glnx_dfd_name_get_all_xattrs (src_parent_dfd, src_name, - &xattrs, cancellable, error)) - goto out; - if (!glnx_fd_set_all_xattrs (dest_dfd, xattrs, - cancellable, error)) - goto out; + */ + if (!(flags & OSTREE_SYSROOT_DEBUG_NO_XATTRS)) + { + if (!glnx_dfd_name_get_all_xattrs (src_parent_dfd, src_name, + &xattrs, cancellable, error)) + goto out; + if (!glnx_fd_set_all_xattrs (dest_dfd, xattrs, + cancellable, error)) + goto out; + } if (fstat (src_dfd, &src_stbuf) != 0) { @@ -169,6 +184,7 @@ static gboolean copy_dir_recurse (int src_parent_dfd, int dest_parent_dfd, const char *name, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -190,7 +206,7 @@ copy_dir_recurse (int src_parent_dfd, return FALSE; if (!dirfd_copy_attributes_and_xattrs (src_parent_dfd, name, src_dfd_iter.fd, dest_dfd, - cancellable, error)) + flags, cancellable, error)) return FALSE; while (TRUE) @@ -212,14 +228,14 @@ copy_dir_recurse (int src_parent_dfd, if (S_ISDIR (child_stbuf.st_mode)) { if (!copy_dir_recurse (src_dfd_iter.fd, dest_dfd, dent->d_name, - cancellable, error)) + flags, cancellable, error)) return FALSE; } else { if (!glnx_file_copy_at (src_dfd_iter.fd, dent->d_name, &child_stbuf, dest_dfd, dent->d_name, - GLNX_FILE_COPY_OVERWRITE, + sysroot_flags_to_copy_flags (GLNX_FILE_COPY_OVERWRITE, flags), cancellable, error)) return FALSE; } @@ -234,6 +250,7 @@ ensure_directory_from_template (int orig_etc_fd, int new_etc_fd, const char *path, int *out_dfd, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -262,7 +279,7 @@ ensure_directory_from_template (int orig_etc_fd, if (strcmp (parent_path, ".") != 0) { if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd, - parent_path, NULL, cancellable, error)) + parent_path, NULL, flags, cancellable, error)) goto out; /* Loop */ @@ -286,7 +303,7 @@ ensure_directory_from_template (int orig_etc_fd, goto out; if (!dirfd_copy_attributes_and_xattrs (modified_etc_fd, path, src_dfd, target_dfd, - cancellable, error)) + flags, cancellable, error)) goto out; ret = TRUE; @@ -312,6 +329,7 @@ copy_modified_config_file (int orig_etc_fd, int modified_etc_fd, int new_etc_fd, const char *path, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -332,7 +350,7 @@ copy_modified_config_file (int orig_etc_fd, g_autofree char *parent = g_path_get_dirname (path); if (!ensure_directory_from_template (orig_etc_fd, modified_etc_fd, new_etc_fd, - parent, &dest_parent_dfd, cancellable, error)) + parent, &dest_parent_dfd, flags, cancellable, error)) goto out; } else @@ -386,7 +404,7 @@ copy_modified_config_file (int orig_etc_fd, if (S_ISDIR (modified_stbuf.st_mode)) { - if (!copy_dir_recurse (modified_etc_fd, new_etc_fd, path, + if (!copy_dir_recurse (modified_etc_fd, new_etc_fd, path, flags, cancellable, error)) goto out; } @@ -394,7 +412,7 @@ copy_modified_config_file (int orig_etc_fd, { if (!glnx_file_copy_at (modified_etc_fd, path, &modified_stbuf, new_etc_fd, path, - GLNX_FILE_COPY_OVERWRITE, + sysroot_flags_to_copy_flags (GLNX_FILE_COPY_OVERWRITE, flags), cancellable, error)) goto out; } @@ -426,6 +444,7 @@ static gboolean merge_etc_changes (GFile *orig_etc, GFile *modified_etc, GFile *new_etc, + OstreeSysrootDebugFlags flags, GCancellable *cancellable, GError **error) { @@ -496,7 +515,7 @@ merge_etc_changes (GFile *orig_etc, g_assert (path); if (!copy_modified_config_file (orig_etc_fd, modified_etc_fd, new_etc_fd, path, - cancellable, error)) + flags, cancellable, error)) goto out; } for (i = 0; i < added->len; i++) @@ -507,7 +526,7 @@ merge_etc_changes (GFile *orig_etc, g_assert (path); if (!copy_modified_config_file (orig_etc_fd, modified_etc_fd, new_etc_fd, path, - cancellable, error)) + flags, cancellable, error)) goto out; } @@ -827,7 +846,7 @@ merge_configuration (OstreeSysroot *sysroot, /* TODO - set out labels as we copy files */ g_assert (!etc_exists); if (!copy_dir_recurse (deployment_usr_dfd, deployment_dfd, "etc", - cancellable, error)) + sysroot->debug_flags, cancellable, error)) goto out; /* Here, we initialize SELinux policy from the /usr/etc inside @@ -847,8 +866,8 @@ merge_configuration (OstreeSysroot *sysroot, if (source_etc_path) { - if (!merge_etc_changes (source_etc_pristine_path, source_etc_path, deployment_etc_path, - cancellable, error)) + if (!merge_etc_changes (source_etc_pristine_path, source_etc_path, deployment_etc_path, + sysroot->debug_flags, cancellable, error)) goto out; } @@ -1319,6 +1338,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, } if (!hardlink_or_copy_at (tree_boot_dfd, tree_kernel_name, bootcsum_dfd, dest_kernel_name, + sysroot->debug_flags, cancellable, error)) goto out; } @@ -1336,6 +1356,7 @@ install_deployment_kernel (OstreeSysroot *sysroot, } if (!hardlink_or_copy_at (tree_boot_dfd, tree_initramfs_name, bootcsum_dfd, dest_initramfs_name, + sysroot->debug_flags, cancellable, error)) goto out; } diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index c2f5d2d9..3900092a 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -30,7 +30,9 @@ G_BEGIN_DECLS typedef enum { /* Don't flag deployments as immutable. */ - OSTREE_SYSROOT_DEBUG_MUTABLE_DEPLOYMENTS = 1 << 0 + OSTREE_SYSROOT_DEBUG_MUTABLE_DEPLOYMENTS = 1 << 0, + /* See https://github.com/ostreedev/ostree/pull/759 */ + OSTREE_SYSROOT_DEBUG_NO_XATTRS = 1 << 1, } OstreeSysrootDebugFlags; diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index c4f608a2..446dd4ab 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -161,9 +161,10 @@ ostree_sysroot_init (OstreeSysroot *self) { const GDebugKey keys[] = { { "mutable-deployments", OSTREE_SYSROOT_DEBUG_MUTABLE_DEPLOYMENTS }, + { "no-xattrs", OSTREE_SYSROOT_DEBUG_NO_XATTRS }, }; - self->debug_flags = g_parse_debug_string (g_getenv("OSTREE_SYSROOT_DEBUG"), + self->debug_flags = g_parse_debug_string (g_getenv ("OSTREE_SYSROOT_DEBUG"), keys, G_N_ELEMENTS (keys)); self->sysroot_fd = -1; diff --git a/tests/archive-test.sh b/tests/archive-test.sh index 9c5f8a47..76bc2635 100644 --- a/tests/archive-test.sh +++ b/tests/archive-test.sh @@ -31,7 +31,7 @@ echo "ok content" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init +ostree_repo_init repo2 ${CMD_PREFIX} ostree --repo=repo2 pull-local repo echo "ok local clone" diff --git a/tests/basic-test.sh b/tests/basic-test.sh index 68c7b0a6..c1c6173b 100644 --- a/tests/basic-test.sh +++ b/tests/basic-test.sh @@ -46,8 +46,8 @@ echo "ok shortened checksum" echo "ok repo-in-cwd" rm test-repo -rf -$OSTREE --repo=test-repo init --mode=bare-user -$OSTREE --repo=test-repo init --mode=bare-user +ostree_repo_init test-repo --mode=bare-user +ostree_repo_init test-repo --mode=bare-user rm test-repo -rf echo "ok repo-init on existing repo" @@ -197,7 +197,7 @@ echo "ok diff file changing type" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init +ostree_repo_init repo2 ${CMD_PREFIX} ostree --repo=repo2 pull-local repo echo "ok pull-local" @@ -315,7 +315,7 @@ echo "ok checkout union add" cd ${test_tmpdir} rm -rf shadow-repo mkdir shadow-repo -${CMD_PREFIX} ostree --repo=shadow-repo init +ostree_repo_init shadow-repo ${CMD_PREFIX} ostree --repo=shadow-repo config set core.parent $(pwd)/repo rm -rf test2-checkout parent_rev_test2=$(${CMD_PREFIX} ostree --repo=repo rev-parse test2) @@ -335,7 +335,7 @@ echo "ok subdir noent" cd ${test_tmpdir} mkdir repo3 -${CMD_PREFIX} ostree --repo=repo3 init +ostree_repo_init repo3 ${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2 ${CMD_PREFIX} ostree --repo=repo3 rev-parse aremote/test2 echo "ok pull-local with --remote arg" @@ -354,7 +354,7 @@ echo "ok prune" cd ${test_tmpdir} rm repo3 -rf -${CMD_PREFIX} ostree --repo=repo3 init --mode=archive +ostree_repo_init repo3 --mode=archive ${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2 rm repo3/refs/remotes -rf mkdir repo3/refs/remotes @@ -437,7 +437,7 @@ echo "ok metadata commit with strings" cd ${test_tmpdir} rm repo2 -rf mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init +ostree_repo_init repo2 ${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${CMD_PREFIX} ostree --repo=repo2 show --print-detached-metadata-key=SIGNATURE test2 > test2-meta assert_file_has_content test2-meta "HANCOCK" @@ -481,7 +481,7 @@ echo "ok commit of fifo was rejected" cd ${test_tmpdir} rm repo2 -rf mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode=archive +ostree_repo_init repo2 --mode=archive ${CMD_PREFIX} ostree --repo=repo2 pull-local repo rm -rf test2-checkout ${CMD_PREFIX} ostree --repo=repo2 checkout -U --disable-cache test2 test2-checkout diff --git a/tests/libostreetest.c b/tests/libostreetest.c index d0eb3e81..cda1649d 100644 --- a/tests/libostreetest.c +++ b/tests/libostreetest.c @@ -21,6 +21,8 @@ #include "config.h" #include #include +#include +#include #include "libglnx.h" #include "libostreetest.h" @@ -90,12 +92,26 @@ ot_test_setup_sysroot (GCancellable *cancellable, gboolean ret = FALSE; g_autoptr(GFile) sysroot_path = g_file_new_for_path ("sysroot"); glnx_unref_object OstreeSysroot *ret_sysroot = NULL; + struct statfs stbuf; if (!ot_test_run_libtest ("setup_os_repository \"archive-z2\" \"syslinux\"", error)) goto out; - /* Make sure deployments are mutable */ - g_setenv ("OSTREE_SYSROOT_DEBUG", "mutable-deployments", TRUE); + { g_autoptr(GString) buf = g_string_new ("mutable-deployments"); + if (statfs ("/", &stbuf) < 0) + return glnx_throw_errno (error), NULL; + /* Keep this in sync with the overlayfs bits in libtest.sh */ +#ifndef OVERLAYFS_SUPER_MAGIC +#define OVERLAYFS_SUPER_MAGIC 0x794c7630 +#endif + if (stbuf.f_type == OVERLAYFS_SUPER_MAGIC) + { + g_print ("libostreetest: detected overlayfs\n"); + g_string_append (buf, ",no-xattrs"); + } + /* Make sure deployments are mutable */ + g_setenv ("OSTREE_SYSROOT_DEBUG", buf->str, TRUE); + } ret_sysroot = ostree_sysroot_new (sysroot_path); diff --git a/tests/libtest.sh b/tests/libtest.sh index 0126827e..363413fd 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -86,6 +86,18 @@ chmod -R u+w "${test_tmpdir}" export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted +# See comment in ot-builtin-commit.c and https://github.com/ostreedev/ostree/issues/758 +# Also keep this in sync with the bits in libostreetest.c +echo evaluating for overlayfs... +case $(stat -f --printf '%T' /) in + overlayfs) + echo "overlayfs found; enabling OSTREE_NO_XATTRS" + export OSTREE_SYSROOT_DEBUG="${OSTREE_SYSROOT_DEBUG},no-xattrs" + export OSTREE_NO_XATTRS=1 ;; + *) ;; +esac +echo done + if test -n "${OT_TESTS_DEBUG:-}"; then set -x fi @@ -195,15 +207,13 @@ setup_test_repository () { oldpwd=`pwd` cd ${test_tmpdir} - mkdir repo - cd repo - ot_repo="--repo=`pwd`" - export OSTREE="${CMD_PREFIX} ostree ${ot_repo}" - if test -n "$mode"; then - $OSTREE init --mode=${mode} + if test -n "${mode}"; then + ostree_repo_init repo --mode=${mode} else - $OSTREE init + ostree_repo_init repo fi + ot_repo="--repo=$(pwd)/repo" + export OSTREE="${CMD_PREFIX} ostree ${ot_repo}" cd ${test_tmpdir} mkdir files @@ -232,6 +242,16 @@ setup_test_repository () { cd $oldpwd } +# A wrapper which also possibly disables xattrs for CI testing +ostree_repo_init() { + repo=$1 + shift + ${CMD_PREFIX} ostree --repo=${repo} init "$@" + if test -n "${OSTREE_NO_XATTRS:-}"; then + echo -e 'disable-xattrs=true\n' >> ${repo}/config + fi +} + setup_fake_remote_repo1() { mode=$1 commit_opts=${2:-} @@ -241,7 +261,7 @@ setup_fake_remote_repo1() { mkdir ostree-srv cd ostree-srv mkdir gnomerepo - ${CMD_PREFIX} ostree --repo=gnomerepo init --mode=$mode + ostree_repo_init gnomerepo --mode=$mode mkdir gnomerepo-files cd gnomerepo-files echo first > firstfile @@ -284,8 +304,8 @@ setup_exampleos_repo() { mkdir -p ostree-srv/exampleos/{repo,build-repo} export ORIGIN_REPO=ostree-srv/exampleos/repo export ORIGIN_BUILD_REPO=ostree-srv/exampleos/build-repo - ${CMD_PREFIX} ostree --repo=${ORIGIN_REPO} init --mode=archive - ${CMD_PREFIX} ostree --repo=${ORIGIN_BUILD_REPO} init --mode=bare-user + ostree_repo_init ${ORIGIN_REPO} --mode=archive + ostree_repo_init ${ORIGIN_BUILD_REPO} --mode=bare-user cd ${test_tmpdir} rm main -rf mkdir main @@ -365,7 +385,7 @@ setup_exampleos_repo() { cd ${test_tmpdir} rm repo -rf - ${CMD_PREFIX} ostree --repo=repo init --mode=bare-user + ostree_repo_init repo --mode=bare-user ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat ostree-srv/httpd/address)/exampleos/repo export OSTREE="${CMD_PREFIX} ostree --repo=repo" } @@ -413,9 +433,9 @@ setup_os_repository () { cd ${test_tmpdir} mkdir testos-repo if test -n "$mode"; then - ${CMD_PREFIX} ostree --repo=testos-repo init --mode=${mode} + ostree_repo_init testos-repo --mode=${mode} else - ${CMD_PREFIX} ostree --repo=testos-repo init + ostree_repo_init testos-repo fi cd ${test_tmpdir} diff --git a/tests/pull-test.sh b/tests/pull-test.sh index f6176079..f2486c31 100644 --- a/tests/pull-test.sh +++ b/tests/pull-test.sh @@ -23,7 +23,7 @@ function repo_init() { cd ${test_tmpdir} rm repo -rf mkdir repo - ${CMD_PREFIX} ostree --repo=repo init + ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo } @@ -50,7 +50,7 @@ echo "ok pull contents" cd ${test_tmpdir} mkdir mirrorrepo -${CMD_PREFIX} ostree --repo=mirrorrepo init --mode=archive-z2 +ostree_repo_init mirrorrepo --mode=archive-z2 ${CMD_PREFIX} ostree --repo=mirrorrepo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=mirrorrepo pull --mirror origin main ${CMD_PREFIX} ostree --repo=mirrorrepo fsck @@ -96,7 +96,7 @@ echo "ok pull commit metadata only (should not apply deltas)" cd ${test_tmpdir} mkdir mirrorrepo-local -${CMD_PREFIX} ostree --repo=mirrorrepo-local init --mode=archive-z2 +ostree_repo_init mirrorrepo-local --mode=archive-z2 ${CMD_PREFIX} ostree --repo=mirrorrepo-local remote add --set=gpg-verify=false origin file://$(pwd)/ostree-srv/gnomerepo ${CMD_PREFIX} ostree --repo=mirrorrepo-local pull --mirror origin main ${CMD_PREFIX} ostree --repo=mirrorrepo-local fsck @@ -114,7 +114,7 @@ echo "ok pull detached metadata" cd ${test_tmpdir} mkdir parentpullrepo -${CMD_PREFIX} ostree --repo=parentpullrepo init --mode=archive-z2 +ostree_repo_init parentpullrepo --mode=archive-z2 ${CMD_PREFIX} ostree --repo=parentpullrepo remote add --set=gpg-verify=false origin file://$(pwd)/ostree-srv/gnomerepo parent_rev=$(ostree --repo=ostree-srv/gnomerepo rev-parse main^) rev=$(ostree --repo=ostree-srv/gnomerepo rev-parse main) diff --git a/tests/test-archivez.sh b/tests/test-archivez.sh index b8793284..836e9180 100755 --- a/tests/test-archivez.sh +++ b/tests/test-archivez.sh @@ -29,7 +29,7 @@ setup_test_repository "archive-z2" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init +ostree_repo_init repo2 ${CMD_PREFIX} ostree --repo=repo2 remote add --set=gpg-verify=false aremote file://$(pwd)/repo test2 ${CMD_PREFIX} ostree --repo=repo2 pull aremote ${CMD_PREFIX} ostree --repo=repo2 rev-parse aremote/test2 diff --git a/tests/test-commit-sign.sh b/tests/test-commit-sign.sh index f963b104..96608e88 100755 --- a/tests/test-commit-sign.sh +++ b/tests/test-commit-sign.sh @@ -33,7 +33,7 @@ oldpwd=`pwd` mkdir ostree-srv cd ostree-srv mkdir gnomerepo -${CMD_PREFIX} ostree --repo=gnomerepo init --mode="archive-z2" +ostree_repo_init gnomerepo --mode="archive-z2" mkdir gnomerepo-files cd gnomerepo-files echo first > firstfile @@ -67,7 +67,7 @@ cp -a ${repopath} ${repopath}.orig # Set OSTREE_GPG_HOME to a place with no keyrings, we shouldn't trust the signature cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo if env OSTREE_GPG_HOME=${test_tmpdir} ${CMD_PREFIX} ostree --repo=repo pull origin main; then assert_not_reached "pull with no trusted GPG keys unexpectedly succeeded!" @@ -77,7 +77,7 @@ rm repo -rf # And a test case with valid signature cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull origin main ${CMD_PREFIX} ostree --repo=repo show --gpg-verify-remote=origin main | grep -o 'Found [[:digit:]] signature' > show-verify-remote @@ -90,7 +90,7 @@ find ${test_tmpdir}/ostree-srv/gnomerepo -name '*.commitmeta' | while read fname echo borkborkbork > ${fname}; done mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo if ${CMD_PREFIX} ostree --repo=repo pull origin main; then assert_not_reached "pull with corrupted signature unexpectedly succeeded!" @@ -101,7 +101,7 @@ rm repo -rf # verification off cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull origin main rm repo -rf @@ -114,7 +114,7 @@ echo secret > signme ${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s "Don't forget to sign me!" cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull origin main if ${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature'; then diff --git a/tests/test-delta.sh b/tests/test-delta.sh index b9883830..84320b80 100755 --- a/tests/test-delta.sh +++ b/tests/test-delta.sh @@ -29,7 +29,7 @@ morebindatafiles="false ls" echo '1..12' mkdir repo -${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 mkdir files for bin in ${bindatafiles}; do @@ -121,7 +121,7 @@ if ${CMD_PREFIX} ostree --repo=repo static-delta generate --from=${origrev} --to assert_not_reached "static-delta generate --from=${origrev} --empty unexpectedly succeeded" fi -${CMD_PREFIX} ostree --repo=temp-repo init --mode=archive +ostree_repo_init temp-repo --mode=archive ${CMD_PREFIX} ostree --repo=temp-repo pull-local repo ${CMD_PREFIX} ostree --repo=temp-repo static-delta generate --empty --to=${newrev} --filename=some.delta assert_has_file some.delta @@ -168,7 +168,7 @@ echo 'ok heuristic endian detection' ${CMD_PREFIX} ostree --repo=repo summary -u -mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user +mkdir repo2 && ostree_repo_init repo2 --mode=bare-user ${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${newrev} ${CMD_PREFIX} ostree --repo=repo2 fsck ${CMD_PREFIX} ostree --repo=repo2 ls ${newrev} >/dev/null @@ -176,7 +176,7 @@ ${CMD_PREFIX} ostree --repo=repo2 ls ${newrev} >/dev/null echo 'ok pull delta' rm repo2 -rf -mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user +mkdir repo2 && ostree_repo_init repo2 --mode=bare-user mkdir deltadir deltaprefix=$(get_assert_one_direntry_matching repo/deltas '.') @@ -194,7 +194,7 @@ ${CMD_PREFIX} ostree --repo=repo static-delta generate --from=${origrev} --to=${ assert_not_has_file repo/deltas/${deltaprefix}/${deltadir}/0 rm repo2 -rf -mkdir repo2 && ostree --repo=repo2 init --mode=bare-user +ostree_repo_init repo2 --mode=bare-user ${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${origrev} ${CMD_PREFIX} ostree --repo=repo2 ls ${origrev} >/dev/null @@ -236,7 +236,7 @@ echo 'ok generate + show empty delta part' ${CMD_PREFIX} ostree --repo=repo summary -u rm -rf repo2 -mkdir repo2 && ${CMD_PREFIX} ostree --repo=repo2 init --mode=bare-user +mkdir repo2 && ostree_repo_init repo2 --mode=bare-user ${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${newrev} ${CMD_PREFIX} ostree --repo=repo2 pull-local --require-static-deltas repo ${samerev} ${CMD_PREFIX} ostree --repo=repo2 fsck diff --git a/tests/test-demo-buildsystem.sh b/tests/test-demo-buildsystem.sh index cc926979..99ddc505 100755 --- a/tests/test-demo-buildsystem.sh +++ b/tests/test-demo-buildsystem.sh @@ -66,9 +66,9 @@ exampleos_recompose() { packages="bash systemd" mkdir build-repo -${CMD_PREFIX} ostree --repo=build-repo init --mode=bare-user +ostree_repo_init build-repo --mode=bare-user mkdir repo -${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 # Our FUSE mount point mkdir mnt diff --git a/tests/test-local-pull-depth.sh b/tests/test-local-pull-depth.sh index e89d0914..fef2f2dc 100755 --- a/tests/test-local-pull-depth.sh +++ b/tests/test-local-pull-depth.sh @@ -27,7 +27,7 @@ echo "1..1" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode="archive-z2" +ostree_repo_init repo2 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo2 pull-local repo find repo2/objects -name '*.commit' | wc -l > commitcount diff --git a/tests/test-local-pull.sh b/tests/test-local-pull.sh index 9e8c8a00..43b96010 100755 --- a/tests/test-local-pull.sh +++ b/tests/test-local-pull.sh @@ -33,14 +33,14 @@ echo "ok setup" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode="bare-user" +ostree_repo_init repo2 --mode="bare-user" ${CMD_PREFIX} ostree --repo=repo2 pull-local repo ${CMD_PREFIX} ostree --repo=repo2 fsck echo "ok pull-local z2 to bare-user" mkdir repo3 -${CMD_PREFIX} ostree --repo=repo3 init --mode="archive-z2" +ostree_repo_init repo3 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo3 pull-local repo2 ${CMD_PREFIX} ostree --repo=repo3 fsck echo "ok pull-local bare-user to z2" @@ -62,7 +62,7 @@ cmp checkout1.files checkout3.files echo "ok checkouts same" mkdir repo4 -${CMD_PREFIX} ostree --repo=repo4 init --mode="archive-z2" +ostree_repo_init repo4 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo4 remote add --gpg-import ${test_tmpdir}/gpghome/key1.asc origin repo if ${CMD_PREFIX} ostree --repo=repo4 pull-local --remote=origin --gpg-verify repo test2 2>&1; then assert_not_reached "GPG verification unexpectedly succeeded" @@ -72,13 +72,13 @@ echo "ok --gpg-verify with no signature" ${OSTREE} gpg-sign --gpg-homedir=${TEST_GPG_KEYHOME} test2 ${TEST_GPG_KEYID_1} mkdir repo5 -${CMD_PREFIX} ostree --repo=repo5 init --mode="archive-z2" +ostree_repo_init repo5 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo5 remote add --gpg-import ${test_tmpdir}/gpghome/key1.asc origin repo ${CMD_PREFIX} ostree --repo=repo5 pull-local --remote=origin --gpg-verify repo test2 echo "ok --gpg-verify" mkdir repo6 -${CMD_PREFIX} ostree --repo=repo6 init --mode="archive-z2" +ostree_repo_init repo6 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo6 remote add --gpg-import ${test_tmpdir}/gpghome/key1.asc origin repo if ${CMD_PREFIX} ostree --repo=repo6 pull-local --remote=origin --gpg-verify-summary repo test2 2>&1; then assert_not_reached "GPG summary verification with no summary unexpectedly succeeded" @@ -97,7 +97,7 @@ ${CMD_PREFIX} ostree --repo=repo6 pull-local --remote=origin --gpg-verify-summar echo "ok --gpg-verify-summary" mkdir repo7 -${CMD_PREFIX} ostree --repo=repo7 init --mode="archive-z2" +ostree_repo_init repo7 --mode="archive-z2" ${CMD_PREFIX} ostree --repo=repo7 pull-local repo ${CMD_PREFIX} ostree --repo=repo7 fsck for src_object in `find repo/objects -name '*.filez'`; do diff --git a/tests/test-oldstyle-partial.sh b/tests/test-oldstyle-partial.sh index a578e7d2..08be69d3 100755 --- a/tests/test-oldstyle-partial.sh +++ b/tests/test-oldstyle-partial.sh @@ -28,7 +28,7 @@ echo '1..1' cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull origin main --subpath /baz diff --git a/tests/test-parent.sh b/tests/test-parent.sh index d1f5d7c9..4d5520dd 100755 --- a/tests/test-parent.sh +++ b/tests/test-parent.sh @@ -32,7 +32,7 @@ export OSTREE_GPG_SIGN="${OSTREE} gpg-sign --gpg-homedir=${TEST_GPG_KEYHOME}" cd ${test_tmpdir} # Create a repo -${CMD_PREFIX} ostree --repo=repo2 init +ostree_repo_init repo2 ${CMD_PREFIX} ostree --repo=repo2 remote add --gpg-import=${test_tmpdir}/gpghome/trusted/pubring.gpg --set=gpg-verify=true aremote file://$(pwd)/repo test2 # Create a repo with repo2 as parent diff --git a/tests/test-prune.sh b/tests/test-prune.sh index 51ec7948..0781b543 100755 --- a/tests/test-prune.sh +++ b/tests/test-prune.sh @@ -29,7 +29,7 @@ echo '1..5' cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo mkdir -p tree/root @@ -142,7 +142,7 @@ assert_file_has_content deltascount "^1$" echo "ok prune" rm repo -rf -${CMD_PREFIX} ostree --repo=repo init --mode=bare-user +ostree_repo_init repo --mode=bare-user ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull --depth=-1 --commit-metadata-only origin test ${CMD_PREFIX} ostree --repo=repo prune @@ -158,7 +158,7 @@ assert_has_n_objects() { cd ${test_tmpdir} for repo in repo child-repo tmp-repo; do rm ${repo} -rf - ${CMD_PREFIX} ostree --repo=${repo} init --mode=archive + ostree_repo_init ${repo} --mode=archive done echo parent=${test_tmpdir}/repo >> child-repo/config mkdir files @@ -189,7 +189,7 @@ echo "ok prune with parent repo" # would interact. We make a new repo test suite, then clone it # for "subtests" below with reinitialize_datesnap_repo() rm repo datetest-snapshot-repo -rf -${CMD_PREFIX} ostree --repo=datetest-snapshot-repo init --mode=archive +ostree_repo_init datetest-snapshot-repo --mode=archive # Some ancient commits on the both a stable/dev branch for day in $(seq 5); do ${CMD_PREFIX} ostree --repo=datetest-snapshot-repo commit --branch=stable -m test -s "old stable build $day" tree --timestamp="October $day 1985" @@ -206,7 +206,7 @@ assert_file_has_content commitcount "^16$" # Snapshot the above reinitialize_datesnap_repo() { rm repo -rf - ${CMD_PREFIX} ostree --repo=repo init --mode=archive + ostree_repo_init repo --mode=archive ${CMD_PREFIX} ostree --repo=repo pull-local --depth=-1 datetest-snapshot-repo } diff --git a/tests/test-pull-commit-only.sh b/tests/test-pull-commit-only.sh index 775b2f71..0cbdebc8 100755 --- a/tests/test-pull-commit-only.sh +++ b/tests/test-pull-commit-only.sh @@ -27,7 +27,7 @@ echo '1..1' cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull --commit-metadata-only origin main diff --git a/tests/test-pull-contenturl.sh b/tests/test-pull-contenturl.sh index d74d619b..5d72fb23 100755 --- a/tests/test-pull-contenturl.sh +++ b/tests/test-pull-contenturl.sh @@ -57,7 +57,7 @@ echo "http://127.0.0.1:${content_port}" > ${test_tmpdir}/httpd-content-address cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo if has_gpgme; then VERIFY=true; else VERIFY=false; fi ${CMD_PREFIX} ostree --repo=repo remote add origin \ --set=gpg-verify=$VERIFY --set=gpg-verify-summary=$VERIFY \ diff --git a/tests/test-pull-corruption.sh b/tests/test-pull-corruption.sh index 646113a1..89d89b75 100755 --- a/tests/test-pull-corruption.sh +++ b/tests/test-pull-corruption.sh @@ -38,7 +38,7 @@ do_corrupt_pull_test() { cd ${test_tmpdir} rm repo -rf mkdir repo - ${CMD_PREFIX} ostree --repo=repo init + ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo if ${CMD_PREFIX} ostree --repo=repo pull origin main; then assert_not_reached "pull unexpectedly succeeded!" diff --git a/tests/test-pull-depth.sh b/tests/test-pull-depth.sh index 7a52f9cb..372bef49 100755 --- a/tests/test-pull-depth.sh +++ b/tests/test-pull-depth.sh @@ -27,7 +27,7 @@ echo '1..1' cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull --depth=0 origin main diff --git a/tests/test-pull-large-metadata.sh b/tests/test-pull-large-metadata.sh index 0fe02031..2fdf0d91 100755 --- a/tests/test-pull-large-metadata.sh +++ b/tests/test-pull-large-metadata.sh @@ -32,7 +32,7 @@ dd if=/dev/zero bs=1M count=20 of=ostree-srv/gnomerepo/objects/$(echo $rev | cut cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo if ${CMD_PREFIX} ostree --repo=repo pull origin main 2>pulllog.txt 1>&2; then diff --git a/tests/test-pull-metalink.sh b/tests/test-pull-metalink.sh index 07d619df..171c8d4b 100755 --- a/tests/test-pull-metalink.sh +++ b/tests/test-pull-metalink.sh @@ -68,7 +68,7 @@ EOF cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin metalink=$(cat metalink-httpd-address)/metalink.xml ${CMD_PREFIX} ostree --repo=repo pull origin:main ${CMD_PREFIX} ostree --repo=repo rev-parse origin:main @@ -87,7 +87,7 @@ test_metalink_pull_error() { msg=$1 rm repo -rf mkdir repo - ${CMD_PREFIX} ostree --repo=repo init + ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin metalink=$(cat metalink-httpd-address)/metalink.xml if ${CMD_PREFIX} ostree --repo=repo pull origin:main 2>err.txt; then assert_not_reached "pull unexpectedly succeeded" @@ -157,7 +157,7 @@ EOF cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin metalink=$(cat metalink-httpd-address)/metalink.xml ${CMD_PREFIX} ostree --repo=repo pull origin:main ${CMD_PREFIX} ostree --repo=repo rev-parse origin:main diff --git a/tests/test-pull-mirror-summary.sh b/tests/test-pull-mirror-summary.sh index 1ef6a09c..883c0245 100755 --- a/tests/test-pull-mirror-summary.sh +++ b/tests/test-pull-mirror-summary.sh @@ -41,7 +41,7 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u prev_dir=`pwd` cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull --mirror origin assert_has_file repo/summary @@ -69,15 +69,13 @@ cd $prev_dir cd ${test_tmpdir} rm -rf repo -mkdir repo -${OSTREE} --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${OSTREE} --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo echo "ok pull mirror without checking signed summary" cd ${test_tmpdir} rm -rf repo -mkdir repo -${OSTREE} --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${OSTREE} --repo=repo remote add --set=gpg-verify-summary=true origin $(cat httpd-address)/ostree/gnomerepo if ${OSTREE} --repo=repo pull --mirror origin 2>err.txt; then assert_not_reached "Mirroring unexpectedly succeeded" @@ -88,8 +86,7 @@ ${OSTREE} --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u ${COMMIT_SIGN} cd ${test_tmpdir} rm -rf repo -mkdir repo -${OSTREE} --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${OSTREE} --repo=repo remote add --set=gpg-verify-summary=true origin $(cat httpd-address)/ostree/gnomerepo ${OSTREE} --repo=repo pull --mirror origin assert_has_file repo/summary @@ -102,7 +99,7 @@ truncate --size=1 ${test_tmpdir}/ostree-srv/gnomerepo/summary.sig cd ${test_tmpdir} rm -rf repo mkdir repo -${OSTREE} --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${OSTREE} --repo=repo remote add origin $(cat httpd-address)/ostree/gnomerepo ${OSTREE} --repo=repo pull --mirror origin assert_has_file repo/summary diff --git a/tests/test-pull-mirrorlist.sh b/tests/test-pull-mirrorlist.sh index 13f40e7a..35320506 100755 --- a/tests/test-pull-mirrorlist.sh +++ b/tests/test-pull-mirrorlist.sh @@ -72,7 +72,7 @@ EOF cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin --no-gpg-verify \ mirrorlist=$(cat httpd-address)/ostree/mirrorlist ${CMD_PREFIX} ostree --repo=repo pull origin:main @@ -84,7 +84,7 @@ echo "ok pull objects from mirrorlist" cd ${test_tmpdir} rm -rf repo mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin --no-gpg-verify \ --contenturl=mirrorlist=$(cat httpd-address)/ostree/mirrorlist \ $(cat httpd-address)/ostree/gnomerepo @@ -97,7 +97,7 @@ echo "ok pull objects from contenturl mirrorlist" cd ${test_tmpdir} rm -rf repo mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add origin --no-gpg-verify \ --contenturl=mirrorlist=$(cat httpd-address)/ostree/mirrorlist \ mirrorlist=$(cat httpd-address)/ostree/mirrorlist diff --git a/tests/test-pull-override-url.sh b/tests/test-pull-override-url.sh index 928013a5..16f79a02 100755 --- a/tests/test-pull-override-url.sh +++ b/tests/test-pull-override-url.sh @@ -34,7 +34,7 @@ gnomerepo_url="$(cat httpd-address)/ostree/gnomerepo" mkdir mirror-srv cd mirror-srv mkdir gnomerepo -${CMD_PREFIX} ostree --repo=gnomerepo init --mode "archive-z2" +ostree_repo_init gnomerepo --mode "archive-z2" ${CMD_PREFIX} ostree --repo=gnomerepo remote add --set=gpg-verify=false origin ${gnomerepo_url} ${CMD_PREFIX} ostree --repo=gnomerepo pull --mirror --depth=-1 origin main @@ -57,7 +57,7 @@ echo "http://127.0.0.1:${port}" > ${test_tmpdir}/mirror-httpd-address cd ${test_tmpdir} mirrorrepo_url="$(cat mirror-httpd-address)/ostree/gnomerepo" mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${gnomerepo_url} rm -rf ${test_tmpdir}/ostree-srv/gnomerepo if ${CMD_PREFIX} ostree --repo=repo pull --depth=-1 origin main diff --git a/tests/test-pull-repeated.sh b/tests/test-pull-repeated.sh index 8934e430..108c2057 100755 --- a/tests/test-pull-repeated.sh +++ b/tests/test-pull-repeated.sh @@ -27,7 +27,7 @@ COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}" setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}" --random-500s=50 cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo for x in $(seq 200); do if ${CMD_PREFIX} ostree --repo=repo pull --mirror origin main 2>err.txt; then diff --git a/tests/test-pull-resume.sh b/tests/test-pull-resume.sh index 06cd0793..51746b9c 100755 --- a/tests/test-pull-resume.sh +++ b/tests/test-pull-resume.sh @@ -31,7 +31,7 @@ cp -a ${repopath} ${repopath}.orig cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo maxtries=`find ${repopath}/objects | wc -l` diff --git a/tests/test-pull-subpath.sh b/tests/test-pull-subpath.sh index dba8b495..27eb64be 100755 --- a/tests/test-pull-subpath.sh +++ b/tests/test-pull-subpath.sh @@ -33,7 +33,7 @@ for remoteurl in $(cat httpd-address)/ostree/gnomerepo \ cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${remoteurl} ${CMD_PREFIX} ostree --repo=repo pull --subpath=/baz/deeper --subpath=/baz/another origin main @@ -58,7 +58,7 @@ echo "ok subpaths" rm -rf repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin ${remoteurl} # Pull a directory which is not the first in the commit (/baz/another is before) diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh index 2dcfbd65..016ee4b9 100755 --- a/tests/test-pull-summary-sigs.sh +++ b/tests/test-pull-summary-sigs.sh @@ -41,7 +41,7 @@ ${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u prev_dir=`pwd` cd ${test_tmpdir} -${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2 +ostree_repo_init repo --mode=archive-z2 ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo ${CMD_PREFIX} ostree --repo=repo pull --mirror origin assert_has_file repo/summary @@ -66,7 +66,7 @@ repo_reinit () { cd ${test_tmpdir} rm -rf repo mkdir repo - ${OSTREE} --repo=repo init --mode=archive-z2 + ostree_repo_init repo --mode=archive-z2 ${OSTREE} --repo=repo remote add --set=gpg-verify-summary=true origin $(cat httpd-address)/ostree/gnomerepo } diff --git a/tests/test-pull-untrusted.sh b/tests/test-pull-untrusted.sh index 53636224..247a34f9 100755 --- a/tests/test-pull-untrusted.sh +++ b/tests/test-pull-untrusted.sh @@ -28,7 +28,7 @@ setup_test_repository "bare" cd ${test_tmpdir} mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode="bare" +ostree_repo_init repo2 --mode="bare" ${CMD_PREFIX} ostree --repo=repo2 --untrusted pull-local repo @@ -52,7 +52,7 @@ done rm -rf repo2 mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode="bare" +ostree_repo_init repo2 --mode="bare" if ${CMD_PREFIX} ostree --repo=repo2 pull-local repo; then echo "ok trusted pull with corruption succeeded" else @@ -61,7 +61,7 @@ fi rm -rf repo2 mkdir repo2 -${CMD_PREFIX} ostree --repo=repo2 init --mode="bare" +ostree_repo_init repo2 --mode="bare" if ${CMD_PREFIX} ostree --repo=repo2 pull-local --untrusted repo; then assert_not_reached "corrupted untrusted pull unexpectedly failed!" else diff --git a/tests/test-refs.sh b/tests/test-refs.sh index ee7841bd..d4db0013 100755 --- a/tests/test-refs.sh +++ b/tests/test-refs.sh @@ -27,7 +27,7 @@ echo '1..1' cd ${test_tmpdir} mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo mkdir -p tree/root touch tree/root/a diff --git a/tests/test-remote-cookies.sh b/tests/test-remote-cookies.sh index ab2bf263..14e3dd12 100755 --- a/tests/test-remote-cookies.sh +++ b/tests/test-remote-cookies.sh @@ -36,7 +36,7 @@ assert_fail (){ cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo # Sanity check the setup, without cookies the pull should fail diff --git a/tests/test-remote-headers.sh b/tests/test-remote-headers.sh index bca46204..6902cefb 100755 --- a/tests/test-remote-headers.sh +++ b/tests/test-remote-headers.sh @@ -38,7 +38,7 @@ assert_fail (){ cd ${test_tmpdir} rm repo -rf mkdir repo -${CMD_PREFIX} ostree --repo=repo init +ostree_repo_init repo ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo # Sanity check the setup, without headers the pull should fail diff --git a/tests/test-xattrs.sh b/tests/test-xattrs.sh index cdc06e87..ae7ae39f 100755 --- a/tests/test-xattrs.sh +++ b/tests/test-xattrs.sh @@ -21,6 +21,9 @@ set -euo pipefail . $(dirname $0)/libtest.sh +skip "We don't really have a use case for committing user. xattrs right now. See also https://github.com/ostreedev/ostree/issues/758" + +# Dead code below skip_without_user_xattrs echo "1..2"