Commit Graph

23615 Commits

Author SHA1 Message Date
Philip Withnall
4d6dbe0904 Merge branch 'g_dbus' into 'main'
gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name()

Closes #402

See merge request GNOME/glib!2156
2021-06-16 10:58:04 +00:00
nitinosiris
a70df97c63 Added test case for g_dbus_is_error_name 2021-06-16 08:06:03 +05:30
nitinosiris
5b9a8e2048 gdbus: Add g_dbus_is_error_name() symbol for g_dbus_is_interface_name()
Closes #402
2021-06-16 08:05:50 +05:30
Philip Withnall
00feb4d5a9 Merge branch 'wip/wait-status' into 'main'
Distinguish more clearly between wait status and exit status

See merge request GNOME/glib!1967
2021-06-15 18:22:02 +00:00
Ondrej Holy
757cc93520 Merge branch 'unix-mount-for-docs' into 'main'
gunixmounts: Document NULL return value for g_unix_mount_for()

See merge request GNOME/glib!2145
2021-06-15 15:29:58 +00:00
Simon McVittie
b483013d02 spawn: Clarify the most common non-exit reason for process termination
A reader might think "how would a process terminate without an exit
status?", or equivalently, "what harm would it do if I assume every
termination has an exit status?" without this reminder that termination
with a signal is also reasonably common.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:33:17 +01:00
Simon McVittie
e0b6b8037d Distinguish more clearly between wait status and exit status
On Unix platforms, wait() and friends yield an integer that encodes
how the process exited. Confusingly, this is usually not the same as
the integer passed to exit() or returned from main(): conceptually it's
an integer encoding of this tagged union:

    enum { EXITED, SIGNALLED, ... } tag;
    union {
        int exit_status;         /* if EXITED */
        struct {
            int terminating_signal;
            bool core_dumped;
        } terminating_signal;    /* if SIGNALLED */
        ...
    } detail;

Meanwhile, on Windows, wait statuses and exit statuses are
interchangeable.

I find that it's clearer what is going on if we are consistent about
referring to the result of wait() as a "wait status", and the value
passed to exit() as an "exit status".

GSubprocess already gets this right: g_subprocess_get_status() returns
the wait status, while g_subprocess_get_exit_status() genuinely returns
the exit status. However, the GSpawn family of APIs has tended to
conflate the two.

Confusingly, g_spawn_check_exit_status() has always checked a wait
status, and it would not be correct to pass an exit status to it; so
let's deprecate it in favour of g_spawn_check_wait_status(), which
does the same thing that g_spawn_check_exit_status() always did.
Code that needs backwards-compatibility with older GLib can use:

    #if !GLIB_CHECK_VERSION(2, 69, 0)
    #define g_spawn_check_wait_status(x) (g_spawn_check_exit_status (x))
    #endif

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:33:14 +01:00
Simon McVittie
f2be22ca52 subprocess test: Check wait status correctly
Confusingly, g_spawn_check_exit_status() takes a wait status, not an
exit status, so passing g_subprocess_get_exit_status() to it is
incorrect (although both encodings happen to use 0 to encode success
and a nonzero value to encode failure, so in practice this probably
had the desired effect).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-06-15 14:32:33 +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
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
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
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