New upstream version 2017.12

This commit is contained in:
Simon McVittie 2017-10-03 18:51:37 +01:00
commit d5964d6850
283 changed files with 4566 additions and 2286 deletions

View File

@ -193,11 +193,11 @@ EXTRA_DIST += \
$(NULL)
libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_OPENSSL_CFLAGS) \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_CRYPTO_CFLAGS) \
-fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern'
libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions $(addprefix $(wl_versionscript_arg),$(symbol_files))
libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) $(OT_INTERNAL_GPGME_LIBS) \
$(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(OT_DEP_OPENSSL_LIBS)
$(OT_DEP_LZMA_LIBS) $(OT_DEP_ZLIB_LIBS) $(OT_DEP_CRYPTO_LIBS)
libostree_1_la_LIBADD += $(bupsplitpath)
EXTRA_libostree_1_la_DEPENDENCIES = $(symbol_files)

View File

@ -54,7 +54,10 @@ ostree_SOURCES = src/ostree/main.c \
$(NULL)
if ENABLE_EXPERIMENTAL_API
ostree_SOURCES += src/ostree/ot-builtin-find-remotes.c
ostree_SOURCES += \
src/ostree/ot-builtin-create-usb.c \
src/ostree/ot-builtin-find-remotes.c \
$(NULL)
endif
# Admin subcommand

View File

@ -115,18 +115,26 @@ _installed_or_uninstalled_test_scripts = \
$(NULL)
experimental_test_scripts = \
tests/test-create-usb.sh \
tests/test-find-remotes.sh \
tests/test-fsck-collections.sh \
tests/test-init-collections.sh \
tests/test-prune-collections.sh \
tests/test-refs-collections.sh \
tests/test-remote-add-collections.sh \
tests/test-repo-finder-mount-integration.sh \
tests/test-summary-collections.sh \
tests/test-pull-collections.sh \
$(NULL)
test_extra_programs = $(NULL)
tests_repo_finder_mount_SOURCES = tests/repo-finder-mount.c
tests_repo_finder_mount_CFLAGS = $(common_tests_cflags)
tests_repo_finder_mount_LDADD = $(common_tests_ldadd) libostreetest.la
if ENABLE_EXPERIMENTAL_API
_installed_or_uninstalled_test_scripts += $(experimental_test_scripts)
test_extra_programs += tests/repo-finder-mount
else
EXTRA_DIST += $(experimental_test_scripts)
endif
@ -212,7 +220,7 @@ endif
_installed_or_uninstalled_test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \
tests/test-gpg-verify-result tests/test-checksum tests/test-lzma tests/test-rollsum \
tests/test-basic-c tests/test-sysroot-c tests/test-pull-c
tests/test-basic-c tests/test-sysroot-c tests/test-pull-c tests/test-repo
if ENABLE_EXPERIMENTAL_API
test_programs += \
@ -282,6 +290,9 @@ tests_test_sysroot_c_LDADD = $(TESTS_LDADD)
tests_test_pull_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_pull_c_LDADD = $(TESTS_LDADD)
tests_test_repo_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_LDADD = $(TESTS_LDADD)
tests_test_ot_unix_utils_CFLAGS = $(TESTS_CFLAGS)
tests_test_ot_unix_utils_LDADD = $(TESTS_LDADD)

View File

@ -359,13 +359,13 @@ host_triplet = @host@
bin_PROGRAMS = ostree$(EXEEXT) $(am__EXEEXT_1)
sbin_PROGRAMS =
libexec_PROGRAMS =
pkglibexec_PROGRAMS = $(am__EXEEXT_18)
noinst_PROGRAMS = $(am__EXEEXT_15) tests/test-rollsum-cli$(EXEEXT)
ostree_boot_PROGRAMS = $(am__EXEEXT_16) $(am__EXEEXT_17)
TESTS = $(am__EXEEXT_8) $(am__EXEEXT_25) \
$(dist_uninstalled_test_scripts) $(am__EXEEXT_12)
installed_test_PROGRAMS = $(am__EXEEXT_14)
check_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13)
pkglibexec_PROGRAMS = $(am__EXEEXT_20)
noinst_PROGRAMS = $(am__EXEEXT_17) tests/test-rollsum-cli$(EXEEXT)
ostree_boot_PROGRAMS = $(am__EXEEXT_18) $(am__EXEEXT_19)
TESTS = $(am__EXEEXT_8) $(am__EXEEXT_27) \
$(dist_uninstalled_test_scripts) $(am__EXEEXT_14)
installed_test_PROGRAMS = $(am__EXEEXT_16)
check_PROGRAMS = $(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_15)
@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_1 = $(all_test_ltlibs)
@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_2 = $(all_test_programs)
@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__append_3 = $(all_test_scripts)
@ -464,7 +464,11 @@ check_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13)
@BUILDOPT_INTROSPECTION_TRUE@am__append_44 = OSTree-1.0.gir
@BUILDOPT_INTROSPECTION_TRUE@am__append_45 = OSTree-1.0.typelib
@BUILDOPT_INTROSPECTION_TRUE@am__append_46 = $(gir_DATA) $(typelib_DATA)
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_47 = src/ostree/ot-builtin-find-remotes.c
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_47 = \
@ENABLE_EXPERIMENTAL_API_TRUE@ src/ostree/ot-builtin-create-usb.c \
@ENABLE_EXPERIMENTAL_API_TRUE@ src/ostree/ot-builtin-find-remotes.c \
@ENABLE_EXPERIMENTAL_API_TRUE@ $(NULL)
@USE_CURL_OR_SOUP_TRUE@am__append_48 = src/ostree/ot-remote-builtin-add-cookie.c \
@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-builtin-delete-cookie.c \
@USE_CURL_OR_SOUP_TRUE@ src/ostree/ot-remote-builtin-list-cookies.c \
@ -499,38 +503,39 @@ check_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_12) $(am__EXEEXT_13)
@BUILDOPT_FUSE_TRUE@am__append_62 = rofiles-fuse
@BUILDOPT_ASAN_TRUE@am__append_63 = OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_64 = $(experimental_test_scripts)
@ENABLE_EXPERIMENTAL_API_FALSE@am__append_65 = $(experimental_test_scripts)
@BUILDOPT_FUSE_TRUE@am__append_66 = tests/test-rofiles-fuse.sh
@BUILDOPT_FUSE_FALSE@am__append_67 = tests/test-rofiles-fuse.sh
@USE_LIBSOUP_TRUE@am__append_68 = tests/test-remote-cookies.sh
@BUILDOPT_GJS_TRUE@am__append_69 = $(js_tests) $(js_installed_tests)
@BUILDOPT_GJS_FALSE@am__append_70 = $(js_tests)
@BUILDOPT_GJS_FALSE@am__append_71 = $(js_installed_tests)
@ENABLE_INSTALLED_TESTS_FALSE@am__append_72 = -rpath $(abs_builddir)
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_73 = \
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_65 = tests/repo-finder-mount
@ENABLE_EXPERIMENTAL_API_FALSE@am__append_66 = $(experimental_test_scripts)
@BUILDOPT_FUSE_TRUE@am__append_67 = tests/test-rofiles-fuse.sh
@BUILDOPT_FUSE_FALSE@am__append_68 = tests/test-rofiles-fuse.sh
@USE_LIBSOUP_TRUE@am__append_69 = tests/test-remote-cookies.sh
@BUILDOPT_GJS_TRUE@am__append_70 = $(js_tests) $(js_installed_tests)
@BUILDOPT_GJS_FALSE@am__append_71 = $(js_tests)
@BUILDOPT_GJS_FALSE@am__append_72 = $(js_installed_tests)
@ENABLE_INSTALLED_TESTS_FALSE@am__append_73 = -rpath $(abs_builddir)
@ENABLE_EXPERIMENTAL_API_TRUE@am__append_74 = \
@ENABLE_EXPERIMENTAL_API_TRUE@ tests/test-bloom \
@ENABLE_EXPERIMENTAL_API_TRUE@ tests/test-repo-finder-config \
@ENABLE_EXPERIMENTAL_API_TRUE@ tests/test-repo-finder-mount \
@ENABLE_EXPERIMENTAL_API_TRUE@ $(NULL)
@ENABLE_EXPERIMENTAL_API_TRUE@@USE_AVAHI_TRUE@am__append_74 = tests/test-repo-finder-avahi
@USE_LIBARCHIVE_TRUE@am__append_75 = tests/test-libarchive-import
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_76 = $(_installed_or_uninstalled_test_scripts)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_77 = $(_installed_or_uninstalled_test_programs)
@ENABLE_INSTALLED_TESTS_TRUE@am__append_78 = install-installed-tests-extra
@ENABLE_EXPERIMENTAL_API_TRUE@@USE_AVAHI_TRUE@am__append_75 = tests/test-repo-finder-avahi
@USE_LIBARCHIVE_TRUE@am__append_76 = tests/test-libarchive-import
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_77 = $(_installed_or_uninstalled_test_scripts)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__append_78 = $(_installed_or_uninstalled_test_programs)
@ENABLE_INSTALLED_TESTS_TRUE@am__append_79 = install-installed-tests-extra
# Allow the distcheck install under $prefix test to pass
@BUILDOPT_SYSTEMD_TRUE@am__append_79 = --with-systemdsystemunitdir='$${libdir}/systemd/system'
@BUILDOPT_SYSTEMD_TRUE@am__append_80 = --with-systemdsystemunitdir='$${libdir}/systemd/system'
# We're using the system grub2-mkconfig generator
@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_80 = src/boot/grub2/grub2-15_ostree
@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_81 = install-grub2-config-hook
@BUILDOPT_TRIVIAL_HTTPD_TRUE@@ENABLE_MAN_TRUE@am__append_82 = ostree-trivial-httpd.1
@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_81 = src/boot/grub2/grub2-15_ostree
@BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_82 = install-grub2-config-hook
@BUILDOPT_TRIVIAL_HTTPD_TRUE@@ENABLE_MAN_TRUE@am__append_83 = ostree-trivial-httpd.1
# We still want to distribute the source, even if we are not building it
@BUILDOPT_TRIVIAL_HTTPD_FALSE@@ENABLE_MAN_TRUE@am__append_83 = man/ostree-trivial-httpd.xml
@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_84 = rofiles-fuse.1
@ENABLE_MAN_TRUE@am__append_85 = $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml)
@ENABLE_MAN_TRUE@am__append_86 = \
@BUILDOPT_TRIVIAL_HTTPD_FALSE@@ENABLE_MAN_TRUE@am__append_84 = man/ostree-trivial-httpd.xml
@BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_85 = rofiles-fuse.1
@ENABLE_MAN_TRUE@am__append_86 = $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml)
@ENABLE_MAN_TRUE@am__append_87 = \
@ENABLE_MAN_TRUE@ $(man1_MANS) \
@ENABLE_MAN_TRUE@ $(man5_MANS) \
@ENABLE_MAN_TRUE@ $(NULL)
@ -911,24 +916,26 @@ am__EXEEXT_6 = tests/test-varint$(EXEEXT) \
tests/test-checksum$(EXEEXT) tests/test-lzma$(EXEEXT) \
tests/test-rollsum$(EXEEXT) tests/test-basic-c$(EXEEXT) \
tests/test-sysroot-c$(EXEEXT) tests/test-pull-c$(EXEEXT) \
$(am__EXEEXT_5)
tests/test-repo$(EXEEXT) $(am__EXEEXT_5)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__EXEEXT_7 = \
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@ $(am__EXEEXT_6)
am__EXEEXT_8 = $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) \
$(am__EXEEXT_7)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_TRUE@am__EXEEXT_9 = $(am__EXEEXT_6)
am__EXEEXT_10 = $(am__EXEEXT_8) $(am__EXEEXT_9)
@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__EXEEXT_11 = $(am__EXEEXT_10)
am__EXEEXT_12 = test-libglnx-xattrs$(EXEEXT) \
@ENABLE_EXPERIMENTAL_API_TRUE@am__EXEEXT_10 = tests/repo-finder-mount$(EXEEXT)
am__EXEEXT_11 = $(am__EXEEXT_2) $(am__EXEEXT_10)
am__EXEEXT_12 = $(am__EXEEXT_8) $(am__EXEEXT_9) $(am__EXEEXT_11)
@ENABLE_ALWAYS_BUILD_TESTS_FALSE@am__EXEEXT_13 = $(am__EXEEXT_12)
am__EXEEXT_14 = test-libglnx-xattrs$(EXEEXT) \
test-libglnx-fdio$(EXEEXT) test-libglnx-errors$(EXEEXT) \
test-libglnx-macros$(EXEEXT)
@BUILDOPT_SYSTEMD_FALSE@am__EXEEXT_13 = ostree-remount$(EXEEXT)
@ENABLE_INSTALLED_TESTS_TRUE@am__EXEEXT_14 = $(am__EXEEXT_8) \
@ENABLE_INSTALLED_TESTS_TRUE@ $(am__EXEEXT_9)
@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__EXEEXT_15 = $(am__EXEEXT_10)
@BUILDOPT_SYSTEMD_TRUE@am__EXEEXT_16 = ostree-remount$(EXEEXT)
@BUILDOPT_USE_STATIC_COMPILER_FALSE@am__EXEEXT_17 = ostree-prepare-root$(EXEEXT)
@USE_LIBSOUP_TRUE@am__EXEEXT_18 = ostree-trivial-httpd$(EXEEXT)
@BUILDOPT_SYSTEMD_FALSE@am__EXEEXT_15 = ostree-remount$(EXEEXT)
@ENABLE_INSTALLED_TESTS_TRUE@am__EXEEXT_16 = $(am__EXEEXT_8) \
@ENABLE_INSTALLED_TESTS_TRUE@ $(am__EXEEXT_9) $(am__EXEEXT_11)
@ENABLE_ALWAYS_BUILD_TESTS_TRUE@am__EXEEXT_17 = $(am__EXEEXT_12)
@BUILDOPT_SYSTEMD_TRUE@am__EXEEXT_18 = ostree-remount$(EXEEXT)
@BUILDOPT_USE_STATIC_COMPILER_FALSE@am__EXEEXT_19 = ostree-prepare-root$(EXEEXT)
@USE_LIBSOUP_TRUE@am__EXEEXT_20 = ostree-trivial-httpd$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS) $(installed_test_PROGRAMS) \
$(libexec_PROGRAMS) $(noinst_PROGRAMS) $(ostree_boot_PROGRAMS) \
$(pkglibexec_PROGRAMS) $(sbin_PROGRAMS) \
@ -951,6 +958,7 @@ am__ostree_SOURCES_DIST = src/ostree/main.c \
src/ostree/ot-main.c src/ostree/ot-dump.h src/ostree/ot-dump.c \
src/ostree/ot-editor.c src/ostree/ot-editor.h \
src/ostree/parse-datetime.h src/ostree/parse-datetime.c \
src/ostree/ot-builtin-create-usb.c \
src/ostree/ot-builtin-find-remotes.c \
src/ostree/ot-admin-builtin-init-fs.c \
src/ostree/ot-admin-builtin-diff.c \
@ -986,7 +994,9 @@ am__ostree_SOURCES_DIST = src/ostree/main.c \
src/ostree/ot-remote-cookie-util.c \
src/ostree/ot-builtin-pull.c \
src/ostree/ot-builtin-trivial-httpd.c
@ENABLE_EXPERIMENTAL_API_TRUE@am__objects_11 = src/ostree/ostree-ot-builtin-find-remotes.$(OBJEXT)
@ENABLE_EXPERIMENTAL_API_TRUE@am__objects_11 = src/ostree/ostree-ot-builtin-create-usb.$(OBJEXT) \
@ENABLE_EXPERIMENTAL_API_TRUE@ src/ostree/ostree-ot-builtin-find-remotes.$(OBJEXT) \
@ENABLE_EXPERIMENTAL_API_TRUE@ $(am__objects_1)
@USE_CURL_OR_SOUP_TRUE@am__objects_12 = src/ostree/ostree-ot-remote-builtin-add-cookie.$(OBJEXT) \
@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-delete-cookie.$(OBJEXT) \
@USE_CURL_OR_SOUP_TRUE@ src/ostree/ostree-ot-remote-builtin-list-cookies.$(OBJEXT) \
@ -1128,6 +1138,16 @@ test_libglnx_xattrs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(test_libglnx_xattrs_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
am_tests_repo_finder_mount_OBJECTS = \
tests/tests_repo_finder_mount-repo-finder-mount.$(OBJEXT)
tests_repo_finder_mount_OBJECTS = \
$(am_tests_repo_finder_mount_OBJECTS)
tests_repo_finder_mount_DEPENDENCIES = $(am__DEPENDENCIES_12) \
libostreetest.la
tests_repo_finder_mount_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tests_repo_finder_mount_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
tests_test_basic_c_SOURCES = tests/test-basic-c.c
tests_test_basic_c_OBJECTS = \
tests/tests_test_basic_c-test-basic-c.$(OBJEXT)
@ -1241,6 +1261,13 @@ tests_test_pull_c_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tests_test_pull_c_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
tests_test_repo_SOURCES = tests/test-repo.c
tests_test_repo_OBJECTS = tests/tests_test_repo-test-repo.$(OBJEXT)
tests_test_repo_DEPENDENCIES = $(am__DEPENDENCIES_13)
tests_test_repo_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(tests_test_repo_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
am__tests_test_repo_finder_avahi_SOURCES_DIST = \
src/libostree/ostree-repo-finder-avahi-parser.c \
tests/test-repo-finder-avahi.c
@ -1355,15 +1382,16 @@ SOURCES = $(libbsdiff_la_SOURCES) $(libbupsplit_la_SOURCES) \
$(ostree_trivial_httpd_SOURCES) $(rofiles_fuse_SOURCES) \
$(test_libglnx_errors_SOURCES) $(test_libglnx_fdio_SOURCES) \
$(test_libglnx_macros_SOURCES) $(test_libglnx_xattrs_SOURCES) \
tests/test-basic-c.c $(tests_test_bloom_SOURCES) \
tests/test-bsdiff.c $(tests_test_checksum_SOURCES) \
$(tests_repo_finder_mount_SOURCES) tests/test-basic-c.c \
$(tests_test_bloom_SOURCES) tests/test-bsdiff.c \
$(tests_test_checksum_SOURCES) \
$(tests_test_gpg_verify_result_SOURCES) \
tests/test-keyfile-utils.c \
$(tests_test_libarchive_import_SOURCES) \
$(tests_test_lzma_SOURCES) tests/test-mutable-tree.c \
tests/test-ot-opt-utils.c tests/test-ot-tool-util.c \
tests/test-ot-unix-utils.c tests/test-pull-c.c \
$(tests_test_repo_finder_avahi_SOURCES) \
tests/test-repo.c $(tests_test_repo_finder_avahi_SOURCES) \
$(tests_test_repo_finder_config_SOURCES) \
$(tests_test_repo_finder_mount_SOURCES) \
$(tests_test_rollsum_SOURCES) \
@ -1381,14 +1409,16 @@ DIST_SOURCES = $(libbsdiff_la_SOURCES) \
$(am__rofiles_fuse_SOURCES_DIST) \
$(test_libglnx_errors_SOURCES) $(test_libglnx_fdio_SOURCES) \
$(test_libglnx_macros_SOURCES) $(test_libglnx_xattrs_SOURCES) \
tests/test-basic-c.c $(tests_test_bloom_SOURCES) \
tests/test-bsdiff.c $(tests_test_checksum_SOURCES) \
$(tests_repo_finder_mount_SOURCES) tests/test-basic-c.c \
$(tests_test_bloom_SOURCES) tests/test-bsdiff.c \
$(tests_test_checksum_SOURCES) \
$(tests_test_gpg_verify_result_SOURCES) \
tests/test-keyfile-utils.c \
$(tests_test_libarchive_import_SOURCES) \
$(tests_test_lzma_SOURCES) tests/test-mutable-tree.c \
tests/test-ot-opt-utils.c tests/test-ot-tool-util.c \
tests/test-ot-unix-utils.c tests/test-pull-c.c \
tests/test-repo.c \
$(am__tests_test_repo_finder_avahi_SOURCES_DIST) \
$(tests_test_repo_finder_config_SOURCES) \
$(tests_test_repo_finder_mount_SOURCES) \
@ -1634,17 +1664,18 @@ am__set_TESTS_bases = \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
RECHECK_LOGS = $(TEST_LOGS)
am__EXEEXT_19 = tests/test-find-remotes.sh \
am__EXEEXT_21 = tests/test-create-usb.sh tests/test-find-remotes.sh \
tests/test-fsck-collections.sh tests/test-init-collections.sh \
tests/test-prune-collections.sh tests/test-refs-collections.sh \
tests/test-remote-add-collections.sh \
tests/test-repo-finder-mount-integration.sh \
tests/test-summary-collections.sh \
tests/test-pull-collections.sh $(am__EXEEXT_2)
@ENABLE_EXPERIMENTAL_API_TRUE@am__EXEEXT_20 = $(am__EXEEXT_19)
am__EXEEXT_21 = tests/test-core.js tests/test-remotes-config-dir.js \
@ENABLE_EXPERIMENTAL_API_TRUE@am__EXEEXT_22 = $(am__EXEEXT_21)
am__EXEEXT_23 = tests/test-core.js tests/test-remotes-config-dir.js \
tests/test-sizes.js tests/test-sysroot.js $(am__EXEEXT_2)
@BUILDOPT_GJS_TRUE@am__EXEEXT_22 = $(js_tests) $(am__EXEEXT_21)
am__EXEEXT_23 = tests/test-basic.sh tests/test-basic-user.sh \
@BUILDOPT_GJS_TRUE@am__EXEEXT_24 = $(js_tests) $(am__EXEEXT_23)
am__EXEEXT_25 = tests/test-basic.sh tests/test-basic-user.sh \
tests/test-basic-user-only.sh tests/test-basic-root.sh \
tests/test-pull-subpath.sh tests/test-archivez.sh \
tests/test-remote-add.sh tests/test-remote-headers.sh \
@ -1680,11 +1711,11 @@ am__EXEEXT_23 = tests/test-basic.sh tests/test-basic-user.sh \
tests/test-refs.sh tests/test-demo-buildsystem.sh \
tests/test-switchroot.sh tests/test-pull-contenturl.sh \
tests/test-pull-mirrorlist.sh tests/test-summary-update.sh \
tests/test-summary-view.sh $(am__EXEEXT_2) $(am__EXEEXT_20) \
$(am__append_66) $(am__append_68) $(am__EXEEXT_22)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__EXEEXT_24 = \
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@ $(am__EXEEXT_23)
am__EXEEXT_25 = $(am__EXEEXT_2) $(am__EXEEXT_24)
tests/test-summary-view.sh $(am__EXEEXT_2) $(am__EXEEXT_22) \
$(am__append_67) $(am__append_69) $(am__EXEEXT_24)
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@am__EXEEXT_26 = \
@ENABLE_INSTALLED_TESTS_EXCLUSIVE_FALSE@ $(am__EXEEXT_25)
am__EXEEXT_27 = $(am__EXEEXT_2) $(am__EXEEXT_26)
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
@ -1855,6 +1886,8 @@ OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
OT_DEP_AVAHI_CFLAGS = @OT_DEP_AVAHI_CFLAGS@
OT_DEP_AVAHI_LIBS = @OT_DEP_AVAHI_LIBS@
OT_DEP_CRYPTO_CFLAGS = @OT_DEP_CRYPTO_CFLAGS@
OT_DEP_CRYPTO_LIBS = @OT_DEP_CRYPTO_LIBS@
OT_DEP_CURL_CFLAGS = @OT_DEP_CURL_CFLAGS@
OT_DEP_CURL_LIBS = @OT_DEP_CURL_LIBS@
OT_DEP_E2P_CFLAGS = @OT_DEP_E2P_CFLAGS@
@ -1869,8 +1902,6 @@ OT_DEP_LIBMOUNT_CFLAGS = @OT_DEP_LIBMOUNT_CFLAGS@
OT_DEP_LIBMOUNT_LIBS = @OT_DEP_LIBMOUNT_LIBS@
OT_DEP_LZMA_CFLAGS = @OT_DEP_LZMA_CFLAGS@
OT_DEP_LZMA_LIBS = @OT_DEP_LZMA_LIBS@
OT_DEP_OPENSSL_CFLAGS = @OT_DEP_OPENSSL_CFLAGS@
OT_DEP_OPENSSL_LIBS = @OT_DEP_OPENSSL_LIBS@
OT_DEP_SELINUX_CFLAGS = @OT_DEP_SELINUX_CFLAGS@
OT_DEP_SELINUX_LIBS = @OT_DEP_SELINUX_LIBS@
OT_DEP_SOUP_CFLAGS = @OT_DEP_SOUP_CFLAGS@
@ -1977,7 +2008,7 @@ AM_CFLAGS = -std=gnu99 $(WARN_CFLAGS)
# Allow the distcheck install under $prefix test to pass
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-man \
--disable-maintainer-mode $(NULL) $(am__append_61) \
$(am__append_79) \
$(am__append_80) \
BASH_COMPLETIONSDIR='$${datadir}/bash-completion/completions'
SUBDIRS = . $(am__append_14)
NULL =
@ -1990,7 +2021,7 @@ CLEANFILES = $(am__append_13) $(BUILT_SOURCES) $(am__append_46) \
tests/ostree-remount-symlink-stamp \
tests/rofiles-fuse-symlink-stamp tests/ostree \
tests/ostree-prepare-root tests/ostree-remount \
tests/rofiles-fuse $(am__append_86)
tests/rofiles-fuse $(am__append_87)
EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \
COPYING README.md $(am__append_15) libglnx/README.md \
libglnx/COPYING libglnx/libglnx.m4 $(NULL) \
@ -2007,19 +2038,19 @@ EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \
src/libostree/ostree-repo-deprecated.h \
src/libostree/ostree-version.h src/ostree/parse-datetime.y \
buildutil/tap-driver.sh buildutil/tap-test tests/glib.supp \
tests/ostree.supp $(NULL) $(am__append_65) $(am__append_67) \
$(am__append_70) tests/libtest.sh $(am__append_71) \
tests/ostree.supp $(NULL) $(am__append_66) $(am__append_68) \
$(am__append_71) tests/libtest.sh $(am__append_72) \
tests/libostreetest.h tests/libtest.sh \
tests/gpg-verify-data/README.md $(NULL) \
src/boot/dracut/module-setup.sh src/boot/dracut/ostree.conf \
src/boot/mkinitcpio/ostree \
src/boot/ostree-prepare-root.service \
src/boot/ostree-remount.service src/boot/grub2/grub2-15_ostree \
src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_83) \
$(am__append_85)
src/boot/grub2/ostree-grub-generator $(NULL) $(am__append_84) \
$(am__append_86)
bin_SCRIPTS =
lib_LTLIBRARIES = libostree-1.la
pkglibexec_SCRIPTS = $(am__append_80)
pkglibexec_SCRIPTS = $(am__append_81)
noinst_LTLIBRARIES = $(am__append_1) libglnx.la libbsdiff.la \
libotutil.la libostree-kernel-args.la $(am__append_18) \
libostreetest.la
@ -2089,8 +2120,8 @@ all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installe
# This initializes some more variables
# This is a special facility to chain together hooks easily
INSTALL_DATA_HOOKS = install-mkdir-remotes-d-hook $(am__append_78) \
$(am__append_81)
INSTALL_DATA_HOOKS = install-mkdir-remotes-d-hook $(am__append_79) \
$(am__append_82)
ALL_LOCAL_RULES = tests/libreaddir-rand.so
shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||')
OSTREE_GITREV = $(shell cd $(srcdir) && if command -v git >/dev/null 2>&1 && test -d .git; then git describe --abbrev=42 --tags --always HEAD; fi)
@ -2139,6 +2170,7 @@ libglnx_la_SOURCES = \
libglnx/glnx-shutil.h \
libglnx/glnx-shutil.c \
libglnx/libglnx.h \
libglnx/tests/libglnx-testlib.h \
$(NULL)
libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
@ -2315,7 +2347,7 @@ libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff \
-I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
$(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) \
$(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) \
$(OT_DEP_OPENSSL_CFLAGS) -fvisibility=hidden \
$(OT_DEP_CRYPTO_CFLAGS) -fvisibility=hidden \
'-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) \
extern' $(am__append_26) $(am__append_28) $(am__append_30) \
$(am__append_34) $(am__append_37) $(am__append_39) \
@ -2324,7 +2356,7 @@ libostree_1_la_LDFLAGS = -version-number 1:0:0 -Bsymbolic-functions $(addprefix
libostree_1_la_LIBADD = libotutil.la libglnx.la libbsdiff.la \
libostree-kernel-args.la $(OT_INTERNAL_GIO_UNIX_LIBS) \
$(OT_INTERNAL_GPGME_LIBS) $(OT_DEP_LZMA_LIBS) \
$(OT_DEP_ZLIB_LIBS) $(OT_DEP_OPENSSL_LIBS) $(bupsplitpath) \
$(OT_DEP_ZLIB_LIBS) $(OT_DEP_CRYPTO_LIBS) $(bupsplitpath) \
$(am__append_27) $(am__append_29) $(am__append_31) \
$(am__append_35) $(am__append_38) $(am__append_40) \
$(am__append_42)
@ -2449,9 +2481,9 @@ dist_uninstalled_test_scripts = tests/test-symbols.sh tests/coccinelle.sh
# tests *only* run installed, to avoid having to run them twice in CI.
# This overrides the glib-tap.mk emphasis on doing both, if we'd
# used e.g. `dist_test_scripts`.
dist_test_scripts = $(NULL) $(am__append_76)
test_programs = $(NULL) $(am__append_73) $(am__append_74) \
$(am__append_77)
dist_test_scripts = $(NULL) $(am__append_77)
test_programs = $(NULL) $(am__append_74) $(am__append_75) \
$(am__append_78)
_installed_or_uninstalled_test_scripts = tests/test-basic.sh \
tests/test-basic-user.sh tests/test-basic-user-only.sh \
tests/test-basic-root.sh tests/test-pull-subpath.sh \
@ -2489,18 +2521,24 @@ _installed_or_uninstalled_test_scripts = tests/test-basic.sh \
tests/test-switchroot.sh tests/test-pull-contenturl.sh \
tests/test-pull-mirrorlist.sh tests/test-summary-update.sh \
tests/test-summary-view.sh $(NULL) $(am__append_64) \
$(am__append_66) $(am__append_68) $(am__append_69)
$(am__append_67) $(am__append_69) $(am__append_70)
experimental_test_scripts = \
tests/test-create-usb.sh \
tests/test-find-remotes.sh \
tests/test-fsck-collections.sh \
tests/test-init-collections.sh \
tests/test-prune-collections.sh \
tests/test-refs-collections.sh \
tests/test-remote-add-collections.sh \
tests/test-repo-finder-mount-integration.sh \
tests/test-summary-collections.sh \
tests/test-pull-collections.sh \
$(NULL)
test_extra_programs = $(NULL) $(am__append_65)
tests_repo_finder_mount_SOURCES = tests/repo-finder-mount.c
tests_repo_finder_mount_CFLAGS = $(common_tests_cflags)
tests_repo_finder_mount_LDADD = $(common_tests_ldadd) libostreetest.la
# These call into gjs scripts
js_tests = tests/test-corruption.sh tests/test-pull-corruption.sh
@ -2552,14 +2590,15 @@ libreaddir_rand_la_LIBADD = \
$(NULL)
libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version \
$(am__append_72)
$(am__append_73)
_installed_or_uninstalled_test_programs = tests/test-varint \
tests/test-ot-unix-utils tests/test-bsdiff \
tests/test-mutable-tree tests/test-keyfile-utils \
tests/test-ot-opt-utils tests/test-ot-tool-util \
tests/test-gpg-verify-result tests/test-checksum \
tests/test-lzma tests/test-rollsum tests/test-basic-c \
tests/test-sysroot-c tests/test-pull-c $(am__append_75)
tests/test-sysroot-c tests/test-pull-c tests/test-repo \
$(am__append_76)
common_tests_cflags = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
common_tests_ldadd = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
libostreetest_la_SOURCES = tests/libostreetest.c tests/test-mock-gio.c tests/test-mock-gio.h
@ -2593,6 +2632,8 @@ tests_test_sysroot_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_sysroot_c_LDADD = $(TESTS_LDADD)
tests_test_pull_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_pull_c_LDADD = $(TESTS_LDADD)
tests_test_repo_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_LDADD = $(TESTS_LDADD)
tests_test_ot_unix_utils_CFLAGS = $(TESTS_CFLAGS)
tests_test_ot_unix_utils_LDADD = $(TESTS_LDADD)
tests_test_varint_SOURCES = src/libostree/ostree-varint.c tests/test-varint.c
@ -2660,8 +2701,8 @@ tests_test_gpg_verify_result_LDADD = $(TESTS_LDADD) $(OT_INTERNAL_GPGME_LIBS)
@ENABLE_MAN_TRUE@ ostree-pull.1 ostree-refs.1 ostree-remote.1 \
@ENABLE_MAN_TRUE@ ostree-reset.1 ostree-rev-parse.1 \
@ENABLE_MAN_TRUE@ ostree-show.1 ostree-summary.1 \
@ENABLE_MAN_TRUE@ ostree-static-delta.1 $(am__append_82) \
@ENABLE_MAN_TRUE@ $(am__append_84)
@ENABLE_MAN_TRUE@ ostree-static-delta.1 $(am__append_83) \
@ENABLE_MAN_TRUE@ $(am__append_85)
@ENABLE_MAN_TRUE@man5_files = ostree.repo.5 ostree.repo-config.5
@ENABLE_MAN_TRUE@man1_MANS = $(addprefix man/,$(man1_files))
@ENABLE_MAN_TRUE@man5_MANS = $(addprefix man/,$(man5_files))
@ -3606,6 +3647,9 @@ src/ostree/ostree-ot-editor.$(OBJEXT): src/ostree/$(am__dirstamp) \
src/ostree/ostree-parse-datetime.$(OBJEXT): \
src/ostree/$(am__dirstamp) \
src/ostree/$(DEPDIR)/$(am__dirstamp)
src/ostree/ostree-ot-builtin-create-usb.$(OBJEXT): \
src/ostree/$(am__dirstamp) \
src/ostree/$(DEPDIR)/$(am__dirstamp)
src/ostree/ostree-ot-builtin-find-remotes.$(OBJEXT): \
src/ostree/$(am__dirstamp) \
src/ostree/$(DEPDIR)/$(am__dirstamp)
@ -3781,6 +3825,12 @@ libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.$(OBJEXT): \
test-libglnx-xattrs$(EXEEXT): $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_DEPENDENCIES) $(EXTRA_test_libglnx_xattrs_DEPENDENCIES)
@rm -f test-libglnx-xattrs$(EXEEXT)
$(AM_V_CCLD)$(test_libglnx_xattrs_LINK) $(test_libglnx_xattrs_OBJECTS) $(test_libglnx_xattrs_LDADD) $(LIBS)
tests/tests_repo_finder_mount-repo-finder-mount.$(OBJEXT): \
tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp)
tests/repo-finder-mount$(EXEEXT): $(tests_repo_finder_mount_OBJECTS) $(tests_repo_finder_mount_DEPENDENCIES) $(EXTRA_tests_repo_finder_mount_DEPENDENCIES) tests/$(am__dirstamp)
@rm -f tests/repo-finder-mount$(EXEEXT)
$(AM_V_CCLD)$(tests_repo_finder_mount_LINK) $(tests_repo_finder_mount_OBJECTS) $(tests_repo_finder_mount_LDADD) $(LIBS)
tests/tests_test_basic_c-test-basic-c.$(OBJEXT): \
tests/$(am__dirstamp) tests/$(DEPDIR)/$(am__dirstamp)
@ -3874,6 +3924,12 @@ tests/tests_test_pull_c-test-pull-c.$(OBJEXT): tests/$(am__dirstamp) \
tests/test-pull-c$(EXEEXT): $(tests_test_pull_c_OBJECTS) $(tests_test_pull_c_DEPENDENCIES) $(EXTRA_tests_test_pull_c_DEPENDENCIES) tests/$(am__dirstamp)
@rm -f tests/test-pull-c$(EXEEXT)
$(AM_V_CCLD)$(tests_test_pull_c_LINK) $(tests_test_pull_c_OBJECTS) $(tests_test_pull_c_LDADD) $(LIBS)
tests/tests_test_repo-test-repo.$(OBJEXT): tests/$(am__dirstamp) \
tests/$(DEPDIR)/$(am__dirstamp)
tests/test-repo$(EXEEXT): $(tests_test_repo_OBJECTS) $(tests_test_repo_DEPENDENCIES) $(EXTRA_tests_test_repo_DEPENDENCIES) tests/$(am__dirstamp)
@rm -f tests/test-repo$(EXEEXT)
$(AM_V_CCLD)$(tests_test_repo_LINK) $(tests_test_repo_OBJECTS) $(tests_test_repo_LDADD) $(LIBS)
src/libostree/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.$(OBJEXT): \
src/libostree/$(am__dirstamp) \
src/libostree/$(DEPDIR)/$(am__dirstamp)
@ -4279,6 +4335,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-checksum.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-commit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-config.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-diff.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-export.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/ostree/$(DEPDIR)/ostree-ot-builtin-find-remotes.Po@am__quote@
@ -4321,6 +4378,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/libostreetest_la-libostreetest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/libostreetest_la-test-mock-gio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/libreaddir_rand_la-readdir-rand.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_bloom-test-bloom.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_bsdiff-test-bsdiff.Po@am__quote@
@ -4334,6 +4392,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_ot_tool_util-test-ot-tool-util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_ot_unix_utils-test-ot-unix-utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_pull_c-test-pull-c.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_repo-test-repo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_repo_finder_avahi-test-repo-finder-avahi.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_repo_finder_config-test-repo-finder-config.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@tests/$(DEPDIR)/tests_test_repo_finder_mount-test-repo-finder-mount.Po@am__quote@
@ -5346,6 +5405,20 @@ src/ostree/ostree-parse-datetime.obj: src/ostree/parse-datetime.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-parse-datetime.obj `if test -f 'src/ostree/parse-datetime.c'; then $(CYGPATH_W) 'src/ostree/parse-datetime.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/parse-datetime.c'; fi`
src/ostree/ostree-ot-builtin-create-usb.o: src/ostree/ot-builtin-create-usb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-builtin-create-usb.o -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Tpo -c -o src/ostree/ostree-ot-builtin-create-usb.o `test -f 'src/ostree/ot-builtin-create-usb.c' || echo '$(srcdir)/'`src/ostree/ot-builtin-create-usb.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Tpo src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ostree/ot-builtin-create-usb.c' object='src/ostree/ostree-ot-builtin-create-usb.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-ot-builtin-create-usb.o `test -f 'src/ostree/ot-builtin-create-usb.c' || echo '$(srcdir)/'`src/ostree/ot-builtin-create-usb.c
src/ostree/ostree-ot-builtin-create-usb.obj: src/ostree/ot-builtin-create-usb.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-builtin-create-usb.obj -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Tpo -c -o src/ostree/ostree-ot-builtin-create-usb.obj `if test -f 'src/ostree/ot-builtin-create-usb.c'; then $(CYGPATH_W) 'src/ostree/ot-builtin-create-usb.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/ot-builtin-create-usb.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Tpo src/ostree/$(DEPDIR)/ostree-ot-builtin-create-usb.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ostree/ot-builtin-create-usb.c' object='src/ostree/ostree-ot-builtin-create-usb.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -c -o src/ostree/ostree-ot-builtin-create-usb.obj `if test -f 'src/ostree/ot-builtin-create-usb.c'; then $(CYGPATH_W) 'src/ostree/ot-builtin-create-usb.c'; else $(CYGPATH_W) '$(srcdir)/src/ostree/ot-builtin-create-usb.c'; fi`
src/ostree/ostree-ot-builtin-find-remotes.o: src/ostree/ot-builtin-find-remotes.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ostree_CFLAGS) $(CFLAGS) -MT src/ostree/ostree-ot-builtin-find-remotes.o -MD -MP -MF src/ostree/$(DEPDIR)/ostree-ot-builtin-find-remotes.Tpo -c -o src/ostree/ostree-ot-builtin-find-remotes.o `test -f 'src/ostree/ot-builtin-find-remotes.c' || echo '$(srcdir)/'`src/ostree/ot-builtin-find-remotes.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/ostree/$(DEPDIR)/ostree-ot-builtin-find-remotes.Tpo src/ostree/$(DEPDIR)/ostree-ot-builtin-find-remotes.Po
@ -5892,6 +5965,20 @@ libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj: libglnx/tests/test-li
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libglnx_xattrs_CFLAGS) $(CFLAGS) -c -o libglnx/tests/test_libglnx_xattrs-test-libglnx-xattrs.obj `if test -f 'libglnx/tests/test-libglnx-xattrs.c'; then $(CYGPATH_W) 'libglnx/tests/test-libglnx-xattrs.c'; else $(CYGPATH_W) '$(srcdir)/libglnx/tests/test-libglnx-xattrs.c'; fi`
tests/tests_repo_finder_mount-repo-finder-mount.o: tests/repo-finder-mount.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_repo_finder_mount_CFLAGS) $(CFLAGS) -MT tests/tests_repo_finder_mount-repo-finder-mount.o -MD -MP -MF tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Tpo -c -o tests/tests_repo_finder_mount-repo-finder-mount.o `test -f 'tests/repo-finder-mount.c' || echo '$(srcdir)/'`tests/repo-finder-mount.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Tpo tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/repo-finder-mount.c' object='tests/tests_repo_finder_mount-repo-finder-mount.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_repo_finder_mount_CFLAGS) $(CFLAGS) -c -o tests/tests_repo_finder_mount-repo-finder-mount.o `test -f 'tests/repo-finder-mount.c' || echo '$(srcdir)/'`tests/repo-finder-mount.c
tests/tests_repo_finder_mount-repo-finder-mount.obj: tests/repo-finder-mount.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_repo_finder_mount_CFLAGS) $(CFLAGS) -MT tests/tests_repo_finder_mount-repo-finder-mount.obj -MD -MP -MF tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Tpo -c -o tests/tests_repo_finder_mount-repo-finder-mount.obj `if test -f 'tests/repo-finder-mount.c'; then $(CYGPATH_W) 'tests/repo-finder-mount.c'; else $(CYGPATH_W) '$(srcdir)/tests/repo-finder-mount.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Tpo tests/$(DEPDIR)/tests_repo_finder_mount-repo-finder-mount.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/repo-finder-mount.c' object='tests/tests_repo_finder_mount-repo-finder-mount.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_repo_finder_mount_CFLAGS) $(CFLAGS) -c -o tests/tests_repo_finder_mount-repo-finder-mount.obj `if test -f 'tests/repo-finder-mount.c'; then $(CYGPATH_W) 'tests/repo-finder-mount.c'; else $(CYGPATH_W) '$(srcdir)/tests/repo-finder-mount.c'; fi`
tests/tests_test_basic_c-test-basic-c.o: tests/test-basic-c.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_basic_c_CFLAGS) $(CFLAGS) -MT tests/tests_test_basic_c-test-basic-c.o -MD -MP -MF tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Tpo -c -o tests/tests_test_basic_c-test-basic-c.o `test -f 'tests/test-basic-c.c' || echo '$(srcdir)/'`tests/test-basic-c.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Tpo tests/$(DEPDIR)/tests_test_basic_c-test-basic-c.Po
@ -6144,6 +6231,20 @@ tests/tests_test_pull_c-test-pull-c.obj: tests/test-pull-c.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_pull_c_CFLAGS) $(CFLAGS) -c -o tests/tests_test_pull_c-test-pull-c.obj `if test -f 'tests/test-pull-c.c'; then $(CYGPATH_W) 'tests/test-pull-c.c'; else $(CYGPATH_W) '$(srcdir)/tests/test-pull-c.c'; fi`
tests/tests_test_repo-test-repo.o: tests/test-repo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_repo_CFLAGS) $(CFLAGS) -MT tests/tests_test_repo-test-repo.o -MD -MP -MF tests/$(DEPDIR)/tests_test_repo-test-repo.Tpo -c -o tests/tests_test_repo-test-repo.o `test -f 'tests/test-repo.c' || echo '$(srcdir)/'`tests/test-repo.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_test_repo-test-repo.Tpo tests/$(DEPDIR)/tests_test_repo-test-repo.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/test-repo.c' object='tests/tests_test_repo-test-repo.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_repo_CFLAGS) $(CFLAGS) -c -o tests/tests_test_repo-test-repo.o `test -f 'tests/test-repo.c' || echo '$(srcdir)/'`tests/test-repo.c
tests/tests_test_repo-test-repo.obj: tests/test-repo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_repo_CFLAGS) $(CFLAGS) -MT tests/tests_test_repo-test-repo.obj -MD -MP -MF tests/$(DEPDIR)/tests_test_repo-test-repo.Tpo -c -o tests/tests_test_repo-test-repo.obj `if test -f 'tests/test-repo.c'; then $(CYGPATH_W) 'tests/test-repo.c'; else $(CYGPATH_W) '$(srcdir)/tests/test-repo.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) tests/$(DEPDIR)/tests_test_repo-test-repo.Tpo tests/$(DEPDIR)/tests_test_repo-test-repo.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tests/test-repo.c' object='tests/tests_test_repo-test-repo.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_repo_CFLAGS) $(CFLAGS) -c -o tests/tests_test_repo-test-repo.obj `if test -f 'tests/test-repo.c'; then $(CYGPATH_W) 'tests/test-repo.c'; else $(CYGPATH_W) '$(srcdir)/tests/test-repo.c'; fi`
src/libostree/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.o: src/libostree/ostree-repo-finder-avahi-parser.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tests_test_repo_finder_avahi_CFLAGS) $(CFLAGS) -MT src/libostree/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.o -MD -MP -MF src/libostree/$(DEPDIR)/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.Tpo -c -o src/libostree/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.o `test -f 'src/libostree/ostree-repo-finder-avahi-parser.c' || echo '$(srcdir)/'`src/libostree/ostree-repo-finder-avahi-parser.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.Tpo src/libostree/$(DEPDIR)/tests_test_repo_finder_avahi-ostree-repo-finder-avahi-parser.Po
@ -7106,6 +7207,13 @@ tests/test-pull-c.log: tests/test-pull-c$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-repo.log: tests/test-repo$(EXEEXT)
@p='tests/test-repo$(EXEEXT)'; \
b='tests/test-repo'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-libarchive-import.log: tests/test-libarchive-import$(EXEEXT)
@p='tests/test-libarchive-import$(EXEEXT)'; \
b='tests/test-libarchive-import'; \
@ -7526,6 +7634,13 @@ tests/test-summary-view.sh.log: tests/test-summary-view.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-create-usb.sh.log: tests/test-create-usb.sh
@p='tests/test-create-usb.sh'; \
b='tests/test-create-usb.sh'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-find-remotes.sh.log: tests/test-find-remotes.sh
@p='tests/test-find-remotes.sh'; \
b='tests/test-find-remotes.sh'; \
@ -7568,6 +7683,13 @@ tests/test-remote-add-collections.sh.log: tests/test-remote-add-collections.sh
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-repo-finder-mount-integration.sh.log: tests/test-repo-finder-mount-integration.sh
@p='tests/test-repo-finder-mount-integration.sh'; \
b='tests/test-repo-finder-mount-integration.sh'; \
$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
tests/test-summary-collections.sh.log: tests/test-summary-collections.sh
@p='tests/test-summary-collections.sh'; \
b='tests/test-summary-collections.sh'; \

View File

@ -265,6 +265,8 @@ OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
OT_DEP_AVAHI_CFLAGS = @OT_DEP_AVAHI_CFLAGS@
OT_DEP_AVAHI_LIBS = @OT_DEP_AVAHI_LIBS@
OT_DEP_CRYPTO_CFLAGS = @OT_DEP_CRYPTO_CFLAGS@
OT_DEP_CRYPTO_LIBS = @OT_DEP_CRYPTO_LIBS@
OT_DEP_CURL_CFLAGS = @OT_DEP_CURL_CFLAGS@
OT_DEP_CURL_LIBS = @OT_DEP_CURL_LIBS@
OT_DEP_E2P_CFLAGS = @OT_DEP_E2P_CFLAGS@
@ -279,8 +281,6 @@ OT_DEP_LIBMOUNT_CFLAGS = @OT_DEP_LIBMOUNT_CFLAGS@
OT_DEP_LIBMOUNT_LIBS = @OT_DEP_LIBMOUNT_LIBS@
OT_DEP_LZMA_CFLAGS = @OT_DEP_LZMA_CFLAGS@
OT_DEP_LZMA_LIBS = @OT_DEP_LZMA_LIBS@
OT_DEP_OPENSSL_CFLAGS = @OT_DEP_OPENSSL_CFLAGS@
OT_DEP_OPENSSL_LIBS = @OT_DEP_OPENSSL_LIBS@
OT_DEP_SELINUX_CFLAGS = @OT_DEP_SELINUX_CFLAGS@
OT_DEP_SELINUX_LIBS = @OT_DEP_SELINUX_LIBS@
OT_DEP_SOUP_CFLAGS = @OT_DEP_SOUP_CFLAGS@

View File

@ -14,7 +14,7 @@
<div class="titlepage">
<div>
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">OSTree API references</p></th></tr></table></div>
<div><p class="releaseinfo">for OSTree 2017.11</p></div>
<div><p class="releaseinfo">for OSTree 2017.12</p></div>
</div>
<hr>
</div>

View File

@ -169,6 +169,22 @@
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint</span>
</td>
<td class="function_name">
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-hash" title="ostree_repo_hash ()">ostree_repo_hash</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-equal" title="ostree_repo_equal ()">ostree_repo_equal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GKeyFile</span> *
</td>
<td class="function_name">
@ -1629,6 +1645,78 @@ repository (to see whether a ref was written).</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-hash"></a><h3>ostree_repo_hash ()</h3>
<pre class="programlisting"><span class="returnvalue">guint</span>
ostree_repo_hash (<em class="parameter"><code><a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>);</pre>
<p>Calculate a hash value for the given open repository, suitable for use when
putting it into a hash table. It is an error to call this on an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a>
which is not yet open, as a persistent hash value cannot be calculated until
the repository is open and the inode of its root directory has been loaded.</p>
<p>This function does no I/O.</p>
<div class="refsect3">
<a name="ostree-repo-hash.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="ostree-repo-hash.returns"></a><h4>Returns</h4>
<p> hash value for the <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a></p>
</div>
<p class="since">Since: 2017.12</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-equal"></a><h3>ostree_repo_equal ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
ostree_repo_equal (<em class="parameter"><code><a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *a</code></em>,
<em class="parameter"><code><a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *b</code></em>);</pre>
<p>Check whether two opened repositories are the same on disk: if their root
directories are the same inode. If <em class="parameter"><code>a</code></em>
or <em class="parameter"><code>b</code></em>
are not open yet (due to
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-open" title="ostree_repo_open ()"><code class="function">ostree_repo_open()</code></a> not being called on them yet), <code class="literal">FALSE</code> will be returned.</p>
<div class="refsect3">
<a name="ostree-repo-equal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>a</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>b</p></td>
<td class="parameter_description"><p>an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="ostree-repo-equal.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if <em class="parameter"><code>a</code></em>
and <em class="parameter"><code>b</code></em>
are the same repository on disk, <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: 2017.12</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-copy-config"></a><h3>ostree_repo_copy_config ()</h3>
<pre class="programlisting"><span class="returnvalue">GKeyFile</span> *
ostree_repo_copy_config (<em class="parameter"><code><a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>);</pre>
@ -7217,9 +7305,16 @@ possible modes.</p>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-MODE-ARCHIVE:CAPS"></a>OSTREE_REPO_MODE_ARCHIVE</p></td>
<td class="enum_member_description">
<p>Files are compressed, should be owned by non-root. Can be served via HTTP. Since: 2017.12</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-MODE-ARCHIVE-Z2:CAPS"></a>OSTREE_REPO_MODE_ARCHIVE_Z2</p></td>
<td class="enum_member_description">
<p>Files are compressed, should be owned by non-root. Can be served via HTTP</p>
<p>Legacy alias for <code class="literal">OSTREE_REPO_MODE_ARCHIVE</code></p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
@ -7816,7 +7911,7 @@ as - List of pack file checksums in which this object appears</p>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-PULL-FLAGS-UNTRUSTED:CAPS"></a>OSTREE_REPO_PULL_FLAGS_UNTRUSTED</p></td>
<td class="enum_member_description">
<p>Don't trust local remote</p>
<p>Do verify checksums of local (filesystem-accessible) repositories (defaults on for HTTP)</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
@ -7827,6 +7922,13 @@ as - List of pack file checksums in which this object appears</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="OSTREE-REPO-PULL-FLAGS-TRUSTED-HTTP:CAPS"></a>OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP</p></td>
<td class="enum_member_description">
<p>Don't verify checksums of objects HTTP repositories (Since: 2017.12)</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>

View File

@ -97,6 +97,8 @@
<keyword type="function" name="ostree_repo_get_mode ()" link="ostree-OstreeRepo.html#ostree-repo-get-mode"/>
<keyword type="function" name="ostree_repo_get_config ()" link="ostree-OstreeRepo.html#ostree-repo-get-config"/>
<keyword type="function" name="ostree_repo_get_dfd ()" link="ostree-OstreeRepo.html#ostree-repo-get-dfd"/>
<keyword type="function" name="ostree_repo_hash ()" link="ostree-OstreeRepo.html#ostree-repo-hash" since="2017.12"/>
<keyword type="function" name="ostree_repo_equal ()" link="ostree-OstreeRepo.html#ostree-repo-equal" since="2017.12"/>
<keyword type="function" name="ostree_repo_copy_config ()" link="ostree-OstreeRepo.html#ostree-repo-copy-config"/>
<keyword type="function" name="ostree_repo_remote_add ()" link="ostree-OstreeRepo.html#ostree-repo-remote-add"/>
<keyword type="function" name="ostree_repo_remote_delete ()" link="ostree-OstreeRepo.html#ostree-repo-remote-delete"/>
@ -387,6 +389,7 @@
<keyword type="constant" name="OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT" link="ostree-Core-repository-independent-functions.html#OSTREE-OBJECT-TYPE-TOMBSTONE-COMMIT:CAPS"/>
<keyword type="constant" name="OSTREE_OBJECT_TYPE_COMMIT_META" link="ostree-Core-repository-independent-functions.html#OSTREE-OBJECT-TYPE-COMMIT-META:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_MODE_BARE" link="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_MODE_ARCHIVE" link="ostree-OstreeRepo.html#OSTREE-REPO-MODE-ARCHIVE:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_MODE_ARCHIVE_Z2" link="ostree-OstreeRepo.html#OSTREE-REPO-MODE-ARCHIVE-Z2:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_MODE_BARE_USER" link="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE-USER:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_MODE_BARE_USER_ONLY" link="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE-USER-ONLY:CAPS"/>
@ -431,6 +434,7 @@
<keyword type="constant" name="OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY" link="ostree-OstreeRepo.html#OSTREE-REPO-PULL-FLAGS-COMMIT-ONLY:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PULL_FLAGS_UNTRUSTED" link="ostree-OstreeRepo.html#OSTREE-REPO-PULL-FLAGS-UNTRUSTED:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES" link="ostree-OstreeRepo.html#OSTREE-REPO-PULL-FLAGS-BAREUSERONLY-FILES:CAPS"/>
<keyword type="constant" name="OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP" link="ostree-OstreeRepo.html#OSTREE-REPO-PULL-FLAGS-TRUSTED-HTTP:CAPS"/>
<keyword type="constant" name="OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE" link="ostree-Root-partition-mount-point.html#OSTREE-SYSROOT-SIMPLE-WRITE-DEPLOYMENT-FLAGS-NONE:CAPS"/>
<keyword type="constant" name="OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN" link="ostree-Root-partition-mount-point.html#OSTREE-SYSROOT-SIMPLE-WRITE-DEPLOYMENT-FLAGS-RETAIN:CAPS"/>
<keyword type="constant" name="OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT" link="ostree-Root-partition-mount-point.html#OSTREE-SYSROOT-SIMPLE-WRITE-DEPLOYMENT-FLAGS-NOT-DEFAULT:CAPS"/>

View File

@ -790,6 +790,10 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-equal" title="ostree_repo_equal ()">ostree_repo_equal</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-export-tree-to-archive" title="ostree_repo_export_tree_to_archive ()">ostree_repo_export_tree_to_archive</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>
@ -882,6 +886,10 @@ OSTREE_RELEASE_VERSION, macro in ostree-version
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-hash" title="ostree_repo_hash ()">ostree_repo_hash</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-has-object" title="ostree_repo_has_object ()">ostree_repo_has_object</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>

View File

@ -85,4 +85,5 @@ ostree_repo_list_collection_refs
ostree_repo_remote_list_collection_refs
ostree_repo_set_collection_ref_immediate
ostree_repo_transaction_set_collection_ref
ostree_repo_resolve_collection_ref
</SECTION>

View File

@ -287,6 +287,8 @@ ostree_repo_get_path
ostree_repo_get_mode
ostree_repo_get_config
ostree_repo_get_dfd
ostree_repo_hash
ostree_repo_equal
ostree_repo_copy_config
ostree_repo_remote_add
ostree_repo_remote_delete

View File

@ -1 +1 @@
2017.11
2017.12

View File

@ -8,7 +8,8 @@
srcd=$(cd $(dirname $1) && pwd)
bn=$(basename $1)
tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX)
TEST_TMPDIR=${TEST_TMPDIR:-/var/tmp}
tempdir=$(mktemp -d $TEST_TMPDIR/tap-test.XXXXXX)
touch ${tempdir}/.testtmp
function cleanup () {
if test -f ${tempdir}/.testtmp; then

View File

@ -40,6 +40,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if we have gnutls */
#undef HAVE_GNUTLS
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

220
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libostree 2017.11.
# Generated by GNU Autoconf 2.69 for libostree 2017.12.
#
# Report bugs to <walters@verbum.org>.
#
@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libostree'
PACKAGE_TARNAME='libostree'
PACKAGE_VERSION='2017.11'
PACKAGE_STRING='libostree 2017.11'
PACKAGE_VERSION='2017.12'
PACKAGE_STRING='libostree 2017.12'
PACKAGE_BUGREPORT='walters@verbum.org'
PACKAGE_URL=''
@ -676,10 +676,12 @@ USE_AVAHI_FALSE
USE_AVAHI_TRUE
OT_DEP_AVAHI_LIBS
OT_DEP_AVAHI_CFLAGS
USE_GNUTLS_FALSE
USE_GNUTLS_TRUE
USE_OPENSSL_FALSE
USE_OPENSSL_TRUE
OT_DEP_OPENSSL_LIBS
OT_DEP_OPENSSL_CFLAGS
OT_DEP_CRYPTO_LIBS
OT_DEP_CRYPTO_CFLAGS
USE_SMACK_FALSE
USE_SMACK_TRUE
USE_SELINUX_FALSE
@ -938,6 +940,7 @@ enable_rust_debug
with_libarchive
with_selinux
with_smack
with_crypto
with_openssl
with_avahi
with_libmount
@ -987,8 +990,8 @@ OT_DEP_LIBARCHIVE_CFLAGS
OT_DEP_LIBARCHIVE_LIBS
OT_DEP_SELINUX_CFLAGS
OT_DEP_SELINUX_LIBS
OT_DEP_OPENSSL_CFLAGS
OT_DEP_OPENSSL_LIBS
OT_DEP_CRYPTO_CFLAGS
OT_DEP_CRYPTO_LIBS
OT_DEP_AVAHI_CFLAGS
OT_DEP_AVAHI_LIBS
OT_DEP_LIBMOUNT_CFLAGS
@ -1537,7 +1540,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libostree 2017.11 to adapt to many kinds of systems.
\`configure' configures libostree 2017.12 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1607,7 +1610,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libostree 2017.11:";;
short | recursive ) echo "Configuration of libostree 2017.12:";;
esac
cat <<\_ACEOF
@ -1677,6 +1680,8 @@ Optional Packages:
--without-libarchive Do not use libarchive
--without-selinux Do not use SELinux
--with-smack Enable smack
--with-crypto Choose library for checksums, one of glib, openssl,
gnutls (default: glib)
--with-openssl Enable use of OpenSSL libcrypto (checksums)
--without-avahi Do not use Avahi
--without-libmount Do not use libmount
@ -1759,10 +1764,10 @@ Some influential environment variables:
C compiler flags for OT_DEP_SELINUX, overriding pkg-config
OT_DEP_SELINUX_LIBS
linker flags for OT_DEP_SELINUX, overriding pkg-config
OT_DEP_OPENSSL_CFLAGS
C compiler flags for OT_DEP_OPENSSL, overriding pkg-config
OT_DEP_OPENSSL_LIBS
linker flags for OT_DEP_OPENSSL, overriding pkg-config
OT_DEP_CRYPTO_CFLAGS
C compiler flags for OT_DEP_CRYPTO, overriding pkg-config
OT_DEP_CRYPTO_LIBS
linker flags for OT_DEP_CRYPTO, overriding pkg-config
OT_DEP_AVAHI_CFLAGS
C compiler flags for OT_DEP_AVAHI, overriding pkg-config
OT_DEP_AVAHI_LIBS
@ -1846,7 +1851,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libostree configure 2017.11
libostree configure 2017.12
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@ -2261,7 +2266,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libostree $as_me 2017.11, which was
It was created by libostree $as_me 2017.12, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -3129,7 +3134,7 @@ fi
# Define the identity of the package.
PACKAGE='libostree'
VERSION='2017.11'
VERSION='2017.12'
# Some tools Automake needs.
@ -5863,9 +5868,9 @@ test -n "$YACC" || YACC="yacc"
YEAR_VERSION=2017
RELEASE_VERSION=11
RELEASE_VERSION=12
PACKAGE_VERSION=2017.11
PACKAGE_VERSION=2017.12
if echo "$CFLAGS" | grep -q -E -e '-Werror($| )'; then :
@ -16390,25 +16395,44 @@ else
fi
# Check whether --with-crypto was given.
if test "${with_crypto+set}" = set; then :
withval=$with_crypto; :
else
with_crypto=glib
fi
if test $with_crypto = glib; then :
elif test $with_crypto = openssl; then :
with_openssl=yes
elif test $with_crypto = gnutls; then :
else
as_fn_error $? "Invalid --with-crypto $with_crypto" "$LINENO" 5
fi
OPENSSL_DEPENDENCY="libcrypto >= 1.0.1"
# Check whether --with-openssl was given.
if test "${with_openssl+set}" = set; then :
withval=$with_openssl; :
withval=$with_openssl; with_openssl=$withval
else
with_openssl=no
fi
if test x$with_openssl != xno ; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OT_DEP_OPENSSL" >&5
$as_echo_n "checking for OT_DEP_OPENSSL... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OT_DEP_CRYPTO" >&5
$as_echo_n "checking for OT_DEP_CRYPTO... " >&6; }
if test -n "$OT_DEP_OPENSSL_CFLAGS"; then
pkg_cv_OT_DEP_OPENSSL_CFLAGS="$OT_DEP_OPENSSL_CFLAGS"
if test -n "$OT_DEP_CRYPTO_CFLAGS"; then
pkg_cv_OT_DEP_CRYPTO_CFLAGS="$OT_DEP_CRYPTO_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$OPENSSL_DEPENDENCY\""; } >&5
@ -16416,7 +16440,7 @@ if test -n "$OT_DEP_OPENSSL_CFLAGS"; then
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_OT_DEP_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "$OPENSSL_DEPENDENCY" 2>/dev/null`
pkg_cv_OT_DEP_CRYPTO_CFLAGS=`$PKG_CONFIG --cflags "$OPENSSL_DEPENDENCY" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -16424,8 +16448,8 @@ fi
else
pkg_failed=untried
fi
if test -n "$OT_DEP_OPENSSL_LIBS"; then
pkg_cv_OT_DEP_OPENSSL_LIBS="$OT_DEP_OPENSSL_LIBS"
if test -n "$OT_DEP_CRYPTO_LIBS"; then
pkg_cv_OT_DEP_CRYPTO_LIBS="$OT_DEP_CRYPTO_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$OPENSSL_DEPENDENCY\""; } >&5
@ -16433,7 +16457,7 @@ if test -n "$OT_DEP_OPENSSL_LIBS"; then
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_OT_DEP_OPENSSL_LIBS=`$PKG_CONFIG --libs "$OPENSSL_DEPENDENCY" 2>/dev/null`
pkg_cv_OT_DEP_CRYPTO_LIBS=`$PKG_CONFIG --libs "$OPENSSL_DEPENDENCY" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@ -16454,22 +16478,22 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
OT_DEP_OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$OPENSSL_DEPENDENCY" 2>&1`
OT_DEP_CRYPTO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$OPENSSL_DEPENDENCY" 2>&1`
else
OT_DEP_OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$OPENSSL_DEPENDENCY" 2>&1`
OT_DEP_CRYPTO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$OPENSSL_DEPENDENCY" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$OT_DEP_OPENSSL_PKG_ERRORS" >&5
echo "$OT_DEP_CRYPTO_PKG_ERRORS" >&5
as_fn_error $? "Package requirements ($OPENSSL_DEPENDENCY) were not met:
$OT_DEP_OPENSSL_PKG_ERRORS
$OT_DEP_CRYPTO_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables OT_DEP_OPENSSL_CFLAGS
and OT_DEP_OPENSSL_LIBS to avoid the need to call pkg-config.
Alternatively, you may set the environment variables OT_DEP_CRYPTO_CFLAGS
and OT_DEP_CRYPTO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
@ -16480,15 +16504,15 @@ as_fn_error $? "The pkg-config script could not be found or is too old. Make su
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables OT_DEP_OPENSSL_CFLAGS
and OT_DEP_OPENSSL_LIBS to avoid the need to call pkg-config.
Alternatively, you may set the environment variables OT_DEP_CRYPTO_CFLAGS
and OT_DEP_CRYPTO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
OT_DEP_OPENSSL_CFLAGS=$pkg_cv_OT_DEP_OPENSSL_CFLAGS
OT_DEP_OPENSSL_LIBS=$pkg_cv_OT_DEP_OPENSSL_LIBS
OT_DEP_CRYPTO_CFLAGS=$pkg_cv_OT_DEP_CRYPTO_CFLAGS
OT_DEP_CRYPTO_LIBS=$pkg_cv_OT_DEP_CRYPTO_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@ -16496,6 +16520,7 @@ fi
$as_echo "#define HAVE_OPENSSL 1" >>confdefs.h
with_crypto=openssl
with_openssl=yes
else
@ -16513,6 +16538,115 @@ else
fi
GNUTLS_DEPENDENCY="gnutls >= 3.5.0"
if test $with_crypto = gnutls ; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OT_DEP_CRYPTO" >&5
$as_echo_n "checking for OT_DEP_CRYPTO... " >&6; }
if test -n "$OT_DEP_CRYPTO_CFLAGS"; then
pkg_cv_OT_DEP_CRYPTO_CFLAGS="$OT_DEP_CRYPTO_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$GNUTLS_DEPENDENCY\""; } >&5
($PKG_CONFIG --exists --print-errors "$GNUTLS_DEPENDENCY") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_OT_DEP_CRYPTO_CFLAGS=`$PKG_CONFIG --cflags "$GNUTLS_DEPENDENCY" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$OT_DEP_CRYPTO_LIBS"; then
pkg_cv_OT_DEP_CRYPTO_LIBS="$OT_DEP_CRYPTO_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$GNUTLS_DEPENDENCY\""; } >&5
($PKG_CONFIG --exists --print-errors "$GNUTLS_DEPENDENCY") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_OT_DEP_CRYPTO_LIBS=`$PKG_CONFIG --libs "$GNUTLS_DEPENDENCY" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
OT_DEP_CRYPTO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$GNUTLS_DEPENDENCY" 2>&1`
else
OT_DEP_CRYPTO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$GNUTLS_DEPENDENCY" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$OT_DEP_CRYPTO_PKG_ERRORS" >&5
as_fn_error $? "Package requirements ($GNUTLS_DEPENDENCY) were not met:
$OT_DEP_CRYPTO_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables OT_DEP_CRYPTO_CFLAGS
and OT_DEP_CRYPTO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables OT_DEP_CRYPTO_CFLAGS
and OT_DEP_CRYPTO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
OT_DEP_CRYPTO_CFLAGS=$pkg_cv_OT_DEP_CRYPTO_CFLAGS
OT_DEP_CRYPTO_LIBS=$pkg_cv_OT_DEP_CRYPTO_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
$as_echo "#define HAVE_GNUTLS 1" >>confdefs.h
OSTREE_FEATURES="$OSTREE_FEATURES gnutls"
fi
if test $with_crypto = gnutls; then
USE_GNUTLS_TRUE=
USE_GNUTLS_FALSE='#'
else
USE_GNUTLS_TRUE='#'
USE_GNUTLS_FALSE=
fi
AVAHI_DEPENDENCY="avahi-client >= 0.6.31 avahi-glib >= 0.6.31"
@ -17577,6 +17711,10 @@ if test -z "${USE_OPENSSL_TRUE}" && test -z "${USE_OPENSSL_FALSE}"; then
as_fn_error $? "conditional \"USE_OPENSSL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${USE_GNUTLS_TRUE}" && test -z "${USE_GNUTLS_FALSE}"; then
as_fn_error $? "conditional \"USE_GNUTLS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${USE_AVAHI_TRUE}" && test -z "${USE_AVAHI_FALSE}"; then
as_fn_error $? "conditional \"USE_AVAHI\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -18030,7 +18168,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libostree $as_me 2017.11, which was
This file was extended by libostree $as_me 2017.12, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -18096,7 +18234,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libostree config.status 2017.11
libostree config.status 2017.12
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@ -19796,7 +19934,7 @@ echo "
HTTP backend: $fetcher_backend
\"ostree trivial-httpd\": $enable_trivial_httpd_cmdline
SELinux: $with_selinux
OpenSSL libcrypto (checksums): $with_openssl
cryptographic checksums: $with_crypto
systemd: $have_libsystemd
libmount: $with_libmount
libarchive (parse tar files directly): $with_libarchive

