Commit Graph

23913 Commits

Author SHA1 Message Date
Philip Withnall
bd8d139a77 tests: Add missing wakeup calls to gdbus-names.c
Following on from the previous commit, some explicit
`g_main_context_wakeup()` calls were missing from the test code which
only uses `GMainContext`.

Add them, and also add some assertions to check that these functions are
being called in the expected thread (as the code comments say).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-15 13:48:03 +01:00
Philip Withnall
031e5020ee Merge branch 'wip/pwithnall/local-file-monitor-deadlock' into 'main'
glocalfilemonitor: Avoid a deadlock on finalization

See merge request GNOME/glib!2155
2021-06-15 12:24:51 +00:00
Philip Withnall
8530a6a8e4 tests: Add missing wakeup calls to gdbus-names test
The tests in `gdbus-names.c` use a mixture of `GMainLoop` and iterating
a `GMainContext` directly. Some of the helper functions based around the
`OwnNameData` struct use the `loop` `GMainLoop` even when called from
tests like `watch_with_different_context()` which themselves use
`GMainContext` directly.

Thus, it’s possible for the `GMainLoop` to not be running, while the
test is iterating on `g_main_context_iteration()`. In this case,
`g_main_loop_quit()` is a no-op and will not wake up the `GMainContext`.
This causes the test to livelock in around 1 in 1200 test runs.

Fix this by adding an explicit `g_main_context_wakeup()` call after each
`g_main_loop_quit()` call. A more comprehensive fix would be to port all
the tests in this file to iterating `GMainContext` directly, and drop
all the `GMainLoop` usage, but I don’t have time for that right now.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-15 13:01:28 +01:00
Philip Withnall
7b6ccc8bdb Merge branch 'range-checked' into 'main'
GBytes: add range-checked pointer getter

Closes #1098

See merge request GNOME/glib!2147
2021-06-15 12:01:12 +00:00
Nitin Wartkar
e3452ea01f GBytes: add range-checked pointer getter
Updated and improved by Nitin Wartkar.

Fixes: #1098
2021-06-15 12:01:11 +00:00
Philip Withnall
b95d9d1db6 Merge branch 'g_obj_take_ref' into 'main'
GObject: add g_object_take_ref()

Closes #1112

See merge request GNOME/glib!2146
2021-06-15 11:28:00 +00:00
Simon McVittie
9d2d99efe7 Merge branch '2423-llvm-objcopy' into 'main'
tests: Allow GResource external data tests to use llvm-objcopy

Closes #2423

See merge request GNOME/glib!2154
2021-06-14 16:19:17 +00:00
Simon McVittie
e7ebee5959 Merge branch 'bookmarkfile-test-tmp' into 'main'
tests: Use a temporary file in the bookmarkfile tests

See merge request GNOME/glib!2105
2021-06-14 15:47:42 +00:00
Philip Withnall
838dc04c76 glocalfilemonitor: Avoid a deadlock on finalization
If `g_file_monitor_source_dispatch()` drops the last reference to its
`GLocalFileMonitor`, a deadlock will occur, because disposing the
`GLocalFileMonitor` causes synchronous disposal of the
`GFileMonitorSource`, and hence an attempt to re-lock the already-locked
mutex in the `GFileMonitorSource`.

Fix that by dropping the reference to the `GLocalFileMonitor` after
unlocking.

Diagnosed by Ting-Wei Lan. The bug was originally introduced by me in
commit 592a13b483.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-14 15:09:52 +01:00
Philip Withnall
e522768ef4 tests: Allow GResource external data tests to use llvm-objcopy
Relax the requirement for the test to only be compiled/run under gcc,
since a version of LLVM was released which supports `--add-symbol`.

`objcopy` should be overrideable to be `llvm-objcopy` by using a machine
file as per https://mesonbuild.com/Machine-files.html#binaries.

Suggested and tested by Grigory Vasilyev.

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

Fixes: #2423
2021-06-14 14:49:59 +01:00
Philip Withnall
b519cf0f3e Merge branch 'wip/fix-docs' into 'main'
docs: Fix annotations for optional arguments

See merge request GNOME/glib!2153
2021-06-11 14:46:25 +00:00
Evangelos Ribeiro Tzaras
708100c0a2 docs: Fix annotations for optional arguments
The length parameter in g_hash_table_get_keys_as_arrays() is optional and
this should be reflected in the gtk-doc annotations.
2021-06-11 15:19:17 +02:00
Allison Ryan Lortie
3764c6730e GObject: add g_object_take_ref()
This works in the same way as g_variant_take_ref(), and for the same
reason.

Updated and Rebased by Nitin Wartkar <nitinwartkar58@gmail.com>

Closes #1112
2021-06-11 18:13:34 +05:30
Philip Withnall
4de3ea4ead subprojects: Add libpcre.wrap
This is from the wrapdb, at version 8.37-2. This version includes
changes needed for the subproject to work correctly in GLib: enabled
Unicode support. Earlier wrap versions won’t work.

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

