New upstream version 2017.15
This commit is contained in:
commit
ef9ffc09f4
66 files changed
+2620
-638
No files matched your search
+18
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((77 + ${extra_basic_tests:-0}))"
|
||||
echo "1..$((78 + ${extra_basic_tests:-0}))"
|
||||
|
||||
CHECKOUT_U_ARG=""
|
||||
CHECKOUT_H_ARGS="-H"
|
||||
@@ -751,16 +751,32 @@ $OSTREE commit ${COMMIT_ARGS} -s sometest -b test2 checkout-test2
|
||||
echo "ok commit with directory filename"
|
||||
|
||||
cd $test_tmpdir/checkout-test2
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR --add-metadata-string=KITTENS=CUTE --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=test2
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR \
|
||||
--add-metadata-string=KITTENS=CUTE --add-detached-metadata-string=SIGNATURE=HANCOCK \
|
||||
--add-metadata=SOMENUM='uint64 42' --tree=ref=test2
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE show --print-metadata-key=FOO test2 > test2-meta
|
||||
assert_file_has_content test2-meta "BAR"
|
||||
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
|
||||
assert_file_has_content test2-meta "CUTE"
|
||||
$OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta
|
||||
assert_file_has_content test2-meta "uint64 3026418949592973312"
|
||||
$OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta
|
||||
assert_file_has_content test2-meta "uint64 42"
|
||||
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
|
||||
assert_file_has_content test2-meta "HANCOCK"
|
||||
echo "ok metadata commit with strings"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
$OSTREE show --print-metadata-key=ostree.ref-binding test2 > test2-ref-binding
|
||||
assert_file_has_content test2-ref-binding 'test2'
|
||||
|
||||
$OSTREE commit ${COMMIT_ARGS} -b test2-unbound --no-bindings --tree=dir=${test_tmpdir}/checkout-test2
|
||||
if $OSTREE show --print-metadata-key=ostree.ref-binding; then
|
||||
fatal "ref bindings found with --no-bindings?"
|
||||
fi
|
||||
echo "ok refbinding"
|
||||
|
||||
if ! skip_one_without_user_xattrs; then
|
||||
cd ${test_tmpdir}
|
||||
rm repo2 -rf
|
||||
|
||||
@@ -37,6 +37,8 @@ assert_not_reached () {
|
||||
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8)
|
||||
if locale -a | grep C.UTF-8 >/dev/null; then
|
||||
export LC_ALL=C.UTF-8
|
||||
elif locale -a | grep C.utf8 >/dev/null; then
|
||||
export LC_ALL=C.utf8
|
||||
else
|
||||
export LC_ALL=C
|
||||
fi
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ if ! skip_one_without_user_xattrs; then
|
||||
if ${CMD_PREFIX} ostree --repo=cacherepo fsck 2>err.txt; then
|
||||
fatal "corrupt repo fsck?"
|
||||
fi
|
||||
assert_file_has_content err.txt "corrupted.*${checksum}"
|
||||
assert_file_has_content err.txt "Corrupted.*${checksum}"
|
||||
rm ostree-srv/corruptrepo -rf
|
||||
ostree_repo_init ostree-srv/corruptrepo --mode=archive
|
||||
${CMD_PREFIX} ostree --repo=ostree-srv/corruptrepo pull-local cacherepo main
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <gio/gio.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "libglnx.h"
|
||||
#include "libostreetest.h"
|
||||
@@ -236,6 +237,72 @@ test_object_writes (gconstpointer data)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_test_break_hardlink (int tmp_dfd,
|
||||
const char *path,
|
||||
GError **error)
|
||||
{
|
||||
const char *linkedpath = glnx_strjoina (path, ".link");
|
||||
struct stat orig_stbuf;
|
||||
if (!glnx_fstatat (tmp_dfd, path, &orig_stbuf, AT_SYMLINK_NOFOLLOW, error))
|
||||
return FALSE;
|
||||
|
||||
/* Calling ostree_break_hardlink() should be a noop */
|
||||
struct stat stbuf;
|
||||
if (!ostree_break_hardlink (tmp_dfd, path, TRUE, NULL, error))
|
||||
return FALSE;
|
||||
if (!glnx_fstatat (tmp_dfd, path, &stbuf, AT_SYMLINK_NOFOLLOW, error))
|
||||
return FALSE;
|
||||
|
||||
g_assert_cmpint (orig_stbuf.st_dev, ==, stbuf.st_dev);
|
||||
g_assert_cmpint (orig_stbuf.st_ino, ==, stbuf.st_ino);
|
||||
|
||||
if (linkat (tmp_dfd, path, tmp_dfd, linkedpath, 0) < 0)
|
||||
return glnx_throw_errno_prefix (error, "linkat");
|
||||
|
||||
if (!ostree_break_hardlink (tmp_dfd, path, TRUE, NULL, error))
|
||||
return FALSE;
|
||||
if (!glnx_fstatat (tmp_dfd, path, &stbuf, AT_SYMLINK_NOFOLLOW, error))
|
||||
return FALSE;
|
||||
/* This file should be different */
|
||||
g_assert_cmpint (orig_stbuf.st_dev, ==, stbuf.st_dev);
|
||||
g_assert_cmpint (orig_stbuf.st_ino, !=, stbuf.st_ino);
|
||||
/* But this one is still the same */
|
||||
if (!glnx_fstatat (tmp_dfd, linkedpath, &stbuf, AT_SYMLINK_NOFOLLOW, error))
|
||||
return FALSE;
|
||||
g_assert_cmpint (orig_stbuf.st_dev, ==, stbuf.st_dev);
|
||||
g_assert_cmpint (orig_stbuf.st_ino, ==, stbuf.st_ino);
|
||||
|
||||
(void) unlinkat (tmp_dfd, path, 0);
|
||||
(void) unlinkat (tmp_dfd, linkedpath, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
test_break_hardlink (void)
|
||||
{
|
||||
int tmp_dfd = AT_FDCWD;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/* Regular file */
|
||||
const char hello_hardlinked_content[] = "hello hardlinked content";
|
||||
glnx_file_replace_contents_at (tmp_dfd, "test-hardlink",
|
||||
(guint8*)hello_hardlinked_content,
|
||||
strlen (hello_hardlinked_content),
|
||||
GLNX_FILE_REPLACE_NODATASYNC,
|
||||
NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
(void)impl_test_break_hardlink (tmp_dfd, "test-hardlink", &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
/* Symlink */
|
||||
if (symlinkat ("some-path", tmp_dfd, "test-symhardlink") < 0)
|
||||
err (1, "symlinkat");
|
||||
(void)impl_test_break_hardlink (tmp_dfd, "test-symhardlink", &error);
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
static GVariant*
|
||||
xattr_cb (OstreeRepo *repo,
|
||||
const char *path,
|
||||
@@ -376,6 +443,7 @@ int main (int argc, char **argv)
|
||||
g_test_add_data_func ("/raw-file-to-archive-stream", repo, test_raw_file_to_archive_stream);
|
||||
g_test_add_data_func ("/objectwrites", repo, test_object_writes);
|
||||
g_test_add_func ("/xattrs-devino-cache", test_devino_cache_xattrs);
|
||||
g_test_add_func ("/break-hardlink", test_break_hardlink);
|
||||
g_test_add_func ("/remotename", test_validate_remotename);
|
||||
|
||||
return g_test_run();
|
||||
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# 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.
|
||||
|
||||
from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
from multiprocessing import cpu_count
|
||||
|
||||
def fatal(msg):
|
||||
sys.stderr.write(msg)
|
||||
sys.stderr.write('\n')
|
||||
sys.exit(1)
|
||||
|
||||
# Create 20 files with content based on @dname + a serial, basically to have
|
||||
# different files with different checksums.
|
||||
def mktree(dname, serial=0):
|
||||
print('Creating tree', dname, file=sys.stderr)
|
||||
os.mkdir(dname, 0755)
|
||||
for v in xrange(20):
|
||||
with open('{}/{}'.format(dname, v), 'w') as f:
|
||||
f.write('{} {} {}\n'.format(dname, serial, v))
|
||||
|
||||
subprocess.check_call(['ostree', '--repo=repo', 'init', '--mode=bare'])
|
||||
# like the bit in libtest, but let's do it unconditionally since it's simpler,
|
||||
# and we don't need xattr coverage for this
|
||||
with open('repo/config', 'a') as f:
|
||||
f.write('disable-xattrs=true\n')
|
||||
f.write('locking=true\n')
|
||||
|
||||
def commit(v):
|
||||
tdir='tree{}'.format(v)
|
||||
cmd = ['ostree', '--repo=repo', 'commit', '--fsync=0', '-b', tdir, '--tree=dir='+tdir]
|
||||
proc = subprocess.Popen(cmd)
|
||||
print('PID {}'.format(proc.pid), *cmd, file=sys.stderr)
|
||||
return proc
|
||||
def prune():
|
||||
cmd = ['ostree', '--repo=repo', 'prune', '--refs-only']
|
||||
proc = subprocess.Popen(cmd)
|
||||
print('PID {}:'.format(proc.pid), *cmd, file=sys.stderr)
|
||||
return proc
|
||||
|
||||
def wait_check(proc):
|
||||
pid = proc.pid
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
sys.stderr.write("process {} exited with code {}\n".format(proc.pid, proc.returncode))
|
||||
return False
|
||||
else:
|
||||
sys.stderr.write('PID {} exited OK\n'.format(pid))
|
||||
return True
|
||||
|
||||
print("1..2")
|
||||
|
||||
def run(n_committers, n_pruners):
|
||||
# The number of committers needs to be even since we only create half as
|
||||
# many trees
|
||||
n_committers += n_committers % 2
|
||||
|
||||
committers = set()
|
||||
pruners = set()
|
||||
|
||||
print('n_committers', n_committers, 'n_pruners', n_pruners, file=sys.stderr)
|
||||
n_trees = n_committers / 2
|
||||
for v in xrange(n_trees):
|
||||
mktree('tree{}'.format(v))
|
||||
|
||||
for v in xrange(n_committers):
|
||||
committers.add(commit(v / 2))
|
||||
for v in xrange(n_pruners):
|
||||
pruners.add(prune())
|
||||
|
||||
failed = False
|
||||
for committer in committers:
|
||||
if not wait_check(committer):
|
||||
failed = True
|
||||
for pruner in pruners:
|
||||
if not wait_check(pruner):
|
||||
failed = True
|
||||
if failed:
|
||||
fatal('A child process exited abnormally')
|
||||
|
||||
for v in xrange(n_trees):
|
||||
shutil.rmtree('tree{}'.format(v))
|
||||
|
||||
# No concurrent pruning
|
||||
run(cpu_count()/2 + 2, 0)
|
||||
print("ok no concurrent prunes")
|
||||
|
||||
run(cpu_count()/2 + 4, 3)
|
||||
print("ok concurrent prunes")
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
|
||||
# Copyright (C) 2011,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
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..3"
|
||||
echo "1..4"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
@@ -29,12 +29,26 @@ setup_test_repository "bare"
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
cd checkout-test2
|
||||
chmod o+x firstfile
|
||||
$OSTREE fsck -q && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
|
||||
if $OSTREE fsck -q; then
|
||||
fatal "fsck unexpectedly succeeded"
|
||||
fi
|
||||
chmod o-x firstfile
|
||||
$OSTREE fsck -q
|
||||
|
||||
echo "ok chmod"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo files -rf
|
||||
setup_test_repository "bare"
|
||||
rev=$($OSTREE rev-parse test2)
|
||||
echo -n > repo/objects/${rev:0:2}/${rev:2}.commit
|
||||
if $OSTREE fsck -q 2>err.txt; then
|
||||
fatal "fsck unexpectedly succeeded"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt "Corrupted commit object; checksum expected"
|
||||
|
||||
echo "ok metadata checksum"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm repo files -rf
|
||||
setup_test_repository "bare"
|
||||
@@ -42,7 +56,9 @@ rm checkout-test2 -rf
|
||||
$OSTREE checkout test2 checkout-test2
|
||||
cd checkout-test2
|
||||
chmod o+x firstfile
|
||||
$OSTREE fsck -q --delete && (echo 1>&2 "fsck unexpectedly succeeded"; exit 1)
|
||||
if $OSTREE fsck -q --delete; then
|
||||
fatal "fsck unexpectedly succeeded"
|
||||
fi
|
||||
|
||||
echo "ok chmod"
|
||||
|
||||
|
||||
@@ -21,12 +21,28 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo '1..2'
|
||||
echo '1..11'
|
||||
|
||||
cd ${test_tmpdir}
|
||||
|
||||
# Check that fsck detects errors with refs which have collection IDs (i.e. refs in refs/mirrors).
|
||||
set_up_repo() {
|
||||
# Create a new repository with one ref with the repository’s collection ID, and
|
||||
# one ref with a different collection ID (which should be in refs/mirrors).
|
||||
set_up_repo_with_collection_id() {
|
||||
rm -rf repo files
|
||||
|
||||
mkdir repo
|
||||
ostree_repo_init repo --collection-id org.example.Collection
|
||||
|
||||
mkdir files
|
||||
pushd files
|
||||
${CMD_PREFIX} ostree --repo=../repo commit -s "Commit 1" -b ref1 > ../ref1-checksum
|
||||
${CMD_PREFIX} ostree --repo=../repo commit -s "Commit 2" --orphan --bind-ref ref2 --add-metadata-string=ostree.collection-binding=org.example.Collection2 > ../ref2-checksum
|
||||
${CMD_PREFIX} ostree --repo=../repo refs --collections --create=org.example.Collection2:ref2 $(cat ../ref2-checksum)
|
||||
popd
|
||||
}
|
||||
|
||||
# Create a new repository with one ref and no collection IDs.
|
||||
set_up_repo_without_collection_id() {
|
||||
rm -rf repo files
|
||||
|
||||
mkdir repo
|
||||
@@ -34,12 +50,12 @@ set_up_repo() {
|
||||
|
||||
mkdir files
|
||||
pushd files
|
||||
${CMD_PREFIX} ostree --repo=../repo commit -s "Commit 1" -b original-ref > ../original-ref-checksum
|
||||
${CMD_PREFIX} ostree --repo=../repo commit -s "Commit 3" -b ref3 --bind-ref ref4 > ../ref3-checksum
|
||||
${CMD_PREFIX} ostree --repo=../repo refs --create=ref4 $(cat ../ref3-checksum)
|
||||
popd
|
||||
${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collection:some-ref $(cat original-ref-checksum)
|
||||
}
|
||||
|
||||
set_up_repo
|
||||
set_up_repo_with_collection_id
|
||||
|
||||
# fsck at this point should succeed
|
||||
${CMD_PREFIX} ostree fsck --repo=repo > fsck
|
||||
@@ -47,9 +63,9 @@ assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
# Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that.
|
||||
find repo/objects -name '*.commit' -delete -print | wc -l > commitcount
|
||||
assert_file_has_content commitcount "^1$"
|
||||
assert_file_has_content commitcount "^2$"
|
||||
|
||||
rm repo/refs/heads/original-ref
|
||||
rm repo/refs/heads/ref1
|
||||
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo > fsck; then
|
||||
@@ -62,7 +78,7 @@ echo "ok 1 fsck-collections"
|
||||
|
||||
# Try fsck in an old repository where refs/mirrors doesn’t exist to begin with.
|
||||
# It should succeed.
|
||||
set_up_repo
|
||||
set_up_repo_with_collection_id
|
||||
rm -rf repo/refs/mirrors
|
||||
|
||||
${CMD_PREFIX} ostree fsck --repo=repo > fsck
|
||||
@@ -70,3 +86,124 @@ assert_file_has_content fsck "^Validating refs...$"
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
echo "ok 2 fsck-collections in old repository"
|
||||
|
||||
# Test that fsck detects commits which are pointed to by refs, but which don’t
|
||||
# list those refs in their ref-bindings.
|
||||
set_up_repo_with_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --create=new-ref $(cat ref1-checksum)
|
||||
|
||||
# For compatibility we don't check for this by default
|
||||
${CMD_PREFIX} ostree fsck --repo=repo
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
|
||||
echo "ok 3 fsck detects missing ref bindings"
|
||||
|
||||
# And the same where the ref is a collection–ref.
|
||||
set_up_repo_with_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collection2:new-ref $(cat ref1-checksum)
|
||||
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref1’)"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
echo "ok 4 fsck detects missing collection–ref bindings"
|
||||
|
||||
# Check that a ref with a different collection ID but the same ref name is caught.
|
||||
set_up_repo_with_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --collections --create=org.example.Collection2:ref1 $(cat ref1-checksum)
|
||||
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Commit has collection ID ‘org.example.Collection’ in collection binding metadata, while the remote it came from has collection ID ‘org.example.Collection2’"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
echo "ok 5 fsck detects missing collection–ref bindings"
|
||||
|
||||
# Check that a commit with ref bindings which aren’t pointed to by refs is OK.
|
||||
set_up_repo_with_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --delete ref1
|
||||
|
||||
# fsck at this point should succeed
|
||||
${CMD_PREFIX} ostree fsck --repo=repo > fsck
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
echo "ok 6 fsck ignores unreferenced ref bindings"
|
||||
|
||||
# …but it’s not OK if we pass --verify-back-refs to fsck.
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Collection–ref (org.example.Collection, ref1) in bindings for commit .* does not exist"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
echo "ok 7 fsck ignores unreferenced ref bindings"
|
||||
|
||||
#
|
||||
# Now repeat most of the above tests with a repository without collection IDs.
|
||||
#
|
||||
|
||||
set_up_repo_without_collection_id
|
||||
|
||||
# fsck at this point should succeed
|
||||
${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck
|
||||
assert_file_has_content fsck "^Validating refs in collections...$"
|
||||
|
||||
# Drop the commit the ref points to, and drop the original ref so that fsck doesn’t prematurely fail on that.
|
||||
find repo/objects -name '*.commit' -delete -print | wc -l > commitcount
|
||||
assert_file_has_content commitcount "^1$"
|
||||
|
||||
rm repo/refs/heads/ref3
|
||||
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after deleting commit!"
|
||||
fi
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
|
||||
echo "ok 8 fsck-collections"
|
||||
|
||||
# Test that fsck detects commits which are pointed to by refs, but which don’t
|
||||
# list those refs in their ref-bindings.
|
||||
set_up_repo_without_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --create=new-ref $(cat ref3-checksum)
|
||||
|
||||
# fsck should now fail
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-bindings > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Commit has no requested ref ‘new-ref’ in ref binding metadata (‘ref3’, ‘ref4’)"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
|
||||
echo "ok 9 fsck detects missing ref bindings"
|
||||
|
||||
# Check that a commit with ref bindings which aren’t pointed to by refs is OK.
|
||||
set_up_repo_without_collection_id
|
||||
${CMD_PREFIX} ostree --repo=repo refs --delete ref3
|
||||
|
||||
# fsck at this point should succeed
|
||||
${CMD_PREFIX} ostree fsck --repo=repo > fsck
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
|
||||
echo "ok 10 fsck ignores unreferenced ref bindings"
|
||||
|
||||
# …but it’s not OK if we pass --verify-back-refs to fsck.
|
||||
if ${CMD_PREFIX} ostree fsck --repo=repo --verify-back-refs > fsck 2> fsck-error; then
|
||||
assert_not_reached "fsck unexpectedly succeeded after adding unbound ref!"
|
||||
fi
|
||||
assert_file_has_content fsck-error "Ref ‘ref3’ in bindings for commit .* does not exist"
|
||||
assert_file_has_content fsck "^Validating refs...$"
|
||||
|
||||
echo "ok 11 fsck ignores unreferenced ref bindings"
|
||||
@@ -76,7 +76,7 @@ if ! skip_one_without_user_xattrs; then
|
||||
if ${CMD_PREFIX} ostree --repo=ostree-srv/gnomerepo fsck 2>err.txt; then
|
||||
assert_not_reached "fsck with corrupted commit worked?"
|
||||
fi
|
||||
assert_file_has_content err.txt "corrupted object ${corruptrev}\.commit"
|
||||
assert_file_has_content_literal err.txt "Corrupted commit object; checksum expected='${corruptrev}' actual='${rev}'"
|
||||
|
||||
# Do a pull-local; this should succeed since we don't verify checksums
|
||||
# for local repos by default.
|
||||
|
||||
+8
-1
@@ -23,7 +23,7 @@ set -euo pipefail
|
||||
|
||||
setup_fake_remote_repo1 "archive"
|
||||
|
||||
echo '1..5'
|
||||
echo '1..6'
|
||||
|
||||
cd ${test_tmpdir}
|
||||
mkdir repo
|
||||
@@ -186,3 +186,10 @@ assert_file_has_content_literal refs.txt 'exampleos/x86_64/stable/server -> exam
|
||||
${CMD_PREFIX} ostree --repo=repo summary -u
|
||||
|
||||
echo "ok ref symlink"
|
||||
|
||||
# https://github.com/ostreedev/ostree/issues/1342
|
||||
if ${CMD_PREFIX} ostree --repo=repo refs -A exampleos/x86_64/27/server --create=exampleos:exampleos/x86_64/stable/server 2>err.txt; then
|
||||
fatal "Created alias ref to remote?"
|
||||
fi
|
||||
assert_file_has_content_literal err.txt 'Cannot create alias to remote ref'
|
||||
echo "ok ref no alias remote"
|
||||
@@ -21,7 +21,7 @@ set -euo pipefail
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
echo '1..13'
|
||||
echo '1..14'
|
||||
|
||||
setup_test_repository "bare"
|
||||
$OSTREE remote add origin http://example.com/ostree/gnome
|
||||
@@ -63,6 +63,18 @@ assert_file_has_content list.txt "http://another.com/repo"
|
||||
assert_file_has_content list.txt "http://another-noexist.example.com/anotherrepo"
|
||||
echo "ok remote list with urls"
|
||||
|
||||
cd ${test_tmpdir}
|
||||
rm -rf parent-repo
|
||||
ostree_repo_init parent-repo
|
||||
$OSTREE config set core.parent ${test_tmpdir}/parent-repo
|
||||
${CMD_PREFIX} ostree --repo=parent-repo remote add --no-gpg-verify parent-remote http://parent-remote.example.com/parent-remote
|
||||
$OSTREE remote list > list.txt
|
||||
assert_file_has_content list.txt "origin"
|
||||
assert_file_has_content list.txt "another"
|
||||
assert_file_has_content list.txt "another-noexist"
|
||||
assert_file_has_content list.txt "parent-remote"
|
||||
echo "ok remote list with parent repo remotes"
|
||||
|
||||
$OSTREE remote delete another
|
||||
echo "ok remote delete"
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ echo 'ok documented symbols'
|
||||
|
||||
# ONLY update this checksum in release commits!
|
||||
cat > released-sha256.txt <<EOF
|
||||
1e2c6b529bc2d940ff8969eaf0377d78d472d41ec2a2fc96e1c79efd7b95d241 ${released_syms}
|
||||
3dbe0aa610c7229050f4a651fd18893742f8a24c34f3e25bf807ff98fbfc7f72 ${released_syms}
|
||||
EOF
|
||||
sha256sum -c released-sha256.txt
|
||||
|
||||
|
||||
Reference in new issue
Block a user