Commit Graph

25748 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
399f46f8bf giomodule: Use g_once_init_enter/leave to register extensions and load dirs
There's no much change in behavior, but let's take advantages of the tools
we already have to handle these cases.
2022-07-13 00:47:31 +02:00
Danial Behzadi
a2f8dca009 Update Persian translation 2022-07-12 20:43:29 +00:00
Marco Trevisan (Treviño)
99c2b4e499 ci: Setup submodules and subprojects before building on dist
Also handle a permission issue.
2022-07-12 20:25:04 +02:00
Marco Trevisan (Treviño)
f622a4ed53
2.73.2
Co-authored-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Marco Trevisan (Treviño) <marco@ubuntu.com>
2022-07-12 18:32:22 +02:00
Yuri Chornoivan
2c8948c3fa Update Ukrainian translation 2022-07-12 16:26:03 +00:00
Marco Trevisan
c752b63143 Merge branch 'wait-for-async-uri-handler-called' into 'main'
gio/tests/desktop-app-info: Wait until the callback is called

See merge request GNOME/glib!2809
2022-07-12 15:46:14 +00:00
Philip Withnall
b8b037c428 Merge branch '2687-socket-cancellable' into 'main'
gsocketclient: Fix passing NULL to g_task_get_cancellable()

Closes #2687

See merge request GNOME/glib!2808
2022-07-12 15:38:43 +00:00
Marco Trevisan (Treviño)
ecaa5b5b7a gio/tests/desktop-app-info: Wait until the callback is called
The test was flacky because we were only relying on the presence of a
file, while the callback could have not been called yet, while ensure
for both assumptions to be true before stop iterating the loop.
2022-07-12 17:33:15 +02:00
Philip Withnall
e2639ce56e gsocketclient: Fix passing NULL to g_task_get_cancellable()
Fix a regression from commit abddb42d14, where it could pass `NULL` to
`g_task_get_cancellable()`, triggering a critical warning. This could
happen because the lifetime of `data->task` is not as long as the
lifetime of the `ConnectionAttempt`, but the code assumed it was.

Fix the problem by keeping a strong ref to that `GCancellable` around
until the `ConnectionAttempt` is finished being destroyed.

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

Fixes: #2687
2022-07-12 16:07:23 +01:00
Marco Trevisan
df239b97fb Merge branch 'wip/pwithnall/wpointer-sign' into 'main'
ci: Specify -Wno-overlength-strings on macOS
gstdio: Do not pass wrong pointer types to FILETIME to unix conversion
build: Specify -Werror=pointer-sign

See merge request GNOME/glib!2807
2022-07-12 14:25:53 +00:00
Philip Withnall
4353813058 build: Specify -Werror=pointer-sign
This can catch the wrong pointer being passed to a function argument (in
some cases), with few false positives.

Spotted while testing !2529.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-12 15:55:59 +02:00
Marco Trevisan (Treviño)
f0e98a1923 gstdio: Do not pass wrong pointer types to FILETIME to unix conversion 2022-07-12 15:55:59 +02:00
Philip Withnall
e6af2d3662 ci: Specify -Wno-overlength-strings on macOS
This disables the following warning, which was causing CI failures on
macOS when building the libpcre2 subproject:
```
../subprojects/pcre2-10.40/src/pcre2_error.c:66:3: error: string literal of length 4380 exceeds maximum length 4095 that ISO C99 compilers are required to support [-Werror,-Woverlength-strings]
```

We don’t want to explicitly rely on using overlength strings in GLib,
which is why this change is a `CFLAGS` in the CI configuration, rather
than setting a project-level argument in `meson.build`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-12 14:16:23 +01:00
Philip Withnall
e19df710d2 Merge branch 'scheduler-warning-atomic-set' into 'main'
gthread-posix: Do not do unguarded and non-atomic assignment of an atomic

See merge request GNOME/glib!2805
2022-07-12 12:52:21 +00:00
Marco Trevisan (Treviño)
39ecb71452 gthread-posix: Do not do unguarded and non-atomic assignment of an atomic
We ended up always skipping showing the scheduler settings errors after
the first call, while we were already setting such variable atomically
in case it needed to.

Related to: #1672
2022-07-12 14:30:20 +02:00
Philip Withnall
cd9a5c173a Merge branch 'rybalkin-pcre2' into 'main'
replace pcre1 with pcre2

Closes #1085

See merge request GNOME/glib!2529
2022-07-12 11:46:35 +00:00
Aleksei Rybalkin
8d5a44dc8f replace pcre1 with pcre2 2022-07-12 11:46:34 +00:00
Philip Withnall
6997ebcfd7 Merge branch 'thread-pool-slow-really-stops-unused' into 'main'
glib/test/thread-pool-slow: Ensure all unused threads are really stopped

Closes #2685

