diff --git a/Makefile-libostree.am b/Makefile-libostree.am index 46984a75..4b412fec 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -117,6 +117,8 @@ libostree_1_la_SOURCES = \ src/libostree/ostree-bootloader.c \ src/libostree/ostree-bootloader-grub2.h \ src/libostree/ostree-bootloader-grub2.c \ + src/libostree/ostree-bootloader-zipl.h \ + src/libostree/ostree-bootloader-zipl.c \ src/libostree/ostree-bootloader-syslinux.h \ src/libostree/ostree-bootloader-syslinux.c \ src/libostree/ostree-bootloader-uboot.h \ diff --git a/Makefile-man.am b/Makefile-man.am index c27a9a55..bc58103b 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -34,7 +34,7 @@ ostree-init.1 ostree-log.1 ostree-ls.1 ostree-prune.1 ostree-pull-local.1 \ ostree-pull.1 ostree-refs.1 ostree-remote.1 ostree-reset.1 \ ostree-rev-parse.1 ostree-show.1 ostree-summary.1 \ ostree-static-delta.1 -if BUILDOPT_TRIVIAL_HTTPD +if USE_LIBSOUP man1_files += ostree-trivial-httpd.1 else # We still want to distribute the source, even if we are not building it diff --git a/Makefile.in b/Makefile.in index 356f5589..7e04837f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -578,9 +578,9 @@ check_PROGRAMS = $(am__EXEEXT_12) $(am__EXEEXT_13) $(am__EXEEXT_14) # We're using the system grub2-mkconfig generator @BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_90 = src/boot/grub2/grub2-15_ostree @BUILDOPT_BUILTIN_GRUB2_MKCONFIG_FALSE@am__append_91 = install-grub2-config-hook -@BUILDOPT_TRIVIAL_HTTPD_TRUE@@ENABLE_MAN_TRUE@am__append_92 = ostree-trivial-httpd.1 +@ENABLE_MAN_TRUE@@USE_LIBSOUP_TRUE@am__append_92 = 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_93 = man/ostree-trivial-httpd.xml +@ENABLE_MAN_TRUE@@USE_LIBSOUP_FALSE@am__append_93 = man/ostree-trivial-httpd.xml @BUILDOPT_FUSE_TRUE@@ENABLE_MAN_TRUE@am__append_94 = rofiles-fuse.1 @ENABLE_MAN_TRUE@@USE_GPGME_TRUE@am__append_95 = ostree-gpg-sign.1 @ENABLE_MAN_TRUE@am__append_96 = $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) @@ -813,6 +813,8 @@ am__libostree_1_la_SOURCES_DIST = \ src/libostree/ostree-bootloader.c \ src/libostree/ostree-bootloader-grub2.h \ src/libostree/ostree-bootloader-grub2.c \ + src/libostree/ostree-bootloader-zipl.h \ + src/libostree/ostree-bootloader-zipl.c \ src/libostree/ostree-bootloader-syslinux.h \ src/libostree/ostree-bootloader-syslinux.c \ src/libostree/ostree-bootloader-uboot.h \ @@ -918,6 +920,7 @@ am_libostree_1_la_OBJECTS = \ src/libostree/libostree_1_la-ostree-deployment.lo \ src/libostree/libostree_1_la-ostree-bootloader.lo \ src/libostree/libostree_1_la-ostree-bootloader-grub2.lo \ + src/libostree/libostree_1_la-ostree-bootloader-zipl.lo \ src/libostree/libostree_1_la-ostree-bootloader-syslinux.lo \ src/libostree/libostree_1_la-ostree-bootloader-uboot.lo \ src/libostree/libostree_1_la-ostree-repo-static-delta-core.lo \ @@ -1484,6 +1487,7 @@ am__depfiles_remade = bsdiff/$(DEPDIR)/libbsdiff_la-bsdiff.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-grub2.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-uboot.Plo \ + src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-chain-input-stream.Plo \ src/libostree/$(DEPDIR)/libostree_1_la-ostree-checksum-input-stream.Plo \ @@ -2611,6 +2615,8 @@ libostree_1_la_SOURCES = src/libostree/ostree-async-progress.c \ src/libostree/ostree-bootloader.c \ src/libostree/ostree-bootloader-grub2.h \ src/libostree/ostree-bootloader-grub2.c \ + src/libostree/ostree-bootloader-zipl.h \ + src/libostree/ostree-bootloader-zipl.c \ src/libostree/ostree-bootloader-syslinux.h \ src/libostree/ostree-bootloader-syslinux.c \ src/libostree/ostree-bootloader-uboot.h \ @@ -3768,6 +3774,9 @@ src/libostree/libostree_1_la-ostree-bootloader.lo: \ src/libostree/libostree_1_la-ostree-bootloader-grub2.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) +src/libostree/libostree_1_la-ostree-bootloader-zipl.lo: \ + src/libostree/$(am__dirstamp) \ + src/libostree/$(DEPDIR)/$(am__dirstamp) src/libostree/libostree_1_la-ostree-bootloader-syslinux.lo: \ src/libostree/$(am__dirstamp) \ src/libostree/$(DEPDIR)/$(am__dirstamp) @@ -4619,6 +4628,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-grub2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-uboot.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-chain-input-stream.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/libostree/$(DEPDIR)/libostree_1_la-ostree-checksum-input-stream.Plo@am__quote@ # am--include-marker @@ -5150,6 +5160,13 @@ src/libostree/libostree_1_la-ostree-bootloader-grub2.lo: src/libostree/ostree-bo @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-bootloader-grub2.lo `test -f 'src/libostree/ostree-bootloader-grub2.c' || echo '$(srcdir)/'`src/libostree/ostree-bootloader-grub2.c +src/libostree/libostree_1_la-ostree-bootloader-zipl.lo: src/libostree/ostree-bootloader-zipl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-bootloader-zipl.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Tpo -c -o src/libostree/libostree_1_la-ostree-bootloader-zipl.lo `test -f 'src/libostree/ostree-bootloader-zipl.c' || echo '$(srcdir)/'`src/libostree/ostree-bootloader-zipl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/libostree/ostree-bootloader-zipl.c' object='src/libostree/libostree_1_la-ostree-bootloader-zipl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -c -o src/libostree/libostree_1_la-ostree-bootloader-zipl.lo `test -f 'src/libostree/ostree-bootloader-zipl.c' || echo '$(srcdir)/'`src/libostree/ostree-bootloader-zipl.c + src/libostree/libostree_1_la-ostree-bootloader-syslinux.lo: src/libostree/ostree-bootloader-syslinux.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libostree_1_la_CFLAGS) $(CFLAGS) -MT src/libostree/libostree_1_la-ostree-bootloader-syslinux.lo -MD -MP -MF src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Tpo -c -o src/libostree/libostree_1_la-ostree-bootloader-syslinux.lo `test -f 'src/libostree/ostree-bootloader-syslinux.c' || echo '$(srcdir)/'`src/libostree/ostree-bootloader-syslinux.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Tpo src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Plo @@ -8710,6 +8727,7 @@ distclean: distclean-recursive -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-grub2.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-uboot.Plo + -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-chain-input-stream.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-checksum-input-stream.Plo @@ -8970,6 +8988,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-grub2.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-syslinux.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-uboot.Plo + -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader-zipl.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-bootloader.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-chain-input-stream.Plo -rm -f src/libostree/$(DEPDIR)/libostree_1_la-ostree-checksum-input-stream.Plo diff --git a/apidoc/html/index.html b/apidoc/html/index.html index bb689ad8..0d46e278 100644 --- a/apidoc/html/index.html +++ b/apidoc/html/index.html @@ -14,7 +14,7 @@
-

