Commit Graph

27595 Commits

Author SHA1 Message Date
Philip Withnall
d0dc7171d6 glib-unix: Accept O_CLOEXEC as well as FD_CLOEXEC in g_unix_open_pipe()
This is one step towards rectifying the mistake of using `FD_CLOEXEC` in
the first place. Eventually we may deprecate support for `FD_CLOEXEC`,
as the `O_*` flags better match the underlying `pipe()` API.

See discussion on
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3459#note_1779264

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-16 14:31:40 +01:00
Simon McVittie
de6cebb5f6 glib-unix: Don't fall back from O_NONBLOCK to O_NDELAY
Since 5c65437d "glib-unix: Add O_NONBLOCK support to g_unix_open_pipe()"
we have been using O_NONBLOCK unconditionally, so we might as well drop
the fallback here as well. This commit should be reverted if someone
reports a significant/supported platform that genuinely doesn't have
O_NONBLOCK.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-16 14:02:35 +01:00
Simon McVittie
40508b35b9 glib-unix: Assert that O_NONBLOCK and FD_CLOEXEC are numerically distinct
Since 5c65437d "glib-unix: Add O_NONBLOCK support to g_unix_open_pipe()"
we have effectively been assuming that these two flags are
distinguishable. If that's an assumption we want to make, we should make
it a static assertion, so that GLib will fail to compile on platforms
where it isn't true.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-08-16 14:02:35 +01:00
Philip Withnall
4a60527f2e Merge branch 'preserve-doc-indent' into 'main'
gdbus-codegen: preserve relative indentation in doc comments

Closes #3032

See merge request GNOME/glib!3536
2023-08-16 11:48:27 +00:00
Philip Withnall
9b15842ec1 Merge branch 'rybalkin-gregex-jit-increase-stack-size' into 'main'
gregex: set default max stack size for PCRE2 JIT compiler to 512KiB

See merge request GNOME/glib!3530
2023-08-15 13:26:43 +00:00
André
9a6ca0ef75
gdbus-codegen: preserve relative indentation in doc comments
This commit also changes the generators for rst, xml and dockbook
to preserve indentation.

Closes #3032
2023-08-14 23:46:09 -03:00
Danial Behzadi
006e102e04 Update Persian translation 2023-08-14 22:57:35 +00:00
Aleksei Rybalkin
c3ff5b8eb3 gregex: set default max stack size for PCRE2 JIT compiler to 512KiB
Previous default used was 32KiB (the library default) which caused some
complex patterns to fail, see #2824. The memory will not be allocated
unless used.
2023-08-14 20:43:15 +02:00
Aleksei Rybalkin
842a105464 gregex: remove redundant call to enable_jit_with_match_options
There is no point to enable jit in g_regex_new, since JIT will be only
used when we do a first match, and at that point
enable_jit_with_match_options will be called again already and will
update the options set in g_regex_new. Instead just run it at first
match for the first time, to the same end result.
2023-08-14 20:32:48 +02:00
Emmanuele Bassi
a7c34b431b Merge branch 'tree-asserts' into 'main'
tests: Use g_assert_*() rather than g_assert() in tree tests

See merge request GNOME/glib!3527
2023-08-14 12:45:21 +00:00
Philip Withnall
73efc47ddd Merge branch 'schedules-pages-again' into 'main'
ci: Further fix to pages CI job

See merge request GNOME/glib!3534
2023-08-14 10:51:14 +00:00
Philip Withnall
84f45cd694 ci: Further fix to pages CI job
Follow-up to e234a4496e to remove the old
`only: main`, which was overriding the changes from that commit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-14 11:00:15 +01:00
Philip Withnall
9309b8d68f Merge branch 'ci-pages-schedules' into 'main'
ci: Only run pages CI job on scheduled job runs

See merge request GNOME/glib!3533
2023-08-14 09:48:14 +00:00
Philip Withnall
c00d7999b1 Merge branch 'th/use-getservbyname-r' into 'main'
gnetworkaddress: use reentrant getservbyname_r() if available

See merge request GNOME/glib!3526
2023-08-14 09:24:51 +00:00
Philip Withnall
e234a4496e ci: Only run pages CI job on scheduled job runs
Since commit b9b7816e5a, the `pages` job
will still try to be run on `main` after an MR is merged, but will fail
because it depends on `coverage` and `style-check-advisory`, which are
no longer run on `main` after a merge.

See https://gitlab.gnome.org/GNOME/glib/-/pipelines/560680 for an
example failure.