See merge request GNOME/glib!2804
2022-07-12 11:44:05 +00:00
Danial Behzadi
e5f3b08b54 Update Persian translation 2022-07-12 11:05:59 +00:00
Danial Behzadi
71e76fa4e8 Update Persian translation 2022-07-12 10:48:03 +00:00
Marco Trevisan (Treviño)
a275ee6679 gthreadpool: Update unused_threads while we still own the pool lock
As per the rationale explained in the previous commit, we could end up
having the unused_threads value not to be conformant to what
g_thread_pool_get_num_threads() returns, because an about-to-be-unused
thread might not be counted yet as such, while the pool threads number
has been already decreased.

To avoid such scenario, and to make sure that when all the pool's
threads are stopped, they're unmarked as unused, let's increase the
unused_threads value earlier, while we still own the pool lock so that
it will always include the pool that is not used anymore, but not yet
queued.

As per this we can update the test, not to repeat the stop-unused call
as now we're sure that when the pool has no threads anymore, the unused
threads value is also updated accordingly.

Also adding a tests with multiple pools.
2022-07-11 19:56:26 +02:00
Marco Trevisan (Treviño)
fabdc2d4fa glib/test/thread-pool-slow: Ensure all unused threads are really stopped
In this tests we wanted to ensure that all the unused threads were
stopped, however while we were calling g_thread_pool_stop_unused_threads
some threads could still be in the process of being recycled even tough
the pool's num_thread values are 0.

In fact, stopping unused threads implies also resetting back the max
unused threads to the previous value, and in this test it caused it to
go from -1 -> 0 and back to -1, after killing the unused threads we
knew about; thus any about-to-be-unused thread that is not killed during
this call will be just left around as a waiting unused thread afterwards.

However, if this function was getting called when a thread was in
between of calling the user function and the moment it was being
recycled (and so when the pool num_threads was updated), but this thread
was not counted in unused_threads, we ended up in having a race because
all the threads were consumed from our POV, but some were actually not
yet unused, and so were kept waiting forever for some new job.

To avoid this in the test, we can ensure that we stop the unused
threads until we the number of them is really 0.

Sadly we need to repeat this as we don't have a clear point in which we
are sure about the fact that our threads are done, while it would be
wrong to stop a thread that is technically not yet marked as unused.

We could also do this in g_thread_pool_stop_unused_threads() itself, but
it would make such function to wait for threads to complete, and this is
probably not what was expected in the initial API.

Fixes: #2685
2022-07-11 19:56:26 +02:00
Marco Trevisan (Treviño)
a5ccaa0525 glib/tests/thread-pool-slow: Fix indentation in test_thread_stop_unused
It used three-spaces indentation instead of 2, fix it.
2022-07-11 19:56:26 +02:00
Marco Trevisan
32dbedc5f2 Merge branch 'custom-dispatch-test-more' into 'main'
gobject/tests/custom-dispatch: Add few more tests

See merge request GNOME/glib!2802
2022-07-08 23:16:46 +00:00
Marco Trevisan (Treviño)
28dc989fc1 gobject/tests: Add test to verify that custom dispatch is called on init
As per this, rename the old test so that it's more in line with the
new one and with what it does.
2022-07-09 00:24:13 +02:00
Marco Trevisan (Treviño)
ed130c8d3b gobject/tests/custom-dispatch: Mark the foo property as explicit-notify
We're calling g_object_notify so let's not make gobject to call it for
us.

This also allows to test that changing a property again doesn't lead to
dispatch properties being called.
2022-07-08 23:54:43 +02:00
Marco Trevisan
fb607d3feb Merge branch '2776-follow-up' into 'main'
gobject: Small speedup in weak-ref-set

See merge request GNOME/glib!2801
2022-07-08 14:37:53 +00:00
Peter Bloomfield
3290ebfadc gobject: Small speedup in weak-ref-set 2022-07-08 14:37:53 +00:00
Matthias Clasen
9d89f75a50 Merge branch 'release-docs' into 'main'
docs: Document the release process

See merge request GNOME/glib!2763
2022-07-08 14:16:47 +00:00
Emmanuele Bassi
043f3dcf11 Merge branch 'wip/pwithnall/2216-pidfd-sigchld' into 'main'
gmain: Use waitid() on pidfds rather than a global SIGCHLD handler

Closes #2216

See merge request GNOME/glib!2408
2022-07-08 14:10:13 +00:00
Emmanuele Bassi
60346f1873 Merge branch 'another-victim-of-gobject' into 'main'
gobject: Fix a recent regression

See merge request GNOME/glib!2794
2022-07-08 14:00:39 +00:00
Matthias Clasen
edcd2d4df4 Add a test for custom dispatch_properties_changed
This tests that we call a custom dispatch_properties_changed,
even in the absence of connected notify handlers. (A recent
optimization broke that and caused a regression in GTK).
2022-07-08 14:03:34 +01:00
Matthias Clasen
c0a618a716 gobject: Don't skip custom dispatch_properties_changed
When I optimized GObject to skip property notification
in some cases, I looked for whether the class has a
custom notify vfunc. I overlooked that that
dispatch_properties_changed can also be customized,
and if it is, we better not skip change notification.