for OSTree 2019.4

+

for OSTree 2019.5


diff --git a/apidoc/version.xml b/apidoc/version.xml index b428e33c..51a8c5f1 100644 --- a/apidoc/version.xml +++ b/apidoc/version.xml @@ -1 +1 @@ -2019.4 \ No newline at end of file +2019.5 \ No newline at end of file diff --git a/build-aux/compile b/build-aux/compile index b89c278e..99e50524 100755 --- a/build-aux/compile +++ b/build-aux/compile @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/config.guess b/build-aux/config.guess index b5d7a0f3..b33c9e89 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. diff --git a/build-aux/config.sub b/build-aux/config.sub index be4dc6e5..b51fb8cd 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. diff --git a/build-aux/depcomp b/build-aux/depcomp index 4e0ae31b..65cbf709 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/install-sh b/build-aux/install-sh index defb86ae..8175c640 100755 --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#!/bin/sh # install - install a program, script, or datafile scriptversion=2018-03-11.20; # UTC diff --git a/build-aux/missing b/build-aux/missing index ab658ed5..625aeb11 100755 --- a/build-aux/missing +++ b/build-aux/missing @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC diff --git a/build-aux/test-driver b/build-aux/test-driver index d1ef0647..b8521a48 100755 --- a/build-aux/test-driver +++ b/build-aux/test-driver @@ -1,4 +1,4 @@ -#!/usr/bin/sh +#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC diff --git a/configure b/configure index a1de30db..bfa772f6 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libostree 2019.4. +# Generated by GNU Autoconf 2.69 for libostree 2019.5. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libostree' PACKAGE_TARNAME='libostree' -PACKAGE_VERSION='2019.4' -PACKAGE_STRING='libostree 2019.4' +PACKAGE_VERSION='2019.5' +PACKAGE_STRING='libostree 2019.5' PACKAGE_BUGREPORT='walters@verbum.org' PACKAGE_URL='' @@ -745,8 +745,6 @@ INTROSPECTION_COMPILER INTROSPECTION_SCANNER USE_CURL_OR_SOUP_FALSE USE_CURL_OR_SOUP_TRUE -BUILDOPT_TRIVIAL_HTTPD_FALSE -BUILDOPT_TRIVIAL_HTTPD_TRUE HAVE_LIBSOUP_CLIENT_CERTS_FALSE HAVE_LIBSOUP_CLIENT_CERTS_TRUE USE_LIBSOUP_FALSE @@ -1556,7 +1554,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 2019.4 to adapt to many kinds of systems. +\`configure' configures libostree 2019.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1626,7 +1624,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libostree 2019.4:";; + short | recursive ) echo "Configuration of libostree 2019.5:";; esac cat <<\_ACEOF @@ -1885,7 +1883,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libostree configure 2019.4 +libostree configure 2019.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2357,7 +2355,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 2019.4, which was +It was created by libostree $as_me 2019.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3225,7 +3223,7 @@ fi # Define the identity of the package. PACKAGE='libostree' - VERSION='2019.4' + VERSION='2019.5' # Some tools Automake needs. @@ -5959,9 +5957,9 @@ test -n "$YACC" || YACC="yacc" YEAR_VERSION=2019 -RELEASE_VERSION=4 +RELEASE_VERSION=5 -PACKAGE_VERSION=2019.4 +PACKAGE_VERSION=2019.5 if echo "$CFLAGS" | grep -q -E -e '-Werror($| )'; then : @@ -15386,15 +15384,7 @@ else enable_trivial_httpd_cmdline=no fi - if test x$enable_trivial_httpd_cmdline = xyes; then - BUILDOPT_TRIVIAL_HTTPD_TRUE= - BUILDOPT_TRIVIAL_HTTPD_FALSE='#' -else - BUILDOPT_TRIVIAL_HTTPD_TRUE='#' - BUILDOPT_TRIVIAL_HTTPD_FALSE= -fi - -if test -z "$BUILDOPT_TRIVIAL_HTTPD_TRUE"; then : +if test x$enable_trivial_httpd_cmdline = xyes; then : $as_echo "#define BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE 1" >>confdefs.h @@ -18304,10 +18294,6 @@ if test -z "${HAVE_LIBSOUP_CLIENT_CERTS_TRUE}" && test -z "${HAVE_LIBSOUP_CLIENT as_fn_error $? "conditional \"HAVE_LIBSOUP_CLIENT_CERTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${BUILDOPT_TRIVIAL_HTTPD_TRUE}" && test -z "${BUILDOPT_TRIVIAL_HTTPD_FALSE}"; then - as_fn_error $? "conditional \"BUILDOPT_TRIVIAL_HTTPD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${USE_CURL_OR_SOUP_TRUE}" && test -z "${USE_CURL_OR_SOUP_FALSE}"; then as_fn_error $? "conditional \"USE_CURL_OR_SOUP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -18833,7 +18819,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 2019.4, which was +This file was extended by libostree $as_me 2019.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18899,7 +18885,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 2019.4 +libostree config.status 2019.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index cd3cfd10..4b022e36 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,13 @@ AC_PREREQ([2.63]) -dnl If doing a final release, remember to follow the instructions to -dnl update libostree-released.sym from libostree-devel.sym, and update the checksum -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. +dnl To do a release: follow the instructions to update libostree-released.sym from +dnl libostree-devel.sym, update the checksum in test-symbols.sh, set is_release_build=yes +dnl below. Then make another post-release commit to bump the version and set +dnl is_release_build=no. +dnl Seed the release notes with `git-shortlog-with-prs ..`. Then use +dnl `git-evtag` to create the tag and push it. Finally, create a GitHub release and attach +dnl the tarball from `make dist`. m4_define([year_version], [2019]) -m4_define([release_version], [4]) +m4_define([release_version], [5]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) is_release_build=yes @@ -191,8 +194,7 @@ AC_ARG_ENABLE(trivial-httpd-cmdline, [AS_HELP_STRING([--enable-trivial-httpd-cmdline], [Continue to support "ostree trivial-httpd" [default=no]])],, enable_trivial_httpd_cmdline=no) -AM_CONDITIONAL(BUILDOPT_TRIVIAL_HTTPD, test x$enable_trivial_httpd_cmdline = xyes) -AM_COND_IF(BUILDOPT_TRIVIAL_HTTPD, +AS_IF([test x$enable_trivial_httpd_cmdline = xyes], [AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])] ) diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 9339c0fd..0b876f3b 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -18,6 +18,8 @@ ***/ /* Add new symbols here. Release commits should copy this section into -released.sym. */ +LIBOSTREE_2019.5 { +} LIBOSTREE_2019.4; /* Stub section for the stable release *after* this development one; don't * edit this other than to update the year. This is just a copy/paste diff --git a/src/libostree/libostree-released.sym b/src/libostree/libostree-released.sym index ec9eec66..f6a83b77 100644 --- a/src/libostree/libostree-released.sym +++ b/src/libostree/libostree-released.sym @@ -575,6 +575,8 @@ LIBOSTREE_2019.4 { ostree_repo_mark_commit_partial_reason; } LIBOSTREE_2019.3; +/* No new symbols in 2019.5 */ + /* NOTE: Only add more content here in release commits! See the * comments at the top of this file. */ diff --git a/src/libostree/ostree-async-progress.c b/src/libostree/ostree-async-progress.c index a8e629ee..64372c27 100644 --- a/src/libostree/ostree-async-progress.c +++ b/src/libostree/ostree-async-progress.c @@ -465,7 +465,7 @@ ostree_async_progress_finish (OstreeAsyncProgress *self) if (self->idle_source) { g_source_destroy (self->idle_source); - self->idle_source = NULL; + g_clear_pointer (&self->idle_source, g_source_unref); emit_changed = TRUE; } } diff --git a/src/libostree/ostree-bootloader-zipl.c b/src/libostree/ostree-bootloader-zipl.c new file mode 100644 index 00000000..4ac785d9 --- /dev/null +++ b/src/libostree/ostree-bootloader-zipl.c @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2019 Colin Walters + * + * This program 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 licence or (at + * your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "ostree-sysroot-private.h" +#include "ostree-bootloader-zipl.h" +#include "otutil.h" + +#include + +/* This is specific to zipl today, but in the future we could also + * use it for the grub2-mkconfig case. + */ +static const char zipl_requires_execute_path[] = "boot/ostree-bootloader-update.stamp"; + +struct _OstreeBootloaderZipl +{ + GObject parent_instance; + + OstreeSysroot *sysroot; +}; + +typedef GObjectClass OstreeBootloaderZiplClass; + +static void _ostree_bootloader_zipl_bootloader_iface_init (OstreeBootloaderInterface *iface); +G_DEFINE_TYPE_WITH_CODE (OstreeBootloaderZipl, _ostree_bootloader_zipl, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (OSTREE_TYPE_BOOTLOADER, _ostree_bootloader_zipl_bootloader_iface_init)); + +static gboolean +_ostree_bootloader_zipl_query (OstreeBootloader *bootloader, + gboolean *out_is_active, + GCancellable *cancellable, + GError **error) +{ + /* We don't auto-detect this one; should be explicitly chosen right now. + * see also https://github.com/coreos/coreos-assembler/pull/849 + */ + *out_is_active = FALSE; + return TRUE; +} + +static const char * +_ostree_bootloader_zipl_get_name (OstreeBootloader *bootloader) +{ + return "zipl"; +} + +static gboolean +_ostree_bootloader_zipl_write_config (OstreeBootloader *bootloader, + int bootversion, + GPtrArray *new_deployments, + GCancellable *cancellable, + GError **error) +{ + OstreeBootloaderZipl *self = OSTREE_BOOTLOADER_ZIPL (bootloader); + + /* Write our stamp file */ + if (!glnx_file_replace_contents_at (self->sysroot->sysroot_fd, zipl_requires_execute_path, + (guint8*)"", 0, GLNX_FILE_REPLACE_NODATASYNC, + cancellable, error)) + return FALSE; + + return TRUE; +} + +static gboolean +_ostree_bootloader_zipl_post_bls_sync (OstreeBootloader *bootloader, + GCancellable *cancellable, + GError **error) +{ + OstreeBootloaderZipl *self = OSTREE_BOOTLOADER_ZIPL (bootloader); + + /* Note that unlike the grub2-mkconfig backend, we make no attempt to + * chroot(). + */ + g_assert (self->sysroot->booted_deployment); + + if (!glnx_fstatat_allow_noent (self->sysroot->sysroot_fd, zipl_requires_execute_path, NULL, 0, error)) + return FALSE; + + /* If there's no stamp file, nothing to do */ + if (errno == ENOENT) + return TRUE; + + const char *const zipl_argv[] = {"zipl", NULL}; + int estatus; + if (!g_spawn_sync (NULL, (char**)zipl_argv, NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, NULL, &estatus, error)) + return FALSE; + if (!g_spawn_check_exit_status (estatus, error)) + return FALSE; + if (!glnx_unlinkat (self->sysroot->sysroot_fd, zipl_requires_execute_path, 0, error)) + return FALSE; + return TRUE; +} + +static void +_ostree_bootloader_zipl_finalize (GObject *object) +{ + OstreeBootloaderZipl *self = OSTREE_BOOTLOADER_ZIPL (object); + + g_clear_object (&self->sysroot); + + G_OBJECT_CLASS (_ostree_bootloader_zipl_parent_class)->finalize (object); +} + +void +_ostree_bootloader_zipl_init (OstreeBootloaderZipl *self) +{ +} + +static void +_ostree_bootloader_zipl_bootloader_iface_init (OstreeBootloaderInterface *iface) +{ + iface->query = _ostree_bootloader_zipl_query; + iface->get_name = _ostree_bootloader_zipl_get_name; + iface->write_config = _ostree_bootloader_zipl_write_config; + iface->post_bls_sync = _ostree_bootloader_zipl_post_bls_sync; +} + +void +_ostree_bootloader_zipl_class_init (OstreeBootloaderZiplClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->finalize = _ostree_bootloader_zipl_finalize; +} + +OstreeBootloaderZipl * +_ostree_bootloader_zipl_new (OstreeSysroot *sysroot) +{ + OstreeBootloaderZipl *self = g_object_new (OSTREE_TYPE_BOOTLOADER_ZIPL, NULL); + self->sysroot = g_object_ref (sysroot); + return self; +} diff --git a/src/libostree/ostree-bootloader-zipl.h b/src/libostree/ostree-bootloader-zipl.h new file mode 100644 index 00000000..79e84912 --- /dev/null +++ b/src/libostree/ostree-bootloader-zipl.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2019 Colin Walters + * + * This program 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 licence 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 + +#include "ostree-bootloader.h" + +G_BEGIN_DECLS + +#define OSTREE_TYPE_BOOTLOADER_ZIPL (_ostree_bootloader_zipl_get_type ()) +#define OSTREE_BOOTLOADER_ZIPL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTLOADER_ZIPL, OstreeBootloaderZipl)) +#define OSTREE_IS_BOOTLOADER_ZIPL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_BOOTLOADER_ZIPL)) + +typedef struct _OstreeBootloaderZipl OstreeBootloaderZipl; + +GType _ostree_bootloader_zipl_get_type (void) G_GNUC_CONST; + +OstreeBootloaderZipl * _ostree_bootloader_zipl_new (OstreeSysroot *sysroot); + +G_END_DECLS diff --git a/src/libostree/ostree-bootloader.c b/src/libostree/ostree-bootloader.c index 5b8125dc..76b7bb82 100644 --- a/src/libostree/ostree-bootloader.c +++ b/src/libostree/ostree-bootloader.c @@ -65,6 +65,19 @@ _ostree_bootloader_write_config (OstreeBootloader *self, cancellable, error); } +gboolean +_ostree_bootloader_post_bls_sync (OstreeBootloader *self, + GCancellable *cancellable, + GError **error) +{ + g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE); + + if (OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync) + return OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync (self, cancellable, error); + + return TRUE; +} + gboolean _ostree_bootloader_is_atomic (OstreeBootloader *self) { diff --git a/src/libostree/ostree-bootloader.h b/src/libostree/ostree-bootloader.h index 5af2dcc8..48a7a9cd 100644 --- a/src/libostree/ostree-bootloader.h +++ b/src/libostree/ostree-bootloader.h @@ -47,6 +47,9 @@ struct _OstreeBootloaderInterface GPtrArray *new_deployments, GCancellable *cancellable, GError **error); + gboolean (* post_bls_sync) (OstreeBootloader *self, + GCancellable *cancellable, + GError **error); gboolean (* is_atomic) (OstreeBootloader *self); }; G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeBootloader, g_object_unref) @@ -66,6 +69,10 @@ gboolean _ostree_bootloader_write_config (OstreeBootloader *self, GCancellable *cancellable, GError **error); +gboolean _ostree_bootloader_post_bls_sync (OstreeBootloader *self, + GCancellable *cancellable, + GError **error); + gboolean _ostree_bootloader_is_atomic (OstreeBootloader *self); G_END_DECLS diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index 49ec995f..8dd14640 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -717,6 +717,8 @@ checkout_one_file_at (OstreeRepo *repo, } current_repo = current_repo->parent_repo; } + /* Pacify clang-analyzer which sees us testing effectively if (repo == NULL) */ + g_assert (repo); need_copy = (hardlink_res == HARDLINK_RESULT_NOT_SUPPORTED); } diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index 0aaebbdb..8c5d9411 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -871,7 +871,10 @@ write_content_object (OstreeRepo *self, /* Give a null input if there's no content */ g_autoptr(GInputStream) null_input = NULL; if (!input) - null_input = input = g_memory_input_stream_new_from_data ("", 0, NULL); + { + null_input = input = g_memory_input_stream_new_from_data ("", 0, NULL); + (void) null_input; /* quiet static analysis */ + } checksum_input = ot_checksum_instream_new_with_start (input, G_CHECKSUM_SHA256, buf, len); @@ -1585,7 +1588,6 @@ ostree_repo_prepare_transaction (OstreeRepo *self, GCancellable *cancellable, GError **error) { - g_autoptr(_OstreeRepoAutoTransaction) txn = NULL; guint64 reserved_bytes = 0; g_return_val_if_fail (self->in_transaction == FALSE, FALSE); @@ -1593,7 +1595,8 @@ ostree_repo_prepare_transaction (OstreeRepo *self, g_debug ("Preparing transaction in repository %p", self); /* Set up to abort the transaction if we return early from this function. */ - txn = self; + g_autoptr(_OstreeRepoAutoTransaction) txn = self; + (void) txn; /* Add use to silence static analysis */ memset (&self->txn.stats, 0, sizeof (OstreeRepoTransactionStats)); @@ -1649,7 +1652,7 @@ ostree_repo_prepare_transaction (OstreeRepo *self, return FALSE; /* Success: do not abort the transaction when returning. */ - txn = NULL; + txn = NULL; (void) txn; if (out_transaction_resume) *out_transaction_resume = ret_transaction_resume; diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index ba6e7289..586b34fe 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -2181,7 +2181,6 @@ static void start_fetch (OtPullData *pull_data, FetchObjectData *fetch) { - gboolean is_meta; g_autofree char *obj_subpath = NULL; guint64 *expected_max_size_p; guint64 expected_max_size; @@ -2190,13 +2189,12 @@ start_fetch (OtPullData *pull_data, GPtrArray *mirrorlist = NULL; ostree_object_name_deserialize (fetch->object, &expected_checksum, &objtype); - is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); g_debug ("starting fetch of %s.%s%s", expected_checksum, ostree_object_type_to_string (objtype), fetch->is_detached_meta ? " (detached)" : ""); - is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); + gboolean is_meta = OSTREE_OBJECT_TYPE_IS_META (objtype); if (is_meta) pull_data->n_outstanding_metadata_fetches++; else @@ -3575,7 +3573,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_autofree char **refs_to_fetch = NULL; g_autoptr(GVariantIter) collection_refs_iter = NULL; g_autofree char **override_commit_ids = NULL; - GSource *update_timeout = NULL; + g_autoptr(GSource) update_timeout = NULL; gboolean opt_gpg_verify_set = FALSE; gboolean opt_gpg_verify_summary_set = FALSE; gboolean opt_collection_refs_set = FALSE; @@ -3677,6 +3675,10 @@ ostree_repo_pull_with_options (OstreeRepo *self, pull_data->async_error = &pull_data->cached_async_error; else pull_data->async_error = NULL; + + /* Note we're using the thread default (or global) context here, so it may outlive the + * OtPullData object if there's another ref on it. Thus, always detach/destroy sources + * local to the `ostree_repo_pull*` operation rather than trying to transfer ownership. */ pull_data->main_context = g_main_context_ref_thread_default (); pull_data->flags = flags; @@ -4516,7 +4518,6 @@ ostree_repo_pull_with_options (OstreeRepo *self, g_source_set_priority (update_timeout, G_PRIORITY_HIGH); g_source_set_callback (update_timeout, update_progress, pull_data, NULL); g_source_attach (update_timeout, pull_data->main_context); - g_source_unref (update_timeout); } /* Now await work completion */ diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index b654aff2..cff70d47 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1548,8 +1548,8 @@ keyfile_set_from_vardict (GKeyFile *keyfile, g_key_file_set_string_list (keyfile, section, key, strv_child, len); } else - g_critical ("Unhandled type '%s' in " G_GNUC_FUNCTION, - (char*)g_variant_get_type (child)); + g_critical ("Unhandled type '%s' in %s", + (char*)g_variant_get_type (child), G_STRFUNC); } } @@ -3184,8 +3184,10 @@ reload_sysroot_config (OstreeRepo *self, * binary "x" in /usr/lib/ostree/bootloaders/x). See: * https://github.com/ostreedev/ostree/issues/1719 * https://github.com/ostreedev/ostree/issues/1801 + * Also, dedup these strings with the bootloader implementations */ - if (!(g_str_equal (bootloader, "auto") || g_str_equal (bootloader, "none"))) + if (!(g_str_equal (bootloader, "auto") || g_str_equal (bootloader, "none") + || g_str_equal (bootloader, "zipl"))) return glnx_throw (error, "Invalid bootloader configuration: '%s'", bootloader); g_free (self->bootloader); @@ -4197,7 +4199,7 @@ ostree_repo_has_object (OstreeRepo *self, GCancellable *cancellable, GError **error) { - gboolean ret_have_object; + gboolean ret_have_object = FALSE; if (!_ostree_repo_has_loose_object (self, checksum, objtype, &ret_have_object, cancellable, error)) diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c index 7a352e6b..ef95d13c 100644 --- a/src/libostree/ostree-sysroot-cleanup.c +++ b/src/libostree/ostree-sysroot-cleanup.c @@ -313,6 +313,7 @@ cleanup_old_deployments (OstreeSysroot *self, if (!list_all_deployment_directories (self, &all_deployment_dirs, cancellable, error)) return FALSE; + g_assert (all_deployment_dirs); /* Pacify static analysis */ for (guint i = 0; i < all_deployment_dirs->len; i++) { OstreeDeployment *deployment = all_deployment_dirs->pdata[i]; diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index c342d7e0..a09c354b 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -43,6 +43,7 @@ #include "ostree.h" #include "ostree-sysroot-private.h" #include "ostree-sepolicy-private.h" +#include "ostree-bootloader-zipl.h" #include "ostree-deployment-private.h" #include "ostree-core-private.h" #include "ostree-linuxfsutil.h" @@ -753,15 +754,14 @@ prepare_deployment_etc (OstreeSysroot *sysroot, return FALSE; gboolean usretc_exists = (errno == 0); - if (etc_exists && usretc_exists) - return glnx_throw (error, "Tree contains both /etc and /usr/etc"); - else if (etc_exists) + if (etc_exists) { + if (usretc_exists) + return glnx_throw (error, "Tree contains both /etc and /usr/etc"); /* Compatibility hack */ if (!glnx_renameat (deployment_dfd, "etc", deployment_dfd, "usr/etc", error)) return FALSE; usretc_exists = TRUE; - etc_exists = FALSE; } if (usretc_exists) @@ -878,6 +878,8 @@ typedef struct { int boot_dfd; char *kernel_srcpath; char *kernel_namever; + char *kernel_hmac_srcpath; + char *kernel_hmac_namever; char *initramfs_srcpath; char *initramfs_namever; char *devicetree_srcpath; @@ -890,6 +892,8 @@ _ostree_kernel_layout_free (OstreeKernelLayout *layout) glnx_close_fd (&layout->boot_dfd); g_free (layout->kernel_srcpath); g_free (layout->kernel_namever); + g_free (layout->kernel_hmac_srcpath); + g_free (layout->kernel_hmac_namever); g_free (layout->initramfs_srcpath); g_free (layout->initramfs_namever); g_free (layout->devicetree_srcpath); @@ -1032,6 +1036,16 @@ get_kernel_from_tree_usrlib_modules (int deployment_dfd, g_clear_object (&in); glnx_close_fd (&fd); + /* And finally, look for any HMAC file. This is needed for FIPS mode on some distros. */ + if (!glnx_fstatat_allow_noent (ret_layout->boot_dfd, ".vmlinuz.hmac", NULL, 0, error)) + return FALSE; + if (errno == 0) + { + ret_layout->kernel_hmac_srcpath = g_strdup (".vmlinuz.hmac"); + /* Name it as dracut expects it: https://github.com/dracutdevs/dracut/blob/225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1/modules.d/01fips/fips.sh#L129 */ + ret_layout->kernel_hmac_namever = g_strdup_printf (".%s.hmac", ret_layout->kernel_namever); + } + char hexdigest[OSTREE_SHA256_STRING_LEN+1]; ot_checksum_get_hexdigest (&checksum, hexdigest, sizeof (hexdigest)); ret_layout->bootcsum = g_strdup (hexdigest); @@ -1686,6 +1700,20 @@ install_deployment_kernel (OstreeSysroot *sysroot, } } + if (kernel_layout->kernel_hmac_srcpath) + { + if (!glnx_fstatat_allow_noent (bootcsum_dfd, kernel_layout->kernel_hmac_namever, &stbuf, 0, error)) + return FALSE; + if (errno == ENOENT) + { + if (!install_into_boot (sepolicy, kernel_layout->boot_dfd, kernel_layout->kernel_hmac_srcpath, + bootcsum_dfd, kernel_layout->kernel_hmac_namever, + sysroot->debug_flags, + cancellable, error)) + return FALSE; + } + } + g_autofree char *contents = NULL; if (!glnx_fstatat_allow_noent (deployment_dfd, "usr/lib/os-release", &stbuf, 0, error)) return FALSE; @@ -1830,6 +1858,7 @@ prepare_new_bootloader_link (OstreeSysroot *sysroot, /* Update the /boot/loader symlink to point to /boot/loader.$new_bootversion */ static gboolean swap_bootloader (OstreeSysroot *sysroot, + OstreeBootloader *bootloader, int current_bootversion, int new_bootversion, GCancellable *cancellable, @@ -1863,6 +1892,15 @@ swap_bootloader (OstreeSysroot *sysroot, if (fsync (boot_dfd) != 0) return glnx_throw_errno_prefix (error, "fsync(boot)"); + /* TODO: In the future also execute this automatically via a systemd unit + * if we detect it's necessary. + **/ + if (bootloader) + { + if (!_ostree_bootloader_post_bls_sync (bootloader, cancellable, error)) + return FALSE; + } + return TRUE; } @@ -2129,7 +2167,7 @@ write_deployments_bootswap (OstreeSysroot *self, if (!full_system_sync (self, out_syncstats, cancellable, error)) return FALSE; - if (!swap_bootloader (self, self->bootversion, new_bootversion, + if (!swap_bootloader (self, bootloader, self->bootversion, new_bootversion, cancellable, error)) return FALSE; @@ -2356,6 +2394,14 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self, { /* No bootloader specified; do not query bootloaders to run. */ } + else if (g_str_equal (bootloader_config, "zipl")) + { + /* Because we do not mark zipl as active by default, lets creating one here, + * which is basically the same what _ostree_sysroot_query_bootloader() does + * for other bootloaders if being activated. + * */ + bootloader = (OstreeBootloader*) _ostree_bootloader_zipl_new (self); + } bootloader_is_atomic = bootloader != NULL && _ostree_bootloader_is_atomic (bootloader); diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 2c0c0546..1c9dbf37 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -945,6 +945,7 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self, g_autoptr(GPtrArray) deployments = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref); + g_assert (boot_loader_configs); /* Pacify static analysis */ for (guint i = 0; i < boot_loader_configs->len; i++) { OstreeBootconfigParser *config = boot_loader_configs->pdata[i]; @@ -1671,10 +1672,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, /* add it last if no crossover defined (or it's the first deployment in the sysroot) */ if (!added_new) - { - g_ptr_array_add (new_deployments, g_object_ref (new_deployment)); - added_new = TRUE; - } + g_ptr_array_add (new_deployments, g_object_ref (new_deployment)); OstreeSysrootWriteDeploymentsOpts write_opts = { .do_postclean = postclean }; if (!ostree_sysroot_write_deployments_with_options (sysroot, new_deployments, &write_opts, diff --git a/src/libostree/ostree-version.h b/src/libostree/ostree-version.h index ebb38d0e..704f3493 100644 --- a/src/libostree/ostree-version.h +++ b/src/libostree/ostree-version.h @@ -43,7 +43,7 @@ * * Since: 2017.4 */ -#define OSTREE_RELEASE_VERSION (4) +#define OSTREE_RELEASE_VERSION (5) /** * OSTREE_VERSION @@ -52,7 +52,7 @@ * * Since: 2017.4 */ -#define OSTREE_VERSION (2019.4) +#define OSTREE_VERSION (2019.5) /** * OSTREE_VERSION_S: @@ -62,7 +62,7 @@ * * Since: 2017.4 */ -#define OSTREE_VERSION_S "2019.4" +#define OSTREE_VERSION_S "2019.5" #define OSTREE_ENCODE_VERSION(year,release) \ ((year) << 16 | (release)) diff --git a/src/libotutil/ot-checksum-utils.c b/src/libotutil/ot-checksum-utils.c index 6eb6fdc0..66767368 100644 --- a/src/libotutil/ot-checksum-utils.c +++ b/src/libotutil/ot-checksum-utils.c @@ -250,9 +250,8 @@ ot_gio_splice_get_checksum (GOutputStream *out, guint8 digest[_OSTREE_SHA256_DIGEST_LEN]; ot_checksum_get_digest (&checksum, digest, sizeof (digest)); - g_autofree guchar *ret_csum = g_malloc (sizeof (digest)); - memcpy (ret_csum, digest, sizeof (digest)); - ot_transfer_out_value (out_csum, &ret_csum); + if (out_csum) + *out_csum = g_memdup (digest, sizeof (digest)); return TRUE; } diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c index 9d5903ce..2050e969 100644 --- a/src/libotutil/ot-keyfile-utils.c +++ b/src/libotutil/ot-keyfile-utils.c @@ -35,15 +35,12 @@ ot_keyfile_get_boolean_with_default (GKeyFile *keyfile, gboolean *out_bool, GError **error) { - gboolean ret = FALSE; + g_return_val_if_fail (keyfile != NULL, FALSE); + g_return_val_if_fail (section != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + GError *temp_error = NULL; - gboolean ret_bool; - - g_return_val_if_fail (keyfile != NULL, ret); - g_return_val_if_fail (section != NULL, ret); - g_return_val_if_fail (value != NULL, ret); - - ret_bool = g_key_file_get_boolean (keyfile, section, value, &temp_error); + gboolean ret_bool = g_key_file_get_boolean (keyfile, section, value, &temp_error); if (temp_error) { if (g_error_matches (temp_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) @@ -54,14 +51,12 @@ ot_keyfile_get_boolean_with_default (GKeyFile *keyfile, else { g_propagate_error (error, temp_error); - goto out; + return FALSE; } } - ret = TRUE; *out_bool = ret_bool; - out: - return ret; + return TRUE; } gboolean @@ -72,33 +67,29 @@ ot_keyfile_get_value_with_default (GKeyFile *keyfile, char **out_value, GError **error) { - gboolean ret = FALSE; + g_return_val_if_fail (keyfile != NULL, FALSE); + g_return_val_if_fail (section != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + GError *temp_error = NULL; - g_autofree char *ret_value = NULL; - - g_return_val_if_fail (keyfile != NULL, ret); - g_return_val_if_fail (section != NULL, ret); - g_return_val_if_fail (value != NULL, ret); - - ret_value = g_key_file_get_value (keyfile, section, value, &temp_error); + g_autofree char *ret_value = g_key_file_get_value (keyfile, section, value, &temp_error); if (temp_error) { if (g_error_matches (temp_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { g_clear_error (&temp_error); + g_assert (ret_value == NULL); ret_value = g_strdup (default_value); } else { g_propagate_error (error, temp_error); - goto out; + return FALSE; } } - ret = TRUE; ot_transfer_out_value(out_value, &ret_value); - out: - return ret; + return TRUE; } gboolean @@ -109,14 +100,12 @@ ot_keyfile_get_value_with_default_group_optional (GKeyFile *keyfile, char **out_value, GError **error) { - gboolean ret = FALSE; + g_return_val_if_fail (keyfile != NULL, FALSE); + g_return_val_if_fail (section != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + GError *local_error = NULL; g_autofree char *ret_value = NULL; - - g_return_val_if_fail (keyfile != NULL, ret); - g_return_val_if_fail (section != NULL, ret); - g_return_val_if_fail (value != NULL, ret); - if (!ot_keyfile_get_value_with_default (keyfile, section, value, default_value, &ret_value, &local_error)) { if (g_error_matches (local_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) @@ -127,14 +116,12 @@ ot_keyfile_get_value_with_default_group_optional (GKeyFile *keyfile, else { g_propagate_error (error, local_error); - goto out; + return FALSE; } } - ret = TRUE; ot_transfer_out_value(out_value, &ret_value); - out: - return ret; + return TRUE; } /* Read the value of key as a string. If the value string contains @@ -151,22 +138,21 @@ ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile, char ***out_value, GError **error) { - guint sep_count = 0; - gchar sep = '\0'; - g_autofree char *value_str = NULL; - g_autofree char **value_list = NULL; - g_return_val_if_fail (keyfile != NULL, FALSE); g_return_val_if_fail (section != NULL, FALSE); g_return_val_if_fail (key != NULL, FALSE); g_return_val_if_fail (separators != NULL, FALSE); + g_autofree char *value_str = NULL; if (!ot_keyfile_get_value_with_default (keyfile, section, key, NULL, &value_str, error)) return FALSE; + g_auto(GStrv) value_list = NULL; if (value_str) { + gchar sep = '\0'; + guint sep_count = 0; for (size_t i = 0; i < strlen (separators) && sep_count <= 1; i++) { if (strchr (value_str, separators[i])) @@ -215,8 +201,8 @@ ot_keyfile_get_string_list_with_default (GKeyFile *keyfile, g_key_file_set_list_separator (keyfile, separator); - g_autofree char **ret_value = g_key_file_get_string_list (keyfile, section, - key, NULL, &temp_error); + g_auto(GStrv) ret_value = g_key_file_get_string_list (keyfile, section, + key, NULL, &temp_error); if (temp_error) { @@ -224,7 +210,7 @@ ot_keyfile_get_string_list_with_default (GKeyFile *keyfile, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) { g_clear_error (&temp_error); - ret_value = default_value; + ret_value = g_strdupv (default_value); } else { diff --git a/src/libotutil/ot-variant-builder.c b/src/libotutil/ot-variant-builder.c index 5b331e62..6636068e 100644 --- a/src/libotutil/ot-variant-builder.c +++ b/src/libotutil/ot-variant-builder.c @@ -1150,14 +1150,8 @@ ot_variant_builder_end (OtVariantBuilder *builder, GError **error) { OtVariantBuilderInfo *info = builder->head; - gsize total_size; - gsize offset_size; - int i; - g_autofree guchar *offset_table = NULL; - gsize offset_table_size; gboolean add_offset_table = FALSE; gboolean reverse_offset_table = FALSE; - guchar *p; g_return_val_if_fail (info->n_children >= info->min_items, FALSE); @@ -1188,15 +1182,14 @@ ot_variant_builder_end (OtVariantBuilder *builder, if (add_offset_table) { - total_size = gvs_calculate_total_size (info->offset, info->child_ends->len); - offset_size = gvs_get_offset_size (total_size); - - offset_table_size = total_size - info->offset; - offset_table = g_malloc (offset_table_size); - p = offset_table; + const gsize total_size = gvs_calculate_total_size (info->offset, info->child_ends->len); + const gsize offset_size = gvs_get_offset_size (total_size); + const gsize offset_table_size = total_size - info->offset; + g_autofree guchar *offset_table = g_malloc (offset_table_size); + guchar *p = offset_table; if (reverse_offset_table) { - for (i = info->child_ends->len - 1; i >= 0; i--) + for (int i = info->child_ends->len - 1; i >= 0; i--) { gvs_write_unaligned_le (p, g_array_index (info->child_ends, guint64, i), offset_size); p += offset_size; @@ -1204,7 +1197,7 @@ ot_variant_builder_end (OtVariantBuilder *builder, } else { - for (i = 0; i < info->child_ends->len; i++) + for (int i = 0; i < info->child_ends->len; i++) { gvs_write_unaligned_le (p, g_array_index (info->child_ends, guint64, i), offset_size); p += offset_size; diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 43eb18b3..0eea09d7 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -772,8 +772,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio if (!skip_commit) { - guint64 timestamp; - if (!opt_no_bindings) { g_autoptr(GVariant) old_metadata = g_steal_pointer (&metadata); @@ -782,10 +780,6 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio if (!opt_timestamp) { - GDateTime *now = g_date_time_new_now_utc (); - timestamp = g_date_time_to_unix (now); - g_date_time_unref (now); - if (!ostree_repo_write_commit (repo, parent, opt_subject, commit_body, metadata, OSTREE_REPO_FILE (root), &commit_checksum, cancellable, error)) @@ -800,8 +794,8 @@ ostree_builtin_commit (int argc, char **argv, OstreeCommandInvocation *invocatio "Could not parse '%s'", opt_timestamp); goto out; } - timestamp = ts.tv_sec; + guint64 timestamp = ts.tv_sec; if (!ostree_repo_write_commit_with_time (repo, parent, opt_subject, commit_body, metadata, OSTREE_REPO_FILE (root), timestamp, diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c index 5ad3bf38..dea03af4 100644 --- a/src/ostree/ot-builtin-fsck.c +++ b/src/ostree/ot-builtin-fsck.c @@ -434,6 +434,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation, if (opt_add_tombstones) { guint i; + g_assert (tombstones); /* Pacify static analysis */ if (tombstones->len) { if (!ot_enable_tombstone_commits (repo, error)) diff --git a/src/ostree/ot-builtin-prune.c b/src/ostree/ot-builtin-prune.c index 2f560d14..fd2ab05f 100644 --- a/src/ostree/ot-builtin-prune.c +++ b/src/ostree/ot-builtin-prune.c @@ -205,7 +205,7 @@ ostree_builtin_prune (int argc, char **argv, OstreeCommandInvocation *invocation g_autoptr(GHashTable) all_refs = NULL; g_autoptr(GHashTable) reachable = ostree_repo_traverse_new_reachable (); g_autoptr(GHashTable) retain_branch_depth = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - struct timespec keep_younger_than_ts; + struct timespec keep_younger_than_ts = {0, }; GHashTableIter hash_iter; gpointer key, value; diff --git a/src/ostree/ot-dump.c b/src/ostree/ot-dump.c index 1ef63740..38f3730b 100644 --- a/src/ostree/ot-dump.c +++ b/src/ostree/ot-dump.c @@ -125,7 +125,10 @@ dump_commit (GVariant *variant, timestamp = GUINT64_FROM_BE (timestamp); str = format_timestamp (timestamp, &local_error); if (!str) - errx (1, "Failed to read commit: %s", local_error->message); + { + g_assert (local_error); /* Pacify static analysis */ + errx (1, "Failed to read commit: %s", local_error->message); + } g_autofree char *contents = ostree_commit_get_content_checksum (variant) ?: ""; g_print ("ContentChecksum: %s\n", contents); g_print ("Date: %s\n", str); diff --git a/tests/libostreetest.c b/tests/libostreetest.c index 9a2fae09..1efee40e 100644 --- a/tests/libostreetest.c +++ b/tests/libostreetest.c @@ -145,7 +145,7 @@ ot_test_setup_sysroot (GCancellable *cancellable, g_autoptr(GString) buf = g_string_new ("mutable-deployments"); - gboolean can_relabel; + gboolean can_relabel = FALSE; if (!ot_check_relabeling (&can_relabel, error)) return FALSE; if (!can_relabel) diff --git a/tests/libtest.sh b/tests/libtest.sh index 8832e63c..ba00073a 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -395,6 +395,8 @@ setup_os_repository () { mkdir -p usr/bin ${bootdir} usr/lib/modules/${kver} usr/share usr/etc kernel_path=${bootdir}/vmlinuz initramfs_path=${bootdir}/initramfs.img + # the HMAC file is only in /usr/lib/modules + hmac_path=usr/lib/modules/${kver}/.vmlinuz.hmac # /usr/lib/modules just uses "vmlinuz", since the version is in the module # directory name. if [[ $bootdir != usr/lib/modules/* ]]; then @@ -403,6 +405,7 @@ setup_os_repository () { fi echo "a kernel" > ${kernel_path} echo "an initramfs" > ${initramfs_path} + echo "an hmac file" > ${hmac_path} bootcsum=$(cat ${kernel_path} ${initramfs_path} | sha256sum | cut -f 1 -d ' ') export bootcsum # Add the checksum for legacy dirs (/boot, /usr/lib/ostree-boot), but not diff --git a/tests/test-admin-deploy-none.sh b/tests/test-admin-deploy-none.sh index 66a1491f..09dee624 100755 --- a/tests/test-admin-deploy-none.sh +++ b/tests/test-admin-deploy-none.sh @@ -43,6 +43,7 @@ ${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os testos assert_file_has_content out.txt "Bootloader updated.*" assert_file_has_content sysroot/boot/loader/entries/ostree-1-testos.conf 'options.* root=LABEL=MOO' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/vmlinuz-3.6.0 'a kernel' +assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/.vmlinuz-3.6.0.hmac 'an hmac file' assert_file_has_content sysroot/boot/ostree/testos-${bootcsum}/initramfs-3.6.0.img 'an initramfs' echo "ok generate bls config on first deployment" diff --git a/tests/test-export.sh b/tests/test-export.sh index e1a0346c..17f7c024 100755 --- a/tests/test-export.sh +++ b/tests/test-export.sh @@ -21,6 +21,11 @@ set -euo pipefail +if ! ostree --version | grep -q -e '- libarchive'; then + echo "1..0 #SKIP no libarchive support compiled in" + exit 0 +fi + . $(dirname $0)/libtest.sh setup_test_repository "archive" diff --git a/tests/test-keyfile-utils.c b/tests/test-keyfile-utils.c index 258e7dd8..c580f81c 100644 --- a/tests/test-keyfile-utils.c +++ b/tests/test-keyfile-utils.c @@ -199,16 +199,15 @@ test_get_value_with_default_group_optional (void) static void test_copy_group (void) { - g_auto(GStrv) keys = NULL; - g_auto(GStrv) keys2 = NULL; - gsize length, length2, ii; - GKeyFile *tmp = g_key_file_new (); + gsize length, length2; const char *section = "section"; GLogLevelFlags always_fatal_mask; /* Avoid that g_return_val_if_fail causes the test to fail. */ always_fatal_mask = g_log_set_always_fatal (0); + g_autoptr(GKeyFile) tmp = g_key_file_new (); + g_assert_false (ot_keyfile_copy_group (NULL, tmp, section)); g_assert_false (ot_keyfile_copy_group (g_keyfile, NULL, section)); g_assert_false (ot_keyfile_copy_group (g_keyfile, tmp, NULL)); @@ -218,21 +217,17 @@ test_copy_group (void) g_assert_true (ot_keyfile_copy_group (g_keyfile, tmp, section)); - keys = g_key_file_get_keys (g_keyfile, section, &length, NULL); - keys2 = g_key_file_get_keys (tmp, section, &length2, NULL); + g_auto(GStrv) keys = g_key_file_get_keys (g_keyfile, section, &length, NULL); + g_strfreev (g_key_file_get_keys (tmp, section, &length2, NULL)); g_assert_cmpint(length, ==, length2); - for (ii = 0; ii < length; ii++) + for (gsize ii = 0; ii < length; ii++) { - g_autofree char *value = NULL; - g_autofree char *value2 = NULL; - - value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); - value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); + g_autofree char *value = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); + g_autofree char *value2 = g_key_file_get_value (g_keyfile, section, keys[ii], NULL); g_assert_cmpstr (value, ==, value2); } - g_key_file_free (tmp); } static void diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index 32285bdc..2287710d 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -54,7 +54,7 @@ echo 'ok documented symbols' # ONLY update this checksum in release commits! cat > released-sha256.txt <