View File

@ -4,7 +4,7 @@ dnl update libostree-released.sym from libostree-devel.sym, and update the check
dnl in test-symbols.sh, and also set is_release_build=yes below. Then make
dnl another post-release commit to bump the version, and set is_release_build=no.
m4_define([year_version], [2017])
m4_define([release_version], [11])
m4_define([release_version], [12])
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
is_release_build=yes
@ -329,15 +329,29 @@ AS_IF([ test x$with_smack = xyes], [
])
AM_CONDITIONAL(USE_SMACK, test $with_smack != no)
dnl crypto
AC_ARG_WITH(crypto,
AS_HELP_STRING([--with-crypto], [Choose library for checksums, one of glib, openssl, gnutls (default: glib)]),
:, with_crypto=glib)
AS_IF([test $with_crypto = glib],
[],
[test $with_crypto = openssl],
[with_openssl=yes],
[test $with_crypto = gnutls],
[],
[AC_MSG_ERROR([Invalid --with-crypto $with_crypto])]
)
dnl begin openssl (really just libcrypto right now)
dnl Note this option is now deprecated in favor of --with-crypto=openssl
OPENSSL_DEPENDENCY="libcrypto >= 1.0.1"
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl], [Enable use of OpenSSL libcrypto (checksums)]),
:, with_openssl=no)
AS_HELP_STRING([--with-openssl], [Enable use of OpenSSL libcrypto (checksums)]),with_openssl=$withval,with_openssl=no)
AS_IF([ test x$with_openssl != xno ], [
PKG_CHECK_MODULES(OT_DEP_OPENSSL, $OPENSSL_DEPENDENCY)
PKG_CHECK_MODULES(OT_DEP_CRYPTO, $OPENSSL_DEPENDENCY)
AC_DEFINE([HAVE_OPENSSL], 1, [Define if we have openssl])
with_crypto=openssl
with_openssl=yes
], [
with_openssl=no
@ -346,6 +360,17 @@ if test x$with_openssl != xno; then OSTREE_FEATURES="$OSTREE_FEATURES openssl";
AM_CONDITIONAL(USE_OPENSSL, test $with_openssl != no)
dnl end openssl
dnl begin gnutls; in contrast to openssl this one only
dnl supports --with-crypto=gnutls
GNUTLS_DEPENDENCY="gnutls >= 3.5.0"
AS_IF([ test $with_crypto = gnutls ], [
PKG_CHECK_MODULES(OT_DEP_CRYPTO, $GNUTLS_DEPENDENCY)
AC_DEFINE([HAVE_GNUTLS], 1, [Define if we have gnutls])
OSTREE_FEATURES="$OSTREE_FEATURES gnutls"
])
AM_CONDITIONAL(USE_GNUTLS, test $with_crypto = gnutls)
dnl end gnutls
dnl Avahi dependency for finding repos
AVAHI_DEPENDENCY="avahi-client >= 0.6.31 avahi-glib >= 0.6.31"
@ -536,7 +561,7 @@ echo "
HTTP backend: $fetcher_backend
\"ostree trivial-httpd\": $enable_trivial_httpd_cmdline
SELinux: $with_selinux
OpenSSL libcrypto (checksums): $with_openssl
cryptographic checksums: $with_crypto
systemd: $have_libsystemd
libmount: $with_libmount
libarchive (parse tar files directly): $with_libarchive

View File

@ -46,13 +46,14 @@ libglnx_la_SOURCES = \
$(libglnx_srcpath)/glnx-shutil.h \
$(libglnx_srcpath)/glnx-shutil.c \
$(libglnx_srcpath)/libglnx.h \
$(libglnx_srcpath)/tests/libglnx-testlib.h \
$(NULL)
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)
@ -71,3 +72,7 @@ test_libglnx_errors_LDADD = $(libglnx_libs) libglnx.la
test_libglnx_macros_SOURCES = $(libglnx_srcpath)/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_srcpath)/tests/test-libglnx-shutil.c
test_libglnx_shutil_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)
test_libglnx_shutil_LDADD = $(libglnx_libs) libglnx.la