Instead, make the `pages` job only run at the end of a scheduled CI run.
Its dependent jobs will have run then. This means that the ‘canonical’
code coverage report at
https://gnome.pages.gitlab.gnome.org/glib/coverage/ will be updated once
a week, rather than after every merge into `main`.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-14 10:20:43 +01:00
Philip Withnall
11d051f36e Merge branch 'wip/pwithnall/fix-ptrace' into 'main'
tests: Disable use of ptrace() in tests on BSD and macOS

See merge request GNOME/glib!3532
2023-08-14 09:08:19 +00:00
Thomas Haller
f738c7f3db gio: use reentrant getservbyname_r() if available 2023-08-14 09:32:43 +01:00
Thomas Haller
8aa889dbf1 gio: include missing dependency in "gio/gnetworkingprivate.h"
Otherwise, GResolver typedef is unknown.
2023-08-14 09:32:43 +01:00
Thomas Haller
adb3763592 tests: add case for getservbyname() during g_network_address_parse()
Add test cases that result in lookup of the port via
getservbyname().

As the result depends on "/etc/services", it's not reliably the same on
every system. It requires a workaround.
2023-08-14 09:32:43 +01:00
Philip Withnall
065069191c tests: Disable use of ptrace() in tests on BSD and macOS
Commit cf55c31170 added a new test which
uses `ptrace()` to check some `GSubprocess` behaviour. FreeBSD uses
different symbol names for ptrace symbols, and we haven’t tested whether
the test works (and reproduces the failure) on FreeBSD, so skip the test
for now.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-14 09:27:07 +01:00
Philip Withnall
da47d030d4 Merge branch 'ms-bitfield' into 'main'
meson: warn if -mms-bitfields is necessary

See merge request GNOME/glib!3519
2023-08-14 08:16:02 +00:00
Asier Sarasua Garmendia
df289c3c73 Update Basque translation 2023-08-14 06:47:01 +00:00
Philip Withnall
73d2658191 Merge branch 'thread-safe-menus_get_interface' into 'main'
gmenuexporter: synchronization in org_gtk_Menus_get_interface.

Closes #3051

See merge request GNOME/glib!3529
2023-08-13 14:21:15 +00:00
Philip Withnall
3ee019c036 Merge branch 'gio-tool-info-translator-comments' into 'main'
gio-tool-info: Move translator comments so they’re visible

See merge request GNOME/glib!3528
2023-08-13 14:18:58 +00:00
Marc-André Lureau
4dde72e038 meson: warn if -mms-bitfields is necessary
GCC >= 4.7 and clang >= 12 don't need it. It should be left to the user
to decide what ABI convention should be used, and it creates some issues
with some tools to have this flag in cflags.

We leave the flag for now, but print a warning at compile time so people
get a chance to change their build system before we drop it from glib.pc

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-08-13 16:13:21 +04:00
André
5fb89dd597
gmenuexporter: synchronization in org_gtk_Menus_get_interface.
Protects the mutation inside org_gtk_Menus_get_interface with
g_once_init_{enter,leave}.

Fixes #3051.
2023-08-13 01:21:49 -03:00
Philip Withnall
65e7a10d2a Merge branch 'macos_ci' into 'main'
interim solution for macOS CI

See merge request GNOME/glib!3503
2023-08-12 22:52:57 +00:00
Philip Withnall
1e8d310e6e
2.77.2
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-12 23:38:03 +01:00
Philip Withnall
400a335fe2 Merge branch 'wip/pidfd-exit-status' into 'main'
main: Don't treat si_pid from pidfd as child exiting

Closes #3071

See merge request GNOME/glib!3433
2023-08-12 20:05:09 +00:00
Philip Withnall
1de94bdd6f Merge branch 'disable-post-merge-ci' into 'main'
ci: Don’t run pipeline after merging a MR

See merge request GNOME/glib!3432
2023-08-12 19:23:37 +00:00
Philip Withnall
faee7d0858 gio-tool-info: Move translator comments so they’re visible
The tooling won’t pick them up unless they’re directly above the gettext
calls.

Spotted by Piotr Drąg in
ec03755355 (note_1808152).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-12 20:01:36 +01:00
Philip Withnall
ca9723f951 tests: Use g_assert_*() rather than g_assert() in tree tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-12 19:41:26 +01:00
Philip Withnall
3029f08ed8 Merge branch 'gtree-overflow' into 'main'
GTree: Handle node counter overflow and return it as an unsigned value

See merge request GNOME/glib!3521
2023-08-12 18:35:17 +00:00
Philip Withnall
528e3270e1 Merge branch 'closure-annotation-fixes' into 'main'
gspawn, gdataset: Restore nullable callback functions

