summaryrefslogtreecommitdiff
path: root/src/libostree
Commit message (Collapse)AuthorAgeFilesLines
* lib/sysroot-cleanup: Convert bootdir listing to dfd-relativeJonathan Lebon2023-04-141-54/+25
| | | | No functional change.
* Revert "repo: Fix nullability for remote options"Colin Walters2023-03-171-1/+1
| | | | This reverts commit c4d03d28500c75ad2bcf7b75383fc60fe7b83ca8.
* Merge pull request #2813 from tintou/tintou/asyncprogress-typedefColin Walters2023-03-171-1/+7
|\ | | | | libostree: Ignore new_and_connect in the introspection
| * libostree: Ignore new_and_connect in the introspectionCorentin Noël2023-02-091-1/+7
| | | | | | | | | | This function can't be correctly introspected and it is easy enough to connect to the signal afterwards.
* | Merge pull request #2836 from smcv/file-info-sizeColin Walters2023-03-172-3/+9
|\ \ | | | | | | Cope with GLib 2.76 being more strict about GFileInfo standard::size
| * | write_content_object: Don't assume file info has standard::sizeSimon McVittie2023-03-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The file info object for symlinks might validly not have this attribute. If not, behave as though it was 0, matching what happened with older versions of GLib. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | _ostree_zlib_file_header_new: Default size to 0Simon McVittie2023-03-171-1/+4
| | | | | | | | | | | | | | | | | | | | | Similar to the previous commit, but for ostree_raw_file_to_archive_z2_stream() and similar public APIs. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | ostree_raw_file_to_content_stream: Make size default to 0Simon McVittie2023-03-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some existing code calls into ostree_raw_file_to_content_stream() with file objects that do not have the standard::size attribute. Since GLib 2.76.0, attempting to access the size of such an object raises a critical warning. Handle this more gracefully by defaulting the size to 0, like earlier versions of GLib did. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | Merge pull request #2837 from smcv/g-steal-fdColin Walters2023-03-174-15/+15
|\ \ \ | | | | | | | | Use g_steal_fd() in preference to glnx_steal_fd()
| * | | Use g_steal_fd() in preference to glnx_steal_fd()Simon McVittie2023-03-174-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | g_steal_fd() exists in GLib since 2.70, and libglnx has a backport for older GLib versions, equivalent to the libglnx-specific glnx_steal_fd(). Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | | Merge pull request #2705 from cgwalters/always-bootJoseph Marrero Corchado2023-03-173-5/+13
|\ \ \ \ | | | | | | | | | | Add `sysroot.bootprefix` option
| * | | | Add `sysroot.bootprefix` optionColin Walters2022-08-313-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up to https://github.com/ostreedev/ostree/pull/2149/commits/0ced9fde7649271d9458ca424aa8c41908634b02 "sysroot: Support /boot on root or as seperate filesystem for syslinux and u-boot" What we should have done at the time is changed our bootloader entries to be prefixed with `/boot`. This means that the GRUB2 BLS support will Just Work. For now, I'm making this option default to off out of a lot of conservatism. I think in the future we should flip this on by default.
* | | | | repo: Fix nullability for remote optionsColin Walters2023-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, the nullability of the output value here is dependent on whether the `default_value` parameter is provided. There's no way to express this in introspection or Rust.
* | | | | lib: Fix two nullable annotationsColin Walters2023-03-173-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | - commit parents are optional - remote URLs are optional
* | | | | Add docs and fix annotations for ostree-repo-file.cColin Walters2023-03-171-0/+51
| |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | The code here is not great, embarassing we've gone this long without docs for some of these public API functions too. I think this is right though.
* | | | core: Ensure glib standard::size attribute is always setEvan Anderson2023-03-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * A recent change in glib [1] requires that the appropriate attribute be available when calling getters. ostree core only sets this attribute on regular files, and frequently triggers the critical warning. Solve this by setting standard::size to zero for non-regular files. Fixes https://github.com/ostreedev/ostree/issues/2827 [1]: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3261
* | | | Merge pull request #2831 from nanonyme/larger-bufferColin Walters2023-03-151-2/+3
|\ \ \ \ | | | | | | | | | | Increase buffer size for create_regular_tmpfile_linkable_with_content
| * | | | Increase buffer size for create_regular_tmpfile_linkable_with_contentSeppo Yli-Olli2023-03-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The small buffer size results in really bad performance under any FUSE-based filesystems with round-trips.
* | | | | Merge pull request #2814 from tintou/tintou/ostree-coverageColin Walters2023-03-1413-66/+96
|\ \ \ \ \ | |/ / / / |/| | | | libostree: Enhance the annotation coverage
| * | | | libostree: Enhance the annotation coverageCorentin Noël2023-02-0913-66/+96
| | |_|/ | |/| | | | | | | | | | | | | | | | | | Increase the coverage of the GObject Introspection annotation and most notably replace the use of "allow-none" with "out" parameters to "nullable" or "optional" as the previous annotation is deprecated and ambiguous.
* | | | lib/fetcher-util: Wake up main context when a request is completePhilip Withnall2023-03-101-0/+4
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the value of `data->done` is not watched by the main context, the context doesn’t know to wake up from `g_main_context_iteration()` when that value is changed. The code currently relies on something else happening to wake the main context up shortly after `data->done` is set. That doesn’t seem very reliable, so wake the main context up explicitly. Spotted this while reading the code while trying to debug a stall with backtrace: ``` 5 0x00007ffff68bbbfb in g_main_context_iteration (context=0x60f000136900, may_block=1) at ../../source/glib/glib/gmain.c:4343 6 0x00007fffdc0e50db in _ostree_fetcher_mirrored_request_to_membuf_once (fetcher=0x604001138c10, mirrorlist=0x603001df18b0, filename=0x7fffdc1049e7 "summary.sig", flags=OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT, if_none_match=0x602002f3b7f0 "\"640a49ff-250\"", if_modified_since=1678395903, out_contents=0x7fffdadd0e80, out_not_modified=0x7fffdadd0e38, out_etag=0x7fffdadd0e28, out_last_modified=0x7fffdadd0e00, max_size=10485760, cancellable=0x6060004bd720, error=0x7fffdadd0ca0) at src/libostree/ostree-fetcher-util.c:95 7 0x00007fffdc0e52e0 in _ostree_fetcher_mirrored_request_to_membuf (fetcher=0x604001138c10, mirrorlist=0x603001df18b0, filename=0x7fffdc1049e7 "summary.sig", flags=OSTREE_FETCHER_REQUEST_OPTIONAL_CONTENT, if_none_match=0x602002f3b7f0 "\"640a49ff-250\"", if_modified_since=1678395903, n_network_retries=5, out_contents=0x7fffdadd0e80, out_not_modified=0x7fffdadd0e38, out_etag=0x7fffdadd0e28, out_last_modified=0x7fffdadd0e00, max_size=10485760, cancellable=0x6060004bd720, error=0x7fffdadd10c0) at src/libostree/ostree-fetcher-util.c:155 8 0x00007fffdc08d937 in _ostree_preload_metadata_file (self=0x61600057bd80, fetcher=0x604001138c10, mirrorlist=0x603001df18b0, filename=0x7fffdc1049e7 "summary.sig", is_metalink=0, if_none_match=0x602002f3b7f0 "\"640a49ff-250\"", if_modified_since=1678395903, n_network_retries=5, out_bytes=0x7fffdadd0e80, out_not_modified=0x7fffdadd0e38, out_etag=0x7fffdadd0e28, out_last_modified=0x7fffdadd0e00, cancellable=0x6060004bd720, error=0x7fffdadd10c0) at src/libostree/ostree-repo-pull.c:3329 9 0x00007fffdc099712 in ostree_repo_remote_fetch_summary_with_options (self=0x61600057bd80, name=0x6020007f4fd0 "eos-apps", options=0x0, out_summary=0x7fffdadd0f88, out_signatures=0x7fffdadd0f80, cancellable=0x6060004bd720, error=0x7fffdadd10c0) at src/libostree/ostree-repo-pull.c:6675 10 0x00007fffdc06887f in ostree_repo_remote_fetch_summary (self=0x61600057bd80, name=0x6020007f4fd0 "eos-apps", out_summary=0x7fffdadd0f88, out_signatures=0x7fffdadd0f80, cancellable=0x6060004bd720, error=0x7fffdadd10c0) at src/libostree/ostree-repo.c:2706 11 0x00007fffdc18f5de in flatpak_dir_remote_fetch_summary (self=0x60c00577e640, name_or_uri=0x6020007f4fd0 "eos-apps", only_cached=0, out_summary=0x7fffdadd10f0, out_summary_sig=0x7fffdadd10e8, cancellable=0x6060004bd720, error=0x7fffdadd10c0) at /opt/gnome/source/flatpak/common/flatpak-dir.c:12235 12 0x00007fffdc1918cb in _flatpak_dir_get_remote_state (self=0x60c00577e640, remote_or_uri=0x6020007f4fd0 "eos-apps", optional=1, local_only=0, only_cached=0, opt_summary_is_index=0, opt_summary=0x0, opt_summary_sig=0x0, cancellable=0x6060004bd720, error=0x7fffdadd15a0) at /opt/gnome/source/flatpak/common/flatpak-dir.c:12789 13 0x00007fffdc19206d in flatpak_dir_get_remote_state_optional (self=0x60c00577e640, remote=0x6020007f4fd0 "eos-apps", only_cached=0, cancellable=0x6060004bd720, error=0x7fffdadd15a0) at /opt/gnome/source/flatpak/common/flatpak-dir.c:12953 14 0x00007fffdc1784f2 in flatpak_dir_update_appstream (self=0x60c00577e640, remote=0x6020007f4fd0 "eos-apps", arch=0x7fffdc239f30 "x86_64", out_changed=0x0, progress=0x6110007479c0, cancellable=0x6060004bd720, error=0x7fffdadd15a0) at /opt/gnome/source/flatpak/common/flatpak-dir.c:5182 ``` I don’t think it’ll fix it (calling `g_main_context_wakeup()` on the context in the debugger didn’t help), but it can’t hurt. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* | | Merge pull request #2755 from cgwalters/use-new-selinux-argJonathan Lebon2023-02-171-4/+4
|\ \ \
| * | | deploy: Use `semodule --refresh` if availableColin Walters2022-11-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current FCOS emits a warning: ``` [root@cosa-devsh ~]# journalctl -b -1 -u ostree-finalize-staged --grep=deprecated Nov 01 20:21:21 cosa-devsh ostree[2481]: The --rebuild-if-modules-changed option is deprecated. Use --refresh instead. [root@cosa-devsh ~]# ```
* | | | Release 2023.1v2023.1Colin Walters2023-02-172-5/+5
| | | |
* | | | Merge pull request #1946 from dbnicholson/ostree-metadata-apiColin Walters2023-02-0943-197/+544
|\ \ \ \ | |_|/ / |/| | | ostree-metadata commit API
| * | | repo: Prevent publishing summary without matching signatureDan Nicholson2023-02-071-7/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a temporary directory for the summary and signature file in `ostree_repo_regenerate_metadata` so that the summary file isn't published if signing fails. This prevents publishing a summary without a signature file or leaving a mismatched signature file in place.
| * | | lib: Provide internal summary signing with separate directoryDan Nicholson2023-02-073-42/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the summary signing APIs to use internal versions where the directory fd containing the summary can be found. The existing signing APIs still uses the repo directory fd, but this will allow using a temporary directory for the summary and signature in the new metadata generating API.
| * | | repo: Create metadata commit in ostree_repo_regenerate_metadataDan Nicholson2023-02-073-4/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than creating the `ostree-metadata` commit in the summary builtin, do it in the new `ostree_repo_regenerate_metadata` API. The commit contents are unchanged and the commit is generated before the summary as before. To keep from triggering an extra summary update, automatic summary updating is disabled in the transaction. Since the summary builtin was already using the new API, it will continue to generate the `ostree-metadata` commit when the repo has a collection ID. However, the `ostree_repo_regenerate_summary` API will still only generate the summary file as before.
| * | | commit: Allow skipping automatic summary generationDan Nicholson2023-02-072-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a commit is being made during summary generation, then it would trigger the summary to be generated again. That's either unwanted busy work or could result in an infinite loop. Add a boolean in `OstreeRepoTxn` to disable automatic summary generation as seen fit.
| * | | repo: Add API to regenerate and sign repo metadataDan Nicholson2023-02-073-31/+129
| | | | | | | | | | | | | | | | | | | | | | | | Currently this is just a wrapper around regenerating and signing the summary in one call, but later it will be used to also generate the `ostree-metadata` commit if the repo has a collection ID.
| * | | Strip trailing whitespace on all C filesDan Nicholson2023-02-0740-119/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My editor started following the configuration in .editorconfig and is applying this rule to many files I'm editing. Let's just get this over with and strip everything. This was done like so: git ls-files | grep '\.[ch]$' | xargs sed -ri 's/\s+$//'
* | | | lib/sysroot-upgrader: add some 'nullable' annotationsLuca BRUNO2023-02-081-3/+3
|/ / /
* | | Merge pull request #2793 from ericcurtin/aboot-bootloader-supportColin Walters2023-01-055-0/+323
|\ \ \ | | | | | | | | bootloader: Add an aboot (Android) bootloader backend
| * | | bootloader: Add an aboot (Android) bootloader backendEric Curtin2022-12-155-0/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aboot is special in that it packages kernel, initrd, cmdline, dtb and signature one combined image (similar to upcoming unified kernel images). This is then loaded as an image into an aboot partition. This image is signed by the OS vendor and covers everything in the image. So locally on the deployed system it should not be possible to boot an unsigned image (unless signature checking is turned off). We call a shell script aboot-deploy when it is required to write a new image to the aboot partition (a file typically starting with aboot and ending in .img extension). This shell script may also read some configurations from a .cfg file. Signed-off-by: Eric Curtin <ecurtin@redhat.com>
* | | | lib/repo-checkout: Add ALLPERMS for muslAlex Kiernan2022-12-311-0/+5
|/ / / | | | | | | | | | | | | | | | ALLPERMS is glibc specific, add a definition for musl. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
* | | Merge pull request #2766 from cgwalters/avoid-endless-object-queueingJonathan Lebon2022-12-011-0/+8
|\ \ \ | | | | | | | | Closes https://github.com/ostreedev/ostree/issues/2732
| * | | fetcher: Avoid too large queues for metadata processingColin Walters2022-11-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We added backoff/queueing for fetching via HTTP, but we have another queue in the metadata scanning which can also grow up to the number of outstanding objects, which can be large. Capping the scanning operation when we have hit our operation limit will avoid potentially large amounts of allocations in the case of e.g. a slow network. Closes: https://github.com/ostreedev/ostree/issues/2732
* | | | lib/repo: fix an 'unused-function' warningLuca BRUNO2022-11-291-0/+2
| | | | | | | | | | | | | | | | This silences a warning when building the project with `--with-gpme=no`.
* | | | lib: assert more invariantsLuca BRUNO2022-11-248-23/+27
| | | | | | | | | | | | | | | | | | | | This converts a few more safety checks into either plain GErrors or hard assertions.
* | | | Release 2022.7v2022.7Colin Walters2022-11-232-7/+7
| | | |
* | | | sysroot: Add an API to initialize with mountnsColin Walters2022-11-223-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lowers down into the C library some logic we have in the binary/app logic, in prep for having more Rust-native CLI code in https://github.com/ostreedev/ostree-rs-ext/pull/412 Basically we want to *ensure* a mount namespace by invoking `unshare()` if necessary, instead of requiring our callers to do this dance. This also helps fix e.g. Closes: https://github.com/ostreedev/ostree/issues/2769
* | | | lib/pull: Fix a small leak when a variable is reusedPhilip Withnall2022-11-211-0/+1
| | | | | | | | | | | | | | | | Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* | | | Idempotent delete operation for OstreeKernelArgsRafael Garcia Ruiz2022-11-183-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ostree_kernel_args_delete_if_present checks if an argument is present in OstreeKernelArgs and delete it. Signed-off-by: Rafael Garcia Ruiz <rafael.garcia@collabora.com>
* | | | ostree_kernel_args_contains for OstreeKernelArgsRafael Garcia Ruiz2022-11-183-4/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check if an argument is present in OstreeKernelArgs. This is a way to make easier idempotent append and delete operations. ostree_kernel_args_append_if_missing uses it to avoid inserting a duplicate key. Closes #2329 Signed-off-by: Rafael Garcia Ruiz <rafael.garcia@collabora.com>
* | | | Replace calls to g_memdup() with g_memdup2()Simon McVittie2022-11-112-3/+3
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | g_memdup() is subject to an integer overflow on 64-bit machines if the object being copied is larger than UINT_MAX bytes. I suspect none of these objects can actually be that large in practice, but it's easier to replace all the calls than it is to assess whether we need to replace them. A backport in libglnx is used on systems where GLib is older than 2.68.x. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | Merge pull request #2760 from cgwalters/offline-deploy-no-bwrapLuca Bruno2022-11-111-3/+3
|\ \ \ | | | | | | | | deploy: Don't rebuild selinux policy on first deployment
| * | | deploy: Don't rebuild selinux policy on first deploymentColin Walters2022-11-091-3/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically, it should not be necessary - the policy should be up-to-date. We don't want to force on continual policy rebuilds. Even trying to run bwrap when we're *not* in a booted root can cause failures in nested containerization scenarios. Closes: https://github.com/ostreedev/ostree/issues/2758
* | | Enabling retry for HTTP 500 internal server errorRicardo Noriega2022-11-081-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Ricardo Noriega <rnoriega@redhat.com> Use G_IO_ERROR_BUSY to represent 500 error Signed-off-by: Ricardo Noriega <rnoriega@redhat.com> Make G_IO_ERROR_BUSY independent from glib version Signed-off-by: Ricardo Noriega <rnoriega@redhat.com>
* | lib/repo-refs: properly return an error valueLuca BRUNO2022-10-261-1/+2
| | | | | | | | | | This tweaks a logic check in order to return a proper error value when the related condition is not satisfied.
* | lib/sign-ed25519: convert invariant checks to assertionsLuca BRUNO2022-10-261-11/+14
| | | | | | | | | | | | This converts several invariant checks to asserts. Most of the functions in this file were already using assertions, so this aligns the remaining few outliers to the rest.