Helps: #962
2021-06-10 15:32:41 +01:00
Yongsu Park
3364e02041 win32: Check and avoid using TLS index 0
Zero is a valid TLS index so it needs to be checked. It’s also the
integer used to indicate that no TLS has been allocated yet, so it can’t
be used as a TLS identifier.

Incorporates changes from Philip Withnall.

Fixes: #2058
2021-06-10 15:22:55 +01:00
Philip Withnall
de74a70b7e Merge branch 'try-tls-binding-tests-again' into 'main'
Revert "tests: Deactivate tls-bindings test suite for windows"

See merge request GNOME/glib!2130
2021-06-10 12:46:12 +00:00
Philip Withnall
76ecdeffd0 Merge branch '2409-application-must-be-registered' into 'main'
gapplication: Guard g_application_mark_busy()

Closes #2409

See merge request GNOME/glib!2111
2021-06-10 12:44:13 +00:00
Philip Withnall
fa21de35c9 Merge branch 'dbus-guids-docs' into 'main'
docs: Expand documentation about D-Bus GUIDs

See merge request GNOME/glib!1812
2021-06-10 12:27:29 +00:00
Philip Withnall
c0fe89c986 Merge branch 'gtypeof' into 'main'
glib_typeof: Move definition to its own header

See merge request GNOME/glib!1969
2021-06-10 12:26:27 +00:00
Philip Withnall
055f7c6bc5 gdbusconnection: Fix a typo in a code comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:37:23 +01:00
Philip Withnall
ee716d9159 docs: Fix capitalisation of ‘GUID’ in a few places
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:37:11 +01:00
Philip Withnall
c794261a40 docs: Expand documentation about D-Bus GUIDs
Clarify that the terms ‘GUID’ and ‘UUID’ are used interchangeably in the
context of D-Bus, and that neither of them are an RFC 4122 UUID.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-10 12:36:25 +01:00
Philip Withnall
71edc3ffe1 Merge branch 'fix_more_warnings' into 'main'
Fix more warnings

See merge request GNOME/glib!2119
2021-06-10 09:37:34 +00:00
Michael Catanzaro
c816ee5bd1 Merge branch 'feature/tls-cert-additional-fields' into 'main'
tls: expose SAN details on GTlsCertificate

See merge request GNOME/glib!2142
2021-06-10 00:54:45 +00:00
Ross Wollman
4d3618cbd1 tls: expose SAN details on GTlsCertificate
This changeset exposes

* `dns-names`
* `ip-addresses`

on GTlsCertificate provided by the underlying TLS Backend.

See https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/165 for the corresponding glib-networking changes.

Relates: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2113
Relates: https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/156/diffs
Relates: https://github.com/microsoft/playwright/issues/6759
2021-06-10 00:54:45 +00:00
Philip Withnall
0362bf5d64 gunixmounts: Document when g_unix_mount_at() returns NULL
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-09 16:01:44 +01:00
Philip Withnall
165a0baa15 gunixmounts: Document NULL return value for g_unix_mount_for()
It will return `NULL` if the path doesn’t exist.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-09 15:53:32 +01:00
Emmanuele Bassi
eff19df205 Merge branch '229-regex-match' into 'main'
gregex: Fix return from g_match_info_fetch() for unmatched subpatterns

Closes #229

See merge request GNOME/glib!1751
2021-06-09 14:08:56 +00:00
Philip Withnall
b052620398 gregex: Fix return from g_match_info_fetch() for unmatched subpatterns
If there were more subpatterns in the regex than matches (which can
happen if one or more of the subpatterns are optional),
`g_match_info_fetch()` was erroneously returning `NULL` rather than the
empty string. It should only return `NULL` when the `match_num`
specifies a subpattern which doesn’t exist in the regex.

This is complicated slightly by the fact that when using
`g_regex_match_all()`, more matches can be returned than there are
subpatterns, due to one or more subpatterns matching multiple times at
different offsets in the string.

This includes a fix for a unit test which was erroneously checking the
broken behaviour.

Thanks to Allison Karlitskaya for the minimal reproducer.

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

Fixes: #229
2021-06-09 14:39:20 +01:00
Philip Withnall
9ed66b21dd Merge branch 'confusing_errors' into 'main'
gdbusconnection: removed a confusing message

Closes #793

See merge request GNOME/glib!2118
2021-06-09 12:49:04 +00:00
Philip Withnall
1891165e73 tests: Tweak whether a PCRE test is enabled
Rather than predicating the test on whether the system PCRE is being
used, use a more specific version comparison which should work
regardless of whether the system or internal copy of libpcre is being
used.

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

Helps: #962
2021-06-09 12:29:02 +01:00
Philip Withnall
78d43a0502 Merge branch 'utkarsh181-main-patch-34260' into 'main'
compiling.xml: Don't recommend backticks

