There are some cases where we want to copy with just a filename,
so let's be convenient in that case and do stat for the caller.
This will be used by an ostree commit.
There are a lot of APIs that still only take absolute paths, such as
librpm (and everything above it). I plan to use this in rpm-ostree to
convert temporary directories that I'm accessing fd-relative back into
absolutes until such time as fd-relative APIs are plumbed through the
stack more.
Doing nothing isn't super useful; if you're using e.g. rpm-ostree in
Jenkins you want to see *something* from the "live tail".
This is a basic line-per-change implementation.
Closes: https://github.com/GNOME/libglnx/pull/6
For extra fun, both of these functions have different error handling
schemes. `posix_fallocate` does *not* set `errno` because... I'm not
sure. Maybe POSIX was trying a new function design?
`loop_write` uses the systemd error handling style which returns
`-errno`, so we need to set errno back so that the macro can propagate
it into the `GError`.
I looked at the systemd code but it didn't have a variant of
mkdir_parents that used `*at()`. This is a fresh implementation, with
the risk that entails.
However I am changing libgsystem to call it now for testing, and
libgsystem APIs are covered by ostree usage at least.
We have to wrap the glibc version to ensure we get the right version,
otherwise depending on the variance of includes we may end up crashing
if we get the POSIX version.
This will allow deleting some code from OSTree for the config file
merging. We're reusing some code from systemd, which a nice modern
clean codebase, and among other things this gets us BTRFS reflinking
(if available) again.
We don't have this really in GLib, unfortunately. We do want
GCancellable, but we also want to operate on raw fds where possible.
The "read a file and validate as UTF-8" is a common use case of mine,
and this combines that with openat().
This module is a new successor to libgsystem. It currently contains a
backport of the GLib cleanup macros, but soon more Linux-specific code
will be added.