Commit Graph

27012 Commits

Author SHA1 Message Date
Philip Withnall
bd2ccc2f69 Merge branch 'fix-windows-spawn-non-english' into 'main'
spawn-test: Fix running on non-English Windows

See merge request GNOME/glib!3288
2023-02-21 17:49:31 +00:00
Luca Bacci
0f0520ffa2 Add VTable definition for IPackage2
Derived from MIT-licensed code:
https://github.com/microsoft/windows-rs/blob/0.43.0/crates/libs/windows/src/Windows/ApplicationModel/mod.rs#L554
2023-02-21 18:01:51 +01:00
Philip Withnall
339aaa3719 Merge branch 'cloexec-audit' into 'main'
Make sure new file descriptors have close-on-exec flag set on them in a race-free way

See merge request GNOME/glib!3283
2023-02-21 12:58:01 +00:00
Maciej S. Szmigiero
0e7bf99ec2 Use "e" mode flag in fopen () calls for race-free setting of the close-on-exec flag
All Unix CRTs examined: glibc, musl, BSDs, Apple libc, Android bionic
ignore unknown fopen () mode flags, so this flag can be added
unconditionally for Unix builds.

Only Windows CRT is intolerant of these, so the single case in
g_dbus_address_connect () where the fopen () call is shared between Unix
and Windows needs appropriate platform-specific handling.

Skipped the call sites in libcharset and xdgmime copylibs.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
3f2e18b07c Use O_CLOEXEC in {g_,}open () calls for race-free setting of the close-on-exec flag
The remaining call sites are either Windows-only, between fork () and
exec () or in xdgmime copylib.

Hope I haven't missed any site.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
0f5d274871 gtestutils: Document that g_test_trap_fork () won't get close-on-exec fix
We don't want to update this function in case some crusty old third party
code might be relying on its current behavior.
Also, it is deprecated anyway and no code should be using it.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
dd36ee0abf gtestdbus: Use g_unix_open_pipe_internal () for creating pipes
This attempts to create the pipes with race-free setting of the
close-on-exec flag.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
05d2a1d097 gbacktrace: Use g_unix_open_pipe_internal () for creating pipes
This attempts to create the pipes with race-free setting of the
close-on-exec flag.
2023-02-21 12:42:55 +00:00
Maciej S. Szmigiero
14b5207bfa Add g_unix_open_pipe_internal () for pipes with the close-on-exec flag
Based on the existing g_unix_open_pipe () but for internal use where
returning a raw errno is needed, not a GError.
2023-02-21 12:42:55 +00:00
Philip Withnall
13fe2e0c79 ci: Enable JIT debugging on msys2-* CI jobs
Suggested by Christoph Reiter, this is a workaround for random Python
crashes in Meson which only appear on this platform.

It’s being tracked upstream at
https://github.com/msys2/MINGW-packages/issues/11864, but unfortunately
it seems hard to fix.

Work around the issue the same way that Meson have in their CI, by
enabling JIT debugging. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-21 11:52:24 +00:00
Daniel
ea87d78c7f Updated Spanish translation 2023-02-21 11:52:42 +01:00
Chun-wei Fan
601fce37cb spawn-test: Fix running on non-English Windows
Use SetThreadUILocale() to set the UI locale to English (United States)
(en-US), and use SetConsoleOutputCP() to set the code page to en-US (codepage
437) so that g_win32_error_message() will always return the error messages in
English and ensure that the program runs in English as well, so that we
can ensure that the expected error message string can match up
regardless of the languge version of Windows that is running.
2023-02-21 16:34:31 +08:00
Philip Withnall
c4203f740c gerror: Emit a critical warning if the message format is NULL
The code has warned about this since commit 6d9f874330 in 2011.

glibc 2.37 has just started asserting if a `NULL` format is passed to
`sprintf()`, which caused the existing GLib workaround to start
asserting too.

Bite the bullet and upgrade the warning for `format != NULL` to a
critical warning. Projects have had 12 years to fix their code.