See merge request GNOME/glib!2143
2021-06-09 10:13:27 +00:00
Utkarsh Singh
47e161d082 compiling.xml: Don't recommend backticks 2021-06-09 10:13:27 +00:00
Emmanuel Fleury
f4d6680f13 Fix dropped 'const' qualifier warning in glib/tests/once.c
glib/tests/once.c(199): warning C4090: 'function': different 'const' qualifiers
2021-06-09 11:11:06 +02:00
Emmanuel Fleury
6d8caf6482 Fix comparison of unsigned expression < 0 is always false warning in glib/gunicollate.c
glib/gunicollate.c:444:17: warning: comparison of unsigned expression < 0 is always false
          if (xfrm_len < 0 || xfrm_len >= G_MAXINT - 2)
              ~~~~~~~~ ^ ~
2021-06-09 11:11:06 +02:00
nitinosiris
5e2986ea2c gdbusconnection: removed a confusing message
The message `No such interface %s on object at path %s`
displayed when requested object does not exist, which was kind of
confusing.

Closes #793
2021-06-08 21:07:21 +05:30
Philip Withnall
601ef3b6be Merge branch 'resimplify-w32-veh' into 'main'
Re-simplify exception handling on Windows

See merge request GNOME/glib!2031
2021-06-08 12:10:41 +00:00
LRN
0908e6a8e7 Fix the math in copy_chars
Now we end up returning a pointer to the end of the buffer
after we run out of space. On subsequent calls copy_count will
end up being 0.
2021-06-08 08:38:59 +00:00
Руслан Ижбулатов
fbd7a37e1a Test the wchar_t version of pid-event subst routine
Also move env setup earlier in the test, to ensure that
the child gets the envvars during initialization.

Also, don't look for exception codes in stderr, since
OutputDebugStringA() doesn't dump stuff there.
2021-06-08 08:38:59 +00:00
Руслан Ижбулатов
5c187b9385 Convert the crash handler to UTF-16, mostly 2021-06-08 08:38:59 +00:00
Руслан Ижбулатов
6d9c3e3226 W32: Remove allocations from the crash handler
Use OutputDebugStringA() instead of fprintf.

The goal for this code is to inform the person running the debugger
about the exception that caused the debugger to be attached.
This is useful for debugging with gdb, because gdb does not catch Windows
exception information (it just displays "Segmentation fault").

OutputDebugStringA() ensures that the output goes to the debugger,
and the (ab)use of strcpy() with a stack-allocated buffer ensures
that we do not allocate anything while the crash handler is running,
nor to we call CRT functions that can be reasinably expected to allocate
anything.
2021-06-08 08:38:59 +00:00
Руслан Ижбулатов
891e3a0bba W32: Initialize debugger stuff in advance
Since VEH is invoked when an exception occurs (which, for us,
is mostly when the program is already crashing), we should
try to avoid doing much processing at that point. Since these
things (debugger commandline, a list of extra exceptions to catch)
are known in advance, set them up during initialization.
2021-06-08 08:38:59 +00:00
Руслан Ижбулатов
1955ede43b W32: Don't use g_getenv() in crash handler or during initialization
The first is to avoid any non-trivial code in the crash handler.
The second is to avoid the use of quarks and hash tables (brought
in by g_getenv()) during GLib initialization.
2021-06-08 08:38:59 +00:00
Emmanuele Bassi
ff8b43a154 Merge branch '2418-more-stupid-atomics' into 'main'
gbitlock: Drop unnecessary volatile qualifiers

Closes #2418

See merge request GNOME/glib!2131
2021-06-07 17:21:50 +00:00
Philip Withnall
2e8feda5d1 Merge branch 'Garray' into 'main'
doc: example for GArray and g_array_set_clear_func()

Closes #626

See merge request GNOME/glib!2124
2021-06-07 15:52:43 +00:00
Nitin Wartkar
b1d7a57cdf doc: example for GArray and g_array_set_clear_func() 2021-06-07 15:52:43 +00:00
Philip Withnall
2b4e8521e8 Merge branch 'fix/accidental-dllexport' into 'main'
gdbus, win32: Fix accidental dllexport in static builds

See merge request GNOME/glib!2139
2021-06-07 14:54:46 +00:00
Philip Withnall
6e92c2c233 Merge branch '2348-rename-master' into 'master'
Rename default development branch to main

Closes #2348

See merge request GNOME/glib!2140
2021-06-07 13:22:34 +00:00
Emmanuele Bassi
8bb4e7519e Merge branch '2417-file-replace-contents-etags' into 'master'
glocalfileoutputstream: Fix ETag check when replacing through a symlink

Closes #2417

See merge request GNOME/glib!2138
2021-06-07 13:15:52 +00:00
Philip Withnall
d81165216d docs: Add a section to the README about the branch rename
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2348
2021-06-07 14:03:48 +01:00