Commit Graph

27687 Commits

Author SHA1 Message Date
Dario Saccavino
ccea09c1c8 Avoid stack overflow in gspawn on macOS 2023-06-28 13:42:40 +00:00
Emmanuele Bassi
4a7409a0ac Merge branch 'main' into 'main'
Added Annotations

Closes #2993

See merge request GNOME/glib!3476
2023-06-27 16:49:43 +00:00
N.Pranav Krishna
b963bcf8c5 Added Annotations 2023-06-27 16:49:43 +00:00
Philip Withnall
7d4f6673b9 build: Call override_find_program() for gtester
Just in case anyone tries to look it up using `find_program()` in a
`meson.build` in GLib (or a project pulling GLib in as a subproject) in
future.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-27 14:54:18 +01:00
Philip Withnall
28ad519ff8 gdbus-codegen: Fix some minor typos in the documentation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-27 14:23:01 +01:00
Philip Withnall
0990106501 Merge branch 'futex-errno-kersplato' into 'main'
glib: reset errno to 0 when futex() returns EAGAIN

Closes #3034

See merge request GNOME/glib!3473
2023-06-22 14:22:03 +00:00
Daniel P. Berrange
1bfc04a13d glib: reset errno to 0 when futex() returns EAGAIN 2023-06-22 14:22:03 +00:00
Philip Withnall
3637c2c47f Merge branch 'wip/chergert/fix-listmodel-docs' into 'main'
listmodel: add documentation about unique instances

Closes #3030

See merge request GNOME/glib!3474
2023-06-22 13:57:18 +00:00
Christian Hergert
d972ba03b4 listmodel: add documentation about unique instances
This has subtly been required and the original intention, so make it more
discoverable by adding to the documentation.

Fixes #3030
2023-06-21 11:01:52 -07:00
Emmanuele Bassi
43e133723c Merge branch 'timer-test-fix' into 'main'
tests: Fix an intermittent timing error with testing g_usleep(0)

See merge request GNOME/glib!3472
2023-06-21 11:06:04 +00:00
Philip Withnall
679560feaa tests: Fix an intermittent timing error with testing g_usleep(0)
The code to test that `g_usleep(0)` returns immediately assumes that
`g_usleep(1)` always takes longer, but that’s not necessarily always the
case. Even if no sleeping happens, the function call for `g_usleep(0)`
could get descheduled and take longer than normal.

This results in occasional failures like this one:
```
GLib:ERROR:../glib/tests/timer.c:367:test_usleep_with_zero_wait: assertion failed (elapsed0 <= elapsed1): (0.000206 <= 0.000202)
```