The original bug reports
(https://bugzilla.gnome.org/show_bug.cgi?id=660371,
https://bugzilla.gnome.org/show_bug.cgi?id=560482) are actually both
about a domain which is `0`, rather than a format which is `NULL`, which
gives some confidence that this change will actually impact very little
third party code.

Since it doesn’t currently need changing, I have not touched the warning
about `domain != 0`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2913
2023-02-20 16:41:23 +00:00
Philip Withnall
a8e8b742e7 Merge branch 'list-store-find-with-equal-func-null-item' into 'main'
Allow passing a `NULL` item to `g_list_store_find_with_equal_func()`

See merge request GNOME/glib!3284
2023-02-20 12:37:25 +00:00
Sebastian Dröge
7c5e930170 Allow passing a NULL item to g_list_store_find_with_equal_func()
The `equal_func` closure can already have all required information
available without the item, and passing the item via the closure instead
of an explicit parameter is more natural for languages that have a
concept of closures that can capture variables.
2023-02-20 10:16:11 +02:00
Aurimas Černius
5202d1daa9 Update Lithuanian translation 2023-02-19 19:13:55 +00:00
Maciej S. Szmigiero
3dc77fef24 gsocket: Use accept4 () for race-free setting of the close-on-exec flag
The code was already setting the close-on-exec flag for the new socket,
just in a racy way.
2023-02-19 16:47:13 +01:00
Tim Sabsch
1c305c4fb0 Update German translation
(cherry picked from commit 290c4b7709)
2023-02-18 14:48:25 +00:00
Sabri Ünal
8e8b90bcf8 Update Turkish translation 2023-02-18 09:53:40 +00:00
Philip Withnall
02a00a831c Merge branch 'fix-spawn-test-on-windows' into 'main'
spawn-test: Use an absolute path to the system sort.exe on Windows

See merge request GNOME/glib!3282
2023-02-17 18:04:02 +00:00
Luca Bacci
5631a6b9eb spawn-test: Remove the can_fail attribute 2023-02-17 15:57:49 +01:00
Luca Bacci
390dcc92d8 spawn-test: Use an absolute path to the system sort.exe on Windows
This way we avoid executing other kinds of sort.exe which are
available in PATH. This is useful especially on MSYS2 which
provides coreutils sort.
2023-02-17 15:29:00 +01:00
Yaron Shahrabani
f4e323dd40 Update Hebrew translation 2023-02-17 09:52:11 +00:00
Hugo Carvalho
30202e9b59 Update Portuguese translation 2023-02-16 18:34:44 +00:00
Philip Withnall
5d469dbe5a tests: Remove custom printerr logging from live-g-file
Use `g_test_message()` instead, so that the logs get treated properly
for TAP output.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 13:50:15 +00:00
Philip Withnall
5370df540c ci: Use Meson 1.0.0 on Windows and macOS CI builds
This is a departure from our policy of using the minimum required Meson
version, but I think it might be worth a try to see if it fixes the
persistent intermittent build failures on these platforms due to what
looks like build dependency graph issues.

For example:
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2579411
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2578792
 - https://gitlab.gnome.org/GNOME/glib/-/jobs/2579220
 - https://gitlab.gnome.org/pwithnall/glib/-/jobs/2588507

I was looking at trying to diagnose some of these failures in order to
potentially file bugs against Meson, but the first step is really to
test against the latest version of Meson. So here we are.

Crucially, our other CI jobs continue to use the minimum Meson version
required by GLib, so we continue to test that GLib builds with its
minimum dependencies. I do not plan to change that.

Also crucially, this MR continues to use a specific Meson version,
rather than asking `pip` to install the latest available. Doing that
could lead to unexpected regressions in future, and that’s not what
GLib’s CI is meant to be testing for.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 13:34:59 +00:00
Philip Withnall
0e84e28978 tests: Don’t run the GObject performance tests under valgrind
They take too long and time out, and are not particularly useful to run
under valgrind because they aren’t designed to test code coverage.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 12:52:30 +00:00
Fran Dieguez
6ed23087b5 Update Galician translation 2023-02-16 12:07:58 +00:00
Philip Withnall
6a46aabd4c tests: Use g_assert_*() rather than g_assert() in string tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-16 11:29:26 +00:00
Philip Withnall
bc53fff8a3 tests: Add a -Wsign-conversion test for gstring.h
While it’s not possible to build GLib with `-Wsign-conversion` enabled
(there are too many warnings), it would be useful to check that GLib’s
public headers can be used with `-Wsign-conversion` enabled, as some
projects want to do that. For example, dnf5 is built that way (see
issue #2919).

Add a simple regression test for this, by re-building the `gstring`
tests with `-Wsign-conversion` enabled. Since they include `glib.h`,
this will test all the public libglib headers by proxy.

Since this is a compile-only test, it doesn’t need to be installed.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2919
2023-02-16 11:29:26 +00:00
Philip Withnall
0bdf7fcce4 tests: Fix some sign-conversion warnings in the GString tests
This will be useful for the next commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2919
2023-02-16 11:29:26 +00:00
Philip Withnall
d2d1af284d gtestutils: Fix a sign-conversion warning in g_assert_cmpmem()
It was assigning the two provided lengths to internal `int` variables.
Given that memory block lengths are typically a `size_t`, this will
usually result in a warning if `-Wsign-conversion` is enabled.

Given that the internal variables are passed to `memcmp()`, which takes
`size_t`, change them to `size_t` and add an explicit cast to avoid
warnings in future.

The alternative would be to mess around with defining `__l1` and `__l2`
to using `typeof()`, but that would lead to a complete mess with the
printf placeholders and probably cause more problems than it fixes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2919
2023-02-16 11:29:26 +00:00
Philip Withnall
39eea23825 Merge branch 'implicit_conversion' into 'main'
g_string_append_len_inline: fix implicit conversion changes signedness

Closes #2919

See merge request GNOME/glib!3274
2023-02-16 11:19:38 +00:00
Aleš Matěj
f6d6800962 g_string_append_len_inline: fix implicit conversion changes signedness
For: https://gitlab.gnome.org/GNOME/glib/-/issues/2919
2023-02-16 10:57:48 +00:00
Philip Withnall
e784bedd40 Merge branch 'gitlab-ci-enable-python-utf8-mode-for-windows' into 'main'
Enable Python UTF-8 mode for Windows CI jobs

Closes #2915

See merge request GNOME/glib!3278
2023-02-16 10:55:47 +00:00
Марко Костић
8376928c6a Update Serbian translation 2023-02-16 09:59:25 +00:00
Kukuh Syafaat
12df145382 Update Indonesian translation 2023-02-16 03:30:05 +00:00
Luca Bacci
c31eeb0b64 Enable Python UTF-8 mode for Windows CI jobs
It will become the default in Python 3.15 and makes things
more consistent across Unix and Windows platforms.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2915
2023-02-15 19:28:46 +01:00
Yuri Chornoivan
ffbcba1f63 Update Ukrainian translation 2023-02-15 17:37:36 +00:00
Philip Withnall
40fc22f81f Merge branch 'no-buffered-reads-during-server-auth' into 'main'
gdbus: Never buffer reads during server authentication

Closes #2916

See merge request GNOME/glib!3272
2023-02-15 16:29:38 +00:00
Marius Vollmer
8f02681f6e gdbus: Never buffer reads during server authentication
Otherwise, the content of the buffer is thrown away when switching
from reading via a GDataInputStream to unbuffered reads when waiting
for the "BEGIN" line.

(The code already tried to protect against over-reading like this by
using unbuffered reads for the last few lines of the auth protocol,
but it might already be too late at that point.  The buffer of the
GDataInputStream might already contain the "BEGIN" line for example.)

This matters when connecting a sd-bus client directly to a GDBus
client.  A sd-bus client optimistically sends the whole auth
conversation in one go without waiting for intermediate replies.  This
is done to improve performance for the many short-lived connections
that are typically made.
2023-02-15 14:33:15 +00:00
Simon McVittie
c83fd0bce7 Merge branch 'revert-revert-revert-i-hate-ci' into 'main'
Revert "Revert "tests: Temporarily disable socket test due to a kernel bug""

See merge request GNOME/glib!3273
2023-02-15 13:59:25 +00:00
Philip Withnall
bde724e5ac Revert "Revert "tests: Temporarily disable socket test due to a kernel bug""
This reverts commit 27bee8fe5d.

Inevitably, despite testing the CI multiple times before merging commit
27bee8fe, the CI is now failing again in the `socket` test due to (what
I continue to assume is) the kernel regression:

https://gitlab.gnome.org/martinpitt/glib/-/jobs/2585332

In order to unblock development on `main` expediently, I guess I’ll just
revert the revert.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Reopens: #2879
2023-02-15 13:23:13 +00:00
Philip Withnall
0816156cfe Merge branch 'wip/smcv/garray-endian' into 'main'
array-test: Don't rely on endianness of multi-byte numbers

Closes #2918

See merge request GNOME/glib!3270
2023-02-15 13:02:48 +00:00
Fran Dieguez
66b1f4e99a Update Galician translation 2023-02-14 20:05:09 +00:00
Philip Withnall
5af1e3d8c2 Merge branch 'wip/pwithnall/revert-disabling-socket-test-maybe' into 'main'
Revert "tests: Temporarily disable socket test due to a kernel bug"

Closes #2879 and Infrastructure/Infrastructure#981

See merge request GNOME/glib!3269
2023-02-14 13:19:58 +00:00
Hugo Carvalho
edb5df31e8 Update Portuguese translation 2023-02-14 11:58:49 +00:00
Simon McVittie
854fd11422 array-test: Don't rely on endianness of multi-byte numbers
The array is an array of bytes in this part of the test, so we need to
append a single byte. Previously we were reusing val (a size_t variable)
from earlier in the test, but because g_array_append_val passes the value
by reference, appending a multi-byte number to an array of bytes will
take the first byte of the number's memory representation, which has the
desired value on little-endian CPUs but is zero on big-endian, leading
to a test failure.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2918
Bug-Debian: https://bugs.debian.org/1031271
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-14 10:42:08 +00:00
Ekaterine Papava
23a839159a Update Georgian translation 2023-02-14 07:33:25 +00:00
Kukuh Syafaat
bda564d68c Update Indonesian translation 2023-02-14 02:35:10 +00:00