View File

@ -46,6 +46,7 @@ libglnx_la_SOURCES = \
libglnx/glnx-shutil.h \
libglnx/glnx-shutil.c \
libglnx/libglnx.h \
libglnx/tests/libglnx-testlib.h \
$(NULL)
libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags)

View File

@ -23,8 +23,10 @@
#include <string.h>
#include <glnx-dirfd.h>
#include <glnx-fdio.h>
#include <glnx-errors.h>
#include <glnx-local-alloc.h>
#include <glnx-shutil.h>
/**
* glnx_opendirat_with_errno:
@ -203,8 +205,8 @@ glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator *dfd_iter,
if (ret_dent->d_type == DT_UNKNOWN)
{
struct stat stbuf;
if (TEMP_FAILURE_RETRY (fstatat (dfd_iter->fd, ret_dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW)) != 0)
return glnx_throw_errno (error);
if (!glnx_fstatat (dfd_iter->fd, ret_dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
ret_dent->d_type = IFTODT (stbuf.st_mode);
}
}
@ -283,27 +285,36 @@ glnx_gen_temp_name (gchar *tmpl)
/**
* glnx_mkdtempat:
* @dfd: Directory fd
* @tmpl: (type filename): template directory name, last 6 characters will be replaced
* @mode: permissions to create the temporary directory with
* @tmpl: (type filename): Initial template directory name, last 6 characters will be replaced
* @mode: permissions with which to create the temporary directory
* @out_tmpdir: (out caller-allocates): Initialized tempdir structure
* @error: Error
*
* Similar to g_mkdtemp_full, but using openat.
* Somewhat similar to g_mkdtemp_full(), but fd-relative, and returns a
* structure that uses autocleanups. Note that the supplied @dfd lifetime
* must match or exceed that of @out_tmpdir in order to remove the directory.
*/
gboolean
glnx_mkdtempat (int dfd,
gchar *tmpl,
int mode,
GError **error)
glnx_mkdtempat (int dfd, const char *tmpl, int mode,
GLnxTmpDir *out_tmpdir, GError **error)
{
int count;
g_return_val_if_fail (tmpl != NULL, FALSE);
g_return_val_if_fail (out_tmpdir != NULL, FALSE);
g_return_val_if_fail (!out_tmpdir->initialized, FALSE);
g_return_val_if_fail (tmpl != NULL, -1);
dfd = glnx_dirfd_canonicalize (dfd);
for (count = 0; count < 100; count++)
g_autofree char *path = g_strdup (tmpl);
for (int count = 0; count < 100; count++)
{
glnx_gen_temp_name (tmpl);
glnx_gen_temp_name (path);
if (mkdirat (dfd, tmpl, mode) == -1)
/* Ideally we could use openat(O_DIRECTORY | O_CREAT | O_EXCL) here
* to create and open the directory atomically, but thats not supported by
* current kernel versions: http://www.openwall.com/lists/oss-security/2014/11/26/14
* (Tested on kernel 4.10.10-200.fc25.x86_64). For the moment, accept a
* TOCTTOU race here. */
if (mkdirat (dfd, path, mode) == -1)
{
if (errno == EEXIST)
continue;
@ -314,77 +325,109 @@ glnx_mkdtempat (int dfd,
return glnx_throw_errno_prefix (error, "mkdirat");
}
/* And open it */
glnx_fd_close int ret_dfd = -1;
if (!glnx_opendirat (dfd, path, FALSE, &ret_dfd, error))
{
/* If we fail to open, let's try to clean up */
(void)unlinkat (dfd, path, AT_REMOVEDIR);
return FALSE;
}
/* Return the initialized directory struct */
out_tmpdir->initialized = TRUE;
out_tmpdir->src_dfd = dfd; /* referenced; see above docs */
out_tmpdir->fd = glnx_steal_fd (&ret_dfd);
out_tmpdir->path = g_steal_pointer (&path);
return TRUE;
}
/* Failure */
g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
"mkstempat ran out of combinations to try.");
"glnx_mkdtempat ran out of combinations to try");
return FALSE;
}
/**
* glnx_mkdtempat_open:
* @dfd: Directory FD
* @tmpl: (type filename): template directory name, last 6 characters will be replaced
* glnx_mkdtemp:
* @tmpl: (type filename): Source template directory name, last 6 characters will be replaced
* @mode: permissions to create the temporary directory with
* @out_dfd: (out caller-allocates): Return location for an FD for the new
* temporary directory, or `-1` on error
* @out_tmpdir: (out caller-allocates): Return location for tmpdir data
* @error: Return location for a #GError, or %NULL
*
* Similar to glnx_mkdtempat(), except it will open the resulting temporary
* directory and return a directory FD to it.
* Similar to glnx_mkdtempat(), but will use g_get_tmp_dir() as the parent
* directory to @tmpl.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
*/
gboolean
glnx_mkdtempat_open (int dfd,
gchar *tmpl,
glnx_mkdtemp (const gchar *tmpl,
int mode,
int *out_dfd,
GLnxTmpDir *out_tmpdir,
GError **error)
{
/* FIXME: Ideally we could use openat(O_DIRECTORY | O_CREAT | O_EXCL) here
* to create and open the directory atomically, but thats not supported by
* current kernel versions: http://www.openwall.com/lists/oss-security/2014/11/26/14
* (Tested on kernel 4.10.10-200.fc25.x86_64). For the moment, accept a
* TOCTTOU race here. */
*out_dfd = -1;
g_autofree char *path = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
return glnx_mkdtempat (AT_FDCWD, path, mode,
out_tmpdir, error);
}
if (!glnx_mkdtempat (dfd, tmpl, mode, error))
static gboolean
_glnx_tmpdir_free (GLnxTmpDir *tmpd,
gboolean delete_dir,
GCancellable *cancellable,
GError **error)
{
/* Support being passed NULL so we work nicely in a GPtrArray */
if (!(tmpd && tmpd->initialized))
return TRUE;
g_assert_cmpint (tmpd->fd, !=, -1);
(void) close (tmpd->fd);
tmpd->fd = -1;
g_assert (tmpd->path);
g_assert_cmpint (tmpd->src_dfd, !=, -1);
g_autofree char *path = tmpd->path; /* Take ownership */
tmpd->initialized = FALSE;
if (delete_dir)
{
if (!glnx_shutil_rm_rf_at (tmpd->src_dfd, path, cancellable, error))
return FALSE;
return glnx_opendirat (dfd, tmpl, FALSE, out_dfd, error);
}
return TRUE;
}
/**
* glnx_mkdtempat_open_in_system:
* @tmpl: (type filename): template directory name, last 6 characters will be replaced
* @mode: permissions to create the temporary directory with
* @out_dfd: (out caller-allocates): Return location for an FD for the new
* temporary directory, or `-1` on error
* @error: Return location for a #GError, or %NULL
* glnx_tmpdir_delete:
* @tmpf: Temporary dir
* @cancellable: Cancellable
* @error: Error
*
* Similar to glnx_mkdtempat_open(), except it will use the system temporary
* directory (from g_get_tmp_dir()) as the parent directory to @tmpl.
* Deallocate a tmpdir, closing the fd and recursively deleting the path. This
* is normally called indirectly via glnx_tmpdir_cleanup() by the autocleanup
* attribute, but you can also invoke this directly.
*
* Returns: %TRUE on success, %FALSE otherwise
* Since: UNRELEASED
* If an error occurs while deleting the filesystem path, @tmpf will still have
* been deallocated and should not be reused.
*
* See also `glnx_tmpdir_unset` to avoid deleting the path.
*/
gboolean
glnx_mkdtempat_open_in_system (gchar *tmpl,
int mode,
int *out_dfd,
GError **error)
glnx_tmpdir_delete (GLnxTmpDir *tmpf, GCancellable *cancellable, GError **error)
{
glnx_fd_close int tmp_dfd = -1;
*out_dfd = -1;
if (!glnx_opendirat (-1, g_get_tmp_dir (), TRUE, &tmp_dfd, error))
return FALSE;
return glnx_mkdtempat_open (tmp_dfd, tmpl, mode, out_dfd, error);
return _glnx_tmpdir_free (tmpf, TRUE, cancellable, error);
}
/**
* glnx_tmpdir_unset:
* @tmpf: Temporary dir
* @cancellable: Cancellable
* @error: Error
*
* Deallocate a tmpdir, but do not delete the filesystem path. See also
* `glnx_tmpdir_delete()`.
*/
void
glnx_tmpdir_unset (GLnxTmpDir *tmpf)
{
(void) _glnx_tmpdir_free (tmpf, FALSE, NULL, NULL);
}

View File

@ -92,7 +92,7 @@ void glnx_gen_temp_name (gchar *tmpl);
* @mode: Mode
* @error: Return location for a #GError, or %NULL
*
* Wrapper around mkdirat() which ignores adds #GError support, ensures that
* Wrapper around mkdirat() which adds #GError support, ensures that
* it retries on %EINTR, and also ignores `EEXIST`.
*
* See also `glnx_shutil_mkdir_p_at()` for recursive handling.
@ -113,20 +113,25 @@ glnx_ensure_dir (int dfd,
return TRUE;
}
gboolean glnx_mkdtempat (int dfd,
gchar *tmpl,
int mode,
GError **error);
typedef struct {
gboolean initialized;
int src_dfd;
int fd;
char *path;
} GLnxTmpDir;
gboolean glnx_tmpdir_delete (GLnxTmpDir *tmpf, GCancellable *cancellable, GError **error);
void glnx_tmpdir_unset (GLnxTmpDir *tmpf);
static inline void
glnx_tmpdir_cleanup (GLnxTmpDir *tmpf)
{
(void)glnx_tmpdir_delete (tmpf, NULL, NULL);
}
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxTmpDir, glnx_tmpdir_cleanup)
gboolean glnx_mkdtempat_open (int dfd,
gchar *tmpl,
int mode,
int *out_dfd,
GError **error);
gboolean glnx_mkdtempat (int dfd, const char *tmpl, int mode,
GLnxTmpDir *out_tmpdir, GError **error);
gboolean glnx_mkdtempat_open_in_system (gchar *tmpl,
int mode,
int *out_dfd,
GError **error);
gboolean glnx_mkdtemp (const char *tmpl, int mode,
GLnxTmpDir *out_tmpdir, GError **error);
G_END_DECLS

