summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE: Merge branches 'wip/smcv/subproject' and 'wip/smcv/warnings'wip/smcv/for-flatpak-meson-buildSimon McVittie2022-04-245-10/+11
|\ | | | | | | See !34 and !35.
| * meson: Build with more warnings by defaultSimon McVittie2022-04-241-0/+1
| | | | | | | | | | | | | | | | If we keep this module closer to warnings-clean, then it can be submoduled into Meson projects that enable warnings by default without having to override it to a lower warning-level. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * tests: Make signedness of timestamp agreeSimon McVittie2022-04-241-1/+1
| | | | | | | | | | | | | | This silences a warning from gcc -Wsign-compare. g_get_monotonic_time() returns a signed int64. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * tests: Make iterator signedness agree with limitSimon McVittie2022-04-241-1/+1
| | | | | | | | | | | | | | | | | | g_variant_n_children() returns a size_t (or gsize, which is equivalent) so in principle it could overflow an int, although in practice we are not going to have that many extended attributes. This silences a warning from gcc -Wsign-compare. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * fdio: Match signedness of length parameterSimon McVittie2022-04-241-1/+1
| | | | | | | | | | | | | | | | This is documented as taking a length of -1, but the parameter is unsigned, so it's more correctly ((gsize) -1). This silences a warning from gcc -Wsign-compare. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * fdio: Make signedness of iterator consistent with limitSimon McVittie2022-04-241-1/+1
| | | | | | | | | | | | | | gcc -Wsign-compare warns about this. The iteration limit is constant and small enough that either int or guint would be fine. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * fdio, xattrs: Mark unused cancellables as suchSimon McVittie2022-04-242-5/+5
| | | | | | | | | | | | | | These functions take a GCancellable for consistency with other file APIs, but are not actually cancellable at the moment. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * console: Mark an unused parameter as suchSimon McVittie2022-04-241-1/+1
| | | | | | | | | | | | | | This signal handler is only called for SIGWINCH, so it doesn't need to look at its parameter. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | fdio: Skip glnx_try_fallocate() if _GNU_SOURCE is not definedSimon McVittie2022-04-212-1/+2
| | | | | | | | | | | | | | | | | | fallocate() is only visible in fcntl.h if _GNU_SOURCE is defined. Most users of libglnx will want to do that anyway, but it seems nicer to avoid "implicit declaration of function ‘fallocate’" warnings from simply including <libglnx.h> into naive code. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | tests: Verify libglnx can work as a subprojectSimon McVittie2022-04-218-5/+95
| | | | | | | | | | | | | | What isn't tested usually doesn't work, and the only way to use libglnx is as a subproject, so test it like that. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | tests: Optionally skip building and running the actual testsSimon McVittie2022-04-212-20/+31
| | | | | | | | | | | | | | If we're building libglnx as a subproject in a larger project, we won't necessarily want to run these. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | tests: Build libglnx-testlib as a separate static librarySimon McVittie2022-04-211-2/+20
| | | | | | | | | | | | | | | | One of Flatpak's unit tests uses this, for _GLNX_TEST_SCOPED_TEMP_DIR. Its API is not really stable, but libglnx is a "copylib" anyway, so none of it has (or needs) a strictly stable API. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | meson: Always build with hidden symbol visibilitySimon McVittie2022-04-211-0/+1
| | | | | | | | | | | | | | | | | | This copylib isn't intended to be part of anyone's ABI. In Autotools, this is typically implemented by doing some ad-hoc compiler checks and adding -fvisibility=hidden to the global CFLAGS of any library that pulls in libglnx, but in Meson it's a build system feature. Signed-off-by: Simon McVittie <smcv@collabora.com>
* | meson: Automatically link libglnx-dependent objects to gio-unixSimon McVittie2022-04-211-0/+1
|/ | | | | | | | | If we don't do this, users of libglnx all have to add this dependency themselves, otherwise they'll get errors like: fatal error: gio/gfiledescriptorbased.h: No such file or directory Signed-off-by: Simon McVittie <smcv@collabora.com>
* Merge branch 'mwleeds/fix-config-h-clean' into 'master'Simon McVittie2022-03-011-0/+1
|\ | | | | | | | | Add libglnx-config.h to CLEANFILES See merge request GNOME/libglnx!33
| * Add libglnx-config.h to CLEANFILESPhaedrus Leeds2022-03-011-0/+1
|/ | | | | This fixes make distcheck for Flatpak (but you have to re-run autogen.sh).
* Merge branch 'wip/noxattr' into 'master'Colin Walters2022-02-221-1/+3
|\ | | | | | | | | tests: Don't copy extended attributes when testing pseudo-files See merge request GNOME/libglnx!32
| * tests: Don't copy extended attributes when testing pseudo-filesSimon McVittie2022-02-221-1/+3
|/ | | | | | | It seems that on SELinux systems, files in /proc have extended attributes that cannot be copied by an unprivileged user. Signed-off-by: Simon McVittie <smcv@debian.org>
* Merge branch 'wip/reuse' into 'master'Simon McVittie2022-02-1942-503/+750
|\ | | | | | | | | Declare copyright and licensing using REUSE See merge request GNOME/libglnx!27
| * Update copyright holder for Endless' contributionsSimon McVittie2022-02-196-6/+6
| | | | | | | | | | | | | | Will Thompson reports that all of Endless' IP was transferred to Endless OS Foundation LLC. Signed-off-by: Simon McVittie <smcv@debian.org>
| * CI: Run `reuse lint` across the treeSimon McVittie2022-02-191-0/+9
| | | | | | | | Signed-off-by: Simon McVittie <smcv@debian.org>
| * Declare copyright and licensing using REUSESimon McVittie2022-02-1942-502/+740
|/ | | | | | | | | | | | | | To fill in some gaps, I've had to make some assumptions: * trivial changes (such as checking for an additional function or header file in libglnx.m4) are assumed to not be copyrightable * Will Thompson and Matthew Leeds are assumed to be contributing on behalf of Endless Mobile Inc. * files with no explicit licensing information are assumed to be under the license found in COPYING Reference: https://reuse.software/ Signed-off-by: Simon McVittie <smcv@debian.org>
* Merge branch 'wip/smcv/copy-pseudo-files' into 'master'Colin Walters2022-02-182-3/+54
|\ | | | | | | | | fdio: Use a read/write loop until EOF if st_size is zero See merge request GNOME/libglnx!31
| * fdio: Use a read/write loop until EOF if st_size is zeroSimon McVittie2022-01-282-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some pseudo-files in /proc and /sys list a size of 0 bytes in stat() results, but do in fact have content. For these pseudo-files, the only way to find out the true file size is to try read() until EOF, so leave the max_bytes set to -1. copy_file_range() and sendfile() don't work for such files in some kernel versions (see <https://lwn.net/Articles/846403/>), so skip the fast-paths and use a read() and write() loop. For pseudo-files, we expect to be able to copy the whole content in one read() in any case. Signed-off-by: Simon McVittie <smcv@debian.org>
* | Merge branch 'not-config-h' into 'master'Phaedrus Leeds2022-02-1820-20/+24
|\ \ | | | | | | | | | | | | Include libglnx-config.h instead of config.h See merge request GNOME/libglnx!24
| * | Include libglnx-config.h instead of config.hSimon McVittie2021-06-2819-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids colliding with a config.h generated by a parent Meson project. In the Meson build system, we generate libglnx-config.h by doing our own checks, so we want to avoid it colliding. In the Autotools build system, we assume that the parent project will generate its own config.h that contains the results of LIBGLNX_CONFIGURE, and create a forwarding header libglnx-config.h in the $(top_builddir) (so that it is next to config.h). Note that after updating libglnx in an Autotools non-recursive-Make project (libostree, flatpak, flatpak-builder) it will be necessary to re-run autogen.sh. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * | glnx-lockfile.h: Remove unused inclusion of config.hSimon McVittie2021-06-281-2/+0
| | | | | | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* | | Merge branch 'wip/stdc99' into 'master'Phaedrus Leeds2022-02-181-2/+7
|\ \ \ | | | | | | | | | | | | | | | | build: Use Meson built-in option c_std instead of -std=gnu99 See merge request GNOME/libglnx!28
| * | | build: Use Meson built-in option c_std instead of -std=gnu99wip/stdc99Simon McVittie2021-07-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | This silences a Meson warning. Signed-off-by: Simon McVittie <smcv@debian.org>
* | | | Merge branch 'disable_copy_file_range_on_EINVAL--I3' into 'master'Simon McVittie2022-01-281-1/+1
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | | | | | | | | | Disable copy_file_range on ecryptfs Closes #3 See merge request GNOME/libglnx!30
| * | | Fall back if copy_file_range fails with EINVALOlaf Leidinger2022-01-281-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | Although EINVAL usually indicates a programming error, ecryptfs (and possibly other stacked filesystems) returns EINVAL for attempts to copy_file_range() or sendfile() between files on that filesystem. Resolves: https://gitlab.gnome.org/GNOME/libglnx/-/issues/3
* | | Merge branch 'pr/cov-fix' into 'master'Colin Walters2021-08-041-1/+1
|\ \ \ | |/ / |/| | | | | | | | xattrs: Fix possible double-free in `get_xattrs_impl` See merge request GNOME/libglnx!29
| * | xattrs: Fix possible double-free in `get_xattrs_impl`Jonathan Lebon2021-08-031-1/+1
|/ / | | | | | | | | | | | | When we free `xattr_name`, we need to transfer ownership away to avoid potential for a double-free if we hit `ENOTSUP` on the next iteration. Reported-by: Seth Arnold <seth.arnold@canonical.com>
* | Merge branch 'console-staticanalysis-fix' into 'master'Colin Walters2021-06-281-1/+1
|\ \ | |/ |/| | | | | console: Pacify `gcc -fanalyzer` See merge request GNOME/libglnx!26
| * console: Pacify `gcc -fanalyzer`Colin Walters2021-06-281-1/+1
| | | | | | | | | | | | It's not smart enough to follow the conditionals here to see that `textlen > 0` implies `text != NULL`. But the cost of an additional check is probably nil, so let's be robust to future code refactoring.
* | Merge branch 'wip/smcv/rewinddir' into 'master'Colin Walters2021-06-282-0/+19
|\ \ | |/ |/| | | | | glnx-dirfd: Add a rewinddir() wrapper See merge request GNOME/libglnx!25
| * glnx-dirfd: Add a rewinddir() wrapperwip/smcv/rewinddirSimon McVittie2021-04-222-0/+19
|/ | | | | | | | This is useful in the same situations rewinddir() is. My use-case right now is to remove some of the files from a directory, then go back through the directory removing symlinks that pointed to those files. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Merge branch 'pr/glnx-no-chown' into 'master'Colin Walters2021-02-092-3/+7
|\ | | | | | | | | glnx_file_copy_at: Add GLNX_FILE_COPY_NOCHOWN See merge request GNOME/libglnx!22
| * glnx_file_copy_at: Add GLNX_FILE_COPY_NOCHOWNJonathan Lebon2021-02-092-3/+7
|/ | | | | | | | | | In some contexts, we may want to copy a root-owned file but we're not running as root so we can't `fchown` it. (The case I'm interested in is actually a bit more obscure than this: running in a supermin VM as root, and wanting to copy a file we created onto a 9p mount where we don't have perms to `fchown`). Add a `GLNX_FILE_COPY_NOCHOWN` to handle this case.
* macros: Fix casting for C++ compatibilityColin Walters2020-12-061-1/+1
| | | | Prep for more work on porting rpm-ostree to use cxx-rs.
* glnx_strjoina: Cast to result for C++ compatibilityColin Walters2020-11-221-1/+1
| | | | Prep for using C++ in rpm-ostree (temporarily).
* fdio: Fix compilation via C++Colin Walters2020-11-221-2/+2
| | | | | I may use https://cxx.rs/ in rpm-ostree, which means we need our dependencies' headers to build in C++ mode.
* Merge branch 'replace-increasing-mtime' into 'master'Alexander Larsson2020-11-032-9/+37
|\ | | | | | | | | Add GLNX_FILE_REPLACE_INCREASING_MTIME See merge request GNOME/libglnx!21
| * Add GLNX_FILE_REPLACE_INCREASING_MTIMEreplace-increasing-mtimeAlexander Larsson2020-11-032-9/+37
|/ | | | | | | | | | | | | | This make replaced files have a strictly increasing st_mtime. The main usecase I have for this is to ensure the summary file mtime increases because the flatpak tests are failing due to the python httpd used in the tests rely on st_mtime for the http If-Modified-Since header. For the tests this breaks all the time since we're just doing a lot of summary updates. However, I can see this accidentally happening in the wild too, so i think its proper to always ensure the new summary is "newer", even though it means it will be timestamped slightly in the future. In practice this will not happen regularly, and the times it *does* happen we really do need it.
* Merge branch 'tmpfile-dir' into 'master'Colin Walters2020-10-021-3/+6
|\ | | | | | | | | glnx-fdio: try $TMPDIR if /var/tmp doesn't exist See merge request GNOME/libglnx!20
| * glnx-fdio: use $TMPDIR if setRebecca Turner2020-10-011-33/+6
| | | | | | | | As suggested by Colin Walters.
| * glnx-fdio: try $TMPDIR if /var/tmp doesn't existRebecca Turner2020-09-231-3/+33
|/ | | | | | | | | | | | | | | | | | `glnx_open_anonymous_tmpfile` attempts to create an fd in `/var/tmp` regardless of the value of `$TMPDIR`. This is _usually_ okay, but can fail in some contexts, such as in the [NixOS][1] build environment, which doesn't have `/var` mapped at all. To avoid failing in this case, if the inner call to `glnx_open_anonymous_tmpfile_full` fails, we retrieve the value of `$TMPDIR` and try calling `glnx_open_anonymous_tmpfile_full` again with that directory instead. In the fast path (i.e. where `/var/tmp` exists), functionality is unchanged. [1]: https://nixos.org/
* Merge branch 'err-prefix-xattr' into 'master'Colin Walters2020-09-101-7/+7
|\ | | | | | | | | xattrs: Add better error prefixing See merge request GNOME/libglnx!19
| * xattrs: Add better error prefixingColin Walters2020-09-101-7/+7
|/ | | | | | | Related to https://github.com/coreos/coreos-assembler/issues/1703 This should help debug things like this in the future.
* Merge branch 'fix-wrpseudo-grammar' into 'master'Colin Walters2020-06-161-2/+2
|\ | | | | | | | | libglnx.m4: Fix grammar in help string See merge request GNOME/libglnx!17