...
 
Commits (60)
  • Colin Walters's avatar
    Post-release version bump · 0d6ead1b
    Colin Walters authored
    Closes: #1705
    Approved by: jlebon
    0d6ead1b
  • Laurent Bonnans's avatar
    lib/fetcher: Fix some memory leaks in curl fetcher · 630b7864
    Laurent Bonnans authored
    Closes: #1716
    Approved by: cgwalters
    630b7864
  • Felix Krull's avatar
    lib/grub2: Support Debian-style grub.cfg path · 74bdf7e1
    Felix Krull authored
    Debian and Debian-derived systems have their GRUB configuration file in
    /boot/grub/grub.cfg, rather than /boot/grub2/grub.cfg. Detecting this
    file is necessary to correctly generate GRUB boot configuration on
    Debian systems.
    
    Closes: #1714
    Approved by: cgwalters
    74bdf7e1
  • Umang Jain's avatar
    lib/repo: Ensure min-free-space* config value doesn't overflow · 3814d075
    Umang Jain authored
    when converted to bytes
    
    In a subsequent commit, we add a public API to read the value of
    min-free-space-* value in bytes. The value for free space check
    is enforced in terms of block size instead of bytes. Therefore,
    for consistency we check while preparing the transaction that the
    value doesn't overflow when converted to bytes.
    
    https://phabricator.endlessm.com/T23694
    
    Closes: #1715
    Approved by: cgwalters
    3814d075
  • Umang Jain's avatar
    lib/repo: Add an API to get min-free-space-* reserved bytes · 68420f70
    Umang Jain authored
    https://phabricator.endlessm.com/T23694
    
    Closes: #1715
    Approved by: cgwalters
    68420f70
  • Umang Jain's avatar
    Add tests for ostree_repo_get_min_free_space_bytes · a70d2f67
    Umang Jain authored
    https://phabricator.endlessm.com/T23694
    
    Closes: #1715
    Approved by: cgwalters
    a70d2f67
  • Matthew Leeds's avatar
    avahi: Be robust to missing refs in peer summaries · e4e6d85e
    Matthew Leeds authored
    In the OstreeRepoFinderAvahi implementation,
    ostree_avahi_service_build_repo_finder_result() is where the DNS-SD
    records are processed and turned into OstreeRepoFinderResult objects.
    Each result object is supposed to have a hash table mapping refs to
    checksums, so this is accomplished by first adding a placeholder (a ref
    mapping to a NULL checksum) for each ref matched by the bloom filter,
    and later filling in the checksums using the remote's summary file,
    which happens in get_checksums(). The problem is that there's no
    guarantee all the checksums will be resolved (non-NULL), so the
    ostree_repo_finder_result_new() call then hits an assertion failure in
    is_valid_collection_ref_map() leading to a crash (in the case that one
    or more refs had NULL checksums).
    
    There are at least two situations where the ref checksum might not be
    found in the peer remote's summary file:
    1) The bloom filter match was a false positive. This is going to happen
    sometimes by design.
    2) The peer remote's summary is out of sync with its DNS-SD records.
    This shouldn't normally happen but it's still good to be robust to the
    possibility; in Endless OS nothing guarantees the atomicity of updating
    the summary and DNS-SD records.
    
    This commit changes libostree to be robust to the possibility of refs
    missing from the peer remote's summary, by removing any that still have
    a NULL checksum associated with them after the summary has been fetched
    and processed.
    
    The other OstreeRepoFinder implementations don't have this issue because
    they use summary files directly and therefore always have access to the
    checksum.
    
    Closes: #1717
    Approved by: pwithnall
    e4e6d85e
  • Jonathan Lebon's avatar
    ci: Disable f28-rpmostree for now · 3c46bcdb
    Jonathan Lebon authored
    It started failing with:
    
    ```
    ERROR: tests/check/test-ucontainer.sh - too few tests run (expected 2, got 0)
    tap-driver.sh: internal error getting exit status
    tap-driver.sh: fatal: I/O or internal error
    make[4]: *** [Makefile:4353: tests/check/test-ucontainer.sh.log] Error 1
    make[4]: *** Waiting for unfinished jobs....
    ```
    
    And the artifacts are not being saved for some reason:
    
    ```
    + cleanup
    + mv test-suite.log /var/tmp/checkout
    mv: cannot stat 'test-suite.log': No such file or directory
    + true
    + mv vmcheck /var/tmp/checkout
    mv: cannot stat 'vmcheck': No such file or directory
    + true
    ```
    
    Let's just disable this for now so that some other pending patches can
    go in while we investigate.
    
    Closes: #1727
    Approved by: cgwalters
    3c46bcdb
  • Matthew Leeds's avatar
    lib/repo: Clean up OstreeRepo docs · 6b37fe83
    Matthew Leeds authored
    This fixes typos and grammar in the docs for OstreeRepo, and copies the
    information about OSTREE_REPO_MODE_BARE_USER_ONLY from ostree-core.h
    
    Closes: #1725
    Approved by: jlebon
    6b37fe83
  • Robert McQueen's avatar
    OstreeMutableTree: add _remove method · b32c9e0d
    Robert McQueen authored
    There is no API method to remove a file or subdirectory from a MutableTree
    besides directly manipulating the GHashTable returned by _get_files or
    _get_subdirs. This isn't possible from an introspection binding that transforms
    the returned GHashTable, and may also leave the tree checksum in an invalid
    state. Introduce a new method so that removing files or subdirectories is
    safe, and possible from bindings.
    
    Closes: #1724
    Approved by: jlebon
    b32c9e0d
  • Matthew Leeds's avatar
    lib/repo: Define a metadata key, ostree.deploy-collection-id · fc84fb40
    Matthew Leeds authored
    This commit defines a metadata key that tells clients to update their
    remote config to add a collection ID. This functionality is currently
    implemented in Flatpak for the key "xa.collection-id", but there are two
    good reasons for moving the key to OSTree:
    
    1) Servers such as Flathub shouldn't set xa.collection-id in their
    metadata now or in the medium term future, because many users are still
    using old versions of Flatpak and OSTree[1] which would hit various
    bugs[2][3][4] on the P2P code paths that are enabled by collection IDs.
    Defining a new key means that only clients running recent
    (as-yet-unreleased) versions of Flatpak and OSTree will pay attention to
    it and deploy the collection ID, leaving the users on old versions
    unaffected.
    
    2) OSTree is as "invested" in collection IDs as Flatpak, so there's no
    reason the key should be defined in Flatpak rather than here. According
    to Philip Withnall, the reason the key was put in Flatpak originally was
    that at the time there was uncertainty about tying OSTree to collection
    IDs.
    
    [1] https://ahayzen.com/direct/flathub.html#downloadsbyflatpakstacked
    [2] https://github.com/ostreedev/ostree/commit/e4e6d85ea
    [3] https://github.com/flatpak/flatpak/commit/5813639f
    [4] https://github.com/flatpak/flatpak/commit/5b21a5b7
    
    Closes: #1726
    Approved by: pwithnall
    fc84fb40
  • Umang Jain's avatar
    lib/repo: Separate min-free-space-* calculation from transaction codepath · a0937b6c
    Umang Jain authored
    Earlier, the actual reserved space (in blocks) were calculated inside the
    transaction codepath ostree_repo_prepare_transaction(). However, while
    reworking on ostree_repo_get_min_free_space_bytes() API, it was realized that
    this calculation can be done independently from the transaction's codepaths, hence
    enabling the usage for ostree_repo_get_min_free_space_bytes() API irrespective
    of whether there is an ongoing transaction or not.
    
    https://github.com/ostreedev/ostree/issues/1720
    
    Closes: #1722
    Approved by: pwithnall
    a0937b6c
  • Umang Jain's avatar
    5d2e62af
  • Colin Walters's avatar
    deploy: Fix removing /var/.updated with separate /var mount · 44d5f1cb
    Colin Walters authored
    There's some subtlety to this, we don't handle all cases.
    But the 99% cases are using `--sysroot deploy` to create an
    initial deployment, and then doing upgrades from inside
    a booted deployment.
    
    It was only the latter case that didn't work with a separate `/var`.
    Fixing all of them would probably require libostree to learn
    how to e.g. look at `/etc/fstab` (or worse, systemd mount units?)
    and handle the mounting.  I don't think we want to do anything
    like that right now, since there are no active drivers for the
    use case.
    
    Closes: https://github.com/ostreedev/ostree/issues/1729
    
    Closes: #1730
    Approved by: akiernan
    44d5f1cb
  • Jonathan Lebon's avatar
    lib/fetcher-util: Mark journaled msgs as LOG_ERR · 8b2940aa
    Jonathan Lebon authored
    E.g. for filtering, and so it shows up in red.
    
    Closes: #1732
    Approved by: cgwalters
    8b2940aa
  • Jonathan Lebon's avatar
    lib/fetcher-curl: Drop unnecessary check · a88032a0
    Jonathan Lebon authored
    `_ostree_fetcher_journal_failure()` already checks that we only log
    messages which have remotes.
    
    Closes: #1732
    Approved by: cgwalters
    a88032a0
  • Jonathan Lebon's avatar
    lib/fetcher-curl: Prefix fatal errors with full URL · 4aadbe21
    Jonathan Lebon authored
    Just include the whole URL that failed if libcurl failed with something
    elementary like CURLE_COULDNT_CONNECT or CURLE_COULDNT_RESOLVE_HOST.
    
    Closes: #1731
    
    Closes: #1732
    Approved by: cgwalters
    4aadbe21
  • Matthew Leeds's avatar
    create-usb: Always use archive mode · fc357adb
    Matthew Leeds authored
    Change the create-usb command so that it always creates the destination
    repository using the "archive" mode, rather than using archive mode when
    xattrs aren't supported and bare-user otherwise. This has a few
    advantages:
    
    1. The archive mode works with FAT filesystems, which is what most
    USB drives are, and which doesn't support xattrs.
    
    2. At least in some quick testing I did, archive mode is about
    twice as performant as bare-user mode, in terms of how long it takes for
    the create-usb command to complete.
    
    3. This ensures that a tool can safely change the permissions on
    ".ostree/repo" and subdirectories after create-usb completes, which is
    important for Endless since otherwise you can't use `ostree create-usb`
    as root and then `flatpak create-usb` as a non-root user on the same USB
    drive (or in other words copy OS updates and apps to the same USB).
    
    Closes: #1733
    Approved by: cgwalters
    fc357adb
  • Colin Walters's avatar
    lib/commit: Don't copy xattrs for metadata objects · c141fe61
    Colin Walters authored
    Copying the xattrs on metadata objects is wrong in general, we
    don't "own" them.  Notably this would fail in the situation of
    doing a pull from e.g. a `bare-user` source to a destination
    that was on a different mount point (so we couldn't hardlink),
    and the source had e.g. a `security.selinux` attribute.
    
    Closes: #1734
    
    Closes: #1736
    Approved by: jlebon
    c141fe61
  • Matthew Leeds's avatar
    create-usb: Add a --commit option · 9a06c540
    Matthew Leeds authored
    Currently on Endless OS, the OSTree ref for the operating system is
    something like os/eos/amd64/eos3, so that's what gets passed to `ostree
    create-usb` when copying the OS to a USB drive (for offline updates).
    However, when eos-updater checks for updates it pulls the metadata for a
    candidate commit and in so doing updates that eos3 ref to point to the
    partial commit being examined as a potential update rather than the
    deployed commit. This causes `ostree create-usb` to fail with an error
    like "No such metadata object
    7fb045cb2d1f1f3a81bfc157c6128ff443eb56350315b9536bdb56aee0659863.dirtree".
    
    OSTree creates deployment refs that look like "ostree/1/1/0" to maintain
    a pointer to the deployed commit, but create-usb can't use these because
    it shows up in the summary as just a ref, not a collection-ref.
    
    So this commit adds a --commit option to the create-usb command, so we
    can use the appropriate ref but copy the deployed commit rather than a
    (potentially partial) update commit.
    
    Closes: #1735
    Approved by: cgwalters
    9a06c540
  • Matthew Leeds's avatar
    lib/repo: Allow disabling lock timeout · 0c8a6d64
    Matthew Leeds authored
    Currently the locking code checks if the value -1 was set for the config
    key "lock-timeout-secs" and if so, a thread trying to acquire a lock
    will block indefinitely. Positive values specify how long to attempt to
    acquire a lock in a non-blocking way (the attempt is made once every
    second). But when the value is read from the config file,
    g_ascii_strtoull() is used, which converts it to an unsigned integer.
    This commit makes libostree use g_ascii_strtoll() instead, so that it's
    possible to set that key to -1 as intended.
    
    Closes: #1737
    Approved by: jlebon
    0c8a6d64
  • Matthew Leeds's avatar
    lib/repo: Fix minor mistake in locking docs · 7892d35c
    Matthew Leeds authored
    The config option is "lock-timeout-secs" not "lock-timeout".
    
    Closes: #1737
    Approved by: jlebon
    7892d35c
  • Matthew Leeds's avatar
    man/ostree.repo-config: Document locking options · 1a7536c0
    Matthew Leeds authored
    This commit documents the "locking" and "lock-timeout-secs" options
    which have been around for a few releases.
    
    Closes: #1737
    Approved by: jlebon
    1a7536c0
  • Jonathan Lebon's avatar
    ci: Bump rpm-ostree tag to 2018.8 · 6e3d4f90
    Jonathan Lebon authored
    2018.7 started failing `test-ucontainer.sh`. I don't have the cycles to
    look more deeply into what was going on there, but bumping to 2018.8
    fixes it at least. (And of course, it's passing in rpm-ostree too.)
    
    Closes: #1728
    Approved by: cgwalters
    6e3d4f90
  • Colin Walters's avatar
    lib/progress: Fix leak of GSource · 899b0bfa
    Colin Walters authored
    Closes: https://github.com/ostreedev/ostree/issues/1738
    
    Closes: #1741
    Approved by: jlebon
    899b0bfa
  • Jonathan Lebon's avatar
    lib/mutable-tree: Port to new style · 39d5db7e
    Jonathan Lebon authored
    Some therapeutic style conversion to finish off the week. Pretty
    straightforward overall.
    
    Closes: #1742
    Approved by: cgwalters
    39d5db7e
  • Matthew Leeds's avatar
    bash-completion: Fix --repo autocomplete · 5cada0f0
    Matthew Leeds authored
    This commit fixes the bash tab completion handling of the "--repo"
    argument. Before this commit, the completion only works if "--repo"
    comes after the main command. After this commit, you can use "--repo"
    directly after "ostree" in the command line, as is natural.
    
    Closes: #1745
    Approved by: jlebon
    5cada0f0
  • Colin Walters's avatar
    Only verify OSTREE_MAX_METADATA_SIZE for HTTP fetches · 2c55bc69
    Colin Walters authored
    There are use cases for libostree as a local content store
    for content derived or delivered via other mechanisms (e.g. OCI
    images, RPMs, etc.).  rpm-ostree today imports RPMs into OSTree
    branches, and puts the RPM header value as commit metadata.
    Some of these can be quite large because the header includes
    permissions for each file.  Similarly, some OCI metadata is large.
    
    Since there's no security issues with this, support committing
    such content.
    
    We still by default limit the size of metadata fetches, although
    for good measure we make this configurable too via a new
    `max-metadata-size` value.
    
    Closes: https://github.com/ostreedev/ostree/issues/1721
    
    Closes: #1744
    Approved by: jlebon
    2c55bc69
  • Matthew Leeds's avatar
    man/create-usb: Don't recommend summary updates · 039bbe56
    Matthew Leeds authored
    This commit removes the recommendation in the create-usb man page for
    the user to update the summary in the source repo before using the
    create-usb command. I'm not sure where I got the idea that create-usb
    depends on a summary in the source repo. I went back to the first commit
    that introduced the create-usb command and even using that a summary
    isn't required, so it seems unlikely that this changed recently.
    
    This is good news because the exclusive lock that's taken for summary
    updates has been causing problems on Endless (due to other processes
    having a lock for the duration of the 30 second acquire time out
    period).
    
    Closes: #1746
    Approved by: cgwalters
    039bbe56
  • Jonathan Lebon's avatar
    boot: Remove [Install] from ostree-finalize-staged · 367be40a
    Jonathan Lebon authored
    Let's just make this service not installable anymore. It should only be
    activated manually.
    
    Closes: #1750
    Approved by: cgwalters
    367be40a
  • Jonathan Lebon's avatar
    boot: Add Documentation= lines to services · 9161eb8c
    Jonathan Lebon authored
    It's a neat way to point folks to the documentation (of course, better
    would be to have man pages for each of those services). Also
    consistently use Title Case everywhere.
    
    Closes: #1750
    Approved by: cgwalters
    9161eb8c
  • Jonathan Lebon's avatar
    lib/sysroot-deploy: Write to journal when finalizing · 05e99da7
    Jonathan Lebon authored
    Write to the journal when starting to finalize a staged deployment.
    Combined with the "Transaction completed" message we already emit, this
    makes it easy later on to determine whether the operation was successful
    by inspecting the journal. This will be used by `rpm-ostree status`.
    
    Closes: #1750
    Approved by: cgwalters
    05e99da7
  • Sinny Kumari's avatar
    src/ostree: Don't delete refs having aliases · c7052684
    Sinny Kumari authored
    Deleting a ref with aliases makes them dangling. In such
    cases, display an error message to the user.
    
    Fixes #1597
    Signed-off-by: 's avatarSinny Kumari <sinny@redhat.com>
    
    Closes: #1749
    Approved by: cgwalters
    c7052684
  • Colin Walters's avatar
    repo: Add a checkout option to not hardlink zero-sized files · 673cacd6
    Colin Walters authored
    In rpm-ostree we've hit a few cases where hardlinking zero-sized
    files causes us problems.  The most prominent is lock files in
    `/usr/etc`, such as `/usr/etc/selinux/semanage.LOCK`.  If there
    are two zero-sized lock files to grab, but they're hardlinked,
    then locking will fail.
    
    Another case here is if one is using ostree inside a container
    and don't have access to FUSE (i.e. `rofiles-fuse`), then the
    ostree hardlinking can cause files that aren't ordinarily hardlinked
    to become so, and mutation of one mutates all.  An example where
    this is concerning is Python `__init__.py` files.
    
    Now, these lock files should clearly not be in the tree to begin
    with, but - we're not gaining a huge amount by hardlinking these
    files either, so let's add an option to disable it.
    
    Closes: #1752
    Approved by: jlebon
    673cacd6
  • Colin Walters's avatar
    checkout: Support --union-identical and --force-copy{,--zerosized} · 9367a1be
    Colin Walters authored
    Actually testing the patch to add `--force-copy-zerosized` to
    rpm-ostree tripped over the fact that it uses `--union-identical`,
    and we just hit an assertion failure with that combination.
    
    Fix this by copying over the logic we have for the hardlink case.
    
    Closes: #1753
    Approved by: jlebon
    9367a1be
  • Dan Nicholson's avatar
    lib/commit: Don't chown objects to repo target owner · 43d9cac4
    Dan Nicholson authored
    The idea is that if the process is running as root, it can change
    ownership of newly written files to match the owner of the repo.
    Unfortunately, it currently applies in the other direction, too - a
    non-root user writing to a root owned repository. If the repo is
    writable by the user but owned by root, it can still create files and
    directories there, but it can't change ownership of them.
    
    This feature comes from
    https://bugzilla.gnome.org/show_bug.cgi?id=738954. As it turns out, this
    feature was never completed. It only works on content objects and not
    metadata objects, refs, deltas, summaries, etc. Rather than try to fix
    all of those, remove the feature until someone has interest in
    completing it.
    
    Closes: #1754
    Approved by: cgwalters
    43d9cac4
  • Colin Walters's avatar
    rofiles-fuse: Improve error message for failure to open root · 04aff9c1
    Colin Walters authored
    I was debugging some rpm-ostree work and saw:
    `openat: No such file or directory`
    and it wasn't immediately obvious it was stderr from `rofiles-fuse`.
    
    Use the `err` API which is better in many ways; in this case
    it automatically prefixes with `argv0`.
    
    Closes: #1747
    Approved by: jlebon
    04aff9c1
  • Colin Walters's avatar
    finalize-staged: Bump timeout to 5 minutes · e242033f
    Colin Walters authored
    See https://github.com/projectatomic/rpm-ostree/issues/1568
    
    Basically for people on e.g. rotational media, the default 90
    second timeout can be too small.
    
    We're in a tough situation here, because delaying shutdown
    can be problematic too if the user is trying to shut down their
    laptop to put in a backpack, etc.
    
    There's potential optimizations here to make; I think we
    could pre-copy the kernel/initramfs for example.
    
    I suspect for some people the grub2 os-prober is a factor here too,
    if that tries to e.g. inspect attached USB rotational hard drives.
    But hopefully we'll get rid of that soon.
    
    Closes: #1755
    Approved by: jlebon
    e242033f
  • Simon McVittie's avatar
    2932897f
  • Colin Walters's avatar
    sysroot: Update some code to use fstatat_allow_noent API · 5183c8f3
    Colin Walters authored
    It's much easier to read and use correctly.  Making this change
    since I saw an unprefixed error in an issue.
    
    Closes: #1757
    Approved by: jlebon
    5183c8f3
  • Colin Walters's avatar
    sysroot: Add error prefixing to deployment parsing · 1db0db3d
    Colin Walters authored
    I think this is where the bare `readlinkat` came from in
    https://github.com/ostreedev/ostree/issues/1459
    
    `Error setting up sysroot: readlinkat: No such file or directory`
    
    Closes: #1757
    Approved by: jlebon
    1db0db3d
  • Jonathan Lebon's avatar
    ostree-prepare-root.service: Use RemainAfterExit=yes · ae99b9cc
    Jonathan Lebon authored
    For the same reasons as #1697. This is especially important in services
    that are likely to be used as an `After/Before=` target in other units.
    `ostree-prepare-root.service` is one such service.
    
    Closes: #1759
    Approved by: cgwalters
    ae99b9cc
  • Jonathan Lebon's avatar
    ostree-prepare-root.service: Run earlier in initrd · a4a49724
    Jonathan Lebon authored
    Previously, we were preparing the root very late in the boot process;
    right before we switch root. The issue with that is that most services
    in the initrd that run `After=initrd-root-fs.target` expect that
    `/sysroot` already points to the rootfs we'll be pivoting to. Running
    this late violates that assumption.
    
    This patch fixes this by making `ostree-prepare-root.service` instead
    run right after `sysroot.mount` (the physical sysroot mounted by
    systemd) but still before `initrd-root-fs.target` (which is the target
    signalling that `/sysroot` is now valid and ready).
    
    This should make it easier to integrate OSTree with other initrd
    services such as Ignition.
    
    Related: https://github.com/dustymabe/ignition-dracut/issues/20
    
    Closes: #1759
    Approved by: cgwalters
    a4a49724
  • Matthew Leeds's avatar
    Allow disabling pulling from LAN/USB/Internet · 3956fc88
    Matthew Leeds authored
    Currently libostree essentially has two modes when it's pulling refs:
    the "legacy" code paths pull only from the Internet, and the code paths
    that are aware of collection IDs try to pull from the Internet, the
    local network, and mounted filesystems (such as USB drives). The problem
    is that while we eventually want to migrate everyone to using collection
    IDs, we don't want to force checking LAN and USB sources if the user
    just wants to pull from the Internet, since the LAN/USB code paths can
    have privacy[1], security[2], and performance[3] implications.
    
    So this commit implements a new repo config option called "repo-finders"
    which can be configured to, for example, "config;lan;mount;" to check
    all three sources or "config;mount;" to disable searching the LAN. The
    set of values mirror those used for the --finders option of the
    find-remotes command. This configuration affects pulls in three places:
    1. the ostree_repo_find_remotes_async() API, regardless of whether or
    not the user of the API provided a list of OstreeRepoFinders
    2. the ostree_repo_finder_resolve_async() /
    ostree_repo_finder_resolve_all_async() API
    3. the find-remotes command
    
    This feature is especially important right now since we soon want to
    have Flathub publish a metadata key which will have Flatpak clients
    update the remote config to add a collection ID.[4]
    
    This effectively fixes https://github.com/flatpak/flatpak/issues/1863
    but I'll patch Flatpak too, so it doesn't pass finders to libostree only
    to then have them be removed.
    
    [1] https://github.com/flatpak/flatpak/issues/1863#issuecomment-404128824
    [2] https://github.com/ostreedev/ostree/issues/1527
    [3] Based on how long the "ostree find-remotes" command takes to
      complete, having the LAN finder enabled slows down that step of the
      pull process by about 40%. See also
      https://github.com/flatpak/flatpak/issues/1862
    [4] https://github.com/flathub/flathub/issues/676
    
    Closes: #1758
    Approved by: cgwalters
    3956fc88
  • Matthew Leeds's avatar
    lib/repo-pull: Disable LAN updates by default · 1d6347fe
    Matthew Leeds authored
    This commit disables searching on the local network for refs, unless
    explicitly requested by the user either by changing the value of the
    "core.repo-finders" config option, or by passing an OstreeRepoFinderAvahi to
    ostree_repo_find_remotes_async() / ostree_repo_finder_resolve_async(),
    or by specifying "lan" in the --finders option of the find-remotes
    command.
    
    The primary reason for this is that ostree_repo_find_remotes_async()
    takes about 40% longer to complete with the LAN finder enabled, and that
    API is used widely (e.g. in every flatpak operation). It's also probable
    that some users don't want ostree doing potentially unexpected traffic
    on the local network, even though everything pulled from a peer is GPG
    verified.
    
    Flathub will soon deploy collection IDs to everyone[1] so these code
    paths will soon see a lot more use and that's why this change is being
    made now.
    
    Endless is the only potential user of the LAN updates feature, and we
    can revert this patch on our fork of ostree. For it to be used outside
    Endless OS we will need to upstream eos-updater-avahi and
    eos-update-server into ostree.
    
    [1] https://github.com/flathub/flathub/issues/676
    
    Closes: #1758
    Approved by: cgwalters
    1d6347fe
  • Colin Walters's avatar
    remount: Refactor to helper function instead of loop · 1e16aec3
    Colin Walters authored
    Prep for further work.  It was silly to use a loop on
    a static array of two elements.
    
    Closes: #1760
    Approved by: jlebon
    1e16aec3
  • Jonathan Lebon's avatar
    boot: Add ostree-finalize-staged.path · ac1a919f
    Jonathan Lebon authored
    Rather than manually starting the `ostree-finalize-staged.service` unit,
    we can leverage systemd's path units for this. It fits quite nicely too,
    given that we already have a path we drop iif we have a staged
    deployment.
    
    To give some time for the preset to make it to systems, we don't yet
    drop the explicit call to `systemctl start`. Though we do make it
    conditional based on a DEBUG env var so that we can actually test it in
    CI for now. Once we're sure this has propagated, we can drop the
    `systemctl start` path and the env var together.
    
    Closes: #1740
    Approved by: cgwalters
    ac1a919f
  • Colin Walters's avatar
    README: Add bindings section · c9a9e6c3
    Colin Walters authored
    Since rust-libostree now exists too, let's make sure people
    know about it.
    
    Closes: #1762
    Approved by: jlebon
    c9a9e6c3
  • Matthew Leeds's avatar
    lib/repo-pull: Add an explanatory comment · 3fc46f37
    Matthew Leeds authored
    Closes: #1763
    Approved by: pwithnall
    3fc46f37
  • Matthew Leeds's avatar
    Rename core.repo-finders to core.default-repo-finders · ed41822b
    Matthew Leeds authored
    This renames a config key to make its semantics more obvious. Despite
    what the commit message says, it only applies when a set of repo finders
    is not specified (either on the command line or in a library API call).
    This also renames the corresponding ostree_repo_get function. We can do
    this since it hasn't been released yet.
    
    Closes: #1763
    Approved by: pwithnall
    ed41822b
  • Umang Jain's avatar
    Release 2018.9 · f3eba6bc
    Umang Jain authored
    Closes: #1761
    Approved by: cgwalters
    f3eba6bc
  • Simon McVittie's avatar
    New upstream version 2018.9.1 · 854d02fb
    Simon McVittie authored
    854d02fb
  • Simon McVittie's avatar
    Update upstream source from tag 'upstream/2018.9.1' · b258c988
    Simon McVittie authored
    Update to upstream version '2018.9.1'
    with Debian dir 0a4012639c2cd5a086d59fc989bb524dee0656d9
    b258c988
  • Simon McVittie's avatar
    New upstream release · 30f2a315
    Simon McVittie authored
    30f2a315
  • Simon McVittie's avatar
    Skip installation of new ostree-finalize-staged.path unit, which should be in... · b7fb58ab
    Simon McVittie authored
    Skip installation of new ostree-finalize-staged.path unit, which should be in ostree-boot when added (see #824650)
    b7fb58ab
  • Simon McVittie's avatar
    Override lintian warning for /usr/share/ostree/trusted.gpg.d/README-gpg · 32906501
    Simon McVittie authored
    It documents the directory in which it is located.
    32906501
  • Simon McVittie's avatar
    d/libostree-1-1.symbols: Update · ee8c9dff
    Simon McVittie authored
    ee8c9dff
  • Simon McVittie's avatar
    2018.9.1-1 · 08868c7b
    Simon McVittie authored
    08868c7b
  • Simon McVittie's avatar
    Merge tag 'debian/2018.9.1-1' into debian/stretch-backports · 44e600fe
    Simon McVittie authored
    ostree Debian release 2018.9.1-1
    44e600fe
  • Simon McVittie's avatar
    Rebuild for stretch-backports. · a96131fc
    Simon McVittie authored
      - debian/gbp.conf: Adjust for this branch
    a96131fc
......@@ -39,7 +39,10 @@ endif
if BUILDOPT_SYSTEMD
systemdsystemunit_DATA = src/boot/ostree-prepare-root.service \
src/boot/ostree-remount.service src/boot/ostree-finalize-staged.service
src/boot/ostree-remount.service \
src/boot/ostree-finalize-staged.service \
src/boot/ostree-finalize-staged.path \
$(NULL)
systemdtmpfilesdir = $(prefix)/lib/tmpfiles.d
dist_systemdtmpfiles_DATA = src/boot/ostree-tmpfiles.conf
......@@ -64,6 +67,7 @@ EXTRA_DIST += src/boot/dracut/module-setup.sh \
src/boot/dracut/ostree.conf \
src/boot/mkinitcpio/ostree \
src/boot/ostree-prepare-root.service \
src/boot/ostree-finalize-staged.path \
src/boot/ostree-remount.service \
src/boot/ostree-finalize-staged.service \
src/boot/grub2/grub2-15_ostree \
......
......@@ -2075,6 +2075,7 @@ EXTRA_DIST = $(all_dist_test_scripts) $(all_dist_test_data) autogen.sh \
src/boot/dracut/module-setup.sh src/boot/dracut/ostree.conf \
src/boot/mkinitcpio/ostree \
src/boot/ostree-prepare-root.service \
src/boot/ostree-finalize-staged.path \
src/boot/ostree-remount.service \
src/boot/ostree-finalize-staged.service \
src/boot/grub2/grub2-15_ostree \
......@@ -2764,7 +2765,10 @@ tests_test_gpg_verify_result_LDADD = $(TESTS_LDADD) $(OT_INTERNAL_GPGME_LIBS)
@BUILDOPT_MKINITCPIO_TRUE@mkinitcpioconfdir = $(sysconfdir)
@BUILDOPT_MKINITCPIO_TRUE@mkinitcpioconf_DATA = src/boot/mkinitcpio/ostree-mkinitcpio.conf
@BUILDOPT_SYSTEMD_TRUE@systemdsystemunit_DATA = src/boot/ostree-prepare-root.service \
@BUILDOPT_SYSTEMD_TRUE@ src/boot/ostree-remount.service src/boot/ostree-finalize-staged.service
@BUILDOPT_SYSTEMD_TRUE@ src/boot/ostree-remount.service \
@BUILDOPT_SYSTEMD_TRUE@ src/boot/ostree-finalize-staged.service \
@BUILDOPT_SYSTEMD_TRUE@ src/boot/ostree-finalize-staged.path \
@BUILDOPT_SYSTEMD_TRUE@ $(NULL)
@BUILDOPT_SYSTEMD_TRUE@systemdtmpfilesdir = $(prefix)/lib/tmpfiles.d
@BUILDOPT_SYSTEMD_TRUE@dist_systemdtmpfiles_DATA = src/boot/ostree-tmpfiles.conf
......
......@@ -74,6 +74,22 @@ The [BuildStream](https://gitlab.com/BuildStream/buildstream) build and
integration tool uses libostree as a caching system to store and share
built artifacts.
Language bindings
----
libostree is accessible via [GObject Introspection](https://gi.readthedocs.io/en/latest/);
any language which has implemented the GI binding model should work.
For example, Both [pygobject](https://pygobject.readthedocs.io/en/latest/)
and [gjs](https://gitlab.gnome.org/GNOME/gjs) are known to work
and further are actually used in libostree's test suite today.
Some bindings take the approach of using GI as a lower level and
write higher level manual bindings on top; this is more common
for statically compiled languages. Here's a list of such bindings:
- [ostree-go](https://github.com/ostreedev/ostree-go/)
- [rust-libostree](https://gitlab.com/fkrull/rust-libostree/)
Building
--------
......
......@@ -2420,17 +2420,17 @@ ostree_check_version (<em class="parameter"><code><span class="type">guint</span
<a name="OSTREE-MAX-METADATA-SIZE:CAPS"></a><h3>OSTREE_MAX_METADATA_SIZE</h3>
<pre class="programlisting">#define OSTREE_MAX_METADATA_SIZE (10 * 1024 * 1024)
</pre>
<p>Maximum permitted size in bytes of metadata objects. This is an
arbitrary number, but really, no one should be putting humongous
data in metadata.</p>
<p>Default limit for maximum permitted size in bytes of metadata objects fetched
over HTTP (including repo/config files, refs, and commit/dirtree/dirmeta
objects). This is an arbitrary number intended to mitigate disk space
exhaustion attacks.</p>
</div>
<hr>
<div class="refsect2">
<a name="OSTREE-MAX-METADATA-WARN-SIZE:CAPS"></a><h3>OSTREE_MAX_METADATA_WARN_SIZE</h3>
<pre class="programlisting">#define OSTREE_MAX_METADATA_WARN_SIZE (7 * 1024 * 1024)
</pre>
<p>Objects committed above this size will be allowed, but a warning
will be emitted.</p>
<p>This variable is no longer meaningful, it is kept only for compatibility.</p>
</div>
<hr>
<div class="refsect2">
......
......@@ -106,6 +106,14 @@
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-remove" title="ostree_mutable_tree_remove ()">ostree_mutable_tree_remove</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-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-ensure-dir" title="ostree_mutable_tree_ensure_dir ()">ostree_mutable_tree_ensure_dir</a> <span class="c_punctuation">()</span>
</td>
</tr>
......@@ -307,6 +315,52 @@ ostree_mutable_tree_replace_file (<em class="parameter"><code><a class="link" hr
</div>
<hr>
<div class="refsect2">
<a name="ostree-mutable-tree-remove"></a><h3>ostree_mutable_tree_remove ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
ostree_mutable_tree_remove (<em class="parameter"><code><a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#OstreeMutableTree" title="OstreeMutableTree"><span class="type">OstreeMutableTree</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *name</code></em>,
<em class="parameter"><code><span class="type">gboolean</span> allow_noent</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Remove the file or subdirectory named <em class="parameter"><code>name</code></em>
from the mutable tree <em class="parameter"><code>self</code></em>
.</p>
<div class="refsect3">
<a name="ostree-mutable-tree-remove.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>Tree</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>Name of file or subdirectory to remove</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>allow_noent</p></td>
<td class="parameter_description"><p>If <em class="parameter"><code>FALSE</code></em>
, an error will be thrown if <em class="parameter"><code>name</code></em>
does not exist in the tree</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <span class="type">GError</span></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="ostree-mutable-tree-ensure-dir"></a><h3>ostree_mutable_tree_ensure_dir ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
ostree_mutable_tree_ensure_dir (<em class="parameter"><code><a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#OstreeMutableTree" title="OstreeMutableTree"><span class="type">OstreeMutableTree</span></a> *self</code></em>,
......
......@@ -153,6 +153,14 @@
</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-get-min-free-space-bytes" title="ostree_repo_get_min_free_space_bytes ()">ostree_repo_get_min_free_space_bytes</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GKeyFile</span> *
</td>
<td class="function_name">
......@@ -168,6 +176,13 @@
</td>
</tr>
<tr>
<td class="function_type">const <span class="returnvalue">gchar</span> * const *
</td>
<td class="function_name">
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-get-default-repo-finders" title="ostree_repo_get_default_repo_finders ()">ostree_repo_get_default_repo_finders</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint</span>
</td>
......@@ -1209,16 +1224,18 @@
<a name="ostree-OstreeRepo.description"></a><h2>Description</h2>
<p>The <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> is like git, a content-addressed object store.
Unlike git, it records uid, gid, and extended attributes.</p>
<p>There are three possible "modes" for an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a>;
<a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE:CAPS"><code class="literal">OSTREE_REPO_MODE_BARE</code></a> is very simple - content files are
represented exactly as they are, and checkouts are just hardlinks.
<a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE-USER:CAPS"><code class="literal">OSTREE_REPO_MODE_BARE_USER</code></a> is similar, except the uid/gids are not
set on the files, and checkouts as hardlinks hardlinks work only for user checkouts.
A <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-ARCHIVE-Z2:CAPS"><code class="literal">OSTREE_REPO_MODE_ARCHIVE_Z2</code></a> repository in contrast stores
content files zlib-compressed. It is suitable for non-root-owned
<p>There are four possible "modes" for an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a>; <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE:CAPS"><code class="literal">OSTREE_REPO_MODE_BARE</code></a>
is very simple - content files are represented exactly as they are, and
checkouts are just hardlinks. <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE-USER:CAPS"><code class="literal">OSTREE_REPO_MODE_BARE_USER</code></a> is similar, except
the uid/gids are not set on the files, and checkouts as hardlinks work only
for user checkouts. <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-BARE-USER-ONLY:CAPS"><code class="literal">OSTREE_REPO_MODE_BARE_USER_ONLY</code></a> is the same as
BARE_USER, but all metadata is not stored, so it can only be used for user
checkouts. This mode does not require xattrs. A <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-ARCHIVE:CAPS"><code class="literal">OSTREE_REPO_MODE_ARCHIVE</code></a>
(also known as <a class="link" href="ostree-OstreeRepo.html#OSTREE-REPO-MODE-ARCHIVE-Z2:CAPS"><code class="literal">OSTREE_REPO_MODE_ARCHIVE_Z2</code></a>) repository in contrast stores
content files zlib-compressed. It is suitable for non-root-owned
repositories that can be served via a static HTTP server.</p>
<p>Creating an <a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> does not invoke any file I/O, and thus needs
to be initialized, either from an existing contents or with a new
to be initialized, either from existing contents or as a new
repository. If you have an existing repo, use <a class="link" href="ostree-OstreeRepo.html#ostree-repo-open" title="ostree_repo_open ()"><code class="function">ostree_repo_open()</code></a>
to load it from disk and check its validity. To initialize a new
repository in the given filepath, use <a class="link" href="ostree-OstreeRepo.html#ostree-repo-create" title="ostree_repo_create ()"><code class="function">ostree_repo_create()</code></a> instead.</p>
......@@ -1664,6 +1681,14 @@ ostree_repo_get_mode (<em class="parameter"><code><a class="link" href="ostree-O
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-get-min-free-space-bytes"></a><h3>ostree_repo_get_min_free_space_bytes ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
ostree_repo_get_min_free_space_bytes (<em class="parameter"><code><a class="link" href="ostree-OstreeRepo.html#OstreeRepo" title="OstreeRepo"><span class="type">OstreeRepo</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">guint64</span> *out_reserved_bytes</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-get-config"></a><h3>ostree_repo_get_config ()</h3>
<pre class="programlisting"><span class="returnvalue">GKeyFile</span> *
ostree_repo_get_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>
......@@ -1705,6 +1730,35 @@ repository (to see whether a ref was written).</p>
</div>
<hr>
<div class="refsect2">
<a name="ostree-repo-get-default-repo-finders"></a><h3>ostree_repo_get_default_repo_finders ()</h3>
<pre class="programlisting">const <span class="returnvalue">gchar</span> * const *
ostree_repo_get_default_repo_finders (<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>Get the set of default repo finders configured. See the documentation for
the "core.default-repo-finders" config key.</p>
<div class="refsect3">
<a name="ostree-repo-get-default-repo-finders.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-get-default-repo-finders.returns"></a><h4>Returns</h4>
<p><code class="literal">NULL</code>-terminated array of strings. </p>
<p><span class="annotation">[<a href="http://foldoc.org/array"><span class="acronym">array</span></a> zero-terminated=1][<a href="http://foldoc.org/element-type"><span class="acronym">element-type</span></a> utf8]</span></p>
</div>
<p class="since">Since: 2018.9</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>
......@@ -7111,6 +7165,7 @@ string to pull the latest commit for that ref</p></li>
<li class="listitem"><p>require-static-deltas (b): Require static deltas</p></li>
<li class="listitem"><p>override-commit-ids (as): Array of specific commit IDs to fetch for refs</p></li>
<li class="listitem"><p>timestamp-check (b): Verify commit timestamps are newer than current (when pulling via ref); Since: 2017.11</p></li>
<li class="listitem"><p>metadata-size-restriction (t): Restrict metadata objects to a maximum number of bytes; 0 to disable. Since: 2018.9</p></li>
<li class="listitem"><p>dry-run (b): Only print information on what will be downloaded (requires static deltas)</p></li>
<li class="listitem"><p>override-url (s): Fetch objects from this URL if remote specifies no metalink in options</p></li>
<li class="listitem"><p>inherit-transaction (b): Don't initiate, finish or abort a transaction, useful to do multiple pulls in one transaction.</p></li>
......@@ -8127,7 +8182,8 @@ by <a class="link" href="ostree-OstreeRepo.html#ostree-repo-load-commit" title="
gboolean no_copy_fallback;
gboolean force_copy; /* Since: 2017.6 */
gboolean bareuseronly_dirs; /* Since: 2017.7 */
gboolean unused_bools[5];
gboolean force_copy_zerosized; /* Since: 2018.9 */
gboolean unused_bools[4];
/* 4 byte hole on 64 bit */
const char *subpath;
......
......@@ -98,8 +98,10 @@
<keyword type="function" name="ostree_repo_create ()" link="ostree-OstreeRepo.html#ostree-repo-create"/>
<keyword type="function" name="ostree_repo_get_path ()" link="ostree-OstreeRepo.html#ostree-repo-get-path"/>
<keyword type="function" name="ostree_repo_get_mode ()" link="ostree-OstreeRepo.html#ostree-repo-get-mode"/>
<keyword type="function" name="ostree_repo_get_min_free_space_bytes ()" link="ostree-OstreeRepo.html#ostree-repo-get-min-free-space-bytes"/>
<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_get_default_repo_finders ()" link="ostree-OstreeRepo.html#ostree-repo-get-default-repo-finders" since="2018.9"/>
<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"/>
......@@ -246,6 +248,7 @@
<keyword type="function" name="ostree_mutable_tree_set_contents_checksum ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-set-contents-checksum"/>
<keyword type="function" name="ostree_mutable_tree_get_contents_checksum ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-get-contents-checksum"/>
<keyword type="function" name="ostree_mutable_tree_replace_file ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-replace-file"/>
<keyword type="function" name="ostree_mutable_tree_remove ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-remove"/>
<keyword type="function" name="ostree_mutable_tree_ensure_dir ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-ensure-dir"/>
<keyword type="function" name="ostree_mutable_tree_lookup ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-lookup"/>
<keyword type="function" name="ostree_mutable_tree_ensure_parent_dirs ()" link="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-ensure-parent-dirs"/>
......
......@@ -539,6 +539,10 @@ ostree_collection_ref_new, function in ostree-ref
</dt>
<dd></dd>
<dt>
OSTREE_META_KEY_DEPLOY_COLLECTION_ID, macro in ostree-repo-experimental
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#OstreeMutableTree" title="OstreeMutableTree">OstreeMutableTree</a>, typedef in <a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html" title="In-memory modifiable filesystem tree">In-memory modifiable filesystem tree</a>
</dt>
<dd></dd>
......@@ -587,6 +591,10 @@ ostree_collection_ref_new, function in ostree-ref
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-remove" title="ostree_mutable_tree_remove ()">ostree_mutable_tree_remove</a>, function in <a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html" title="In-memory modifiable filesystem tree">In-memory modifiable filesystem tree</a>
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html#ostree-mutable-tree-replace-file" title="ostree_mutable_tree_replace_file ()">ostree_mutable_tree_replace_file</a>, function in <a class="link" href="ostree-In-memory-modifiable-filesystem-tree.html" title="In-memory modifiable filesystem tree">In-memory modifiable filesystem tree</a>
</dt>
<dd></dd>
......@@ -1022,6 +1030,10 @@ ostree_repo_get_collection_id, function in ostree-misc-experimental
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-get-default-repo-finders" title="ostree_repo_get_default_repo_finders ()">ostree_repo_get_default_repo_finders</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-get-dfd" title="ostree_repo_get_dfd ()">ostree_repo_get_dfd</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>
......@@ -1030,6 +1042,10 @@ ostree_repo_get_collection_id, function in ostree-misc-experimental
</dt>
<dd></dd>
<dt>
<a class="link" href="ostree-OstreeRepo.html#ostree-repo-get-min-free-space-bytes" title="ostree_repo_get_min_free_space_bytes ()">ostree_repo_get_min_free_space_bytes</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-get-mode" title="ostree_repo_get_mode ()">ostree_repo_get_mode</a>, function in <a class="link" href="ostree-OstreeRepo.html" title="OstreeRepo: Content-addressed object store">OstreeRepo</a>
</dt>
<dd></dd>
......
......@@ -257,6 +257,7 @@ ostree_mutable_tree_get_metadata_checksum
ostree_mutable_tree_set_contents_checksum
ostree_mutable_tree_get_contents_checksum
ostree_mutable_tree_replace_file
ostree_mutable_tree_remove
ostree_mutable_tree_ensure_dir
ostree_mutable_tree_lookup
ostree_mutable_tree_ensure_parent_dirs
......@@ -294,8 +295,10 @@ ostree_repo_create_at
ostree_repo_create
ostree_repo_get_path
ostree_repo_get_mode
ostree_repo_get_min_free_space_bytes
ostree_repo_get_config
ostree_repo_get_dfd
ostree_repo_get_default_repo_finders
ostree_repo_hash
ostree_repo_equal
ostree_repo_copy_config
......@@ -596,6 +599,7 @@ ostree_repo_pull_from_remotes_async
ostree_repo_pull_from_remotes_finish
ostree_repo_resolve_keyring_for_collection
OSTREE_REPO_METADATA_REF
OSTREE_META_KEY_DEPLOY_COLLECTION_ID
</SECTION>
<SECTION>
......
......@@ -24,12 +24,6 @@
# - Structured option arguments (e.g. --foo KEY=VALUE) are not parsed.
#
# - Static deltas could likely be completed. (e.g. ostree static-delta delete [TAB])
#
# - The "--repo PATH" option needs to come after the subcommand or it
# won't be picked up for completion of subsequent options.
# i.e. ostree commit --repo PATH ... <-- works
# ostree --repo PATH commit ... <-- does not work
# (Possibly an easy fix.)
# Finds the position of the first non-flag word.
......@@ -183,9 +177,16 @@ __ostree_subcommands() {
# This handles "ostree [TAB]" (without a subcommand).
_ostree_ostree() {
case "$prev" in
--repo)
__ostree_compreply_dirs_only
return 0
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "$main_boolean_options" -- "$cur" ) )
COMPREPLY=( $( compgen -W "$main_options" -- "$cur" ) )
;;
*)
COMPREPLY=( $( compgen -W "$commands" -- "$cur" ) )
......@@ -1753,6 +1754,14 @@ _ostree() {
--verbose -v
--version
"
local main_options_with_args="
--repo
"
local main_options_with_args_glob=$( __ostree_to_extglob "$main_options_with_args" )
local main_options="
$main_boolean_options
$main_options_with_args
"
COMPREPLY=()
local cur prev words cword
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libostree 2018.8.
# Generated by GNU Autoconf 2.69 for libostree 2018.9.
#
# Report bugs to <walters@verbum.org>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libostree'
PACKAGE_TARNAME='libostree'
PACKAGE_VERSION='2018.8'
PACKAGE_STRING='libostree 2018.8'
PACKAGE_VERSION='2018.9'
PACKAGE_STRING='libostree 2018.9'
PACKAGE_BUGREPORT='walters@verbum.org'
PACKAGE_URL=''
......@@ -1547,7 +1547,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 2018.8 to adapt to many kinds of systems.
\`configure' configures libostree 2018.9 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1617,7 +1617,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libostree 2018.8:";;
short | recursive ) echo "Configuration of libostree 2018.9:";;
esac
cat <<\_ACEOF
......@@ -1864,7 +1864,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libostree configure 2018.8
libostree configure 2018.9
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2336,7 +2336,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 2018.8, which was
It was created by libostree $as_me 2018.9, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -3204,7 +3204,7 @@ fi
# Define the identity of the package.
PACKAGE='libostree'
VERSION='2018.8'
VERSION='2018.9'
# Some tools Automake needs.
......@@ -5938,9 +5938,9 @@ test -n "$YACC" || YACC="yacc"
YEAR_VERSION=2018
RELEASE_VERSION=8
RELEASE_VERSION=9
PACKAGE_VERSION=2018.8
PACKAGE_VERSION=2018.9
if echo "$CFLAGS" | grep -q -E -e '-Werror($| )'; then :
......@@ -18623,7 +18623,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 2018.8, which was
This file was extended by libostree $as_me 2018.9, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -18689,7 +18689,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 2018.8
libostree config.status 2018.9
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -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], [2018])
m4_define([release_version], [8])
m4_define([release_version], [9])
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
is_release_build=yes
......
ostree (2018.9.1-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
- debian/gbp.conf: Adjust for this branch
-- Simon McVittie <smcv@debian.org> Tue, 06 Nov 2018 21:26:16 +0000
ostree (2018.9.1-1) unstable; urgency=medium
* d/tests/build: Mark as superficial (see #904979)
* New upstream release
- d/libostree-1-1.symbols: Update
* Skip installation of new ostree-finalize-staged.path unit, which
should be in ostree-boot when added (see #824650)
* Override lintian warning for /usr/share/ostree/trusted.gpg.d/README-gpg
not being in /usr/share/doc: it documents the directory in which it is
located
-- Simon McVittie <smcv@debian.org> Tue, 30 Oct 2018 16:04:19 +0000
ostree (2018.8-2~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
......
......@@ -27,6 +27,7 @@ libostree-1.so.1 libostree-1-1 #MINVER#
LIBOSTREE_2018.5@LIBOSTREE_2018.5 2018.5
LIBOSTREE_2018.6@LIBOSTREE_2018.6 2018.6
LIBOSTREE_2018.7@LIBOSTREE_2018.7 2018.7
LIBOSTREE_2018.9@LIBOSTREE_2018.9 2018.9
ostree_async_progress_finish@LIBOSTREE_2016.3 2016.4
ostree_async_progress_get@LIBOSTREE_2017.6 2017.6
ostree_async_progress_get_status@LIBOSTREE_2016.3 2016.4
......@@ -144,6 +145,7 @@ libostree-1.so.1 libostree-1-1 #MINVER#
ostree_mutable_tree_lookup@LIBOSTREE_2016.3 2016.4
ostree_mutable_tree_new@LIBOSTREE_2016.3 2016.4
ostree_mutable_tree_new_from_checksum@LIBOSTREE_2018.7 2018.7
ostree_mutable_tree_remove@LIBOSTREE_2018.9 2018.9
ostree_mutable_tree_replace_file@LIBOSTREE_2016.3 2016.4
ostree_mutable_tree_set_contents_checksum@LIBOSTREE_2016.3 2016.4
ostree_mutable_tree_set_metadata_checksum@LIBOSTREE_2016.3 2016.4
......@@ -236,8 +238,10 @@ libostree-1.so.1 libostree-1-1 #MINVER#
ostree_repo_fsck_object@LIBOSTREE_2017.15 2017.15
ostree_repo_get_collection_id@LIBOSTREE_2018.6 2018.6
ostree_repo_get_config@LIBOSTREE_2016.3 2016.4
ostree_repo_get_default_repo_finders@LIBOSTREE_2018.9 2018.9
ostree_repo_get_dfd@LIBOSTREE_2016.4 2016.4
ostree_repo_get_disable_fsync@LIBOSTREE_2016.3 2016.3
ostree_repo_get_min_free_space_bytes@LIBOSTREE_2018.9 2018.9
ostree_repo_get_mode@LIBOSTREE_2016.3 2016.4
ostree_repo_get_parent@LIBOSTREE_2016.3 2016.4
ostree_repo_get_path@LIBOSTREE_2016.3 2016.4
......
etc/dracut.conf.d/ostree.conf
etc/grub.d/15_ostree
lib/systemd/system-generators/ostree-system-generator
lib/systemd/system/ostree-finalize-staged.path
lib/systemd/system/ostree-finalize-staged.service
lib/systemd/system/ostree-prepare-root.service
lib/systemd/system/ostree-remount.service
......
# Documentation about the directory it's in
ostree: package-contains-documentation-outside-usr-share-doc usr/share/ostree/trusted.gpg.d/README-gpg
......@@ -74,6 +74,7 @@ override_dh_install:
rm -f debian/tmp/etc/dracut.conf.d/ostree.conf
rm -f debian/tmp/etc/grub.d/15_ostree
rm -f debian/tmp/lib/systemd/system-generators/ostree-system-generator
rm -f debian/tmp/lib/systemd/system/ostree-finalize-staged.path
rm -f debian/tmp/lib/systemd/system/ostree-finalize-staged.service
rm -f debian/tmp/lib/systemd/system/ostree-prepare-root.service
rm -f debian/tmp/lib/systemd/system/ostree-remount.service
......
......@@ -2,4 +2,5 @@ Tests: gnome-desktop-testing
Depends: gnome-desktop-testing, ostree-tests
Tests: build
Restrictions: superficial
Depends: build-essential, libostree-dev, pkg-config
......@@ -83,11 +83,6 @@ Boston, MA 02111-1307, USA.
USB mounts use signed per-repo and per-commit metadata instead of
summary signatures.
</para>
<para>
This command relies on the summary file in the source repo, so you
may want to run <command>ostree summary -u</command> before running
this command.
</para>
</refsect1>
<refsect1>
......@@ -112,6 +107,15 @@ Boston, MA 02111-1307, USA.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--commit</option>=COMMIT</term>
<listitem><para>
Pull COMMIT instead of whatever REF points to. This can only
be used if a single ref is specified.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
......
......@@ -198,6 +198,38 @@ Boston, MA 02111-1307, USA.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>locking</varname></term>
<listitem><para>Boolean value controlling whether or not OSTree does
repository locking internally. This uses file locks and is
hence for multiple process exclusion (e.g. Flatpak and OSTree
writing to the same repository separately). This is enabled by
default since 2018.5.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>lock-timeout-secs</varname></term>
<listitem><para>Integer value controlling the number of seconds to
block while attempting to acquire a lock (see above). A value
of -1 means block indefinitely. The default value is 30.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>default-repo-finders</varname></term>
<listitem><para>Semicolon separated default list of finders (sources
for refs) to use when pulling. This can be used to disable
pulling from mounted filesystems, peers on the local network,
or the Internet. However note that it only applies when a set
of finders isn't explicitly specified, either by a consumer of
libostree API or on the command line. Possible values:
<literal>config</literal>, <literal>lan</literal>, and
<literal>mount</literal> (or any combination thereof). If unset, this
defaults to <literal>config;mount;</literal> (since the LAN finder is
costly).
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
......
......@@ -36,7 +36,7 @@ depends() {
install() {
dracut_install /usr/lib/ostree/ostree-prepare-root
inst_simple "${systemdsystemunitdir}/ostree-prepare-root.service"
mkdir -p "${initdir}${systemdsystemconfdir}/initrd-switch-root.target.wants"
mkdir -p "${initdir}${systemdsystemconfdir}/initrd-root-fs.target.wants"
ln_r "${systemdsystemunitdir}/ostree-prepare-root.service" \
"${systemdsystemconfdir}/initrd-switch-root.target.wants/ostree-prepare-root.service"
"${systemdsystemconfdir}/initrd-root-fs.target.wants/ostree-prepare-root.service"
}
# Copyright (C) 2018 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.
# For some implementation discussion, see:
# https://lists.freedesktop.org/archives/systemd-devel/2018-March/040557.html
[Unit]
Description=OSTree Monitor Staged Deployment
Documentation=man:ostree(1)
[Path]
PathExists=/run/ostree/staged-deployment
[Install]
WantedBy=multi-user.target
......@@ -19,6 +19,7 @@
# https://lists.freedesktop.org/archives/systemd-devel/2018-March/040557.html
[Unit]
Description=OSTree Finalize Staged Deployment
Documentation=man:ostree(1)
ConditionPathExists=/run/ostree-booted
DefaultDependencies=no
......@@ -31,6 +32,7 @@ Conflicts=final.target
Type=oneshot
RemainAfterExit=yes
ExecStop=/usr/bin/ostree admin finalize-staged
[Install]
WantedBy=multi-user.target
# This is a quite long timeout intentionally; the failure mode
# here is that people don't get an upgrade. We need to handle
# cases with slow rotational media, etc.
TimeoutStopSec=5m
......@@ -17,13 +17,13 @@
[Unit]
Description=OSTree Prepare OS/
Documentation=man:ostree(1)
DefaultDependencies=no
ConditionKernelCommandLine=ostree
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
After=initrd-switch-root.target
Before=initrd-switch-root.service
Before=plymouth-switch-root.service
After=sysroot.mount
Before=initrd-root-fs.target
[Service]
Type=oneshot
......@@ -31,3 +31,4 @@ ExecStart=/usr/lib/ostree/ostree-prepare-root /sysroot
StandardInput=null
StandardOutput=syslog
StandardError=syslog+console
RemainAfterExit=yes
......@@ -16,7 +16,8 @@
# Boston, MA 02111-1307, USA.
[Unit]
Description=OSTree Remount OS/ bind mounts
Description=OSTree Remount OS/ Bind Mounts
Documentation=man:ostree(1)
DefaultDependencies=no
ConditionKernelCommandLine=ostree
OnFailure=emergency.target
......
......@@ -18,8 +18,6 @@
***/
/* Add new symbols here. Release commits should copy this section into -released.sym. */
LIBOSTREE_2018.9 {
} LIBOSTREE_2018.7;
/* 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
......
......@@ -536,6 +536,12 @@ global:
/* No new symbols in 2018.8 */
LIBOSTREE_2018.9 {
ostree_mutable_tree_remove;
ostree_repo_get_min_free_space_bytes;
ostree_repo_get_default_repo_finders;
} LIBOSTREE_2018.7;
/* NOTE: Only add more content here in release commits! See the
* comments at the top of this file.
*/
......@@ -228,7 +228,7 @@ idle_invoke_async_progress (gpointer user_data)
OstreeAsyncProgress *self = user_data;
g_mutex_lock (&self->lock);
self->idle_source = NULL;
g_clear_pointer (&self->idle_source, g_source_unref);
g_mutex_unlock (&self->lock);
g_signal_emit (self, signals[CHANGED], 0);
......
......@@ -57,7 +57,8 @@ struct _OstreeBootloaderGrub2
GObject parent_instance;
OstreeSysroot *sysroot;
GFile *config_path_bios;
GFile *config_path_bios_1;
GFile *config_path_bios_2;
GFile *config_path_efi;
gboolean is_efi;
};
......@@ -77,7 +78,8 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
/* Look for the BIOS path first */
if (g_file_query_exists (self->config_path_bios, NULL))
if (g_file_query_exists (self->config_path_bios_1, NULL) ||
g_file_query_exists (self->config_path_bios_2, NULL))
{
/* If we found it, we're done */
*out_is_active = TRUE;
......@@ -97,7 +99,7 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
cancellable, error);
if (!direnum)
return FALSE;
while (TRUE)
{
GFileInfo *file_info;
......@@ -448,7 +450,7 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
}
static gboolean
_ostree_bootloader_grub2_is_atomic (OstreeBootloader *bootloader)
_ostree_bootloader_grub2_is_atomic (OstreeBootloader *bootloader)
{
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
return !self->is_efi;
......@@ -460,7 +462,8 @@ _ostree_bootloader_grub2_finalize (GObject *object)
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (object);
g_clear_object (&self->sysroot);
g_clear_object (&self->config_path_bios);
g_clear_object (&self->config_path_bios_1);
g_clear_object (&self->config_path_bios_2);
g_clear_object (&self->config_path_efi);
G_OBJECT_CLASS (_ostree_bootloader_grub2_parent_class)->finalize (object);
......@@ -493,6 +496,9 @@ _ostree_bootloader_grub2_new (OstreeSysroot *sysroot)
{
OstreeBootloaderGrub2 *self = g_object_new (OSTREE_TYPE_BOOTLOADER_GRUB2, NULL);
self->sysroot = g_object_ref (sysroot);
self->config_path_bios = g_file_resolve_relative_path (self->sysroot->path, "boot/grub2/grub.cfg");
/* Used by (at least) Debian */
self->config_path_bios_1 = g_file_resolve_relative_path (self->sysroot->path, "boot/grub/grub.cfg");
/* Used by (at least) Fedora */
self->config_path_bios_2 = g_file_resolve_relative_path (self->sysroot->path, "boot/grub2/grub.cfg");
return self;
}
......@@ -31,18 +31,18 @@ G_BEGIN_DECLS
/**
* OSTREE_MAX_METADATA_SIZE:
*
* Maximum permitted size in bytes of metadata objects. This is an
* arbitrary number, but really, no one should be putting humongous
* data in metadata.
*
* Default limit for maximum permitted size in bytes of metadata objects fetched
* over HTTP (including repo/config files, refs, and commit/dirtree/dirmeta
* objects). This is an arbitrary number intended to mitigate disk space
* exhaustion attacks.
*/
#define OSTREE_MAX_METADATA_SIZE (10 * 1024 * 1024)
/**
* OSTREE_MAX_METADATA_WARN_SIZE:
*
* Objects committed above this size will be allowed, but a warning
* will be emitted.
*
* This variable is no longer meaningful, it is kept only for compatibility.
*/
#define OSTREE_MAX_METADATA_WARN_SIZE (7 * 1024 * 1024)
......
......@@ -172,6 +172,9 @@ _ostree_fetcher_finalize (GObject *object)
curl_multi_cleanup (self->multi);
g_free (self->remote_name);
g_free (self->tls_ca_db_path);
g_free (self->tls_client_cert_path);
g_free (self->tls_client_key_path);
g_free (self->cookie_jar_path);
g_free (self->proxy);
g_assert_cmpint (g_hash_table_size (self->outstanding_requests), ==, 0);
......@@ -319,17 +322,15 @@ check_multi_info (OstreeFetcher *fetcher)
{
/* Handle file not found */
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"%s",
curl_easy_strerror (curlres));
"%s", curl_easy_strerror (curlres));
}
else
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED, "[%u] %s",
curlres,
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
"While fetching %s: [%u] %s", eff_url, curlres,
curl_easy_strerror (curlres));
if (req->fetcher->remote_name)
_ostree_fetcher_journal_failure (req->fetcher->remote_name,
eff_url, curl_easy_strerror (curlres));
_ostree_fetcher_journal_failure (req->fetcher->remote_name,
eff_url, curl_easy_strerror (curlres));
}
}
else
......
......@@ -172,6 +172,7 @@ _ostree_fetcher_journal_failure (const char *remote_name,
"MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(OSTREE_HTTP_FAILURE_ID),
"OSTREE_REMOTE=%s", remote_name,
"OSTREE_URL=%s", url,
"PRIORITY=%i", LOG_ERR,
NULL);
#endif
}
......
......@@ -305,31 +305,57 @@ ostree_mutable_tree_replace_file (OstreeMutableTree *self,
const char *checksum,
GError **error)
{
gboolean ret = FALSE;
g_return_val_if_fail (name != NULL, FALSE);
if (!ot_util_filename_validate (name, error))
goto out;
return FALSE;
if (!_ostree_mutable_tree_make_whole (self, NULL, error))
goto out;
return FALSE;
if (g_hash_table_lookup (self->subdirs, name))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Can't replace directory with file: %s", name);
goto out;
}
return glnx_throw (error, "Can't replace directory with file: %s", name);
invalidate_contents_checksum (self);
g_hash_table_replace (self->files,
g_strdup (name),
g_strdup (checksum));
return TRUE;
}
/**
* ostree_mutable_tree_remove:
* @self: Tree
* @name: Name of file or subdirectory to remove
* @allow_noent: If @FALSE, an error will be thrown if @name does not exist in the tree
* @error: a #GError
*
* Remove the file or subdirectory named @name from the mutable tree @self.
*/
gboolean
ostree_mutable_tree_remove (OstreeMutableTree *self,
const char *name,
gboolean allow_noent,
GError **error)
{
g_return_val_if_fail (name != NULL, FALSE);
ret = TRUE;
out:
return ret;
if (!ot_util_filename_validate (name, error))
return FALSE;
if (!_ostree_mutable_tree_make_whole (self, NULL, error))
return FALSE;
if (!g_hash_table_remove (self->files, name) &&
!g_hash_table_remove (self->subdirs, name))
{
if (allow_noent)
return TRUE; /* NB: early return */
return set_error_noent (error, name);
}
invalidate_contents_checksum (self);
return TRUE;
}
/**
......@@ -348,36 +374,29 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
OstreeMutableTree **out_subdir,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(OstreeMutableTree) ret_dir = NULL;
g_return_val_if_fail (name != NULL, FALSE);
if (!ot_util_filename_validate (name, error))
goto out;
return FALSE;
if (!_ostree_mutable_tree_make_whole (self, NULL, error))
goto out;
return FALSE;
if (g_hash_table_lookup (self->files, name))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Can't replace file with directory: %s", name);
goto out;
}
return glnx_throw (error, "Can't replace file with directory: %s", name);
ret_dir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
g_autoptr(OstreeMutableTree) ret_dir =
ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
if (!ret_dir)
{
ret_dir = ostree_mutable_tree_new ();
invalidate_contents_checksum (self);
insert_child_mtree (self, name, g_object_ref (ret_dir));
}
ret = TRUE;
ot_transfer_out_value (out_subdir, &ret_dir);
out:
return ret;
if (out_subdir)
*out_subdir = g_steal_pointer (&ret_dir);
return TRUE;
}
gboolean
......@@ -387,29 +406,24 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self,
OstreeMutableTree **out_subdir,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(OstreeMutableTree) ret_subdir = NULL;
g_autofree char *ret_file_checksum = NULL;
if (!_ostree_mutable_tree_make_whole (self, NULL, error))
goto out;
return FALSE;
ret_subdir = ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
g_autofree char *ret_file_checksum = NULL;
g_autoptr(OstreeMutableTree) ret_subdir =
ot_gobject_refz (g_hash_table_lookup (self->subdirs, name));
if (!ret_subdir)
{
ret_file_checksum = g_strdup (g_hash_table_lookup (self->files, name));
if (!ret_file_checksum)
{
set_error_noent (error, name);
goto out;
}
return set_error_noent (error, name);
}
ret = TRUE;
ot_transfer_out_value (out_file_checksum, &ret_file_checksum);
ot_transfer_out_value (out_subdir, &ret_subdir);
out:
return ret;
if (out_file_checksum)
*out_file_checksum = g_steal_pointer (&ret_file_checksum);
if (out_subdir)
*out_subdir = g_steal_pointer (&ret_subdir);
return TRUE;
}
/**
......@@ -430,49 +444,38 @@ ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self,
OstreeMutableTree **out_parent,
GError **error)
{
gboolean ret = FALSE;
int i;
OstreeMutableTree *subdir = self; /* nofree */
g_autoptr(OstreeMutableTree) ret_parent = NULL;
g_assert (metadata_checksum != NULL);
if (!_ostree_mutable_tree_make_whole (self, NULL, error))
goto out;
g_assert (metadata_checksum != NULL);
return FALSE;
if (!self->metadata_checksum)
ostree_mutable_tree_set_metadata_checksum (self, metadata_checksum);
for (i = 0; i+1 < split_path->len; i++)
OstreeMutableTree *subdir = self; /* nofree */
for (guint i = 0; i+1 < split_path->len; i++)
{
OstreeMutableTree *next;
const char *name = split_path->pdata[i];
if (g_hash_table_lookup (subdir->files, name))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Can't replace file with directory: %s", name);
goto out;
}
return glnx_throw (error, "Can't replace file with directory: %s", name);
next = g_hash_table_lookup (subdir->subdirs, name);
if (!next)
if (!next)
{
invalidate_contents_checksum (subdir);
next = ostree_mutable_tree_new ();
ostree_mutable_tree_set_metadata_checksum (next, metadata_checksum);
insert_child_mtree (subdir, g_strdup (name), next);
}
subdir = next;
}
ret_parent = g_object_ref (subdir);
ret = TRUE;
ot_transfer_out_value (out_parent, &ret_parent);
out:
return ret;
if (out_parent)
*out_parent = g_object_ref (subdir);
return TRUE;
}
const char empty_tree_csum[] = "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d";
......
......@@ -77,6 +77,12 @@ gboolean ostree_mutable_tree_replace_file (OstreeMutableTree *self,
const char *checksum,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_mutable_tree_remove (OstreeMutableTree *self,
const char *name,
gboolean allow_noent,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
const char *name,
......
......@@ -196,6 +196,7 @@ static gboolean
create_file_copy_from_input_at (OstreeRepo *repo,
OstreeRepoCheckoutAtOptions *options,
CheckoutState *state,
const char *checksum,
GFileInfo *file_info,
GVariant *xattrs,
GInputStream *input,
......@@ -358,8 +359,35 @@ create_file_copy_from_input_at (OstreeRepo *repo,
replace_mode = GLNX_LINK_TMPFILE_NOREPLACE_IGNORE_EXIST;
break;
case OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL:
/* We don't support copying in union identical */
g_assert_not_reached ();
{
replace_mode = GLNX_LINK_TMPFILE_NOREPLACE;
struct stat dest_stbuf;
if (!glnx_fstatat_allow_noent (destination_dfd, destination_name, &dest_stbuf,
AT_SYMLINK_NOFOLLOW, error))
return FALSE;
if (errno == 0)
{
/* We do a checksum comparison; see also equivalent code in
* checkout_file_hardlink().
*/
OstreeChecksumFlags flags = 0;
if (repo->disable_xattrs)
flags |= OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS;
g_autofree char *actual_checksum = NULL;
if (!ostree_checksum_file_at (destination_dfd, destination_name,
&dest_stbuf, OSTREE_OBJECT_TYPE_FILE,
flags, &actual_checksum, cancellable, error))
return FALSE;
if (g_str_equal (checksum, actual_checksum))
return TRUE;
/* Otherwise, fall through and do the link, we should
* get EEXIST.
*/
}
}
break;
}
......@@ -586,6 +614,7 @@ checkout_one_file_at (OstreeRepo *repo,
const gboolean is_symlink = (g_file_info_get_file_type (source_info) == G_FILE_TYPE_SYMBOLIC_LINK);
const gboolean is_whiteout = (!is_symlink && options->process_whiteouts &&
g_str_has_prefix (destination_name, WHITEOUT_PREFIX));
const gboolean is_reg_zerosized = (!is_symlink && g_file_info_get_size (source_info) == 0);
/* First, see if it's a Docker whiteout,
* https://github.com/docker/docker/blob/1a714e76a2cb9008cd19609059e9988ff1660b78/pkg/archive/whiteouts.go
......@@ -604,6 +633,10 @@ checkout_one_file_at (OstreeRepo *repo,
need_copy = FALSE;
}
else if (options->force_copy_zerosized && is_reg_zerosized)
{
need_copy = TRUE;
}
else if (!options->force_copy)
{
HardlinkResult hardlink_res = HARDLINK_RESULT_NOT_SUPPORTED;
......@@ -699,6 +732,7 @@ checkout_one_file_at (OstreeRepo *repo,
if (can_cache
&& !is_whiteout
&& !is_symlink
&& !is_reg_zerosized
&& need_copy
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE
&& options->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
......@@ -762,12 +796,12 @@ checkout_one_file_at (OstreeRepo *repo,
* succeeded at hardlinking above.
*/
if (options->no_copy_fallback)
g_assert (is_bare_user_symlink);
g_assert (is_bare_user_symlink || is_reg_zerosized);
if (!ostree_repo_load_file (repo, checksum, &input, NULL, &xattrs,
cancellable, error))
return FALSE;
if (!create_file_copy_from_input_at (repo, options, state, source_info, xattrs, input,
if (!create_file_copy_from_input_at (repo, options, state, checksum, source_info, xattrs, input,
destination_dfd, destination_name,
cancellable, error))
return glnx_prefix_error (error, "Copy checkout of %s to %s", checksum, destination_name);
......
......@@ -245,16 +245,7 @@ commit_loose_regfile_object (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
/* 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
&& self->target_owner_uid != -1)
{
if (fchown (tmpf->fd, self->target_owner_uid, self->target_owner_gid) < 0)
return glnx_throw_errno_prefix (error, "fchown");
}
else if (self->mode == OSTREE_REPO_MODE_BARE)
if (self->mode == OSTREE_REPO_MODE_BARE)
{
if (TEMP_FAILURE_RETRY (fchown (tmpf->fd, uid, gid)) < 0)
return glnx_throw_errno_prefix (error, "fchown");
......@@ -1336,18 +1327,6 @@ write_metadata_object (OstreeRepo *self,
gsize len;
const guint8 *bufp = g_bytes_get_data (buf, &len);
/* Do the size warning here, to avoid warning for already extant metadata */
if (G_UNLIKELY (len > OSTREE_MAX_METADATA_WARN_SIZE))
{
g_autofree char *metasize = g_format_size (len);
g_autofree char *warnsize = g_format_size (OSTREE_MAX_METADATA_WARN_SIZE);
g_autofree char *maxsize = g_format_size (OSTREE_MAX_METADATA_SIZE);
g_warning ("metadata object %s is %s, which is larger than the warning threshold of %s." \