View File

@ -112,7 +112,7 @@ rename_file_noreplace_at (int olddirfd, const char *oldpath,
return TRUE;
}
else
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "renameat");
}
return TRUE;
}
@ -168,9 +168,11 @@ glnx_tmpfile_clear (GLnxTmpfile *tmpf)
return;
if (!tmpf->initialized)
return;
if (tmpf->fd == -1)
return;
(void) close (tmpf->fd);
if (tmpf->fd != -1)
{
if (close (tmpf->fd) < 0)
g_assert (errno != EBADF);
}
/* If ->path is set, we're likely aborting due to an error. Clean it up */
if (tmpf->path)
{
@ -180,17 +182,8 @@ glnx_tmpfile_clear (GLnxTmpfile *tmpf)
tmpf->initialized = FALSE;
}
/* Allocate a temporary file, using Linux O_TMPFILE if available. The file mode
* will be 0600.
*
* The result will be stored in @out_tmpf, which is caller allocated
* so you can store it on the stack in common scenarios.
*
* The directory fd @dfd must live at least as long as the output @out_tmpf.
*/
gboolean
glnx_open_tmpfile_linkable_at (int dfd,
const char *subpath,
static gboolean
open_tmpfile_core (int dfd, const char *subpath,
int flags,
GLnxTmpfile *out_tmpf,
GError **error)
@ -201,9 +194,6 @@ glnx_open_tmpfile_linkable_at (int dfd,
dfd = glnx_dirfd_canonicalize (dfd);
/* Don't allow O_EXCL, as that has a special meaning for O_TMPFILE */
g_return_val_if_fail ((flags & O_EXCL) == 0, FALSE);
/* Creates a temporary file, that shall be renamed to "target"
* later. If possible, this uses O_TMPFILE in which case
* "ret_path" will be returned as NULL. If not possible a the
@ -260,6 +250,29 @@ glnx_open_tmpfile_linkable_at (int dfd,
return FALSE;
}
/* Allocate a temporary file, using Linux O_TMPFILE if available. The file mode
* will be 0600.
*
* The result will be stored in @out_tmpf, which is caller allocated
* so you can store it on the stack in common scenarios.
*
* The directory fd @dfd must live at least as long as the output @out_tmpf.
*/
gboolean
glnx_open_tmpfile_linkable_at (int dfd,
const char *subpath,
int flags,
GLnxTmpfile *out_tmpf,
GError **error)
{
/* Don't allow O_EXCL, as that has a special meaning for O_TMPFILE;
* it's used for glnx_open_anonymous_tmpfile().
*/
g_return_val_if_fail ((flags & O_EXCL) == 0, FALSE);
return open_tmpfile_core (dfd, subpath, flags, out_tmpf, error);
}
/* A variant of `glnx_open_tmpfile_linkable_at()` which doesn't support linking.
* Useful for true temporary storage. The fd will be allocated in /var/tmp to
* ensure maximum storage space.
@ -269,7 +282,8 @@ glnx_open_anonymous_tmpfile (int flags,
GLnxTmpfile *out_tmpf,
GError **error)
{
if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, "/var/tmp", flags, out_tmpf, error))
/* Add in O_EXCL */
if (!open_tmpfile_core (AT_FDCWD, "/var/tmp", flags | O_EXCL, out_tmpf, error))
return FALSE;
if (out_tmpf->path)
{
@ -428,8 +442,8 @@ glnx_fd_readall_malloc (int fd,
const guint maxreadlen = 4096;
struct stat stbuf;
if (TEMP_FAILURE_RETRY (fstat (fd, &stbuf)) < 0)
return glnx_null_throw_errno (error);
if (!glnx_fstat (fd, &stbuf, error))
return FALSE;
gsize buf_allocated;
if (S_ISREG (stbuf.st_mode) && stbuf.st_size > 0)
@ -597,7 +611,7 @@ glnx_readlinkat_malloc (int dfd,
c = g_malloc (l);
n = TEMP_FAILURE_RETRY (readlinkat (dfd, subpath, c, l-1));
if (n < 0)
return glnx_null_throw_errno (error);
return glnx_null_throw_errno_prefix (error, "readlinkat");
if ((size_t) n < l-1)
{
@ -644,7 +658,7 @@ copy_symlink_at (int src_dfd,
if (TEMP_FAILURE_RETRY (fchownat (dest_dfd, dest_subpath,
src_stbuf->st_uid, src_stbuf->st_gid,
AT_SYMLINK_NOFOLLOW)) != 0)
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "fchownat");
return TRUE;
}
@ -852,17 +866,22 @@ glnx_regfile_copy_bytes (int fdf, int fdt, off_t max_bytes)
* glnx_file_copy_at:
* @src_dfd: Source directory fd
* @src_subpath: Subpath relative to @src_dfd
* @src_stbuf: (allow-none): Optional stat buffer for source; if a stat() has already been done
* @dest_dfd: Target directory fd
* @dest_subpath: Destination name
* @copyflags: Flags
* @cancellable: cancellable
* @error: Error
*
* Perform a full copy of the regular file or
* symbolic link from @src_subpath to @dest_subpath.
* Perform a full copy of the regular file or symbolic link from @src_subpath to
* @dest_subpath; if @src_subpath is anything other than a regular file or
* symbolic link, an error will be returned.
*
* If @src_subpath is anything other than a regular
* file or symbolic link, an error will be returned.
* If the source is a regular file and the destination exists as a symbolic
* link, the symbolic link will not be followed; rather the link itself will be
* replaced. Related to this: for regular files, when `GLNX_FILE_COPY_OVERWRITE`
* is specified, this function always uses `O_TMPFILE` (if available) and does a
* rename-into-place rather than `open(O_TRUNC)`.
*/
gboolean
glnx_file_copy_at (int src_dfd,
@ -874,31 +893,23 @@ glnx_file_copy_at (int src_dfd,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
int r;
int dest_open_flags;
struct timespec ts[2];
glnx_fd_close int src_fd = -1;
glnx_fd_close int dest_fd = -1;
struct stat local_stbuf;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
goto out;
/* Canonicalize dfds */
src_dfd = glnx_dirfd_canonicalize (src_dfd);
dest_dfd = glnx_dirfd_canonicalize (dest_dfd);
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
/* Automatically do stat() if no stat buffer was supplied */
struct stat local_stbuf;
if (!src_stbuf)
{
if (fstatat (src_dfd, src_subpath, &local_stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (!glnx_fstatat (src_dfd, src_subpath, &local_stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
src_stbuf = &local_stbuf;
}
/* For symlinks, defer entirely to copy_symlink_at() */
if (S_ISLNK (src_stbuf->st_mode))
{
return copy_symlink_at (src_dfd, src_subpath, src_stbuf,
@ -910,47 +921,31 @@ glnx_file_copy_at (int src_dfd,
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Cannot copy non-regular/non-symlink file: %s", src_subpath);
goto out;
return FALSE;
}
/* Regular file path below here */
glnx_fd_close int src_fd = -1;
if (!glnx_openat_rdonly (src_dfd, src_subpath, FALSE, &src_fd, error))
goto out;
return FALSE;
dest_open_flags = O_WRONLY | O_CREAT | O_CLOEXEC | O_NOCTTY;
if (!(copyflags & GLNX_FILE_COPY_OVERWRITE))
dest_open_flags |= O_EXCL;
else
dest_open_flags |= O_TRUNC;
dest_fd = TEMP_FAILURE_RETRY (openat (dest_dfd, dest_subpath, dest_open_flags, src_stbuf->st_mode));
if (dest_fd == -1)
{
glnx_set_error_from_errno (error);
goto out;
/* Open a tmpfile for dest. Particularly for AT_FDCWD calls, we really want to
* open in the target directory, otherwise we may not be able to link.
*/
g_auto(GLnxTmpfile) tmp_dest = { 0, };
{ char *dnbuf = strdupa (dest_subpath);
const char *dn = dirname (dnbuf);
if (!glnx_open_tmpfile_linkable_at (dest_dfd, dn, O_WRONLY | O_CLOEXEC,
&tmp_dest, error))
return FALSE;
}
r = glnx_regfile_copy_bytes (src_fd, dest_fd, (off_t) -1);
if (r < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (glnx_regfile_copy_bytes (src_fd, tmp_dest.fd, (off_t) -1) < 0)
return glnx_throw_errno_prefix (error, "regfile copy");
if (fchown (dest_fd, src_stbuf->st_uid, src_stbuf->st_gid) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (fchmod (dest_fd, src_stbuf->st_mode & 07777) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
ts[0] = src_stbuf->st_atim;
ts[1] = src_stbuf->st_mtim;
(void) futimens (dest_fd, ts);
if (fchown (tmp_dest.fd, src_stbuf->st_uid, src_stbuf->st_gid) != 0)
return glnx_throw_errno_prefix (error, "fchown");
if (!(copyflags & GLNX_FILE_COPY_NOXATTRS))
{
@ -958,35 +953,40 @@ glnx_file_copy_at (int src_dfd,
if (!glnx_fd_get_all_xattrs (src_fd, &xattrs,
cancellable, error))
goto out;
return FALSE;
if (!glnx_fd_set_all_xattrs (dest_fd, xattrs,
if (!glnx_fd_set_all_xattrs (tmp_dest.fd, xattrs,
cancellable, error))
goto out;
return FALSE;
}
/* Always chmod after setting xattrs, in case the file has mode 0400 or less,
* like /etc/shadow. Linux currently allows write() on non-writable open files
* but not fsetxattr().
*/
if (fchmod (tmp_dest.fd, src_stbuf->st_mode & 07777) != 0)
return glnx_throw_errno_prefix (error, "fchmod");
struct timespec ts[2];
ts[0] = src_stbuf->st_atim;
ts[1] = src_stbuf->st_mtim;
(void) futimens (tmp_dest.fd, ts);
if (copyflags & GLNX_FILE_COPY_DATASYNC)
{
if (fdatasync (dest_fd) < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (fdatasync (tmp_dest.fd) < 0)
return glnx_throw_errno_prefix (error, "fdatasync");
}
r = close (dest_fd);
dest_fd = -1;
if (r < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
const GLnxLinkTmpfileReplaceMode replacemode =
(copyflags & GLNX_FILE_COPY_OVERWRITE) ?
GLNX_LINK_TMPFILE_REPLACE :
GLNX_LINK_TMPFILE_NOREPLACE;
ret = TRUE;
out:
if (!ret)
(void) unlinkat (dest_dfd, dest_subpath, 0);
return ret;
if (!glnx_link_tmpfile_at (&tmp_dest, replacemode, dest_dfd, dest_subpath, error))
return FALSE;
return TRUE;
}
/**
@ -1071,19 +1071,17 @@ glnx_file_replace_contents_with_perms_at (int dfd,
return FALSE;
if (glnx_loop_write (tmpf.fd, buf, len) < 0)
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "write");
if (!(flags & GLNX_FILE_REPLACE_NODATASYNC))
{
struct stat stbuf;
gboolean do_sync;
if (fstatat (dfd, subpath, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
if (errno != ENOENT)
return glnx_throw_errno (error);
if (!glnx_fstatat_allow_noent (dfd, subpath, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
if (errno == ENOENT)
do_sync = (flags & GLNX_FILE_REPLACE_DATASYNC_NEW) > 0;
}
else
do_sync = TRUE;
@ -1097,11 +1095,11 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if (uid != (uid_t) -1)
{
if (fchown (tmpf.fd, uid, gid) != 0)
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "fchown");
}
if (fchmod (tmpf.fd, mode) != 0)
return glnx_throw_errno (error);
return glnx_throw_errno_prefix (error, "fchmod");
if (!glnx_link_tmpfile_at (&tmpf, GLNX_LINK_TMPFILE_REPLACE,
dfd, subpath, error))

View File

@ -295,6 +295,44 @@ glnx_fstatat (int dfd,
return TRUE;
}
/**
* 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
* @flags: Flags to pass to fstatat()
* @error: Return location for a #GError, or %NULL
*
* Like glnx_fstatat(), but handles `ENOENT` in a non-error way. Instead,
* on success `errno` will be zero, otherwise it will be preserved. Hence
* you can test `if (errno == 0)` to conditionalize on the file existing,
* or `if (errno == ENOENT)` for non-existence.
*
* Returns: %TRUE on success, %FALSE otherwise (errno is preserved)
* Since: UNRELEASED
*/
static inline gboolean
glnx_fstatat_allow_noent (int dfd,
const char *path,
struct stat *out_buf,
int flags,
GError **error)
{
if (TEMP_FAILURE_RETRY (fstatat (dfd, path, out_buf, flags)) != 0)
{
if (errno != ENOENT)
{
int errsv = errno;
(void) glnx_throw_errno_prefix (error, "fstatat(%s)", path);
errno = errsv;
return FALSE;
}
}
else
errno = 0;
return TRUE;
}
/**
* glnx_renameat:
*

View File

@ -105,7 +105,7 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
r = flock(fd, operation);
if (r < 0)
return glnx_throw_errno(error);
return glnx_throw_errno_prefix (error, "flock");
}
/* If we acquired the lock, let's check if the file
@ -114,9 +114,8 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
* it. In such a case our acquired lock is worthless,
* hence try again. */
r = fstat(fd, &st);
if (r < 0)
return glnx_throw_errno(error);
if (!glnx_fstat (fd, &st, error))
return FALSE;
if (st.st_nlink > 0)
break;
@ -127,21 +126,18 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
/* Note that if this is not AT_FDCWD, the caller takes responsibility
* for the fd's lifetime being >= that of the lock.
*/
out_lock->initialized = TRUE;
out_lock->dfd = dfd;
out_lock->path = t;
out_lock->fd = fd;
out_lock->path = g_steal_pointer (&t);
out_lock->fd = glnx_steal_fd (&fd);
out_lock->operation = operation;
fd = -1;
t = NULL;
return TRUE;
}
void glnx_release_lock_file(GLnxLockFile *f) {
int r;
if (!f)
if (!(f && f->initialized))
return;
if (f->path) {
@ -182,4 +178,5 @@ void glnx_release_lock_file(GLnxLockFile *f) {
(void) close (f->fd);
f->fd = -1;
f->operation = 0;
f->initialized = FALSE;
}

View File

@ -27,6 +27,7 @@
#include "glnx-backport-autoptr.h"
typedef struct GLnxLockFile {
gboolean initialized;
int dfd;
char *path;
int fd;
@ -37,5 +38,3 @@ gboolean glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile
void glnx_release_lock_file(GLnxLockFile *f);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxLockFile, glnx_release_lock_file)
#define GLNX_LOCK_FILE_INIT { .fd = -1, .dfd = AT_FDCWD, .path = NULL }

View File

@ -38,7 +38,7 @@ G_BEGIN_DECLS
({ \
const char *_appendees_[] = { a, __VA_ARGS__ }; \
char *_d_, *_p_; \
int _len_ = 0; \
size_t _len_ = 0; \
unsigned _i_; \
for (_i_ = 0; _i_ < G_N_ELEMENTS(_appendees_) && _appendees_[_i_]; _i_++) \
_len_ += strlen(_appendees_[_i_]); \

View File

@ -148,7 +148,13 @@ mkdir_p_at_internal (int dfd,
g_assert (!did_recurse);
lastslash = strrchr (path, '/');
g_assert (lastslash != NULL);
if (lastslash == NULL)
{
/* This can happen if @dfd was deleted between being opened and
* passed to mkdir_p_at_internal(). */
return glnx_throw_errno_prefix (error, "mkdir(%s)", path);
}
/* Note we can mutate the buffer as we dup'd it */
*lastslash = '\0';
@ -187,6 +193,9 @@ mkdir_p_at_internal (int dfd,
* directory fd @dfd.
*
* See also glnx_ensure_dir() for a non-recursive version.
*
* This will return %G_IO_ERROR_NOT_FOUND if @dfd has been deleted since being
* opened. It may return other errors from mkdirat() in other situations.
*/
gboolean
glnx_shutil_mkdir_p_at (int dfd,

View File

@ -0,0 +1,34 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2017 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#pragma once
typedef GError _GLnxTestAutoError;
static inline void
_glnx_test_auto_error_cleanup (_GLnxTestAutoError *autoerror)
{
g_assert_no_error (autoerror);
/* We could add a clear call here, but no point...we'll have aborted */
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(_GLnxTestAutoError, _glnx_test_auto_error_cleanup);
#define _GLNX_TEST_DECLARE_ERROR(local_error, error) \
g_autoptr(_GLnxTestAutoError) local_error = NULL; \
GError **error = &local_error

View File

@ -26,6 +26,8 @@
#include <err.h>
#include <string.h>
#include "libglnx-testlib.h"
static gboolean
renameat_test_setup (int *out_srcfd, int *out_destfd,
GError **error)
@ -59,14 +61,13 @@ renameat_test_setup (int *out_srcfd, int *out_destfd,
static void
test_renameat2_noreplace (void)
{
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
_GLNX_TEST_DECLARE_ERROR(local_error, error);
glnx_fd_close int srcfd = -1;
glnx_fd_close int destfd = -1;
struct stat stbuf;
if (!renameat_test_setup (&srcfd, &destfd, error))
goto out;
return;
if (glnx_renameat2_noreplace (srcfd, "foo", destfd, "bar") == 0)
g_assert_not_reached ();
@ -76,117 +77,153 @@ test_renameat2_noreplace (void)
}
if (glnx_renameat2_noreplace (srcfd, "foo", destfd, "baz") < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return (void)glnx_throw_errno_prefix (error, "renameat");
if (!glnx_fstatat (destfd, "bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
goto out;
return;
if (fstatat (srcfd, "foo", &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
g_assert_not_reached ();
else
g_assert_cmpint (errno, ==, ENOENT);
out:
g_assert_no_error (local_error);
}
static void
test_renameat2_exchange (void)
{
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
_GLNX_TEST_DECLARE_ERROR(local_error, error);
glnx_fd_close int srcfd = -1;
glnx_fd_close int destfd = -1;
struct stat stbuf;
if (!renameat_test_setup (&srcfd, &destfd, error))
goto out;
return;
if (glnx_renameat2_exchange (AT_FDCWD, "srcdir", AT_FDCWD, "destdir") < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
return (void)glnx_throw_errno_prefix (error, "renameat");
/* Ensure the dir fds are the same */
if (fstatat (srcfd, "foo", &stbuf, AT_SYMLINK_NOFOLLOW) < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (fstatat (destfd, "bar", &stbuf, AT_SYMLINK_NOFOLLOW) < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
struct stat stbuf;
if (!glnx_fstatat (srcfd, "foo", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
if (!glnx_fstatat (destfd, "bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
/* But the dirs should be swapped */
if (fstatat (AT_FDCWD, "destdir/foo", &stbuf, AT_SYMLINK_NOFOLLOW) < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (fstatat (AT_FDCWD, "srcdir/bar", &stbuf, AT_SYMLINK_NOFOLLOW) < 0)
{
glnx_set_error_from_errno (error);
goto out;
}
out:
g_assert_no_error (local_error);
if (!glnx_fstatat (AT_FDCWD, "destdir/foo", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
if (!glnx_fstatat (AT_FDCWD, "srcdir/bar", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
}
static void
test_tmpfile (void)
{
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
_GLNX_TEST_DECLARE_ERROR(local_error, error);
g_auto(GLnxTmpfile) tmpf = { 0, };
if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, ".", O_WRONLY|O_CLOEXEC, &tmpf, error))
goto out;
return;
if (glnx_loop_write (tmpf.fd, "foo", strlen ("foo")) < 0)
{
(void)glnx_throw_errno_prefix (error, "write");
goto out;
}
return (void)glnx_throw_errno_prefix (error, "write");
if (glnx_link_tmpfile_at (&tmpf, GLNX_LINK_TMPFILE_NOREPLACE, AT_FDCWD, "foo", error))
goto out;
out:
g_assert_no_error (local_error);
return;
}
static void
test_stdio_file (void)
{
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
_GLNX_TEST_DECLARE_ERROR(local_error, error);
g_auto(GLnxTmpfile) tmpf = { 0, };
g_autoptr(FILE) f = NULL;
if (!glnx_open_anonymous_tmpfile (O_RDWR|O_CLOEXEC, &tmpf, error))
goto out;
return;
f = fdopen (tmpf.fd, "w");
tmpf.fd = -1; /* Ownership was transferred via fdopen() */
if (!f)
{
(void)glnx_throw_errno_prefix (error, "fdopen");
goto out;
}
return (void)glnx_throw_errno_prefix (error, "fdopen");
if (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello"))
{
(void)glnx_throw_errno_prefix (error, "fwrite");
goto out;
}
return (void)glnx_throw_errno_prefix (error, "fwrite");
if (!glnx_stdio_file_flush (f, error))
goto out;
return;
}
out:
static void
test_fstatat (void)
{
_GLNX_TEST_DECLARE_ERROR(local_error, error);
struct stat stbuf = { 0, };
if (!glnx_fstatat_allow_noent (AT_FDCWD, ".", &stbuf, 0, error))
return;
g_assert_cmpint (errno, ==, 0);
g_assert_no_error (local_error);
g_assert (S_ISDIR (stbuf.st_mode));
if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchfile", &stbuf, 0, error))
return;
g_assert_cmpint (errno, ==, ENOENT);
g_assert_no_error (local_error);
}
static void
test_filecopy (void)
{
_GLNX_TEST_DECLARE_ERROR(local_error, error);
g_auto(GLnxTmpfile) tmpf = { 0, };
const char foo[] = "foo";
struct stat stbuf;
if (!glnx_ensure_dir (AT_FDCWD, "subdir", 0755, error))
return;
if (!glnx_file_replace_contents_at (AT_FDCWD, foo, (guint8*)foo, sizeof (foo),
GLNX_FILE_REPLACE_NODATASYNC, NULL, error))
return;
/* Copy it into both the same dir and a subdir */
if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
GLNX_FILE_COPY_NOXATTRS, NULL, error))
return;
if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "subdir/bar",
GLNX_FILE_COPY_NOXATTRS, NULL, error))
return;
if (!glnx_fstatat (AT_FDCWD, "subdir/bar", &stbuf, 0, error))
return;
if (glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
GLNX_FILE_COPY_NOXATTRS, NULL, error))
g_assert_not_reached ();
g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS);
g_clear_error (&local_error);
if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "bar",
GLNX_FILE_COPY_NOXATTRS | GLNX_FILE_COPY_OVERWRITE,
NULL, error))
return;
if (symlinkat ("nosuchtarget", AT_FDCWD, "link") < 0)
return (void) glnx_throw_errno_prefix (error, "symlinkat");
/* Shouldn't be able to overwrite a symlink without GLNX_FILE_COPY_OVERWRITE */
if (glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "link",
GLNX_FILE_COPY_NOXATTRS,
NULL, error))
g_assert_not_reached ();
g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_EXISTS);
g_clear_error (&local_error);
/* Test overwriting symlink */
if (!glnx_file_copy_at (AT_FDCWD, foo, NULL, AT_FDCWD, "link",
GLNX_FILE_COPY_NOXATTRS | GLNX_FILE_COPY_OVERWRITE,
NULL, error))
return;
if (!glnx_fstatat_allow_noent (AT_FDCWD, "nosuchtarget", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
g_assert_cmpint (errno, ==, ENOENT);
g_assert_no_error (local_error);
if (!glnx_fstatat (AT_FDCWD, "link", &stbuf, AT_SYMLINK_NOFOLLOW, error))
return;
g_assert (S_ISREG (stbuf.st_mode));
}
int main (int argc, char **argv)
@ -197,8 +234,10 @@ int main (int argc, char **argv)
g_test_add_func ("/tmpfile", test_tmpfile);
g_test_add_func ("/stdio-file", test_stdio_file);
g_test_add_func ("/filecopy", test_filecopy);
g_test_add_func ("/renameat2-noreplace", test_renameat2_noreplace);
g_test_add_func ("/renameat2-exchange", test_renameat2_exchange);
g_test_add_func ("/fstat", test_fstatat);
ret = g_test_run();

View File

@ -223,19 +223,17 @@ test_xattr_races (void)
GThread *threads[nprocs];
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
glnx_fd_close int dfd = -1;
g_autofree char *tmpdir = g_strdup_printf ("%s/libglnx-xattrs-XXXXXX",
g_auto(GLnxTmpDir) tmpdir = { 0, };
g_autofree char *tmpdir_path = g_strdup_printf ("%s/libglnx-xattrs-XXXXXX",
getenv ("TMPDIR") ?: "/var/tmp");
guint nread = 0;
if (!glnx_mkdtempat (AT_FDCWD, tmpdir, 0700, error))
goto out;
if (!glnx_opendirat (AT_FDCWD, tmpdir, TRUE, &dfd, error))
if (!glnx_mkdtempat (AT_FDCWD, tmpdir_path, 0700,
&tmpdir, error))
goto out;
/* Support people building/testing on tmpfs https://github.com/flatpak/flatpak/issues/686 */
if (fsetxattr (dfd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
if (fsetxattr (tmpdir.fd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
{
if (errno == EOPNOTSUPP)
{
@ -252,7 +250,7 @@ test_xattr_races (void)
for (guint i = 0; i < nprocs; i++)
{
struct XattrWorker *worker = &wdata[i];
worker->dfd = dfd;
worker->dfd = tmpdir.fd;
worker->is_writer = i % 2 == 0;
threads[i] = g_thread_new (NULL, xattr_thread, worker);
}
@ -267,8 +265,6 @@ test_xattr_races (void)
g_print ("Read %u xattrs race free!\n", nread);
(void) glnx_shutil_rm_rf_at (AT_FDCWD, tmpdir, NULL, NULL);
out:
g_assert_no_error (local_error);
}

View File

@ -83,14 +83,23 @@ Boston, MA 02111-1307, USA.
your organisation or repository using a dot prefix. The values
must be in GVariant text format. For example,
<command>exampleos.end-of-life "@t 1445385600"</command>.
</para></listitem>
</para>
<!-- FIXME: Uncomment this when collection ID support becomes non-experimental.
<para>If the repository has a collection ID configured, the
<filename>ostree-metadata</filename> branch for that collection ID
will also be updated with a new commit containing the given metadata,
which will be signed if the summary file is signed.</para>
-->
</listitem>
</varlistentry>
<varlistentry>
<term><option>--gpg-sign</option>=KEYID</term>
<listitem><para>
GPG Key ID to sign the delta with.
GPG Key ID to sign the summary with.
</para></listitem>
</varlistentry>

View File

@ -18,9 +18,8 @@
***/
/* Add new symbols here. Release commits should copy this section into -released.sym. */
LIBOSTREE_2017.12 {
} LIBOSTREE_2017.11;
LIBOSTREE_2017.13 {
} LIBOSTREE_2017.12;
/* Stub section for the stable release *after* this development one; don't
* edit this other than to update the last number. This is just a copy/paste

View File

@ -77,3 +77,8 @@ global:
ostree_repo_transaction_set_collection_ref;
ostree_validate_collection_id;
} LIBOSTREE_2017.7_EXPERIMENTAL;
LIBOSTREE_2017.12_EXPERIMENTAL {
global:
ostree_repo_resolve_collection_ref;
} LIBOSTREE_2017.8_EXPERIMENTAL;

View File

@ -430,6 +430,12 @@ LIBOSTREE_2017.10 {
LIBOSTREE_2017.11 {
} LIBOSTREE_2017.10;
LIBOSTREE_2017.12 {
global:
ostree_repo_equal;
ostree_repo_hash;
} LIBOSTREE_2017.11;
/* NOTE: Only add more content here in release commits! See the
* comments at the top of this file.
*/

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2016 Endless Mobile, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- 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

View File

@ -1,5 +1,4 @@
/* -*- 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
@ -247,7 +246,7 @@ ostree_bloom_set_bit (OstreeBloom *bloom,
{
g_assert (bloom->is_mutable);
g_assert (idx / 8 < bloom->n_bytes);
bloom->mutable_bytes[idx / 8] |= (1 << (idx % 8));
bloom->mutable_bytes[idx / 8] |= (guint8) (1 << (idx % 8));
}
/**
@ -274,11 +273,11 @@ ostree_bloom_maybe_contains (OstreeBloom *bloom,
for (i = 0; i < bloom->k; i++)
{
gsize idx;
guint64 idx;
idx = bloom->hash_func (element, i);
if (!ostree_bloom_get_bit (bloom, idx % (bloom->n_bytes * 8)))
if (!ostree_bloom_get_bit (bloom, (gsize) (idx % (bloom->n_bytes * 8))))
return FALSE; /* definitely not in the set */
}
@ -338,8 +337,8 @@ ostree_bloom_add_element (OstreeBloom *bloom,
for (i = 0; i < bloom->k; i++)
{
gsize idx = bloom->hash_func (element, i);
ostree_bloom_set_bit (bloom, idx % (bloom->n_bytes * 8));
guint64 idx = bloom->hash_func (element, i);
ostree_bloom_set_bit (bloom, (gsize) (idx % (bloom->n_bytes * 8)));
}
}

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Collabora Ltd
*
* Based on ot-bootloader-syslinux.c by Colin Walters <walters@verbum.org>

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Collabora Ltd
*
* Based on ot-bootloader-syslinux.h by Colin Walters <walters@verbum.org>

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -90,6 +89,7 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd,
GError **error);
GFileInfo * _ostree_stbuf_to_gfileinfo (const struct stat *stbuf);
gboolean _ostree_gfileinfo_equal (GFileInfo *a, GFileInfo *b);
GFileInfo * _ostree_mode_uidgid_to_gfileinfo (mode_t mode, uid_t uid, gid_t gid);
static inline void
@ -134,6 +134,19 @@ static inline char * _ostree_get_commitpartial_path (const char *checksum)
return g_strconcat ("state/", checksum, ".commitpartial", NULL);
}
gboolean
_ostree_validate_bareuseronly_mode (guint32 mode,
const char *checksum,
GError **error);
static inline gboolean
_ostree_validate_bareuseronly_mode_finfo (GFileInfo *finfo,
const char *checksum,
GError **error)
{
const guint32 content_mode = g_file_info_get_attribute_uint32 (finfo, "unix::mode");
return _ostree_validate_bareuseronly_mode (content_mode, checksum, error);
}
gboolean
_ostree_parse_delta_name (const char *delta_name,
char **out_from,

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -33,6 +32,13 @@
#include "ostree-chain-input-stream.h"
#include "otutil.h"
/* Generic ABI checks */
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE == 0);
G_STATIC_ASSERT(OSTREE_REPO_MODE_ARCHIVE_Z2 == 1);
G_STATIC_ASSERT(OSTREE_REPO_MODE_ARCHIVE == OSTREE_REPO_MODE_ARCHIVE_Z2);
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE_USER == 2);
G_STATIC_ASSERT(OSTREE_REPO_MODE_BARE_USER_ONLY == 3);
#define ALIGN_VALUE(this, boundary) \
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
@ -1525,7 +1531,7 @@ _ostree_loose_path (char *buf,
buf++;
snprintf (buf, _OSTREE_LOOSE_PATH_MAX - 2, "/%s.%s%s",
checksum + 2, ostree_object_type_to_string (objtype),
(!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE_Z2) ? "z" : "");
(!OSTREE_OBJECT_TYPE_IS_META (objtype) && mode == OSTREE_REPO_MODE_ARCHIVE) ? "z" : "");
}
/**
@ -1562,12 +1568,52 @@ _ostree_stbuf_to_gfileinfo (const struct stat *stbuf)
g_file_info_set_attribute_uint32 (ret, "unix::uid", stbuf->st_uid);
g_file_info_set_attribute_uint32 (ret, "unix::gid", stbuf->st_gid);
g_file_info_set_attribute_uint32 (ret, "unix::mode", mode);
/* those aren't stored by ostree, but used by the devino cache */
g_file_info_set_attribute_uint32 (ret, "unix::device", stbuf->st_dev);
g_file_info_set_attribute_uint64 (ret, "unix::inode", stbuf->st_ino);
if (S_ISREG (mode))
g_file_info_set_attribute_uint64 (ret, "standard::size", stbuf->st_size);
return ret;
}
/**
* _ostree_gfileinfo_equal:
* @a: First file info
* @b: Second file info
*
* OSTree only cares about a subset of file attributes. This function
* checks whether two #GFileInfo objects are equal as far as OSTree is
* concerned.
*
* Returns: TRUE if the #GFileInfo objects are OSTree-equivalent.
*/
gboolean
_ostree_gfileinfo_equal (GFileInfo *a, GFileInfo *b)
{
/* trivial case */
if (a == b)
return TRUE;
#define CHECK_ONE_ATTR(type, attr, a, b) \
do { if (g_file_info_get_attribute_##type(a, attr) != \
g_file_info_get_attribute_##type(b, attr)) \
return FALSE; \
} while (0)
CHECK_ONE_ATTR (uint32, "unix::uid", a, b);
CHECK_ONE_ATTR (uint32, "unix::gid", a, b);
CHECK_ONE_ATTR (uint32, "unix::mode", a, b);
CHECK_ONE_ATTR (uint32, "standard::type", a, b);
CHECK_ONE_ATTR (uint64, "standard::size", a, b);
#undef CHECK_ONE_ATTR
return TRUE;
}
GFileInfo *
_ostree_mode_uidgid_to_gfileinfo (mode_t mode, uid_t uid, gid_t gid)
{
@ -1998,6 +2044,29 @@ ostree_validate_structureof_dirtree (GVariant *dirtree,
return TRUE;
}
/* This bit mirrors similar code in commit_loose_regfile_object() for the
* bare-user-only mode. It's opt-in though for all pulls.
*/
gboolean
_ostree_validate_bareuseronly_mode (guint32 content_mode,
const char *checksum,
GError **error)
{
if (S_ISREG (content_mode))
{
const guint32 invalid_modebits = ((content_mode & ~S_IFMT) & ~0775);
if (invalid_modebits > 0)
return glnx_throw (error, "Content object %s: invalid mode 0%04o with bits 0%04o",
checksum, content_mode, invalid_modebits);
}
else if (S_ISLNK (content_mode))
; /* Nothing */
else
g_assert_not_reached ();
return TRUE;
}
static gboolean
validate_stat_mode_perms (guint32 mode,
GError **error)

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -181,7 +180,8 @@ typedef enum {
/**
* OstreeRepoMode:
* @OSTREE_REPO_MODE_BARE: Files are stored as themselves; checkouts are hardlinks; can only be written as root
* @OSTREE_REPO_MODE_ARCHIVE_Z2: Files are compressed, should be owned by non-root. Can be served via HTTP
* @OSTREE_REPO_MODE_ARCHIVE: Files are compressed, should be owned by non-root. Can be served via HTTP. Since: 2017.12
* @OSTREE_REPO_MODE_ARCHIVE_Z2: Legacy alias for `OSTREE_REPO_MODE_ARCHIVE`
* @OSTREE_REPO_MODE_BARE_USER: Files are stored as themselves, except ownership; can be written by user. Hardlinks work only in user checkouts.
* @OSTREE_REPO_MODE_BARE_USER_ONLY: Same as BARE_USER, but all metadata is not stored, so it can only be used for user checkouts. Does not need xattrs.
*
@ -190,7 +190,8 @@ typedef enum {
*/
typedef enum {
OSTREE_REPO_MODE_BARE,
OSTREE_REPO_MODE_ARCHIVE_Z2,
OSTREE_REPO_MODE_ARCHIVE,
OSTREE_REPO_MODE_ARCHIVE_Z2 = OSTREE_REPO_MODE_ARCHIVE,
OSTREE_REPO_MODE_BARE_USER,
OSTREE_REPO_MODE_BARE_USER_ONLY,
} OstreeRepoMode;

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2015 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -27,6 +26,16 @@
#include "ostree-repo-private.h"
#include "otutil.h"
/* See ostree-repo.c for a bit more info about these ABI checks */
#if __SIZEOF_POINTER__ == 8 && __SIZEOF_LONG__ == 8 && __SIZEOF_INT__ == 4
G_STATIC_ASSERT(sizeof(OstreeDiffDirsOptions) ==
sizeof(int) * 2 +
sizeof(gpointer) +
sizeof(int) * (7+6) +
sizeof(int) + /* hole */
sizeof(gpointer) * 7);
#endif
static gboolean
get_file_checksum (OstreeDiffFlags flags,
GFile *f,

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -86,6 +85,7 @@ typedef struct {
gboolean unused_bools[7];
int unused_ints[6];
/* 4 byte hole on 64 bit */
gpointer unused_ptrs[7];
} OstreeDiffDirsOptions;

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2016 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -379,14 +378,13 @@ check_multi_info (OstreeFetcher *fetcher)
g_autoptr(GError) local_error = NULL;
GError **error = &local_error;
/* TODO - share file naming with soup, and fix it */
g_autofree char *tmpfile_path =
g_compute_checksum_for_string (G_CHECKSUM_SHA256,
eff_url, strlen (eff_url));
ostree_fetcher_generate_url_tmpname (eff_url);
if (!ensure_tmpfile (req, error))
{
g_task_return_error (task, g_steal_pointer (&local_error));
}
/* This should match the libsoup chmod */
else if (fchmod (req->tmpf.fd, 0644) < 0)
{
glnx_set_error_from_errno (error);
@ -748,6 +746,24 @@ initiate_next_curl_request (FetcherRequest *req,
if (self->tls_client_cert_path)
{
/* Support for pkcs11:
* https://github.com/ostreedev/ostree/pull/1183
* This will be used by https://github.com/advancedtelematic/aktualizr
* at least to fetch certificates. No test coverage at the moment
* though. See https://gitlab.com/gnutls/gnutls/tree/master/tests/pkcs11
* and https://github.com/opendnssec/SoftHSMv2 and
* https://github.com/p11-glue/p11-kit/tree/master/p11-kit for
* possible ideas there.
*/
if (g_str_has_prefix (self->tls_client_key_path, "pkcs11:"))
{
curl_easy_setopt (req->easy, CURLOPT_SSLENGINE, "pkcs11");
curl_easy_setopt (req->easy, CURLOPT_SSLENGINE_DEFAULT, 1L);
curl_easy_setopt (req->easy, CURLOPT_SSLKEYTYPE, "ENG");
}
if (g_str_has_prefix (self->tls_client_cert_path, "pkcs11:"))
curl_easy_setopt (req->easy, CURLOPT_SSLCERTTYPE, "ENG");
curl_easy_setopt (req->easy, CURLOPT_SSLCERT, self->tls_client_cert_path);
curl_easy_setopt (req->easy, CURLOPT_SSLKEY, self->tls_client_key_path);
}

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -55,10 +54,7 @@ typedef struct {
volatile gint running;
GError *initialization_error; /* Any failure to load the db */
int tmpdir_dfd;
char *remote_name;
char *tmpdir_name;
GLnxLockFile tmpdir_lock;
int base_tmpdir_dfd;
GVariant *extra_headers;
@ -94,7 +90,7 @@ typedef struct {
gboolean is_membuf;
OstreeFetcherRequestFlags flags;
GInputStream *request_body;
char *out_tmpfile;
GLnxTmpfile tmpf;
GOutputStream *out_stream;
guint64 max_size;
@ -155,17 +151,6 @@ thread_closure_unref (ThreadClosure *thread_closure)
g_clear_pointer (&thread_closure->extra_headers, (GDestroyNotify)g_variant_unref);
if (thread_closure->tmpdir_dfd != -1)
close (thread_closure->tmpdir_dfd);
/* Note: We don't remove the tmpdir here, because that would cause
us to not reuse it on resume. This happens because we use two
fetchers for each pull, so finalizing the first one would remove
all the files to be resumed from the previous second one */
g_free (thread_closure->tmpdir_name);
glnx_release_lock_file (&thread_closure->tmpdir_lock);
g_clear_pointer (&thread_closure->output_stream_set, g_hash_table_unref);
g_mutex_clear (&thread_closure->output_stream_set_lock);
@ -210,7 +195,7 @@ pending_uri_unref (OstreeFetcherPendingURI *pending)
g_free (pending->filename);
g_clear_object (&pending->request);
g_clear_object (&pending->request_body);
g_free (pending->out_tmpfile);
glnx_tmpfile_clear (&pending->tmpf);
g_clear_object (&pending->out_stream);
g_free (pending);
}
@ -477,58 +462,6 @@ session_thread_request_uri (ThreadClosure *thread_closure,
}
else
{
g_autofree char *uristring
= soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
g_autofree char *tmpfile = NULL;
struct stat stbuf;
gboolean exists;
/* The tmp directory is lazily created for each fetcher instance,
* since it may require superuser permissions and some instances
* only need _ostree_fetcher_request_uri_to_membuf() which keeps
* everything in memory buffers. */
if (thread_closure->tmpdir_name == NULL)
{
if (!_ostree_repo_allocate_tmpdir (thread_closure->base_tmpdir_dfd,
OSTREE_REPO_TMPDIR_FETCHER,
&thread_closure->tmpdir_name,
&thread_closure->tmpdir_dfd,
&thread_closure->tmpdir_lock,
NULL,
cancellable,
&local_error))
{
g_task_return_error (task, local_error);
return;
}
}
tmpfile = g_compute_checksum_for_string (G_CHECKSUM_SHA256, uristring, strlen (uristring));
if (fstatat (thread_closure->tmpdir_dfd, tmpfile, &stbuf, AT_SYMLINK_NOFOLLOW) == 0)
exists = TRUE;
else
{
if (errno == ENOENT)
exists = FALSE;
else
{
glnx_set_error_from_errno (&local_error);
g_task_return_error (task, local_error);
return;
}
}
if (SOUP_IS_REQUEST_HTTP (pending->request))
{
glnx_unref_object SoupMessage *msg = NULL;
msg = soup_request_http_get_message ((SoupRequestHTTP*) pending->request);
if (exists && stbuf.st_size > 0)
soup_message_headers_set_range (msg->request_headers, stbuf.st_size, -1);
}
pending->out_tmpfile = tmpfile;
tmpfile = NULL; /* Transfer ownership */
start_pending_request (thread_closure, task);
}
}
@ -658,7 +591,6 @@ _ostree_fetcher_constructed (GObject *object)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
g_autoptr(GMainContext) main_context = NULL;
GLnxLockFile empty_lockfile = GLNX_LOCK_FILE_INIT;
const char *http_proxy;
main_context = g_main_context_new ();
@ -668,8 +600,6 @@ _ostree_fetcher_constructed (GObject *object)
self->thread_closure->main_context = g_main_context_ref (main_context);
self->thread_closure->running = 1;
self->thread_closure->transfer_gzip = (self->config_flags & OSTREE_FETCHER_FLAGS_TRANSFER_GZIP) != 0;
self->thread_closure->tmpdir_dfd = -1;
self->thread_closure->tmpdir_lock = empty_lockfile;
self->thread_closure->outstanding = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)pending_uri_unref);
self->thread_closure->output_stream_set = g_hash_table_new_full (NULL, NULL,
@ -749,7 +679,7 @@ _ostree_fetcher_new (int tmpdir_dfd,
int
_ostree_fetcher_get_dfd (OstreeFetcher *fetcher)
{
return fetcher->thread_closure->tmpdir_dfd;
return fetcher->thread_closure->base_tmpdir_dfd;
}
void
@ -874,14 +804,9 @@ finish_stream (OstreeFetcherPendingURI *pending,
if (!pending->is_membuf)
{
if (fstatat (pending->thread_closure->tmpdir_dfd,
pending->out_tmpfile,
&stbuf, AT_SYMLINK_NOFOLLOW) != 0)
{
glnx_set_error_from_errno (error);
if (!glnx_fstat (pending->tmpf.fd, &stbuf, error))
goto out;
}
}
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
@ -973,11 +898,39 @@ on_stream_read (GObject *object,
pending = g_task_get_task_data (task);
cancellable = g_task_get_cancellable (task);
/* Only open the output stream on demand to ensure we use as
* few file descriptors as possible.
*/
if (!pending->out_stream)
{
if (!pending->is_membuf)
{
if (!glnx_open_tmpfile_linkable_at (pending->thread_closure->base_tmpdir_dfd, ".",
O_WRONLY | O_CLOEXEC, &pending->tmpf, &local_error))
goto out;
/* This should match the libcurl chmod */
if (!glnx_fchmod (pending->tmpf.fd, 0644, &local_error))
goto out;
pending->out_stream = g_unix_output_stream_new (pending->tmpf.fd, FALSE);
}
else
{
pending->out_stream = g_memory_output_stream_new_resizable ();
}
g_mutex_lock (&pending->thread_closure->output_stream_set_lock);
g_hash_table_add (pending->thread_closure->output_stream_set,
g_object_ref (pending->out_stream));
g_mutex_unlock (&pending->thread_closure->output_stream_set_lock);
}
/* Get a GBytes buffer */
bytes = g_input_stream_read_bytes_finish ((GInputStream*)object, result, &local_error);
if (!bytes)
goto out;
bytes_read = g_bytes_get_size (bytes);
/* Was this the end of the stream? */
if (bytes_read == 0)
{
if (!finish_stream (pending, cancellable, &local_error))
@ -990,14 +943,24 @@ on_stream_read (GObject *object,
}
else
{
g_autofree char *uristring =
soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
g_autofree char *tmpfile_path =
ostree_fetcher_generate_url_tmpname (uristring);
if (!glnx_link_tmpfile_at (&pending->tmpf, GLNX_LINK_TMPFILE_REPLACE,
pending->thread_closure->base_tmpdir_dfd, tmpfile_path,
&local_error))
g_task_return_error (task, g_steal_pointer (&local_error));
else
g_task_return_pointer (task,
g_strdup (pending->out_tmpfile),
g_steal_pointer (&tmpfile_path),
(GDestroyNotify) g_free);
}
remove_pending (pending);
}
else
{
/* Verify max size */
if (pending->max_size > 0)
{
if (bytes_read > pending->max_size ||
@ -1063,19 +1026,7 @@ on_request_sent (GObject *object,
if (SOUP_IS_REQUEST_HTTP (object))
{
msg = soup_request_http_get_message ((SoupRequestHTTP*) object);
if (!pending->is_membuf &&
msg->status_code == SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE)
{
// We already have the whole file, so just use it.
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
(void) g_input_stream_close (pending->request_body, NULL, NULL);
g_task_return_pointer (task,
g_strdup (pending->out_tmpfile),
(GDestroyNotify) g_free);
remove_pending (pending);
goto out;
}
else if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
{
/* is there another mirror we can try? */
if (pending->mirrorlist_idx + 1 < pending->mirrorlist->len)
@ -1091,8 +1042,8 @@ on_request_sent (GObject *object,
}
else
{
g_autofree char *uristring
= soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
g_autofree char *uristring =
soup_uri_to_string (soup_request_get_uri (pending->request), FALSE);
GIOErrorEnum code;
switch (msg->status_code)
@ -1143,38 +1094,6 @@ on_request_sent (GObject *object,
pending->content_length = soup_request_get_content_length (pending->request);
if (!pending->is_membuf)
{
int oflags = O_CREAT | O_WRONLY | O_CLOEXEC;
int fd;
/* If we got partial content, we can append; if the server
* ignored our range request, we need to truncate.
*/
if (msg && msg->status_code == SOUP_STATUS_PARTIAL_CONTENT)
oflags |= O_APPEND;
else
oflags |= O_TRUNC;
fd = openat (pending->thread_closure->tmpdir_dfd,
pending->out_tmpfile, oflags, 0666);
if (fd == -1)
{
glnx_set_error_from_errno (&local_error);
goto out;
}
pending->out_stream = g_unix_output_stream_new (fd, TRUE);
}
else
{
pending->out_stream = g_memory_output_stream_new_resizable ();
}
g_mutex_lock (&pending->thread_closure->output_stream_set_lock);
g_hash_table_add (pending->thread_closure->output_stream_set,
g_object_ref (pending->out_stream));
g_mutex_unlock (&pending->thread_closure->output_stream_set_lock);
g_input_stream_read_bytes_async (pending->request_body,
8192, G_PRIORITY_DEFAULT,
cancellable,

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011,2017 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2016 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -26,6 +25,16 @@
G_BEGIN_DECLS
/* FIXME - delete this and replace by having fetchers simply
* return O_TMPFILE fds, not file paths.
*/
static inline char *
ostree_fetcher_generate_url_tmpname (const char *url)
{
return g_compute_checksum_for_string (G_CHECKSUM_SHA256,
url, strlen (url));
}
gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
GPtrArray *mirrorlist,
const char *filename,

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2012 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2013 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
*

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2013 Sjoerd Simons <sjoerd.simons@collabora.co.uk>
*

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013,2014 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2013,2014 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2016 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@redhat.com>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@redhat.com>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- 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

View File

@ -1,5 +1,4 @@
/* -*- 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

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright © 2011 Colin Walters <walters@verbum.org>
* Copyright © 2015 Red Hat, Inc.
* Copyright © 2017 Endless Mobile, Inc.
@ -36,17 +35,24 @@
G_BEGIN_DECLS
/* @refspec_name is set if this is a dynamic remote. Its the name of the static
* remote which this one inherits from, and is what should be used in refspecs
* for pulls from this remote. If its %NULL, @name should be used instead. */
struct OstreeRemote {
volatile int ref_count;
char *name; /* (not nullable) */
char *refspec_name; /* (nullable) */
char *group; /* group name in options (not nullable) */
char *keyring; /* keyring name (NAME.trustedkeys.gpg) (not nullable) */
char *keyring; /* keyring name ($refspec_name.trustedkeys.gpg) (not nullable) */
GFile *file; /* NULL if remote defined in repo/config */
GKeyFile *options;
};
G_GNUC_INTERNAL
OstreeRemote *ostree_remote_new (const gchar *name);
G_GNUC_INTERNAL
OstreeRemote *ostree_remote_new_dynamic (const gchar *name,
const gchar *refspec_name);
G_GNUC_INTERNAL
OstreeRemote *ostree_remote_new_from_keyfile (GKeyFile *keyfile,

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright © 2011 Colin Walters <walters@verbum.org>
* Copyright © 2015 Red Hat, Inc.
* Copyright © 2017 Endless Mobile, Inc.
@ -54,16 +53,25 @@
OstreeRemote *
ostree_remote_new (const gchar *name)
{
return ostree_remote_new_dynamic (name, NULL);
}
OstreeRemote *
ostree_remote_new_dynamic (const gchar *name,
const gchar *refspec_name)
{
OstreeRemote *remote;
g_return_val_if_fail (name != NULL && *name != '\0', NULL);
g_return_val_if_fail (refspec_name == NULL || *refspec_name != '\0', NULL);
remote = g_slice_new0 (OstreeRemote);
remote->ref_count = 1;
remote->name = g_strdup (name);
remote->group = g_strdup_printf ("remote \"%s\"", name);
remote->keyring = g_strdup_printf ("%s.trustedkeys.gpg", name);
remote->refspec_name = g_strdup (refspec_name);
remote->group = g_strdup_printf ("remote \"%s\"", (refspec_name != NULL) ? refspec_name : name);
remote->keyring = g_strdup_printf ("%s.trustedkeys.gpg", (refspec_name != NULL) ? refspec_name : name);
remote->options = g_key_file_new ();
return remote;

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright © 2011 Colin Walters <walters@verbum.org>
* Copyright © 2015 Red Hat, Inc.
* Copyright © 2017 Endless Mobile, Inc.

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -303,11 +302,11 @@ create_file_copy_from_input_at (OstreeRepo *repo,
return FALSE;
/* The add/union/none behaviors map directly to GLnxLinkTmpfileReplaceMode */
GLnxLinkTmpfileReplaceMode replace_mode;
GLnxLinkTmpfileReplaceMode replace_mode = GLNX_LINK_TMPFILE_NOREPLACE;
switch (options->overwrite_mode)
{
case OSTREE_REPO_CHECKOUT_OVERWRITE_NONE:
replace_mode = GLNX_LINK_TMPFILE_NOREPLACE;
/* Handled above */
break;
case OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES:
replace_mode = GLNX_LINK_TMPFILE_REPLACE;
@ -338,6 +337,41 @@ typedef enum {
HARDLINK_RESULT_LINKED
} HardlinkResult;
/* Used for OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES. In
* order to atomically replace a target, we add a new link
* in self->tmp_dir_fd, with a name placed into the mutable
* buffer @tmpname.
*/
static gboolean
hardlink_add_tmp_name (OstreeRepo *self,
int srcfd,
const char *loose_path,
char *tmpname,
GCancellable *cancellable,
GError **error)
{
const int max_attempts = 128;
guint i;
for (i = 0; i < max_attempts; i++)
{
glnx_gen_temp_name (tmpname);
if (linkat (srcfd, loose_path, self->tmp_dir_fd, tmpname, 0) < 0)
{
if (errno == EEXIST)
continue;
else
return glnx_throw_errno_prefix (error, "linkat");
}
else
break;
}
if (i == max_attempts)
return glnx_throw (error, "Exhausted attempts to make temporary hardlink");
return TRUE;
}
static gboolean
checkout_file_hardlink (OstreeRepo *self,
OstreeRepoCheckoutAtOptions *options,
@ -353,7 +387,6 @@ checkout_file_hardlink (OstreeRepo *self,
int srcfd = _ostree_repo_mode_is_bare (self->mode) ?
self->objects_dir_fd : self->uncompressed_objects_dir_fd;
again:
if (linkat (srcfd, loose_path, destination_dfd, destination_name, 0) == 0)
ret_result = HARDLINK_RESULT_LINKED;
else if (!options->no_copy_fallback && (errno == EMLINK || errno == EXDEV || errno == EPERM))
@ -380,27 +413,20 @@ checkout_file_hardlink (OstreeRepo *self,
ret_result = HARDLINK_RESULT_SKIP_EXISTED;
break;
case OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES:
{
/* Idiocy, from man rename(2)
*
* "If oldpath and newpath are existing hard links referring to
* the same file, then rename() does nothing, and returns a
* success status."
*
* So we can't make this atomic.
*/
(void) unlinkat (destination_dfd, destination_name, 0);
goto again;
}
case OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL:
{
/* In this mode, we error out on EEXIST *unless* the files are already
* hardlinked, which is what rpm-ostree wants for package layering.
* https://github.com/projectatomic/rpm-ostree/issues/982
/* In both union-files and union-identical, see if the src/target are
* already hardlinked. If they are, we're done.
*
* If not, for union-identical we error out, which is what
* rpm-ostree wants for package layering.
* https://github.com/projectatomic/rpm-ostree/issues/982
* This should be similar to the librpm version:
* https://github.com/rpm-software-management/rpm/blob/e3cd2bc85e0578f158d14e6f9624eb955c32543b/lib/rpmfi.c#L921
* in rpmfilesCompare().
*
* For union-files, we make a temporary link, then rename() it
* into place.
*/
struct stat src_stbuf;
if (!glnx_fstatat (srcfd, loose_path, &src_stbuf,
@ -413,10 +439,25 @@ checkout_file_hardlink (OstreeRepo *self,
const gboolean is_identical =
(src_stbuf.st_dev == dest_stbuf.st_dev &&
src_stbuf.st_ino == dest_stbuf.st_ino);
if (is_identical)
ret_result = HARDLINK_RESULT_SKIP_EXISTED;
else if (options->overwrite_mode == OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES)
{
char *tmpname = strdupa ("checkout-union-XXXXXX");
/* Make a link with a temp name */
if (!hardlink_add_tmp_name (self, srcfd, loose_path, tmpname, cancellable, error))
return FALSE;
/* Rename it into place */
if (!glnx_renameat (self->tmp_dir_fd, tmpname, destination_dfd, destination_name, error))
return FALSE;
ret_result = HARDLINK_RESULT_LINKED;
}
else
{
g_assert_cmpint (options->overwrite_mode, ==, OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL);
return glnx_throw_errno_prefix (error, "Hardlinking %s to %s", loose_path, destination_name);
}
break;
}
}
@ -495,7 +536,7 @@ checkout_one_file_at (OstreeRepo *repo,
(repo_is_usermode && options->mode == OSTREE_REPO_CHECKOUT_MODE_USER);
gboolean current_can_cache = (options->enable_uncompressed_cache
&& current_repo->enable_uncompressed_cache);
gboolean is_archive_z2_with_cache = (current_repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
gboolean is_archive_z2_with_cache = (current_repo->mode == OSTREE_REPO_MODE_ARCHIVE
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER
&& current_can_cache);
@ -567,7 +608,7 @@ checkout_one_file_at (OstreeRepo *repo,
&& !is_whiteout
&& !is_symlink
&& need_copy
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
{
HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED;

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011,2013 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or
@ -140,7 +139,7 @@ _ostree_repo_commit_tmpf_final (OstreeRepo *self,
int dest_dfd;
if (self->in_transaction)
dest_dfd = self->commit_stagedir_fd;
dest_dfd = self->commit_stagedir.fd;
else
dest_dfd = self->objects_dir_fd;
@ -173,7 +172,7 @@ _ostree_repo_commit_path_final (OstreeRepo *self,
int dest_dfd;
if (self->in_transaction)
dest_dfd = self->commit_stagedir_fd;
dest_dfd = self->commit_stagedir.fd;
else
dest_dfd = self->objects_dir_fd;
@ -216,7 +215,7 @@ commit_loose_regfile_object (OstreeRepo *self,
/* We may be writing as root to a non-root-owned repository; if so,
* automatically inherit the non-root ownership.
*/
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2
if (self->mode == OSTREE_REPO_MODE_ARCHIVE
&& self->target_owner_uid != -1)
{
if (fchown (tmpf->fd, self->target_owner_uid, self->target_owner_gid) < 0)
@ -262,10 +261,8 @@ commit_loose_regfile_object (OstreeRepo *self,
}
else if (self->mode == OSTREE_REPO_MODE_BARE_USER_ONLY)
{
guint32 invalid_modebits = (mode & ~S_IFMT) & ~0775;
if (invalid_modebits > 0)
return glnx_throw (error, "Invalid mode 0%04o with bits 0%04o in bare-user-only repository",
mode, invalid_modebits);
if (!_ostree_validate_bareuseronly_mode (mode, checksum, error))
return FALSE;
if (!glnx_fchmod (tmpf->fd, mode, error))
return FALSE;
@ -606,7 +603,7 @@ write_content_object (OstreeRepo *self,
cancellable, error))
return FALSE;
}
else if (repo_mode != OSTREE_REPO_MODE_ARCHIVE_Z2)
else if (repo_mode != OSTREE_REPO_MODE_ARCHIVE)
{
if (!create_regular_tmpfile_linkable_with_content (self, size, file_input,
&tmpf, cancellable, error))
@ -619,7 +616,7 @@ write_content_object (OstreeRepo *self,
g_autoptr(GOutputStream) compressed_out_stream = NULL;
g_autoptr(GOutputStream) temp_out = NULL;
g_assert (repo_mode == OSTREE_REPO_MODE_ARCHIVE_Z2);
g_assert (repo_mode == OSTREE_REPO_MODE_ARCHIVE);
if (self->generate_sizes)
indexable = TRUE;
@ -935,7 +932,7 @@ scan_one_loose_devino (OstreeRepo *self,
gboolean skip;
switch (self->mode)
{
case OSTREE_REPO_MODE_ARCHIVE_Z2:
case OSTREE_REPO_MODE_ARCHIVE:
case OSTREE_REPO_MODE_BARE:
case OSTREE_REPO_MODE_BARE_USER:
case OSTREE_REPO_MODE_BARE_USER_ONLY:
@ -984,7 +981,7 @@ scan_loose_devino (OstreeRepo *self,
return FALSE;
}
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2)
if (self->mode == OSTREE_REPO_MODE_ARCHIVE)
{
if (!scan_one_loose_devino (self, self->uncompressed_objects_dir_fd, devino_cache,
cancellable, error))
@ -1114,8 +1111,7 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
gboolean ret_transaction_resume = FALSE;
if (!_ostree_repo_allocate_tmpdir (self->tmp_dir_fd,
self->stagedir_prefix,
&self->commit_stagedir_name,
&self->commit_stagedir_fd,
&self->commit_stagedir,
&self->commit_stagedir_lock,
&ret_transaction_resume,
cancellable, error))
@ -1134,7 +1130,7 @@ rename_pending_loose_objects (OstreeRepo *self,
GLNX_AUTO_PREFIX_ERROR ("rename pending", error);
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
if (!glnx_dirfd_iterator_init_at (self->commit_stagedir_fd, ".", FALSE, &dfd_iter, error))
if (!glnx_dirfd_iterator_init_at (self->commit_stagedir.fd, ".", FALSE, &dfd_iter, error))
return FALSE;
/* Iterate over the outer checksum dir */
@ -1188,7 +1184,7 @@ rename_pending_loose_objects (OstreeRepo *self,
renamed_some_object = TRUE;
}
if (renamed_some_object)
if (renamed_some_object && !self->disable_fsync)
{
/* Ensure that in the case of a power cut all the directory metadata that
we want has reached the disk. In particular, we want this before we
@ -1209,11 +1205,13 @@ rename_pending_loose_objects (OstreeRepo *self,
}
/* In case we created any loose object subdirs, make sure they are on disk */
if (!self->disable_fsync)
{
if (fsync (self->objects_dir_fd) == -1)
return glnx_throw_errno_prefix (error, "fsync");
}
if (!glnx_shutil_rm_rf_at (self->tmp_dir_fd, self->commit_stagedir_name,
cancellable, error))
if (!glnx_tmpdir_delete (&self->commit_stagedir, cancellable, error))
return FALSE;
return TRUE;
@ -1236,7 +1234,7 @@ cleanup_tmpdir (OstreeRepo *self,
guint64 delta;
struct dirent *dent;
struct stat stbuf;
g_auto(GLnxLockFile) lockfile = GLNX_LOCK_FILE_INIT;
g_auto(GLnxLockFile) lockfile = { 0, };
gboolean did_lock;
if (!glnx_dirfd_iterator_next_dent (&dfd_iter, &dent, cancellable, error))
@ -1251,12 +1249,10 @@ cleanup_tmpdir (OstreeRepo *self,
if (strcmp (dent->d_name, "cache") == 0)
continue;
if (TEMP_FAILURE_RETRY (fstatat (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW)) < 0)
{
if (!glnx_fstatat_allow_noent (dfd_iter.fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
if (errno == ENOENT) /* Did another cleanup win? */
continue;
return glnx_throw_errno_prefix (error, "fstatat(%s)", dent->d_name);
}
/* First, if it's a directory which needs locking, but it's
* busy, skip it.
@ -1284,13 +1280,6 @@ cleanup_tmpdir (OstreeRepo *self,
if (!glnx_shutil_rm_rf_at (dfd_iter.fd, dent->d_name, cancellable, error))
return glnx_prefix_error (error, "Removing %s", dent->d_name);
}
/* FIXME - move OSTREE_REPO_TMPDIR_FETCHER underneath the
* staging/boot-id scheme as well, since all of the "did it get
* fsync'd" concerns apply to that as well. Then we can skip
* this special case.
*/
else if (g_str_has_prefix (dent->d_name, OSTREE_REPO_TMPDIR_FETCHER))
continue;
else
{
/* Now we do time-based cleanup. Ignore it if it's somehow
@ -1528,10 +1517,11 @@ ostree_repo_commit_transaction (OstreeRepo *self,
if ((self->test_error_flags & OSTREE_REPO_TEST_ERROR_PRE_COMMIT) > 0)
return glnx_throw (error, "OSTREE_REPO_TEST_ERROR_PRE_COMMIT specified");
/* FIXME: Added since valgrind in el7 doesn't know about
* `syncfs`...we should delete this later.
/* FIXME: Added OSTREE_SUPPRESS_SYNCFS since valgrind in el7 doesn't know
* about `syncfs`...we should delete this later.
*/
if (g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL)
if (!self->disable_fsync &&
g_getenv ("OSTREE_SUPPRESS_SYNCFS") == NULL)
{
if (syncfs (self->tmp_dir_fd) < 0)
return glnx_throw_errno_prefix (error, "syncfs");
@ -1556,15 +1546,8 @@ ostree_repo_commit_transaction (OstreeRepo *self,
return FALSE;
g_clear_pointer (&self->txn_collection_refs, g_hash_table_destroy);
if (self->commit_stagedir_fd != -1)
{
(void) close (self->commit_stagedir_fd);
self->commit_stagedir_fd = -1;
glnx_tmpdir_unset (&self->commit_stagedir);
glnx_release_lock_file (&self->commit_stagedir_lock);
}
g_clear_pointer (&self->commit_stagedir_name, g_free);
self->in_transaction = FALSE;
@ -1595,14 +1578,8 @@ ostree_repo_abort_transaction (OstreeRepo *self,
g_clear_pointer (&self->txn_refs, g_hash_table_destroy);
g_clear_pointer (&self->txn_collection_refs, g_hash_table_destroy);
if (self->commit_stagedir_fd != -1)
{
(void) close (self->commit_stagedir_fd);
self->commit_stagedir_fd = -1;
glnx_tmpdir_unset (&self->commit_stagedir);
glnx_release_lock_file (&self->commit_stagedir_lock);
}
g_clear_pointer (&self->commit_stagedir_name, g_free);
self->in_transaction = FALSE;
@ -2093,22 +2070,10 @@ ostree_repo_write_commit (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
GDateTime *now = NULL;
now = g_date_time_new_now_utc ();
ret = ostree_repo_write_commit_with_time (self,
parent,
subject,
body,
metadata,
root,
g_date_time_to_unix (now),
out_commit,
cancellable,
error);
g_date_time_unref (now);
return ret;
g_autoptr(GDateTime) now = g_date_time_new_now_utc ();
return ostree_repo_write_commit_with_time (self, parent, subject, body,
metadata, root, g_date_time_to_unix (now),
out_commit, cancellable, error);
}
/**
@ -2188,8 +2153,8 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo *self,
_ostree_loose_path (buf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
g_autoptr(GVariant) ret_metadata = NULL;
if (self->commit_stagedir_fd != -1 &&
!ot_util_variant_map_at (self->commit_stagedir_fd, buf,
if (self->commit_stagedir.initialized &&
!ot_util_variant_map_at (self->commit_stagedir.fd, buf,
G_VARIANT_TYPE ("a{sv}"),
OT_VARIANT_MAP_ALLOW_NOENT | OT_VARIANT_MAP_TRUSTED, &ret_metadata, error))
return glnx_prefix_error (error, "Unable to read existing detached metadata");
@ -2229,23 +2194,19 @@ ostree_repo_write_commit_detached_metadata (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
char pathbuf[_OSTREE_LOOSE_PATH_MAX];
g_autoptr(GVariant) normalized = NULL;
gsize normalized_size = 0;
const guint8 *data = NULL;
int dest_dfd;
if (self->in_transaction)
dest_dfd = self->commit_stagedir_fd;
dest_dfd = self->commit_stagedir.fd;
else
dest_dfd = self->objects_dir_fd;
_ostree_loose_path (pathbuf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
if (!_ostree_repo_ensure_loose_objdir_at (dest_dfd, checksum,
cancellable, error))
return FALSE;
g_autoptr(GVariant) normalized = NULL;
gsize normalized_size = 0;
const guint8 *data = NULL;
if (metadata != NULL)
{
normalized = g_variant_get_normal_form (metadata);
@ -2256,6 +2217,8 @@ ostree_repo_write_commit_detached_metadata (OstreeRepo *self,
if (data == NULL)
data = (guint8*)"";
char pathbuf[_OSTREE_LOOSE_PATH_MAX];
_ostree_loose_path (pathbuf, checksum, OSTREE_OBJECT_TYPE_COMMIT_META, self->mode);
if (!glnx_file_replace_contents_at (dest_dfd, pathbuf,
data, normalized_size,
0, cancellable, error))
@ -2273,14 +2236,11 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
GHashTable *dir_metadata_checksums)
{
GVariantBuilder files_builder;
GVariantBuilder dirs_builder;
GSList *sorted_filenames = NULL;
GSList *iter;
GVariant *serialized_tree;
g_variant_builder_init (&files_builder, G_VARIANT_TYPE ("a(say)"));
GVariantBuilder dirs_builder;
g_variant_builder_init (&dirs_builder, G_VARIANT_TYPE ("a(sayay)"));
GSList *sorted_filenames = NULL;
GLNX_HASH_TABLE_FOREACH (file_checksums, const char*, name)
{
/* Should have been validated earlier, but be paranoid */
@ -2288,10 +2248,8 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
sorted_filenames = g_slist_prepend (sorted_filenames, (char*)name);
}
sorted_filenames = g_slist_sort (sorted_filenames, (GCompareFunc)strcmp);
for (iter = sorted_filenames; iter; iter = iter->next)
for (GSList *iter = sorted_filenames; iter; iter = iter->next)
{
const char *name = iter->data;
const char *value;
@ -2300,25 +2258,20 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
g_variant_builder_add (&files_builder, "(s@ay)", name,
ostree_checksum_to_bytes_v (value));
}
g_slist_free (sorted_filenames);
sorted_filenames = NULL;
GLNX_HASH_TABLE_FOREACH (dir_metadata_checksums, const char*, name)
sorted_filenames = g_slist_prepend (sorted_filenames, (char*)name);
sorted_filenames = g_slist_sort (sorted_filenames, (GCompareFunc)strcmp);
for (iter = sorted_filenames; iter; iter = iter->next)
for (GSList *iter = sorted_filenames; iter; iter = iter->next)
{
const char *name = iter->data;
const char *content_checksum;
const char *meta_checksum;
const char *content_checksum = g_hash_table_lookup (dir_contents_checksums, name);
const char *meta_checksum = g_hash_table_lookup (dir_metadata_checksums, name);
content_checksum = g_hash_table_lookup (dir_contents_checksums, name);
meta_checksum = g_hash_table_lookup (dir_metadata_checksums, name);
g_variant_builder_add (&dirs_builder, "(s@ay@ay)",
name,
g_variant_builder_add (&dirs_builder, "(s@ay@ay)", name,
ostree_checksum_to_bytes_v (content_checksum),
ostree_checksum_to_bytes_v (meta_checksum));
}
@ -2326,12 +2279,11 @@ create_tree_variant_from_hashes (GHashTable *file_checksums,
g_slist_free (sorted_filenames);
sorted_filenames = NULL;
serialized_tree = g_variant_new ("(@a(say)@a(sayay))",
GVariant *serialized_tree =
g_variant_new ("(@a(say)@a(sayay))",
g_variant_builder_end (&files_builder),
g_variant_builder_end (&dirs_builder));
g_variant_ref_sink (serialized_tree);
return serialized_tree;
return g_variant_ref_sink (serialized_tree);
}
/* If any filtering is set up, perform it, and return modified file info in
@ -2392,16 +2344,13 @@ _ostree_repo_commit_modifier_apply (OstreeRepo *self,
static char *
ptrarray_path_join (GPtrArray *path)
{
GString *path_buf;
path_buf = g_string_new ("");
GString *path_buf = g_string_new ("");
if (path->len == 0)
g_string_append_c (path_buf, '/');
else
{
guint i;
for (i = 0; i < path->len; i++)
for (guint i = 0; i < path->len; i++)
{
const char *elt = path->pdata[i];
@ -2414,7 +2363,7 @@ ptrarray_path_join (GPtrArray *path)
}
static gboolean
get_modified_xattrs (OstreeRepo *self,
get_final_xattrs (OstreeRepo *self,
OstreeRepoCommitModifier *modifier,
const char *relpath,
GFileInfo *file_info,
@ -2422,50 +2371,60 @@ get_modified_xattrs (OstreeRepo *self,
int dfd,
const char *dfd_subpath,
GVariant **out_xattrs,
gboolean *out_modified,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret_xattrs = NULL;
/* track whether the returned xattrs differ from the file on disk */
gboolean modified = TRUE;
const gboolean skip_xattrs = (modifier &&
modifier->flags & (OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS |
OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS)) > 0;
if (modifier && modifier->xattr_callback)
{
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 |
OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS)) > 0)
&& !self->disable_xattrs)
/* fetch on-disk xattrs if needed & not disabled */
g_autoptr(GVariant) original_xattrs = NULL;
if (!skip_xattrs && !self->disable_xattrs)
{
if (path && OSTREE_IS_REPO_FILE (path))
{
if (!ostree_repo_file_get_xattrs (OSTREE_REPO_FILE (path),
&ret_xattrs,
cancellable,
error))
if (!ostree_repo_file_get_xattrs (OSTREE_REPO_FILE (path), &original_xattrs,
cancellable, error))
return FALSE;
}
else if (path)
{
if (!glnx_dfd_name_get_all_xattrs (AT_FDCWD, gs_file_get_path_cached (path),
&ret_xattrs, cancellable, error))
&original_xattrs, cancellable, error))
return FALSE;
}
else if (dfd_subpath == NULL)
{
g_assert (dfd != -1);
if (!glnx_fd_get_all_xattrs (dfd, &ret_xattrs,
cancellable, error))
if (!glnx_fd_get_all_xattrs (dfd, &original_xattrs, cancellable, error))
return FALSE;
}
else
{
g_assert (dfd != -1);
if (!glnx_dfd_name_get_all_xattrs (dfd, dfd_subpath, &ret_xattrs,
if (!glnx_dfd_name_get_all_xattrs (dfd, dfd_subpath, &original_xattrs,
cancellable, error))
return FALSE;
}
g_assert (original_xattrs);
}
g_autoptr(GVariant) ret_xattrs = NULL;
if (modifier && modifier->xattr_callback)
{
ret_xattrs = modifier->xattr_callback (self, relpath, file_info,
modifier->xattr_user_data);
}
/* if callback returned NULL or didn't exist, default to on-disk state */
if (!ret_xattrs && original_xattrs)
ret_xattrs = g_variant_ref (original_xattrs);
if (modifier && modifier->sepolicy)
{
g_autofree char *label = NULL;
@ -2487,10 +2446,9 @@ get_modified_xattrs (OstreeRepo *self,
{
/* drop out any existing SELinux policy from the set, so we don't end up
* counting it twice in the checksum */
g_autoptr(GVariant) new_ret_xattrs = NULL;
new_ret_xattrs = _ostree_filter_selinux_xattr (ret_xattrs);
GVariant* new_ret_xattrs = _ostree_filter_selinux_xattr (ret_xattrs);
g_variant_unref (ret_xattrs);
ret_xattrs = g_steal_pointer (&new_ret_xattrs);
ret_xattrs = new_ret_xattrs;
}
/* ret_xattrs may be NULL */
@ -2509,8 +2467,13 @@ get_modified_xattrs (OstreeRepo *self,
}
}
if (original_xattrs && ret_xattrs && g_variant_equal (original_xattrs, ret_xattrs))
modified = FALSE;
if (out_xattrs)
*out_xattrs = g_steal_pointer (&ret_xattrs);
if (out_modified)
*out_modified = modified;
return TRUE;
}
@ -2531,6 +2494,10 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
/* Given either a dir_enum or a dfd_iter, writes the directory entry to the mtree. For
* subdirs, we go back through either write_dfd_iter_to_mtree_internal (dfd_iter case) or
* write_directory_to_mtree_internal (dir_enum case) which will do the actual dirmeta +
* dirent iteration. */
static gboolean
write_directory_content_to_mtree_internal (OstreeRepo *self,
OstreeRepoFile *repo_dir,
@ -2543,23 +2510,17 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GFile) child = NULL;
g_autoptr(GFileInfo) modified_info = NULL;
g_autoptr(OstreeMutableTree) child_mtree = NULL;
g_autofree char *child_relpath = NULL;
const char *name;
GFileType file_type;
OstreeRepoCommitFilterResult filter_result;
g_assert (dir_enum != NULL || dfd_iter != NULL);
name = g_file_info_get_name (child_info);
const char *name = g_file_info_get_name (child_info);
g_ptr_array_add (path, (char*)name);
if (modifier != NULL)
child_relpath = ptrarray_path_join (path);
g_autofree char *child_relpath = ptrarray_path_join (path);
filter_result = _ostree_repo_commit_modifier_apply (self, modifier, child_relpath, child_info, &modified_info);
g_autoptr(GFileInfo) modified_info = NULL;
OstreeRepoCommitFilterResult filter_result =
_ostree_repo_commit_modifier_apply (self, modifier, child_relpath, child_info, &modified_info);
const gboolean child_info_was_modified = !_ostree_gfileinfo_equal (child_info, modified_info);
if (filter_result != OSTREE_REPO_COMMIT_FILTER_ALLOW)
{
@ -2568,7 +2529,7 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
return TRUE;
}
file_type = g_file_info_get_file_type (child_info);
GFileType file_type = g_file_info_get_file_type (child_info);
switch (file_type)
{
case G_FILE_TYPE_DIRECTORY:
@ -2576,15 +2537,16 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
case G_FILE_TYPE_REGULAR:
break;
default:
return glnx_throw (error, "Unsupported file type: '%s'",
gs_file_get_path_cached (child));
return glnx_throw (error, "Unsupported file type for file: '%s'", child_relpath);
}
g_autoptr(GFile) child = NULL;
if (dir_enum != NULL)
child = g_file_enumerator_get_child (dir_enum, child_info);
if (file_type == G_FILE_TYPE_DIRECTORY)
{
g_autoptr(OstreeMutableTree) child_mtree = NULL;
if (!ostree_mutable_tree_ensure_dir (mtree, name, &child_mtree, error))
return FALSE;
@ -2620,16 +2582,26 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
else
{
guint64 file_obj_length;
const char *loose_checksum;
g_autoptr(GInputStream) file_input = NULL;
g_autoptr(GVariant) xattrs = NULL;
g_autoptr(GInputStream) file_object_input = NULL;
g_autofree guchar *child_file_csum = NULL;
g_autofree char *tmp_checksum = NULL;
loose_checksum = devino_cache_lookup (self, modifier,
g_file_info_get_attribute_uint32 (child_info, "unix::device"),
g_file_info_get_attribute_uint64 (child_info, "unix::inode"));
g_autoptr(GVariant) xattrs = NULL;
gboolean xattrs_were_modified;
if (!get_final_xattrs (self, modifier, child_relpath, child_info, child,
dfd_iter != NULL ? dfd_iter->fd : -1, name, &xattrs,
&xattrs_were_modified, cancellable, error))
return FALSE;
/* only check the devino cache if the file info & xattrs were not modified */
const char *loose_checksum = NULL;
if (!child_info_was_modified && !xattrs_were_modified)
{
guint32 dev = g_file_info_get_attribute_uint32 (child_info, "unix::device");
guint64 inode = g_file_info_get_attribute_uint64 (child_info, "unix::inode");
loose_checksum = devino_cache_lookup (self, modifier, dev, inode);
}
if (loose_checksum)
{
@ -2655,12 +2627,6 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
}
}
if (!get_modified_xattrs (self, modifier,
child_relpath, child_info, child, dfd_iter != NULL ? dfd_iter->fd : -1, name,
&xattrs,
cancellable, error))
return FALSE;
if (!ostree_raw_file_to_content_stream (file_input,
modified_info, xattrs,
&file_object_input, &file_obj_length,
@ -2683,6 +2649,8 @@ write_directory_content_to_mtree_internal (OstreeRepo *self,
return TRUE;
}
/* Handles the dirmeta for the given GFile dir and then calls
* write_directory_content_to_mtree_internal() for each directory entry. */
static gboolean
write_directory_to_mtree_internal (OstreeRepo *self,
GFile *dir,
@ -2732,10 +2700,8 @@ write_directory_to_mtree_internal (OstreeRepo *self,
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
{
if (!get_modified_xattrs (self, modifier, relpath, child_info,
dir, -1, NULL,
&xattrs,
cancellable, error))
if (!get_final_xattrs (self, modifier, relpath, child_info, dir, -1, NULL,
&xattrs, NULL, cancellable, error))
return FALSE;
g_autofree guchar *child_file_csum = NULL;
@ -2780,6 +2746,8 @@ write_directory_to_mtree_internal (OstreeRepo *self,
return TRUE;
}
/* Handles the dirmeta for the dir described by src_dfd_iter and then calls
* write_directory_content_to_mtree_internal() for each directory entry. */
static gboolean
write_dfd_iter_to_mtree_internal (OstreeRepo *self,
GLnxDirFdIterator *src_dfd_iter,
@ -2817,10 +2785,8 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
if (filter_result == OSTREE_REPO_COMMIT_FILTER_ALLOW)
{
if (!get_modified_xattrs (self, modifier, relpath, modified_info,
NULL, src_dfd_iter->fd, NULL,
&xattrs,
cancellable, error))
if (!get_final_xattrs (self, modifier, relpath, modified_info, NULL, src_dfd_iter->fd,
NULL, &xattrs, NULL, cancellable, error))
return FALSE;
if (!_ostree_repo_write_directory_meta (self, modified_info, xattrs, &child_file_csum,
@ -2850,16 +2816,6 @@ write_dfd_iter_to_mtree_internal (OstreeRepo *self,
if (!glnx_fstatat (src_dfd_iter->fd, dent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
const char *loose_checksum = devino_cache_lookup (self, modifier, stbuf.st_dev, stbuf.st_ino);
if (loose_checksum)
{
if (!ostree_mutable_tree_replace_file (mtree, dent->d_name, loose_checksum,
error))
return FALSE;
continue;
}
g_autoptr(GFileInfo) child_info = _ostree_stbuf_to_gfileinfo (&stbuf);
g_file_info_set_name (child_info, dent->d_name);
@ -3191,6 +3147,354 @@ G_DEFINE_BOXED_TYPE(OstreeRepoCommitModifier, ostree_repo_commit_modifier,
ostree_repo_commit_modifier_ref,
ostree_repo_commit_modifier_unref);
/* Special case between bare-user and bare-user-only,
* mostly for https://github.com/flatpak/flatpak/issues/845
* see below for any more comments.
*/
static gboolean
import_is_bareuser_only_conversion (OstreeRepo *src_repo,
OstreeRepo *dest_repo,
OstreeObjectType objtype)
{
return src_repo->mode == OSTREE_REPO_MODE_BARE_USER
&& dest_repo->mode == OSTREE_REPO_MODE_BARE_USER_ONLY
&& objtype == OSTREE_OBJECT_TYPE_FILE;
}
/* Returns TRUE if we can potentially just call link() to copy an object. */
static gboolean
import_via_reflink_is_possible (OstreeRepo *src_repo,
OstreeRepo *dest_repo,
OstreeObjectType objtype)
{
/* Equal modes are always compatible, and metadata
* is identical between all modes.
*/
if (src_repo->mode == dest_repo->mode ||
OSTREE_OBJECT_TYPE_IS_META (objtype))
return TRUE;
/* And now a special case between bare-user and bare-user-only,
* mostly for https://github.com/flatpak/flatpak/issues/845
*/
if (import_is_bareuser_only_conversion (src_repo, dest_repo, objtype))
return TRUE;
return FALSE;
}
/* Copy the detached metadata for commit @checksum from @source repo
* to @self.
*/
static gboolean
copy_detached_metadata (OstreeRepo *self,
OstreeRepo *source,
const char *checksum,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) detached_meta = NULL;
if (!ostree_repo_read_commit_detached_metadata (source,
checksum, &detached_meta,
cancellable, error))
return FALSE;
if (detached_meta)
{
if (!ostree_repo_write_commit_detached_metadata (self,
checksum, detached_meta,
cancellable, error))
return FALSE;
}
return TRUE;
}
/* Try to import an object via reflink or just linkat(); returns a value in
* @out_was_supported if we were able to do it or not. In this path
* we're not verifying the checksum.
*/
static gboolean
import_one_object_direct (OstreeRepo *dest_repo,
OstreeRepo *src_repo,
const char *checksum,
OstreeObjectType objtype,
gboolean *out_was_supported,
GCancellable *cancellable,
GError **error)
{
const char *errprefix = glnx_strjoina ("Importing ", checksum, ".",
ostree_object_type_to_string (objtype));
GLNX_AUTO_PREFIX_ERROR (errprefix, error);
char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
_ostree_loose_path (loose_path_buf, checksum, objtype, dest_repo->mode);
if (!import_via_reflink_is_possible (src_repo, dest_repo, objtype))
{
/* If we can't reflink, nothing to do here */
*out_was_supported = FALSE;
return TRUE;
}
/* hardlinks require the owner to match and to be on the same device */
const gboolean can_hardlink =
src_repo->owner_uid == dest_repo->owner_uid &&
src_repo->device == dest_repo->device;
/* Find our target dfd */
int dest_dfd;
if (dest_repo->commit_stagedir.initialized)
dest_dfd = dest_repo->commit_stagedir.fd;
else
dest_dfd = dest_repo->objects_dir_fd;
if (!_ostree_repo_ensure_loose_objdir_at (dest_dfd, loose_path_buf, cancellable, error))
return FALSE;
gboolean did_hardlink = FALSE;
if (can_hardlink)
{
if (linkat (src_repo->objects_dir_fd, loose_path_buf, dest_dfd, loose_path_buf, 0) != 0)
{
if (errno == EEXIST)
return TRUE;
else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
{
/* EMLINK, EXDEV and EPERM shouldn't be fatal; we just can't do
* the optimization of hardlinking instead of copying. Fall
* through below.
*/
}
else
return glnx_throw_errno_prefix (error, "linkat");
}
else
did_hardlink = TRUE;
}
/* If we weren't able to hardlink, fall back to a copy (which might be
* reflinked).
*/
if (!did_hardlink)
{
struct stat stbuf;
if (!glnx_fstatat (src_repo->objects_dir_fd, loose_path_buf,
&stbuf, AT_SYMLINK_NOFOLLOW, error))
return FALSE;
/* Let's punt for symlinks right now, it's more complicated */
if (!S_ISREG (stbuf.st_mode))
{
*out_was_supported = FALSE;
return TRUE;
}
/* This is yet another variation of glnx_file_copy_at()
* that basically just optionally does chown(). Perhaps
* in the future we should add flags for those things?
*/
glnx_fd_close int src_fd = -1;
if (!glnx_openat_rdonly (src_repo->objects_dir_fd, loose_path_buf,
FALSE, &src_fd, error))
return FALSE;
/* Open a tmpfile for dest */
g_auto(GLnxTmpfile) tmp_dest = { 0, };
if (!glnx_open_tmpfile_linkable_at (dest_dfd, ".", O_WRONLY | O_CLOEXEC,
&tmp_dest, error))
return FALSE;
if (glnx_regfile_copy_bytes (src_fd, tmp_dest.fd, (off_t) -1) < 0)
return glnx_throw_errno_prefix (error, "regfile copy");
/* Only chown for true bare repos */
if (dest_repo->mode == OSTREE_REPO_MODE_BARE)
{
if (fchown (tmp_dest.fd, stbuf.st_uid, stbuf.st_gid) != 0)
return glnx_throw_errno_prefix (error, "fchown");
}
/* Don't want to copy xattrs for archive repos, nor for
* bare-user-only.
*/
const gboolean src_is_bare_or_bare_user =
G_IN_SET (src_repo->mode, OSTREE_REPO_MODE_BARE, OSTREE_REPO_MODE_BARE_USER);
if (src_is_bare_or_bare_user)
{
g_autoptr(GVariant) xattrs = NULL;
if (!glnx_fd_get_all_xattrs (src_fd, &xattrs,
cancellable, error))
return FALSE;
if (!glnx_fd_set_all_xattrs (tmp_dest.fd, xattrs,
cancellable, error))
return FALSE;
}
if (fchmod (tmp_dest.fd, stbuf.st_mode & ~S_IFMT) != 0)
return glnx_throw_errno_prefix (error, "fchmod");
/* For archive repos, we just let the timestamps be object creation.
* Otherwise, copy the ostree timestamp value.
*/
if (_ostree_repo_mode_is_bare (dest_repo->mode))
{
struct timespec ts[2];
ts[0] = stbuf.st_atim;
ts[1] = stbuf.st_mtim;
(void) futimens (tmp_dest.fd, ts);
}
if (!_ostree_repo_commit_tmpf_final (dest_repo, checksum, objtype,
&tmp_dest, cancellable, error))
return FALSE;
}
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
{
if (!copy_detached_metadata (dest_repo, src_repo, checksum, cancellable, error))
return FALSE;
}
*out_was_supported = TRUE;
return TRUE;
}
/* A version of ostree_repo_import_object_from_with_trust()
* with flags; may make this public API later.
*/
gboolean
_ostree_repo_import_object (OstreeRepo *self,
OstreeRepo *source,
OstreeObjectType objtype,
const char *checksum,
OstreeRepoImportFlags flags,
GCancellable *cancellable,
GError **error)
{
const gboolean trusted = (flags & _OSTREE_REPO_IMPORT_FLAGS_TRUSTED) > 0;
/* Implements OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES which was designed for flatpak */
const gboolean verify_bareuseronly = (flags & _OSTREE_REPO_IMPORT_FLAGS_VERIFY_BAREUSERONLY) > 0;
/* A special case between bare-user and bare-user-only,
* mostly for https://github.com/flatpak/flatpak/issues/845
*/
const gboolean is_bareuseronly_conversion =
import_is_bareuser_only_conversion (source, self, objtype);
gboolean try_direct = trusted;
/* If we need to do bareuseronly verification, or we're potentially doing a
* bareuseronly conversion, let's verify those first so we don't complicate
* the rest of the code below.
*/
if ((verify_bareuseronly || is_bareuseronly_conversion) && !OSTREE_OBJECT_TYPE_IS_META (objtype))
{
g_autoptr(GFileInfo) src_finfo = NULL;
if (!ostree_repo_load_file (source, checksum,
NULL, &src_finfo, NULL,
cancellable, error))
return FALSE;
if (verify_bareuseronly)
{
if (!_ostree_validate_bareuseronly_mode_finfo (src_finfo, checksum, error))
return FALSE;
}
if (is_bareuseronly_conversion)
{
switch (g_file_info_get_file_type (src_finfo))
{
case G_FILE_TYPE_REGULAR:
/* This is OK, we'll try a hardlink */
break;
case G_FILE_TYPE_SYMBOLIC_LINK:
/* Symlinks in bare-user are regular files, we can't
* hardlink them to another repo mode.
*/
try_direct = FALSE;
break;
default:
g_assert_not_reached ();
break;
}
}
}
/* We try to import via reflink/hardlink. If the remote is explicitly not trusted
* (i.e.) their checksums may be incorrect, we skip that.
*/
if (try_direct)
{
gboolean direct_was_supported = FALSE;
if (!import_one_object_direct (self, source, checksum, objtype,
&direct_was_supported,
cancellable, error))
return FALSE;
/* If direct import succeeded, we're done! */
if (direct_was_supported)
return TRUE;
}
/* The more expensive copy path; involves parsing the object. For
* example the input might be an archive repo and the destination bare,
* or vice versa. Or we may simply need to verify the checksum.
*/
/* First, do we have the object already? */
gboolean has_object;
if (!ostree_repo_has_object (self, objtype, checksum, &has_object,
cancellable, error))
return FALSE;
/* If we have it, we're done */
if (has_object)
return TRUE;
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
{
/* Metadata object */
g_autoptr(GVariant) variant = NULL;
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
{
/* FIXME - cleanup detached metadata if copy below fails */
if (!copy_detached_metadata (self, source, checksum, cancellable, error))
return FALSE;
}
if (!ostree_repo_load_variant (source, objtype, checksum,
&variant, error))
return FALSE;
g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_metadata (self, objtype,
checksum, variant,
trusted ? NULL : &real_csum,
cancellable, error))
return FALSE;
}
else
{
/* Content object */
guint64 length;
g_autoptr(GInputStream) object_stream = NULL;
if (!ostree_repo_load_object_stream (source, objtype, checksum,
&object_stream, &length,
cancellable, error))
return FALSE;
g_autofree guchar *real_csum = NULL;
if (!ostree_repo_write_content (self, checksum,
object_stream, length,
trusted ? NULL : &real_csum,
cancellable, error))
return FALSE;
}
return TRUE;
}
static OstreeRepoTransactionStats *
ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats)
{

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2016 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or

View File

@ -1,5 +1,4 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
*
* This library is free software; you can redistribute it and/or

Some files were not shown because too many files have changed in this diff Show More