This previous behavior violates RFC-1123 which updated the original
RFC-952.
Patch originally from Ulrich Drepper.
Fixes: #3523
Signed-off-by: Christian Hergert <chergert@redhat.com>
The code stripped all but the first trailing slash in order to handle
the absolute root path "/". This breaks the removal of trailing slashes
for paths starting with $HOME, though.
Fix the logic to remove all trailing slashes if $HOME is encountered.
Closes#3811
The return value from `fread()` doesn’t actually indicate whether the
read failed due to EOF or due to a read error.
Rework the code so that errors are reported correctly, EOF is handled
silently, and as a byproduct, blank lines in the input file are ignored
and skipped over.
Spotted by scan-build.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Error handling in `fread()` is too complex, and the code explicitly
disables the buffering feature of `FILE`, so there’s little point in
using it.
Instead, use `open()`/`read()` directly. This avoids any buffering
issues, and gives us use of `errno` to check errors. `ferror()` doesn’t
give us any more information than “there was an error”.
This fixes an issue flagged by scan-build: that a failure in the first
`fread()` loop iteration would leave the `FILE` in an undefined state
(in particular, an undefined seek position) which would mess up the next
iteration. Since `ferror()` couldn’t actually tell us what the error was
(was it `EINTR`?) and `errno` is not guaranteed to be set by `fread()`,
the whole approach was doomed.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
If asked to replace a file (i.e. effectively delete and re-create it)
which is a symlink, in a read-only directory, the code would end up
trying to do operations on an invalid `fd`. This was masked when asked
to create a backup, as creating the backup in the read-only
directory would error out just in time.
Make the code a bit more robust in this situation, and add some unit
tests.
Spotted by scan-build.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Rather than passing it to `dup2()`, which scan-build thinks could cause
problems (I would have thought `dup2()` would just return `EBADF`, but
perhaps some implementations are buggy?).
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fallback for non-Linux systems that support the _SC_PHYS_PAGES and
_SC_AVPHYS_PAGES sysconf selectors, such as Solaris & OpenBSD.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Solaris inherited the SVR4 sysinfo() function, which takes a different
number of arguments from Linux, and provides information such as host
name and OS version, but not information on free or total memory.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
When the error is defined in a new enough PCRE2 we should handle it.
However let's not define an error message for this in this commit (just
let's use the old one that is generic enough), so that it can be backported
to stable versions without having to require new translations.
Closes: #3809
This test applies to both old and newer versions of PCRE2 where
back reference error has now increased the granularity and is referred
as PCRE2_ERROR_MISSING_NUMBER_TERMINATOR instead.
Co-Authored-By: Marco Trevisan <mail@3v1n0.net>
Previously the len passed to g_socket_address_new_from_native() was only
for IPv4 addresses and the constructor would fail.
This was reported and discussed here:
fe0139ee98 (note_2581394)
Currently two of the tests from libffi 3.5.2 fail on macos-arm64, and
this is not something I have any chance of debugging:
```
481/1066 libffi:closures / closure_loc_fn0 -O0 FAIL 0.54s killed by signal 6 SIGABRT
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
Check failed:
memcmp(pcl, FFI_CL(codeloc), sizeof(*pcl)) == 0
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
485/1066 libffi:closures / cls_1_1byte -O0 RUNNING
>>> ASAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1 MSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_CHECK_=2 G_DEBUG=gc-friendly G_ENABLE_DIAGNOSTIC=1 UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 MALLOC_PERTURB_=147 LINT_WARNINGS_ARE_ERRORS=1 /Users/Shared/work/bgilbert/glib/_build/subprojects/libffi-3.5.2/testsuite/cls_1_1byte_O0
482/1066 libffi:closures / closure_loc_fn0 -O2 FAIL 0.55s killed by signal 6 SIGABRT
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
Check failed:
memcmp(pcl, FFI_CL(codeloc), sizeof(*pcl)) == 0
```
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Version 3.5.2 emits some deprecation warnings on macOS, and those are
out of our control to fix, and also not relevant to the GLib build.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This is the same commit we were already pinning to, but now that there's
a release, we can switch to the WrapDB wrap so `meson wrap update` will
pick up future releases.
We have various APIs that return FDs (such as g_mkstemp) but we do not
have a generic way to get the file name from it.
As per this, provide a simple and cross-platform way to lookup the file
path for an open FD.
This is marked as an unix-only API, although it could be technically be
implemented for windows too
add implementations for these functions using st_{a,c,m}timespec when
__APPLE__ is defined. Also re-enable the g-file-info test for darwin.
Fixes#3070, #2608
`GDBusProxy` implements this interface but allows construction with a
`NULL` interface info and also marks its getter/setter for the interface
info accordingly.
Callers of `g_dbus_interface_get_info()` need to assume that it can
return `NULL` unless they constructed the `GDBusInterface` in a way that
guarantees that the interface info is available.
The connectivity is directly derived from the `is_available` variable,
so if that changes, we need to notify of a change in `connectivity` too.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3803