See merge request GNOME/glib!3523
2023-08-12 18:32:43 +00:00
Jonas Ådahl
cf55c31170 gio/tests: Add test case for exit status when being ptraced
The test case will fail with the

    g_assert_false (g_subprocess_get_successful (proc));

assert failing. Without the fix, it'll hit sometimes, but rather
unreliably. When running `meson test --repeat 100`, it'll reproduce
anywhere between the first or much later, but mostly before the 20th
iteration on my system.

Helps: #3071
2023-08-12 19:30:00 +01:00
Jonas Ådahl
8d78fa7887 main: Don't treat si_pid from pidfd as child exiting
We might repeatedly get si_pid == 0 for a child that hasn't exited,
meaning we won't get a correct exit status. This seems to happen when
the glib application tracks a ptrace():ed child process; the correct
exit status of the process using e.g. a BPF program, where one can
observe that glib appears to get it wrong.

Fixes: #3071
2023-08-12 19:08:46 +01:00
René de Hesselle
439204ed7d Re-enable macOS CI on a new self-hosted runner
Allow two more tests to fail on macOS for the time being:
https://gitlab.gnome.org/GNOME/glib/-/issues/3069
https://gitlab.gnome.org/GNOME/glib/-/issues/3070
2023-08-11 19:33:19 +02:00
Kukuh Syafaat
3513be4e35 Update Indonesian translation 2023-08-11 12:05:11 +00:00
Marco Trevisan (Treviño)
694eb3aa02 gspawn: Mark child setup in g_spawn_sync() as call scope
While it's only called one time, this is something that can only happen
during the function call, so it's more correct to mark it as call scope,
so that bindings don't have to wait for the callback invocation to
cleanup the data.
2023-08-10 23:37:48 +02:00
Marco Trevisan (Treviño)
ff23b24254 gspawn, gdataset: Restore nullable callback functions
As per commit 5d738ddc some callbacks are not nullable anymore even
though they should be.

This breaks the introspection as some arguments won't be considered
nullable anymore.

You can notice this in https://gitlab.gnome.org/3v1n0/gjs/-/pipelines/558839
where some some tests are running against stable g-i version and others
(the failing ones) against the devel one.
2023-08-10 23:37:14 +02:00
Maciej S. Szmigiero
faa11d0910 GTree: Add a G_STATIC_ASSERT for MAX_GTREE_HEIGHT
Makes sure we don't accidentally set it too small and overflow a tree path
array.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
2023-08-09 15:15:13 +02:00
Maciej S. Szmigiero
f08191e398 GTree: Check for node counter overflow when adding new elements
Currently, when adding new elements to GTree we blindly increment the node
counter, which is only of guint size (so 32-bit even on 64-bit Unix
platforms).

This is even more problematic because the only way to check whether
particular GTree is empty is to check whether its node count is zero.
This will obviously give wrong answer if this counter overflows.

Let's fix this by adding an appropriate check when adding a new node.

For the recently added g_tree_{insert,replace}_node () API we can simply
return NULL in such case.

However, the older g_tree_{insert,replace} () API doesn't have any ability
to return an error so for them we follow the example of
g_ptr_array_extend () and g_ptr_array_set_size () by calling g_error ()
when this happens.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
2023-08-09 15:15:09 +02:00
Maciej S. Szmigiero
1237525da2 GTree: Annotate the real return value type of g_tree_nnodes ()
g_tree_nnodes () is returning a signed integer type (gint), however the
tree node counter value type is really an unsigned integer (guint).

This means that the returned size will be negative if the container holds
more than G_MAXINT elements.

Add a note to this function that its return value can be cast back to
guint in order to support its full range of values.

This will also make sure that we take this into account in future Glib
versions.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
2023-08-09 14:57:14 +02:00
Luming Zh
c5ad8187e2 Update Chinese (China) translation 2023-08-08 16:47:12 +00:00
Sabri Ünal
76f7961a7b Update Turkish translation 2023-08-08 11:07:17 +00:00
Daniel Mustieles
9a48871c33 Updated Spanish translation 2023-08-08 08:16:35 +02:00
Fran Dieguez
db411295db Update Galician translation 2023-08-08 00:10:23 +00:00
Piotr Drąg
4d1e9a9520 Update Polish translation 2023-08-06 12:40:39 +00:00
Hugo Carvalho
e8af76ad25 Update Portuguese translation 2023-08-04 15:59:03 +00:00
Artur So
daf778a194 Update Russian translation 2023-08-03 15:54:42 +00:00