- Sep 07, 2017
-
-
Colin Walters authored
This is a very common pattern in both ostree/rpm-ostree. Make a better API for this. I thought a lot about simply zeroing out `struct stat` but that feels dangerous; none of the values have seem obviously `cannot be zero`.
-
- Aug 25, 2017
-
-
Jonathan Lebon authored
-
- Aug 18, 2017
-
-
Colin Walters authored
Basically all of the ostree/rpm-ostree callers want to both create and open, so let's merge `glnx_mkdtempat()` and `glnx_mkdtempat_open()`. Second, all of them want to do `glnx_shutil_rm_rf_at()` on cleanup, so we do the same thing we did with `GLnxTmpfile` and create `GLnxTmpDir` that has a cleanup attribute. The cleanup this results in for rpm-ostree is pretty substantial.
-
- Aug 15, 2017
-
-
Jonathan Lebon authored
The `percentage` var is a guint and so is always >= 0. Coverity CID: 163703
-
Matthew Leeds authored
-
Philip Withnall authored
It’s possible that text is NULL on this path. Coverity CID: 1376570 Signed-off-by:
Philip Withnall <withnall@endlessm.com>
-
- Aug 09, 2017
-
-
Colin Walters authored
FICLONE is the new alias for the formerly btrfs-specific ioctl; XFS has experimental patches to support it. Further, we should use copy_file_range() for the case where we're only doing a limited copy. Both NFS and XFS (with reflink enabled) understand it. Part of the reason I'm doing this is so that ostree's `/etc` merge will start using XFS reflinks. But another major reason is to take the next step after and copy this code into GLib as well, so that all of the general GLib users will benefit; e.g. Nautilus will transparently do server copy offloads with NFS home directories. See also this coreutils thread about `copy_file_range()`: <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24399>. I don't care about file holes for our use cases, so it's fine. Other changes while I'm here: - Tweak the sendfile() case to match the newly inlined logic for cfr - Add a TEMP_FAILURE_RETRY() around the read()
-
- Aug 02, 2017
-
-
Colin Walters authored
We need to handle our "empty to NULL canonicalization" before doing the length. Coverity CID: 1376570
-
- Jul 31, 2017
-
-
Colin Walters authored
We should be able to rely upstream on everything *except* `glnx_unref_object` which requires the library itself to depend on a newer glib, which isn't true for e.g. RHEL7 libsoup. libostree was almost ready for this; just a few patches to push it to completion in https://github.com/ostreedev/ostree/pull/1042
-
- Jul 26, 2017
-
-
Colin Walters authored
systemd does this by default. I think we should treat this as a fatal error since it can cause really painful-to-debug problems if we don't just get EBADF but actually close something else's fd due to a race.
-
- Jul 24, 2017
-
-
Colin Walters authored
It'd be really nice if gtest had a variant which had the funcs take `GError`. May work on that.
-
- Jul 21, 2017
-
-
Jonathan Lebon authored
Minor tweak to the new `GLNX_AUTO_PREFIX_ERROR`. Since the common case is that there's no errors, let's bring down the same check that `g_prefix_error` does to avoid a function call most of the time.
-
- Jul 20, 2017
-
-
Colin Walters authored
Since it's intentional we never use it, and `clang` barfs on this (rightly).
-
Colin Walters authored
Thought the previous patch would have been obvious enough not to compile test but...
-
Colin Walters authored
Another one where we have a lot of inlines in ostree at least. Not the same as `glnx_shutil_mkdir_p_at()` since in these cases we don't want automatic intermediate dirs, and it's cheaper to just call `mkdirat()` and handle `EEXIST` rather than do a `stat()` first.
-
- Jul 19, 2017
-
-
Colin Walters authored
This is kind of long overdue. Reasons are the same as the other wrappers. I debated adding `O_NOFOLLOW` support but the use cases for that are pretty obscure, callers who want that can just use the syscall directly for now.
-
Colin Walters authored
This showed up in https://github.com/projectatomic/rpm-ostree/issues/883 We'll have to audit callers to be sure to avoid double-prefixing.
-
- Jul 17, 2017
-
-
Colin Walters authored
In a lot of places in ostree, we end up prefixing errors in the *caller*. Often we only have 1-2 callers, and doing the error prefixing isn't too duplicative. But there are definitely cases where it's cleaner to do the prefixing in the callee. We have functions that aren't ported to new style for this reason (they still do the prefixing in `out:`). Introduce a cleanup-oriented version of error prefixing so we can port those functions too.
-
Colin Walters authored
For consistency.
-
Colin Walters authored
There are a number of versions of this in ostree at least, might as well wrap it.
-
Colin Walters authored
There are only two users of this in ostree, and one of them is fairly bogus; we can just use `fstat()`.
-
Colin Walters authored
Mostly in ostree/rpm-ostree, we work in either raw `int fd`, or `G{Input,Output}Stream`. One exception is the rpm-ostree `/etc/passwd` handling, which uses `FILE*` since that's what glibc exposes. And in general, there are use cases for `FILE*`; the raw `GUnixOutputStream` for example isn't buffered, and doing so via e.g. `GBufferedOutputStream` means allocating *two* GObjects and even worse going through multiple vfuncs for every write. `FILE*` is used heavily in systemd, and provides buffering. It is a bit cheaper than gobjects, but has its own trap; by default every operation locks a mutex. For more information on that, see `unlocked_stdio(3)`. However, callers can avoid that by using e.g. `fwrite_unlocked`, which I plan to do for most users of `FILE*` that aren't writing to one of the standard streams like `stdout` etc.
-
- Jul 13, 2017
-
-
Matthew Leeds authored
-
- Jul 10, 2017
-
-
Colin Walters authored
Work around an older glibc bug.
-
- Jun 30, 2017
-
-
Colin Walters authored
If the user provides a less than pointer-sized type, we'll clobber other things on the stack. See https://github.com/ostreedev/ostree/pull/990/
-
- Jun 28, 2017
-
-
Colin Walters authored
Not sure how I missed this before.
-
Colin Walters authored
This was confusing `g-ir-scanner`.
-
Colin Walters authored
`g-ir-scanner` is confused by some of the syntax extensions in `G_IN_SET()`; none of this is applicable to bindings, so just skip it.
-
Colin Walters authored
There was a user of this in the libostree static delta code.
-
Colin Walters authored
I'm not aware of a problem in practice here, but we should do this on general principle. Writing this patch now because I hit a fd leak in the ostree static delta processing that was introduced in the tmpfile prep code, but fixed in the final port.
-
Jonathan Lebon authored
Looking at converting the ostree codebase, iterating over only the values of a hash table (while ignoring the key) is actually a more common pattern than I thought. So let's give it its own macro as well so users don't have to resort to the _KV variant.
-
- Jun 26, 2017
-
-
Colin Walters authored
Besides doing `TEMP_FAILURE_RETRY` and `GError` conversion, these also prefix the error with arguments.
-
- Jun 17, 2017
-
-
Jonathan Lebon authored
These macros make it much easier to iterate over a GHashTable. It takes care of initializing an iterator and casting keys and values to their proper types. See the example usage in the docstring for more info.
-
Jonathan Lebon authored
-
- Jun 14, 2017
-
-
Colin Walters authored
I originally tried to get this into GLib: https://bugzilla.gnome.org/show_bug.cgi?id=783751 But that looks like it's going to fail due to MSVC. Let's add it here at least so I can start using it tomorrow and not wait for the MSVC team to catch up. I renamed `glnx-alloca.h` to `glnx-macros.h` as a more natural collective home for things from systemd's `macro.h`. Finally, I used a Coccinelle spatch similar to the one referenced in the above BZ to patch our uses.
-
- Jun 13, 2017
-
-
Colin Walters authored
The glibc `posix_fallocate()` implementation has a bad fallback, and further we need to handle `EOPNOTSUPP` for musl. https://github.com/flatpak/flatpak/issues/802
-
- May 31, 2017
-
-
Colin Walters authored
This avoids callers having to use `glnx_steal_fd()` on their own; in general, I think we should implement move semantics like this at the callee level. Another reason to do this is there's a subtle problem with doing: ``` somefunction (steal_value (&v), ..., error); ``` in that if `somefunction` throws, it may not have taken ownership of the value. At least `glnx_dirfd_iterator_init_take_fd()` didn't.
-
- May 30, 2017
-
-
Colin Walters authored
Not everything, but a good chunk of the remaining bits.
-
- May 19, 2017
-
-
Alexander Larsson authored
Add an `initialized` member which means we work by default in structs allocated with `g_new0` etc. and don't need a special initializer. This also fixes a bug where we need to support `src_dfd == -1` or `AT_FDCWD`. This fixes flatpak which uses AT_FDCWD. Modified-by:
Colin Walters <walters@verbum.org>
-
- May 17, 2017
-
-
Colin Walters authored
Just noticed this while reading the code.
-