(Source: https://gitlab.gnome.org/GNOME/glib/-/jobs/2898468)

I can’t think of a suitable invariant comparison which can be done with
the timers, but running the comparison 10 times and allowing it to fail
once should work. A probabilistic test of `g_usleep(0)`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-21 11:52:03 +01:00
Dušan Kazik
b5d995e6b8 Update Slovak translation
(cherry picked from commit 49c2fe77c1)
2023-06-14 13:52:28 +00:00
Philip Withnall
1bf8f4b720 Merge branch 'gapplication-action-docs' into 'main'
gapplication: Clarify docs

Closes #3027

See merge request GNOME/glib!3469
2023-06-13 09:41:17 +00:00
Matthias Clasen
4171fba2fe gapplication: Clarify docs
D-Bus does not support maybe types, therefore
using such types are action parameters in
GApplication does not work.

Fixes: #3027
2023-06-10 08:04:49 -04:00
Philip Withnall
e1d47f0b0d Merge branch 'wip/pwithnall/macos-testing' into 'main'
tests: Reduce thread and iteration count on CI for /thread/rec-mutex3

See merge request GNOME/glib!3462
2023-06-09 10:13:21 +00:00
Philip Withnall
0adbf23fbe Merge branch 'wip/pwithnall/reenable-socket-tests' into 'main'
Revert "tests: Temporarily disable socket test due to a kernel bug"

Closes #2879

See merge request GNOME/glib!3467
2023-06-07 13:37:40 +00:00
Philip Withnall
8cad32a118 Revert "tests: Temporarily disable socket test due to a kernel bug"
This reverts commit 1507585869.

This should now be fixed:
https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/981#note_1760399.

Fixes: #2879
2023-06-07 12:29:03 +01:00
Marco Trevisan
6f6692562f Merge branch 'adapt_gsignal_changes' into 'main'
gobject_gdb.py: adapt to recent gsignal changes

See merge request GNOME/glib!3465
2023-06-07 10:27:51 +00:00
Philip Withnall
1f1378b80e Merge branch 'add-space' into 'main'
resolver: Add space in documentations

See merge request GNOME/glib!3466
2023-06-07 10:25:25 +00:00
Maximiliano Sandoval R
389398d444
resolver: Add space in documentations
It is standard practice to put a space in between Returns and Since in docstrings.
2023-06-04 17:33:00 +02:00
Nelson Benítez León
c301542f81 gobject_gdb.py: adapt to recent gsignal changes
Add to script the new functions added in
commit 2368187e and commit e5ee6e14 which are:

signal_emitv_unlocked()
signal_emit_valist_unlocked()

so that the "<emit signal 'blabla'>" line keeps
showing after them.
2023-06-02 14:42:45 +01:00
Leônidas Araújo
3304a517d9 Update Brazilian Portuguese translation
(cherry picked from commit 7f8bb8a2ea)
2023-06-01 18:25:18 +00:00
Philip Withnall
8764fe4740 Merge branch 'wip/pwithnall/done-with-macos' into 'main'
ci: Disable the macOS CI

See merge request GNOME/glib!3463
2023-06-01 14:13:41 +00:00
Philip Withnall
ef6e8939aa ci: Disable the macOS CI
It’s almost a complete waste of time at the moment. For several reasons,
jobs flakily fail on it more often than they succeed. It’s wasting
resources, slowing down development and making people quite frustrated.

 * https://gitlab.gnome.org/Infrastructure/GitLab/-/issues/627
 * https://gitlab.gnome.org/GNOME/glib/-/issues/2949
 * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3462 and related
   test failures

Nobody has stepped up to deal with the test or CI runner flakiness, or
generally maintain this CI runner. If someone does care about preventing
regressions for GLib on macOS, and can put time into making the CI
reliable, then this commit can be reverted.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-01 14:51:21 +01:00
Philip Withnall
d861eee868 Merge branch 'wip/smcv/async-signal-safety' into 'main'
gstdio: Improve documentation of some functions as async-signal safe

See merge request GNOME/glib!3458
2023-06-01 13:42:54 +00:00
Philip Withnall
da0a945477 tests: Reduce thread and iteration count on CI for /thread/rec-mutex3
It’s fairly consistently timing out on macOS. Looking at the verbose
test output, it’s still making progress right up until when it times out
(i.e. it hasn’t hit a `GRecMutex` bug and hasn’t deadlocked), so it
seems that the test runner is just hopelessly overloaded/underpowered
for the number of threads and iterations we’re asking it to test.

Tone those numbers down for CI test runs then.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-01 12:19:09 +01:00
Philip Withnall
add5fceedb tests: Move /thread/rec-mutex3 test state into a struct
And dynamically allocate the arrays. This will allow the scale of the
test to be configured in the following commit, which will allow it to be
tweaked to not time out on slow CI runners.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-01 12:12:38 +01:00
Philip Withnall
9db8765e21 tests: Use g_assert_*() rather than g_assert() in rec-mutex tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-01 11:53:19 +01:00
Philip Withnall
10fb2db8f7 Merge branch 'test-timing' into 'main'
gtestutils: print timing information per test case in TAP output

See merge request GNOME/glib!3420
2023-06-01 10:48:15 +00:00
Daniel P. Berrangé
29311d4309 gtestutils: print execution time after every test
Displaying the execution time will aid developers in understanding which
test cases are responsible for slow execution times. The test code is
already measuring the execution time for every test case, but is not
reporting that data anywhere accessible to developers running the tests.

The new code will print a TAP comment:

  # slow test /the/test/path executed in NN.NN secs

for any test taking longer than 0.5 seconds to run.

Example new output format:

  $ ./build/glib/tests/unix
  TAP version 13
  # random seed: R02S690dc3c7a04866e4890501eedc7f8eef
  1..13
  # Start of glib-unix tests
  ok 1 /glib-unix/pipe
  # /glib-unix/pipe-stdio-overwrite summary: Test that g_unix_open_pipe() will use the first available FD, even if it?s stdin/stdout/stderr
  # Bug Reference: https://gitlab.gnome.org/GNOME/glib/-/issues/2795
  ok 2 /glib-unix/pipe-stdio-overwrite
  ok 3 /glib-unix/error
  ok 4 /glib-unix/nonblocking
  ok 5 /glib-unix/sighup
  # slow test /glib-unix/sighup executed in 0.50 secs
  ok 6 /glib-unix/sigterm
  # slow test /glib-unix/sigterm executed in 0.50 secs
  ok 7 /glib-unix/sighup_again
  # slow test /glib-unix/sighup_again executed in 0.50 secs
  ok 8 /glib-unix/sighup_add_remove
  ok 9 /glib-unix/sighup_nested
  ok 10 /glib-unix/callback_after_signal
  # slow test /glib-unix/callback_after_signal took 2.00 secs
  ok 11 /glib-unix/child-wait
  # Start of get-passwd-entry tests
  # /glib-unix/get-passwd-entry/root summary: Tests that g_unix_get_passwd_entry() works for a known-existing username.
  ok 12 /glib-unix/get-passwd-entry/root
  # /glib-unix/get-passwd-entry/nonexistent summary: Tests that g_unix_get_passwd_entry() returns an error for a nonexistent username.
  ok 13 /glib-unix/get-passwd-entry/nonexistent
  # End of get-passwd-entry tests
  # End of glib-unix tests

As a practical usage example, the meson log can be queried to find
slow tests project-wide:

  $ grep 'slow test' build/meson-logs/testlog.txt | sort -n -k 7 -r | head
  # slow test /threadpool/basics executed in 36.04 secs
  # slow test /gobject/refcount/properties-3 executed in 30.00 secs
  # slow test /gio/io-basics executed in 12.54 secs
  # slow test /timeout/rounding executed in 10.60 secs
  # slow test /GObject/threaded-weak-ref executed in 10.42 secs
  # slow test /thread/rerun-all executed in 9.84 secs
  # slow test /gobject/refcount/object-advanced executed in 5.46 secs
  # slow test /thread/static-rw-lock executed in 5.00 secs
  # slow test /gobject/refcount/signals executed in 5.00 secs
  # slow test /gobject/refcount/signals executed in 5.00 secs

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-06-01 11:29:46 +01:00
Philip Withnall
fbc66b834e Merge branch 'mcatanzaro/#2829' into 'main'
Improve depfile generated by glib-compile-resources

Closes #2829

See merge request GNOME/glib!3460
2023-06-01 09:36:15 +00:00
Michael Catanzaro
3e3a0304f7 Improve depfile generated by glib-compile-resources
glib-compile-resources --dependency-file= currently generates a depfile
with rules that look like this:

foo.xml: resource1 resource2

This means that if any of the files listed in the GResource manifest
foo.xml change, rebuild foo.xml because foo.xml depends on those files.
This is not useful because the XML manifest is not expected to be a
generated dependency and even if it was, changes to the listed files
would not imply any need to regenerate the manifest. What we really do
need to regenerate is the C source file that is generated by
glib-compile-resources after processing the XML manifest and all the
resource files. That is, the rule should look like this:

foo.c: foo.xml resource1 resource2

as suggested by Hans Ulrich Niedermann in the issue report.

Fixes #2829
2023-05-31 14:50:21 -05:00
Daniel P. Berrangé
b6ce20329a gtestutils: use an enum for test case result fields
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2023-05-31 20:47:22 +01:00
Simon McVittie
0d86ee0a86 gstdio: Improve documentation of g_clear_fd() as async-signal safe
Add cross-references as requested for similar new API in !3457.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-31 16:34:16 +01:00
Simon McVittie
9af6b7e4e7 gstdio: Improve documentation of g_close() as async-signal safe
Add cross-references as requested for similar new API in !3457.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-31 16:34:14 +01:00
Philip Withnall
7a82da2992 Merge branch 'wip/smcv/steal-fd-preserves-errno' into 'main'
gmain: Document that g_steal_fd() preserves errno

See merge request GNOME/glib!3456
2023-05-31 14:34:33 +00:00
Philip Withnall
2d6073fae2 Merge branch 'symlink-target-filename' into 'main'
gfileinfo: add (type filename) annotation to symlink_target functions

See merge request GNOME/glib!3455
2023-05-31 08:46:13 +00:00
Jason Francis
c556a4d8f8
gfileinfo: add (type filename) annotation to symlink_target functions 2023-05-31 00:54:38 -04:00
Emmanuele Bassi
6fc6d9ea3e Merge branch 'ebassi/keyfile-docs' into 'main'
docs: Use the type name as the section name for GKeyFile

See merge request GNOME/glib!3453
2023-05-31 01:05:34 +00:00
Emmanuele Bassi
e8440ddcf9 Merge branch 'ebassi/type-table-docs' into 'main'
Allow proper introspection of GTypeValueTable

See merge request GNOME/glib!3441
2023-05-30 23:26:54 +00:00
Michael Catanzaro
b7d5e4bc19 Merge branch 'mcatanzaro/#2832' into 'main'
Fix: GSocketClient cannot proxy connect unless default port is explicitly specified in proxy URL

Closes #2832

See merge request GNOME/glib!3451
2023-05-30 16:50:40 +00:00
Simon McVittie
c97348428f gmain: Document that g_steal_fd() preserves errno
This is useful when writing similarly low-level code, and was always true
as implemented here; let's document it so that other codebases can rely
on it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-30 16:02:16 +01:00
Michael Catanzaro
d624c850b2 Add some tests for socks:// URI default ports
This also tests socks5h:// which we don't actually support yet, just to
make sure it works, which it does.
2023-05-30 09:55:39 -05:00
Michael Catanzaro
cc5bb80b9a Fix failure to respect default port of proxy URLs
Currently we require explicitly specifying the port when configuring a
proxy server, which is seriously weird. I take the fact that nobody
reported a bug until 2022 to indicate that almost nobody is using
proxies. Whatever. Let's assume that if no port is provided, the default
port for the protocol should be used instead.

For example, you can now specify in GNOME settings that your proxy server
is https://example.com and it will work. Previously, you had to write
https://example.com:443. Yuck!

This was originally reported as GProxyResolver bug, but nothing is
actually wrong there. It's actually GProxyAddressEnumerator that gets
tripped up by URLs returned by GProxyResolver without a default port.
This breaks GSocketClient.

Fixing this requires exposing GUri's _default_scheme_port() function to
GIO. I considered copy/pasting it since it's not very much code, but I
figure the private call mechanism is probably not too expensive, and I
don't like code duplication.

Fixes #2832
2023-05-30 09:49:43 -05:00
Michael Catanzaro
42cb8dfb95 guri: the default port for SOCKS URLs is 1080
This is true for socks://, socks4://, socks4a://, and socks5://. I could
list them individually and risk breaking in the future if socks6:// ever
exists, or test for "socks" and risk breaking if a future URL scheme
begins with "socks" but doesn't use port 1080. I picked the latter.
2023-05-30 09:49:43 -05:00
Philip Withnall
5c50aec060 Merge branch 'glib-mkenums_parse_trigraph' into 'main'
Take double-quote characters into account when parsing trigraph

Closes #65

See merge request GNOME/glib!3452
2023-05-30 14:45:54 +00:00
Philip Withnall
fe458559d8 Merge branch 'gsignal-emission-locks-cleanups' into 'main'
gsignal: Reduce lock/unlock pairs and ensure we always work on valid signal nodes

See merge request GNOME/glib!2824
2023-05-30 13:57:27 +00:00
Emmanuele Bassi
d4f2db270f Annotate GTypeValueTable callbacks for availability
The compiler annotations are mainly useful for people using the symbols
directly.

To avoid getting compiler warnings for the GTypeValueTable definition
itself, we need to wrap the structure with
G_GNUC_BEGIN_IGNORE_DEPRECATIONS and G_GNUC_END_IGNORE_DEPRECATIONS.
2023-05-30 14:38:16 +01:00
Emmanuele Bassi
23a9dbdaf6 Allow proper introspection of GTypeValueTable
The introspection scanner cannot deal very well with function pointers
into a plain structure. In order to document the various function
pointers in GTypeValueTable we need to create typed callbacks, and
use them to replace the anonymous function pointers inside the
structure. This not only allows us to properly document the function
pointers, but it also allows us to annotate the arguments and return
value of those function pointers.

See also: https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/400#note_1721707
2023-05-30 14:38:16 +01:00
Philip Withnall
32ec11e51d Merge branch 'free-sized-macro' into 'main'
gmem: Add an inline definition of g_free() to automatically use g_free_sized()

See merge request GNOME/glib!3252
2023-05-30 13:29:25 +00:00