This showed up as breakage in the adjustment tests
in the GTK testsuite.
2022-07-08 13:57:40 +01:00
Philip Withnall
f615eef4ba gmain: Use waitid() on pidfds rather than a global SIGCHLD handler
When the system supports it (as all Linux kernels ≥ 5.3 should), it’s
preferable to use `pidfd_open()` and `waitid()` to be notified of
child processes exiting or being signalled, rather than installing a
default `SIGCHLD` handler.

A default `SIGCHLD` handler is global, and can never interact well with
other code (from the application or other libraries) which also wants to
install a `SIGCHLD` handler.

This use of `pidfd_open()` is racy (the PID may be reused between
`g_child_watch_source_new()` being called and `pidfd_open()` being
called), so it doesn’t improve behaviour there. For that, we’d need
continuous use of pidfds throughout GLib, from fork/spawn time until
here. See #1866 for that.

The use of `waitid()` to get the process exit status could be expanded
in future to also work for stopped or continued processes (as per #175)
by adding `WSTOPPED | WCONTINUED` into the flags. That’s a behaviour
change which is outside the strict scope of adding pidfd support,
though.

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

Helps: #1866
Fixes: #2216
2022-07-07 14:08:29 +01:00
Philip Withnall
a7efce14e0 Merge branch 'issue-2659' into 'main'
Fix  /maincontext/timeout-once randomly fails

Closes #2659

See merge request GNOME/glib!2780
2022-07-07 12:34:45 +00:00
Philip Withnall
7b93693ab3 gmain: Add a clarifying comment about exit statuses vs wait statuses
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2216
2022-07-07 13:05:18 +01:00
Marc-André Lureau
1a29fd4308 tests/mainloop: iterate for a little while for timeout-once
On win32, WaitForSingleObject may return before the timeout is
dispatched, as it doesn't have a resolution higher than the system tick.
Wait for ~50ms before checking the callback changes.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-07 15:52:25 +04:00
Marc-André Lureau
17ac6642c7 gmain: do not wakeup the wakeup registration
Do not wakeup immediately for our own context wakeup poll registration.

g_main_context_add_poll_unlocked() will call g_wakeup_signal() to wake
up the loop waiting in poll(). Doing so during context creation will
create an extra wakeup for the first poll().

Skip the wakeup call if it is the wake_up_rec registration. No other
sources/caller should ever reach that condition.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-07 15:52:25 +04:00
Philip Withnall
ed564b71dd Merge branch '2672-dataset-tests-and-fixes' into 'main'
gdataset: Preserve destruction order

Closes #2672 and #2676

See merge request GNOME/glib!2776
2022-07-07 11:52:19 +00:00
Marc-André Lureau
a43723ef17 tests/spawn-singlethread: fix test EOL on win32
The "arg" argument is given in \n-ending form, but the returned result
is \r\n-ending.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-07 15:35:28 +04:00
Philip Withnall
1bf53c9ced Merge branch 'strerror_r-int-variant-support' into 'main'
gbacktrace: Handle case of strerror_r returning an int value

See merge request GNOME/glib!2800
2022-07-07 11:14:44 +00:00
Marco Trevisan (Treviño)
d21d213d00 gstrfuncs: Update docs for g_strerror with a string closer to reality 2022-07-07 00:42:45 +02:00
Marco Trevisan (Treviño)
edd718ba48 gstrfuncs: Handle the case strerror_r returns an error
In the case strerror_r returns an error (both in the char* variant and
in the int variant) we should not try to proceed converting the message
and adding to the errors maps, as that's likely causing errors.

So, let's just return a null string in case this happens
2022-07-07 00:42:45 +02:00
Marco Trevisan (Treviño)
640e586251 gbacktrace: Handle case of strerror_r returning an int value
As it's the case in FreeBSD and Mac OS X.
2022-07-07 00:42:45 +02:00
Marco Trevisan
c25ad9aa56 Merge branch 'error-unused-results' into 'main'
Remove occurrences of unused-results warnings and mark them as errors

See merge request GNOME/glib!2798
2022-07-06 17:17:35 +00:00
Marco Trevisan (Treviño)
8c5dac1eb2 glib/tests/fileutils: use g_assert_no_errno instead of manual checking 2022-07-06 18:41:10 +02:00
Marco Trevisan (Treviño)
b61cd872f1 build: Threat unused-result warnings as errors
We don't have any in code now, so we should definitely ensure that we
won't introduce anymore unguarded calls.
2022-07-06 18:41:10 +02:00
Marco Trevisan (Treviño)
7a382438aa glib/tests: Ensure that calls to write, system, symlink and pipe are checked
Assert that calls to such system calls are returning the expected values
2022-07-06 18:41:10 +02:00
Marco Trevisan (Treviño)
a5390002fc gio-tool-mount: Exit with error in case we can't read from stdin
It's a fatal situation so we can just exit without caring much.
2022-07-06 16:05:33 +02:00
Marco Trevisan (Treviño)
0e4d8c2478 gbacktrace: Ensure return values of write, dup and fgets are used
Make sure that we did not error when doing write or read operations, and
in such case, just exit reporting the error.
2022-07-06 16:02:13 +02:00