Commit Graph

27443 Commits

Author SHA1 Message Date
Philip Withnall
9845f880ca glocalfileinfo: Delete some redundant code
`_g_stat_has_field (statbuf, G_LOCAL_FILE_STAT_FIELD_ATIME)` will always
return `TRUE` on Windows (since it uses a basic `struct stat`), so the
platform-inspecific code is equivalent to the Windows-specific code.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-06-28 17:49:45 +01:00
Philip Withnall
c3762deb78 glocalfileinfo: Fix incorrect use of struct statx.st_mtimensec on Android
`GLocalFileStat` is a platform-specific abstraction around `struct stat`
or `struct statx`. If `struct statx` is available, it will use that by
preference as it has more features.

`glocalfileinfo.c` was, in some places, incorrectly accessing the fields
of `GLocalFileStat` directly rather than through its `_g_stat_*()`
getters. While it correctly accounted for the platform-specific
differences between `st_mtimensec` and `st_mtim.tv_nsec`, it hadn’t been
updated to deal with `stx_mtime`.

On Android, `st_mtimensec` is defined as a fallback for
`st_mtim.tv_nsec` (even though it doesn’t need to be). This caused GLib
to take the `st_mtimensec` code path rather than the `stx_mtime` code
path, and hence try to dereference `st_mtim` in a `struct statx`.

Fix that by correctly using the `_g_stat_*()` getters consistently.

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

Fixes: #3039
2023-06-28 17:32:25 +01:00
Philip Withnall
e8f14a66a6 Merge branch 'wip/oholy/gio-mount-progress' into 'main'
gio-tool-mount: Add option to show progress when unmounting

See merge request GNOME/glib!3471
2023-06-28 15:51:51 +00:00
Ondrej Holy
c083a4d1a6 gio-tool-mount: Add option to show progress when unmounting 2023-06-28 15:51:51 +00:00
Philip Withnall
d3fbb6e0fc Merge branch 'meson-intl-iconv-lookup' into 'main'
meson: try iconv in libintl lookup

See merge request GNOME/glib!3448
2023-06-28 14:48:19 +00:00
Philip Withnall
57d2f161e6 Merge branch 'pcre' into 'main'
pcre subproject fixes: Allow fallback & static build

See merge request GNOME/glib!3470
2023-06-28 14:38:36 +00:00
Marius Kintel
dd5683ce64 meson: Allow fallback & static build of pcre subproject
Using `allow_fallback: false` on the first check for libpcre
was unnecessary, as `required: false` already disables using
fallbacks. `allow_fallback: false` meant that
`--force-fallback-for` couldn’t work. This commit fixes that.

Also allow the fallback libpcre to be built statically so it
can be linked into GLib.

Helps: #3025
2023-06-28 14:38:36 +00:00
Jan200101
a497d5be12 meson: try iconv in libintl lookup
This was originally removed in !2734 but still appears to be required for
some MinGW setups, such as the `x86_64-w64-mingw32.static` target in
[mxe](https://github.com/mxe/mxe).

Currently, this configuration fails the libintl internal assert on line
2128, as on this platform `ngettext()` is only found inside libiconv.

This commit will look up iconv potentially twice, once as `libiconv` and
potentially once as `libintl_iconv`. This is what the code did before
!2734 landed, so it’s known to work reliably on a number of platforms.
2023-06-28 15:22:36 +01:00
Philip Withnall
3fc569085c Merge branch 'gspawn-macos-buffer-limit' into 'main'
Avoid stack overflow in gspawn on macOS

Closes #3024

See merge request GNOME/glib!3468
2023-06-28 13:42:40 +00:00
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
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