Commit Graph

8867 Commits

Author SHA1 Message Date
Philip Withnall
5278efbd63 tests: Ensure Python assertEventually() function uses correct main context
It should be doing already (or the tests would never work), but make it
clearer in the code that the same `GMainContext` is being iterated as is
being woken up in the rest of the test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #2887
2024-01-22 11:22:01 +00:00
Hailey Somerville
c65e163240 gio, gmodule, gthread: compile windows resources only in shared build
When linking static libraries, multiple resources is an error unless
handled in a special way. glib and gobject do not have this problem,
as they already only include resources when building a shared lib.
2024-01-21 18:51:52 +11:00
Emmanuele Bassi
4ff4f073a4 Merge branch 'altiera/docs' into 'main'
docs: Fix links to symbols outside the allowed namsepace

See merge request GNOME/glib!3809
2024-01-18 18:35:21 +00:00
Philip Withnall
5c05dfad97 tests: Run more appinfo tests under a GTestDBus environment
I ran Bustle/dbus-monitor on the session bus while running the full GLib
test suite, and noticed that these tests were causing `Launched` signal
emissions on the main session bus. That suggested they weren’t isolated
properly, which at best causes noise on the bus and at worst could cause
spurious test failures.

Fix that by running those tests in a `GTestDBus` environment, as some of
the other appinfo tests already are.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-18 15:22:30 +00:00
Philip Withnall
048afc5923 Merge branch 'wip/smcv/issue3226' into 'main'
tests: Don't test --external-data with toolchains that can't do the setup

Closes #3226

See merge request GNOME/glib!3819
2024-01-15 15:41:44 +00:00
Philip Withnall
cbb29a54c3 Merge branch 'socket-test-leak' into 'main'
tests: Fix a minor leak in the socket test

See merge request GNOME/glib!3821
2024-01-15 15:32:01 +00:00
Philip Withnall
6900e0450f Merge branch '3093-gdbus-header-validation' into 'main'
gdbusmessage: Validate the types of all known message headers

Closes #3093

See merge request GNOME/glib!3748
2024-01-15 15:21:44 +00:00
Emmanuele Bassi
b5c07063c3 docs: Use code for class names in links
So that they fit with the documentation guidelines, and with the links
generated by gi-docgen.
2024-01-15 14:43:53 +00:00
Philip Withnall
c7ace595e8 tests: Fix a minor leak in the socket test
As seen in [CI](https://gitlab.gnome.org/GNOME/glib/-/jobs/3436216):
```
==13767== 144 (40 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 528 of 562
==13767==    at 0x4A18B2C: g_type_create_instance (gtype.c:1928)
==13767==    by 0x49F92FF: g_object_new_internal (gobject.c:2235)
==13767==    by 0x49FA247: g_object_new_valist (gobject.c:2574)
==13767==    by 0x49F8D81: g_object_new (gobject.c:2047)
==13767==    by 0x4AE2337: g_inet_socket_address_new (ginetsocketaddress.c:387)
==13767==    by 0x4B1DB94: g_socket_address_new_from_native (gsocketaddress.c:230)
==13767==    by 0x4B16CC2: g_socket_get_local_address (gsocket.c:2071)
==13767==    by 0x40E102: test_receive_bytes_from (socket.c:2469)
==13767==    by 0x4901E78: test_case_run (gtestutils.c:2974)
==13767==    by 0x49022B2: g_test_run_suite_internal (gtestutils.c:3069)
==13767==    by 0x490241A: g_test_run_suite_internal (gtestutils.c:3088)
==13767==    by 0x4902690: g_test_run_suite (gtestutils.c:3168)
==13767==    by 0x4900C8F: g_test_run (gtestutils.c:2275)
==13767==    by 0x40EE8A: main (socket.c:2614)
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3220
2024-01-15 14:16:21 +00:00
Simon McVittie
fb5dd18f21 tests: Don't test --external-data with toolchains that can't do the setup
There are several reasons why we might not be able to do the test setup
for --external-data: non-Linux platform, missing ld or objcopy,
objcopy doesn't support --add-symbol, or the CPU family is MIPS
(on which cc -r does not necessarily emit the specific MIPS ABI flavour
that we are targeting, for example different functionality levels or
different NaN encodings).

If we can't link in the test data, then obviously this test is not going
to pass. It was already skipped on non-Linux, but not on platforms that
hit one of the other reasons for the test setup to fail.

In particular, this test failed on Debian mips64el since commit 81059169,
which stopped linking the necessary resource on MIPS platforms, but
continued to assert that the resource is present at runtime.

Fixes: 81059169 "GIO/tests: skip test_resources_binary on MIPS platform"
Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3226
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-01-13 19:54:28 +00:00
Jordan Petridis
3f9f5c1420 docs: Fix links to symbols outside the allowed namsepace
Use markdown links for anything that the docs don't depend upon,
like gtk, pixbuf, etc
2024-01-09 21:24:22 +02:00
Emmanuele Bassi
2b2b04d188 Shorten the title for D-Bus interface docs
The title of an interface can be arbitrarily long, considering that
reverse DNS namespaces can be pretty complex. Instead of using the whole
interface name, we can use the name without the prefix.
2023-12-29 01:02:00 +00:00
Philip Withnall
ec3fb9a48c Merge branch 'glib-gir-sources' into 'main'
gobject: Make GLib-2.0 gir build depend on GObject dependency

See merge request GNOME/glib!3772
2023-12-22 14:45:37 +00:00
Michael Catanzaro
c2fab14030 gapplication: ensure app ID is set when sending notification
Otherwise, we hit a bunch of criticals later on. Also, document this
requirement to ensure there is no ambiguity.

Fixes #3203
2023-12-21 10:44:25 -06:00
Philip Withnall
833d3fb6cf Merge branch 'file-uri-cleanup' into 'main'
glocalvfs: Remove unnecessary and buggy code

See merge request GNOME/glib!3776
2023-12-21 12:42:27 +00:00
Marco Trevisan (Treviño)
9c4ff01feb build: Move gir generation to an introspection folder
Generating gir and typelib files has inter-dependencies that may depend
on other elements.

For example, glib requires gobject and gdump generated files require
gmodule, so we've a cyclic dependency because gmodule requires gobject,
that requires glib.

To prevent this, let's just generate the introspection files at once in
a different meson file so that we don't have to deal with this.

As per this we could even revert commit fa37ab6d0 since gio is now
compiled before the gir files.
2023-12-20 21:35:53 +01:00
Colomban Wendling
1fa03292c1 glocalvfs: Remove unnecessary and buggy code
The code for stripping the query and fragment from file:// URIs was
wrong, as it would not properly strip a query if there was a fragment.

Fortunately, that code was actually useless, as the "stripped URI" was
passed to g_filename_from_uri() that does proper stripping itself.

So simply drop this extra unnecessary stripping logic from GLocalVFS's
get_file_for_uri() and let g_filename_from_uri() do all the work.
2023-12-20 19:25:50 +01:00
Colomban Wendling
5790ce14e8 tests: Test file:// URIs with both query and fragment 2023-12-20 19:23:40 +01:00
Marco Trevisan (Treviño)
81068e5c00 gio: Use g_task_return_error_literal() where we don't need formatting 2023-12-20 16:14:57 +00:00
Marco Trevisan (Treviño)
7c71090723 gtask: Add g_task_return_new_error_literal()
Avoids going through the formatting function or nesting GError calls.
2023-12-20 16:14:57 +00:00
Marco Trevisan (Treviño)
f08609b169 gio/tests/task: Use wait_for_completed_notification() to wait for task 2023-12-19 20:29:44 +01:00
Marco Trevisan (Treviño)
39f820e507 gio/tests/task: Also check for formatted error messages 2023-12-19 18:55:29 +01:00
Philip Withnall
98e4b3adec tests: Add tests for g_socket_receive_bytes() and g_socket_receive_bytes_from()
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-18 14:23:03 +00:00
Philip Withnall
7463a256cb tests: Add a missing no-error assertion in the socket tests
It doesn’t fail, but at least now it’s there to catch problems if they
do happen.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-18 14:23:03 +00:00
Philip Withnall
e46184205f tests: Use g_assert_*() rather than g_assert() in socket tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-18 14:23:03 +00:00
Philip Withnall
309f5384ca tests: Clear up freeing of test data in socket test
The same struct was reused across multiple tests, but without a shared
way of freeing its members. Refactor to add one.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-18 14:23:03 +00:00
Emmanuele Bassi
7cb953dab8 Add GBytes variants for GSocket receive methods
The current buffer API is pretty much C-specific, and cannot be
adequately described in a way that is friendly to introspection and
language bindings: the passed buffer is allocated by the caller, but the
written size of the buffer is in the return value.

Using GBytes, we get a better API at the cost of an additional
allocation.
2023-12-18 14:23:03 +00:00
Jens Georg
b363e07527 gapplication: Fix minor typo in docs 2023-12-16 17:06:36 +01:00
Philip Withnall
91c82b046e tests: Re-format codegen.py with black
This is just the result of running `black $(git ls-files '*.py')`.

For some reason, the `sh-and-py-check` CI job didn’t run on merge
request !3751, so this non-standard formatting slipped through onto
`main`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3754#note_1939914

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-11 16:53:44 +00:00
Philip Withnall
b96778ee43 tests: Use textwrap.dedent to indent expected strings pleasingly
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-11 16:52:07 +00:00
Philip Withnall
b014d622ee Merge branch 'fix_new_rst_anchors' into 'main'
Fix generated RST anchors for methods, signals and properties

See merge request GNOME/glib!3751
2023-12-11 14:19:44 +00:00
Michael Olbrich
19a6742fc2 gdbusconnection: don't cache G_IO_ERROR_CANCELLED errors
It can cause failures for shared connection objects.

What can currently happen is this:
1. A user starts to asynchronously create a proxy object
2. A user starts to asynchronously create another proxy object

At this point, the asynchronous initialization for the two proxy objects
share the not yet initialized connection object.

3. While the shared connection objected is created, the user cancels the
   creation with the supplied cancellable from the fist proxy object.
4. initable_init caches the canceled error and marks the connection as
   initialized.
5. The initialization of the second proxy object fails with the same
   canceled error.

To avoid this, clear the error in this case and destroy any member
variables that may have been created before the creation was canceled.

This way, the initialization of the second proxy object will restart the
connection initialization and with probably succeed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-12-11 14:17:14 +00:00
Philip Withnall
cecc5ef778 tests: Add more tests of header validation in D-Bus message serialisation
See the previous commit. These additions were kept in a separate commit
to make the changes to the existing tests in the previous commit
clearer.

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

Helps: #3093
2023-12-11 12:50:52 +00:00
Philip Withnall
fb60ebb0df gdbusmessage: Validate the types of all known message headers
Previously, the code only validated the types of *required* message
headers, and did not validate optional ones.

Now, the headers are validated in one step, and a subsequent step checks
whether the required ones are present.

The existing tests have been updated to match the new error message
wording. More tests will be added to test the new behaviour in a
subsequent commit.

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

Fixes: #3093
2023-12-11 12:50:52 +00:00
tytan652
605be9a1e9 tests: Add tests for gdbus-codegen generated RST
Those tests check if methods, signals and properties documentation are
properly generated.
2023-12-11 13:48:43 +01:00
tytan652
9a4e54e1b7 Fix generated RST anchors for methods, signals and properties 2023-12-09 15:37:37 +01:00
Philip Withnall
e646c631b2 tests: Assert there no errors first in gdbus-test-codegen
Before checking the properties of `*_proxy`, assert that there were no
errors in constructing the proxy first. Otherwise the property checks
will crash on `NULL` pointer dereferences.

The test is still intermittently buggy somewhere, but at least this
commit will cause a relevant error message to be printed on failure.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-05 15:58:45 +00:00
Philip Withnall
c40fa821b8 Merge branch 'python3.12-remove-distutils' into 'main'
Switch from the Python distutils module to the packaging module

Closes #3134

See merge request GNOME/glib!3740
2023-12-05 15:50:15 +00:00
Jordan Williams
6ef967a0f9 Switch from the deprecated distutils module to the packaging module
The distutils module was removed in Python 3.12.
2023-12-05 14:18:10 +00:00
Philip Withnall
b097adf18a xdgmime: Update to upstream commit c2c814d4051f232
(Modulo the changes in
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/10 which are
still under discussion. Plus the proposed warning fixes from
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/33.)

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

Fixes: #3191
2023-12-04 13:13:13 +00:00
Philip Withnall
44d25c5ad4 Merge branch 'socket-client-cleanups' into 'main'
gsocketclient: Document delays/timeouts better

See merge request GNOME/glib!3394
2023-12-03 23:26:53 +00:00
Philip Withnall
da48656ee7 gsocketclient: Add a missing connection_attempt_remove() call
The connection attempt should always be removed before being unreffed.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-03 23:11:39 +00:00
Philip Withnall
f5f418b057 gsocketclient: Track whether the connection attempt delay is reached
Just for debugging purposes, track whether the Connection Attempt Delay
(https://datatracker.ietf.org/doc/html/rfc8305#section-8) has been
reached for each attempt.

This makes it a bit easier to diagnose `GSocketClient` problems in a
debugger.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-03 23:11:38 +00:00
Philip Withnall
ac6864ded7 gsocketclient: Rename ‘connection timeout’ to ‘connection delay’
This makes it match the terminology from RFC 8305 better, which refers
to a ‘connection attempt delay’. This is a delay because it determines
the spacing between trying additional connection attempts. It’s not a
timeout because it shouldn’t cause cancellation of any ongoing
connection attempts.

This commit introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-03 23:11:11 +00:00
Emmanuele Bassi
b53218a509 Merge branch '3037-doc-build-cleanups' into 'main'
build: Rename -Dgtk_doc option to -Ddocumentation and fix some g-ir-scanner warnings

See merge request GNOME/glib!3736
2023-12-01 22:48:17 +00:00
Philip Withnall
039876e6d9 gsocket: Enable TCP_NODELAY by default for stream GSockets
`TCP_NODELAY` disables Nagle’s algorithm, which is generally a better
default for modern networks than having it enabled. Nagle’s algorithm
delays sending small data blobs until they fill an entire TCP segment,
so as to amortise the cost of sending the segment.

This improves bandwidth at the cost of latency. Given the large
bandwidth capabilities of most modern networks, most streams are
constrained by latency rather than bandwidth, so disabling Nagle’s
algorithm makes sense.

Various other major bits of software (such as libcurl) already disable
Nagle’s algorithm by default.

Specific applications which need it can turn it back on by calling
`g_socket_set_option()`.

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

Fixes: #791
2023-11-29 17:08:10 +00:00
Philip Withnall
a581de2ee7 gsocketclient: Make connection_attempt_remove() safe to call twice
As spotted by Michael Catanzaro in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3394#note_1730123,
on the code path where a `ConnectionAttempt` is cancelled, it will
currently be removed from the `connection_attempts` list by the
cancellation code, and then *again* by the `if
(task_completed_or_cancelled ())` code in
`g_socket_client_connected_callback()`.

That would previously have resulted in a double-unref of the
`ConnectionAttempt`. So change `connection_attempt_remove()` to be a
no-op if the attempt isn’t found in `connection_attempts`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-11-29 15:55:48 +00:00
Philip Withnall
320c9d6d0d gsocketclient: Add some additional debug prints
These make it a bit easier to track the ongoing tasks, as the tasks
and/or their closures are not tracked in a big list somewhere.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-11-29 15:55:48 +00:00
Philip Withnall
bc6d03c3c9 gsocketclient: Document async operation timeout/completion behaviour
These calls are where the `GSocketClient` Happy Eyeballs code relies on
other components within GLib (and glib-networking) to complete
asynchronous operations in a timely manner. `GSocketClient` doesn’t add
its own timeouts to monitor these async operations, so if the
implementations are buggy then a `GSocketClient` operation could stall
forever.

Make that a bit clearer.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-11-29 15:55:48 +00:00
Philip Withnall
240b8bbc2d gsocketclient: Clarify some internal comments
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-11-29 15:55:48 +00:00
Philip Withnall
69c6413182 gsocketclient: Rename an internal variable and change it to a counter
This introduces no functional changes, but makes it a little clearer
what the variable signifies, and provides a little more information when
debugging things.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-11-29 15:27:16 +00:00
Philip Withnall
c4b47c708d gwin32appinfo: Use correct gettext macro
`P_()` is for pspec strings — it gave us the option to split them out to
a separate translation domain. `_()` is for normal strings.

Spotted by Sophie Herold: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3411#note_1733329

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-29 13:41:34 +00:00
Sophie Herold
0d268c4825 Remove all nicks and blurbs from param specs
Nicks and blurbs don't have any practical use for gio/gobject libraries.
Leaving tests untouched since this features is still used by other libraries.

Closes #2991
2023-11-29 13:41:34 +00:00
Philip Withnall
f3aebf0c15 gio: Add various missing property documentation comments
Previously these properties would have been documented using the strings
from the pspec, but those will be removed in the following commit. Re-add
the documentation using those strings, but as gi-docgen documentation
comments.

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

Helps: #2991
2023-11-29 13:41:12 +00:00
Philip Withnall
d930b9058f gtlspassword: Add a missing (out) annotation
Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3037
2023-11-29 11:58:16 +00:00
Philip Withnall
045186a6f2 gthreadedresolver: Mark internal functions as private
This removes a few more g-ir-scanner warnings.

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

Helps: #3037
2023-11-29 11:57:54 +00:00
Philip Withnall
f50ef45220 gnetworking: Hide POSIX networking symbols from g-ir-scanner
They’re not part of the GLib API and don’t need to be exposed to the
scanner.

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

Helps: #3037
2023-11-29 11:57:20 +00:00
Philip Withnall
2a8b0c2388 gicon: Fix an invalid introspection annotation
`(hash)` is not an annotation — it’s probably a typo for `(virtual
hash)`.

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

Helps: #3037
2023-11-29 11:56:46 +00:00
Philip Withnall
d71d4507b8 gfileinfo: Drop an incorrect (transfer) annotation
This fixes a g-ir-scanner warning.

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

Helps: #3037
2023-11-29 11:56:16 +00:00
Philip Withnall
002f846312 gio: Add some missing (scope) annotations
This removes some of the gobject-introspection warnings.

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

Helps: #3037
2023-11-29 11:55:49 +00:00
Philip Withnall
7d0140eea0 gdbusmessage: Reformat a doc comment to gi-docgen format
In an attempt to make gobject-introspection stop warning about using
deprecated gtk-doc `Type:` tags.

It doesn’t work — the gobject-introspection parser is not clever enough
to notice the tag is inside a code block.

Still, a useful port.

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

Helps: #3037
2023-11-29 11:54:13 +00:00
Philip Withnall
96c317418a gdbusconnection: Support matching object paths with arg0 matching
GDBus has always supported matching strings with arg0 matching
(`G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH`). In D-Bus 1.5, support was added
to the spec for also matching object paths. This got forgotten about and
was never added to GDBus, meaning that
`G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH` won’t match against a signal arg0
of type `o`.

Fix that, and add a unit test.

To do so, we need to add a new `g_dbus_message_get_arg0_path()` API to
complement the existing `g_dbus_message_get_arg0()` API. The approach of
letting `g_dbus_message_get_arg0()` return an object-path *or* a string
would not work, as it’s also called in the implementation of
`G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE`, which must only match
string-typed arg0 values and not object-path-typed ones.

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

Fixes: #3183
2023-11-28 14:42:41 +00:00
Philip Withnall
10e9a917be gdbusmessage: Cache the arg0 value
Technically we can’t rely on it being kept alive by the `message->body`
pointer, unless we can guarantee that the `GVariant` is always
serialised. That’s not necessarily the case, so keep a separate ref on
the arg0 value at all times.

This avoids a potential use-after-free.

Spotted by Thomas Haller in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3720#note_1924707.

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

Helps: #3183
2023-11-28 14:09:42 +00:00
Philip Withnall
bd33e0acd2 gio: Fix several incorrect links in documentation comments
Since commit 08f914b29, validation seems to have got a little
stricter/more correct.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
c406c6de6b Merge branch '3148-stream-test' into 'main'
tests: Use a pipe rather than a socketpair in stream-rw_all test

Closes #3148

See merge request GNOME/glib!3691
2023-11-28 11:43:51 +00:00
Philip Withnall
4c86a85eaf Merge branch 'app-command-line-done' into 'main'
gapplicationcommandline: add `.done()` method

Closes #596

See merge request GNOME/glib!3693
2023-11-27 14:15:36 +00:00
Aleksandr Mezin
c03c983d94 gapplicationcommandline: add .done() method
Fixes #596
2023-11-27 14:15:36 +00:00
Philip Withnall
01cdce7573 glocalfileinfo: Increase size of the content-type sniff buffer to 16KiB
It was previously 4KiB, but this isn’t enough for sniffing the
content-type of some GPT disk images (they use 4KiB sectors, and the
magic bytes are in the second sector). A buffer of 8KiB would work,
but 16KiB seems harmless and more future proof.

Most of the time, the buffer size should be set by xdgmime anyway, based
on the largest sniff buffer its database needs. Currently (with
shared-mime-info master) that’s 18730 bytes, so even with a 16KiB buffer
we’re going to potentially mis-identify a few file types.

Tested manually by modifying the example GPT image from shared-mime-info
(https://gitlab.freedesktop.org/xdg/shared-mime-info/-/blob/master/tests/mime-detection/disk.gpt)
to remove the magic at offset 0x200 and add it instead at offset 0x1000,
then running:
```
cp shared-mime-info.git/tests/mime-detection/disk.gpt ./disk-without-extension
gio info -a standard::content-type ./disk-without-extension
```

It should print `application/vnd.efi.img` rather than
`application/octet-stream`.

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

Fixes: #3186
2023-11-27 13:22:21 +00:00
Philip Withnall
29200648da Merge branch 'circular-mime-inheritance' into 'main'
xdgmime: Handle buggy type definitions with circular inheritance

See merge request GNOME/glib!3714
2023-11-22 10:35:34 +00:00
Alex Henrie
77902e1b1c xdgmime: Add continue statements after goto labels in_xdg_mime_(cache_)mime_type_subclass
To fix the Android build.
2023-11-21 11:14:58 -07:00
Philip Withnall
059618956b Merge branch 'muslc-ci' into 'main'
add muslc ci

See merge request GNOME/glib!3524
2023-11-21 14:55:29 +00:00
Alex Henrie
d9c50cac5d xdgmime: Handle buggy type definitions with circular inheritance
This fixes a stack overflow reported by a user who had both the
definition of text/javascript from shared-mime-info 2.3 and the
definition of text/javascript from shared-mime-info 2.4 installed at the
same time. In 2.3, text/javascript is a subtype of
application/ecmascript, but in 2.4 application/ecmascript is a subtype
of text/javascript. Having both at the same time resulted in circular
inheritance.

The new logic keeps a list of all parents that have already been
checked, which is more comprehensive than the old workaround that was
implemented in commit 38869ece2 ("xdgmime: Prevent infinite loops from
badly-formed MIME registrations").

https://bugs.archlinux.org/task/80279
2023-11-20 09:46:51 -07:00
Philip Withnall
6d2f63ecf1 giotypes: Drop redundant duplicate documentation blocks
This fixes a load of warnings about ‘multiple comment blocks documenting
<something> identifier’.

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

Helps: #3037
2023-11-15 12:37:12 +00:00
Philip Withnall
6e4d50fa5c docs: Move the gunixmounts SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-15 11:48:23 +00:00
Philip Withnall
9c414d437e docs: Move the gpollableutils SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-15 11:48:23 +00:00
Philip Withnall
708de2fc12 docs: Move the gnetworking SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-15 11:48:23 +00:00
Philip Withnall
de8e39b344 docs: Move the gmenumodel SECTION
Move it to a separate page, since it doesn’t quite make sense to
incorporate into the `GDBusConnection` docs.

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

Helps: #3037
2023-11-15 11:48:23 +00:00
Philip Withnall
ef049cbaca docs: Move the GIOScheduler SECTION
Move it to a separate page, as there isn’t a `GIOScheduler` struct.
Ensure that all its functions/methods/types are correctly marked as
deprecated. Fix a few broken links about I/O priority which pointed to
it.

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

Helps: #3037
2023-11-15 11:48:23 +00:00
Philip Withnall
de56743bf6 docs: Move the GTask SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 15:17:22 +00:00
Philip Withnall
3d8f1dc203 docs: Move the GUnixFDMessage SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 15:12:53 +00:00
Philip Withnall
a84a704dc6 docs: Move the GVfs SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 15:12:53 +00:00
Philip Withnall
e42bfcb9ae docs: Move the GSocketConnectable SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
b480a733c0 docs: Move the GSubprocess SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
7f6a126f39 docs: Move the GSocketControlMessage SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
8af86abefb docs: Move the GTlsConnection SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
2abbaac589 docs: Move the GIOModule and GIOExtensionPoint SECTIONs
Move them to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
fe8785862a docs: Move the GIOError SECTION
Move it to a separate page as there’s no struct documentation to hang it
off.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
d00a53416f docs: Move the GFileIOStream SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
172bb52e3f docs: Move the GFile SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
70881dbabe docs: Move the GDBusObjectSkeleton SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
108f7e4c65 docs: Move the GDBusObjectManagerServer SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
74735d878f docs: Move the dbusutils SECTION
Move it to a separate page as there’s no struct to hang the
documentation off.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
3205b03df6 docs: Move the GDBusProxy SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
e4de0868ee docs: Move the GDBusObjectManager SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
6492dd7054 docs: Move the GDBus name watching SECTION
Move it to a separate content page as there’s no struct to hang the docs
off.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
beb56279ef docs: Move the GDBus name owning SECTION
Move it to a separate content page as there’s no struct to hang the docs
off.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
f25ede6d1c docs: Move the GDBusMenuModel SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
c7e21d2f59 docs: Move the GDBusIntrospection SECTION
Move it to a separate content page as there is no `GDBusIntrospection`
type to hang the rest of the documentation off.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Philip Withnall
84bed2f6ae docs: Move the GDBusError SECTION
Adding it all to the docs for the `GDBusError` enum seemed a bit much,
so I moved it to its own content page.

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

Helps: #3037
2023-11-14 14:32:19 +00:00
Ondrej Holy
30e102518a gcontenttype: Make filename valid utf-8 string before processing
The `g_content_type_guess_for_tree` function segfaults currently when
processing filenames that are not valid unicode strings. Let's use the
`g_filename_to_utf8` and `g_utf8_make_valid` functions before other
processing to prevent that.

Let's also add a test for it to avoid this in future.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3168
2023-11-13 12:14:01 +00:00
Pablo Correa Gómez
8901ffeffe
ci: add muslc CI 2023-11-12 15:39:14 +01:00
Thomas Haller
7098250e7a gutils: avoid race setting prgname from g_option_context_parse()/g_application_run()
g_option_context_parse()/g_application_run()/g_test_init() for
convenience also call g_set_prgname(), when the prgname is unset at this
point. This was racy.

Fix the race by using an atomic compare-and-exchange and only reset the
value, if it is unset still.
2023-11-08 16:36:14 +01:00
Philip Withnall
d59bac3f32 tests: Fix gio-tool.py test on macOS
Content types are different on macOS.

This fixes commit 9028c9bdf.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: #3158
2023-11-08 10:29:43 +00:00
Emmanuele Bassi
85d93fb581 Merge branch 'codegen-deps-fixes' into 'main'
meson: Add missing dependencies for utility files for gdbus-codegen

See merge request GNOME/glib!3689
2023-11-07 15:21:27 +00:00
Philip Withnall
e87f8e9c5a Merge branch '3158-info-critical' into 'main'
gio-tool-info: Fix critical warning when --attributes are specified and add basic unit tests

Closes #3158

See merge request GNOME/glib!3684
2023-11-07 14:37:11 +00:00
Philip Withnall
9028c9bdf3 gio-tool-info: Fix critical warning when --attributes are specified
When `--attributes` is specified and doesn’t include `standard::name` in
its list, `gio` would print a critical warning from the (mandatory) call
to `g_file_info_get_name()`.

Fix that by making the call to `g_file_info_get_name()` optional.

Add a unit test too.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3158
2023-11-07 13:51:56 +00:00
Philip Withnall
3e0a99a059 tests: Add a very basic test suite for gio-tool
It gives nowhere near full coverage, but it’s something we can build on
in future.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3158
Helps: #2950
2023-11-07 13:51:56 +00:00
Philip Withnall
077104e63b tests: Run processes under test with G_DEBUG=fatal-warnings
Modify all the similar Python test wrappers to set
`G_DEBUG=fatal-warnings` in the environment of the program being tested,
so we can catch unexpected warnings/criticals.

Adding this because I noticed it was missing, not because I noticed a
warning/critical was being ignored.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-07 13:51:56 +00:00
Philip Withnall
120e0ee649 tests: Set a default timeout value for GIO Python tests
Otherwise every test has to set one explicitly, which is a bit tedious.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-07 13:51:56 +00:00
Philip Withnall
96ee1ea086 gio-tool: Print help output to stdout when --help is passed
If the help output is explicitly requested by the user, it’s
conventional for it to be printed to stdout rather than stderr.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-07 13:51:56 +00:00
Philip Withnall
7c97b93837 gio-tool: Factor out repetitive lists of subcommands
Store their details in an array which can be iterated over instead.

This introduces no functional changes, just a cleanup which will allow
following commits to be neater.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-07 13:51:56 +00:00
Sergey Bugaev
150965a9b3 gsocket: Fix detecting timeouts
If she socket is dispatched at exactly the previously set ready time,
it should already be considered to have timed out. This can easily
happen in practice when using a low resolution timer.

This fixes a test failure on GNU/Hurd, see
https://gitlab.gnome.org/GNOME/glib/-/issues/3148

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-11-06 15:14:02 +03:00
Sergey Bugaev
6b7b211338 gio: Add G_IO_ERROR_DESTINATION_UNSET
...and map EDESTADDRREQ to it.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-11-06 15:04:01 +03:00
Philip Withnall
c37bf851e5 tests: Use g_assert_*() rather than g_assert() in stream-rw_all tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-02 17:49:31 +00:00
Philip Withnall
a0de4963e8 tests: Use a pipe rather than a socketpair in stream-rw_all test
The test only needs a unidirectional channel, and a pipe is sufficient
for that.

This may simplify things when running the test on Hurd; see
https://gitlab.gnome.org/GNOME/glib/-/issues/3148#note_1874198.

Additionally, set `O_NONBLOCK` on the pipe since the test seems to
expect that partial writes will succeed and that writes to a full buffer
will fail rather than block.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3148
2023-11-02 17:47:53 +00:00
Philip Withnall
9e95163a3c docs: Move the GZlib*Compressor SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
38c4809719 docs: Move the GWin32RegistryKey SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
754047849c docs: Move the GWin32*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
7df150eaac docs: Move the GVolumeMonitor SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
ed247401bf docs: Move the GVolume SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
830db4e3c0 docs: Move the GUnixSocketAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
1390713af9 docs: Move the GUnix*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
68d3f6e53a docs: Move the GUnixCredentialsMessage SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
2be7859f10 docs: Move the GUnixConnection SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
78411d0975 docs: Move the GTlsDatabase SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
15ae12628d docs: Move the GTls*Connection SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
a463a29522 docs: Move the GTlsCertificate SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
45a815ae6d docs: Move the GSocketService SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
bf5c0cc2ba docs: Move the GSocketListener SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
1c34680833 docs: Move the GSocketAddressEnumerator SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
832bf0f90c docs: Move the GSimpleProxyResolver SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-02 16:30:23 +00:00
Philip Withnall
c16c639729 docs: Move the GSettings SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
8c3e0aa406 docs: Move the GRemoteActionGroup SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
bfa5d99305 docs: Move the GDBusObject SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
ac7cbb146e docs: Move the gtls SECTION
Move it to a separate Markdown page.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-11-02 16:30:23 +00:00
Philip Withnall
1fdbc06385 meson: Add missing dependencies for utility files for gdbus-codegen
Various parts of the build (such as `objectmanager-rst-gen`) depend on
running `gdbus-codegen` after it’s been built, but they currently only
encode a dependency to the main codegen Python file and not the
supporting files. This can cause `gdbus-codegen` to fail with an
`ImportError` if the build races so that `objectmanager-rst-gen` is
built before the codegen supporting files.

Example failure here: https://gitlab.gnome.org/pwithnall/glib/-/jobs/3266471
```
FAILED: gio/tests/gdbus-object-manager-example/objectmanager-rst-gen-org.gtk.GDBus.Example.ObjectManager.Animal.rst gio/tests/gdbus-object-manager-example/objectmanager-rst-gen-org.gtk.GDBus.Example.ObjectManager.Cat.rst
/usr/bin/python3 gio/gdbus-2.0/codegen/gdbus-codegen --interface-prefix org.gtk.GDBus.Example.ObjectManager. --generate-rst objectmanager-rst-gen --output-directory gio/tests/gdbus-object-manager-example ../gio/tests/gdbus-object-manager-example/gdbus-example-objectmanager.xml
Traceback (most recent call last):
  File "/builds/pwithnall/glib/_build/gio/gdbus-2.0/codegen/gdbus-codegen", line 53, in <module>
    from codegen import codegen_main
  File "/builds/pwithnall/glib/_build/gio/gdbus-2.0/codegen/codegen_main.py", line 29, in <module>
    from . import dbustypes
  File "/builds/pwithnall/glib/_build/gio/gdbus-2.0/codegen/dbustypes.py", line 22, in <module>
    from . import utils
ImportError: cannot import name 'utils' from 'codegen' (/builds/pwithnall/glib/_build/gio/gdbus-2.0/codegen/__init__.py)
```

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-02 14:26:31 +00:00
Zander Brown
d33752b5ce
gtask: Add g_task_return_prefixed_error()
An equivalent to g_propagate_prefixed_error, but for errors sent though
GTask, allowing tasks to easily provide extra context to callers.
2023-11-02 02:55:55 +00:00
Philip Withnall
d1eb463ce2 gio-tool: Remove unnecessary exit() call
All the calls to `usage()` are immediately followed by a `return` from
`main()` which sets an appropriate exit status.

Calling `exit()` early means that running `gio --help` returns exit
status 1, which is incorrect — it should (by convention) return 0.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-02 00:50:21 +00:00
Simon McVittie
76148fc6db tests: Don't assume that sh optimizes simple commands into exec
Depending on the operating system, /bin/sh might either be bash (for
example on Fedora or Arch) or dash (for example on Debian or Ubuntu)
or some other POSIX shell.

When bash is asked to run a simple command with no shell keywords or
metacharacters, like this one, it replaces itself with the program
via execve(), but dash does not have that optimization and treats it
like any other program invocation in a larger script: it will fork,
exec the program in the child, and wait for the child in the parent.

This seems like it conflicts with sleep_and_kill() assuming that it can
use the subprocess's process ID as the sleep(1) process ID. Specifically,
if it sends SIGKILL, it will go to the sh(1) process and not the sleep(1)
child, which could result in the sh(1) process being terminated and
its sleep(1) child being leaked.

To get the bash-like behaviour portably, explicitly use the exec builtin
to instruct the shell to replace itself with sleep(1), so that the
process ID previously used for the shell becomes the process ID of the
sleep process.

This appears to resolve an intermittent hang and test timeout on Debian
machines (especially slower ones), although I'm not 100% clear on the
mechanics of how it happens.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3157
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-11-01 17:56:48 +00:00
Marco Trevisan
d1fcb4f253 Merge branch 'gio-test-dependencies' into 'main'
tests: Fix dependency of test.gresource on test-generated.txt

See merge request GNOME/glib!3682
2023-11-01 14:55:25 +00:00
Philip Withnall
5ff31ae57d Merge branch 'zbrown/fix-4ce58df8' into 'main'
codegen: install codegen, not just the wrapper

Closes #3161

See merge request GNOME/glib!3670
2023-11-01 14:22:29 +00:00
Philip Withnall
a61888bceb tests: Fix dependency of test.gresource on test-generated.txt
`test-generated.txt` is listed in `test.gresource.xml`, so it needs to
be specified as a dependency in the `custom_target()` which uses
`test.gresource.xml`.

Fixes intermittent build failures like:
```
FAILED: gio/tests/test.gresource
/builds/GNOME/glib/_build/gio/glib-compile-resources --compiler=gcc --target=gio/tests/test.gresource --sourcedir=/builds/GNOME/glib/gio/tests --sourcedir=/builds/GNOME/glib/_build/gio/tests --internal ../gio/tests/test.gresource.xml
../gio/tests/test.gresource.xml: Failed to locate test-generated.txt in any source directory.
```

See !3671 and #3163.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-11-01 11:24:17 +00:00
Philip Withnall
9695ddfc70 Revert "gio/tests: Add test generated txt as the resources test dependency"
This reverts commit 0b9900e4e7.

The dependency was added in the wrong place: `test-generated.txt` is
needed when compiling `test.gresource`, not when compiling the test
which ultimately uses that gresource.

See !3671 and #3163.
2023-11-01 11:10:39 +00:00
Marco Trevisan (Treviño)
0b9900e4e7 gio/tests: Add test generated txt as the resources test dependency
This is required by the resources used in some tests, however we did not
depend on it so we had some random build failures:
  https://gitlab.gnome.org/3v1n0/glib/-/jobs/3253787
2023-10-27 18:41:51 +02:00
Zander Brown
e2433308c4
codegen: install codegen, not just the wrapper
Turns out, wasn't jhbuild this time

Fix: 4ce58df854
2023-10-27 04:21:58 +01:00
Alessandro Bono
168de73a73 meson: Improve PTRACE_O_EXITKILL presence check
The PTRACE_O_EXITKILL symbol in sys/ptrace.h is an enum member, not
a macro. The #ifdef check added to the GSubprocess test-case in
272ec5dbca will not detect it.

Use cc.has_header_symbol() to properly detect it. According to the
documentation: "Symbols here include function, variable, #define,
type definition, etc.".

Fixes: 272ec5dbca
Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3156
2023-10-26 10:54:34 +02:00
Philip Withnall
58cce38f37 Merge branch 'migrate-to-gi-docgen8' into 'main'
Switch to using gi-docgen for docs (batch 8)

See merge request GNOME/glib!3667
2023-10-25 14:28:43 +00:00
Philip Withnall
14b02d2631 docs: Move the GUnixFDList SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
2f662b6063 docs: Move the GTlsPassword SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
c015ecf0b7 docs: Move the GTlsInteraction SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
850878dfaa docs: Move the GTlsFileDatabase SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
74fbc75920 docs: Move the GThreadedSocketService SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
325e3a6f5b docs: Move the GThemedIcon SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
5817f52222 docs: Move the GTestDBus SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
ed875eb4c9 docs: Move the GTcpWrapperConnection SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
97886412e8 docs: Move the GTcpConnection SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
8d45e4c66b docs: Move the GSubprocessLauncher SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
1b94e0351f docs: Move the GSrvTarget SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
481c856e04 docs: Move the GSimpleActionGroup SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
838388cc68 docs: Move the GSimpleAction SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
b0b5ed8c34 docs: Move the GResource SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
bbb5479d5a docs: Move the GResolver SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
dfab5a3d29 docs: Move the GProxyResolver SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
7b32b5a9f0 docs: Move the GProxyAddressEnumerator SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
34fc02d5ac docs: Move the GProxy SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
06c2e33707 docs: Move the GNetworkService SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
822521215b docs: Move the GFilter*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
607eb851ba docs: Move the GFile*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
6c930587ad docs: Move the GDesktopAppInfo SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
47e58fb4c6 docs: Move the GDBusObjectProxy SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:16 +01:00
Philip Withnall
99e25e74ef docs: Move the GDBusObjectManagerClient SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:15 +01:00
Philip Withnall
264ebbbb2b docs: Move the GDBusMethodInvocation SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-25 15:10:15 +01:00
Michael Catanzaro
eadbdb439e Merge branch 'meson-version-bump' into 'main'
build: Bump Meson dependency to 1.2.0

See merge request GNOME/glib!3666
2023-10-25 13:23:53 +00:00
Alex Richardson
d0e03f0930 GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE
On CHERI-enabled systems we use uintptr_t as the underlying storage for
GType and therefore casting to gsize strips the upper bits from a pointer.
Fix this by casting via uintptr_t instead and introduce a new set of
macros to convert between GType and pointers.
2023-10-25 12:01:02 +01:00
Philip Withnall
7fd9045065 build: Drop pkgconfig.generate variables for builtin directories
Meson has added these automatically since 0.62. This fixes a Meson
warning.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-10-25 11:21:24 +01:00
Philip Withnall
4ce58df854 build: Change configure_file() to fs.copyfile() when copy is set
Meson has preferred `fs.copyfile()` since 0.62. This fixes a set of
Meson warnings.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-10-25 11:20:36 +01:00
Philip Withnall
8831f65a4d build: Drop a no-longer-needed Meson backwards compatibility check
See the previous commit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-10-24 17:00:24 +01:00
Philip Withnall
051c5336d4 docs: Move the GSocketConnection SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
43b4e7e097 docs: Move the GSocketClient SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
4f4ca75b4d docs: Move the GSocketAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
bd753fb87c docs: Move the GSocket SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
0b0179678a docs: Move the GSimplePermission SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
2fc8f47358 docs: Move the GSimpleIOStream SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
dcb382457d docs: Move the GSimpleAsyncResult SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
0d39a138c7 docs: Move the GSeekable SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
bea92c4882 docs: Move the GProxyAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
658bb30f06 docs: Move the GPropertyAction SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
ca02613987 docs: Move the GPowerProfileMonitor SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
d9e35c264b docs: Move the GPolllable*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
ed34ddc355 docs: Move the GPermission SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
723fc46223 docs: Move the GNotification SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
e044045ea4 docs: Move the GNetworkMonitor SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
ffff217a9d docs: Move the GMemory*Stream SECTIONs
Move them to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
22275f389b docs: Move the GLoadableIcon SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
226e9f16ea docs: Move the GDBusServer SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-24 10:58:56 +01:00
Philip Withnall
1c2207d9fb docs: Move the GOsxAppInfo SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
cf7fd070c8 docs: Move the GNativeSocketAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
f17cb81ce5 docs: Move the GMountOperation SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
47da98d7f7 docs: Move the GMenu SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
49a94280c1 docs: Move the GListStore SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
c834b843b9 docs: Move the GListModel SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
b45c554da5 docs: Move the GOutputStream SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
08a16e9143 docs: Move the GInputStream SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
a8b28e312f docs: Move the GInetSocketAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
55bf188365 docs: Move the GInetAddressMask SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
d424383877 docs: Move the GInetAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
ca505f34f2 docs: Move the GFileEnumerator SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
0576e82e9a docs: Move the GFileDescriptorBased SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
7e15d56013 docs: Move the GDebugControllerDBus SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 14:45:51 +01:00
Philip Withnall
9180d9234c docs: Move the GNetworkAddress SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
444d9be09c docs: Move the GMount SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
c5fb817b02 docs: Move the GMenuModel SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
5ce7e8c4f9 docs: Move the GMemoryMonitor SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
663f1a64f6 docs: Move the GFilenameCompleter SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
4f9b00907e docs: Move the GFileMonitor SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
c8abf62ff1 docs: Move the GFileIcon SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
ac6cc7e2b6 docs: Move the GEmblemedIcon SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
7418261f4e docs: Move the GEmblem SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
396b0af3ab docs: Move the GDrive SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
508e164056 docs: Move the GFileAttribute SECTION to Markdown
It needs to be in a separate page because there isn’t actually a
`GFileAttribute` type.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:43:27 +01:00
Philip Withnall
34bb869da1 docs: Move the GFileInfo SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
eefda8158e docs: Move the GIOStream SECTION
Move the contents to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
71ff617159 docs: Move the GDebugController SECTION
Move the contents to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
bd5219a0c0 docs: Move the GDtlsConnection SECTIONs
Move them to the struct docs, for all DTLS classes.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
92d8da4895 docs: Move the GInitable SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
824ae3f931 docs: Move the GIcon SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
9b4bcf1a44 docs: Move the GDBusMessage SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
72b44dce76 docs: Move the GDBusAddress SECTION
Move it to the struct docs, although again this is a little suspect
because there is actually no `GDBusAddress` struct/type.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
ef5ca0952b docs: Move the GContentType SECTION
This might not work, as `GContentType` isn’t actually a defined type
(content types are just strings). It would be a bit weird to create a
separate page for content types, though, as the functions handling them
are very method-like and feel like they should be grouped together like
methods of a class.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
b3b744aec6 docs: Move the GAsyncHelper SECTION
Move it to the struct docs (although this documentation is private
anyway).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
52248a9d69 docs: Move the GActionGroupExporter SECTION
Move it to the struct docs.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 13:18:13 +01:00
Philip Withnall
1d2507a7e5 Merge branch 'ebassi/gir' into 'main'
Generate introspection data

See merge request GNOME/glib!3636
2023-10-23 12:13:39 +00:00
Philip Withnall
635100b1f5 gio: Fix invalid doc links
Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3037
2023-10-23 11:26:53 +01:00
Emmanuele Bassi
fe32c3f5c5 Generate introspection data
Currently, the introspection data for GLib and its sub-libraries is
generated by gobject-introspection, to avoid the cyclic dependency
between the two projects.

Since gobject-introspection is generally available on installed systems,
we can check for its presence, and generate the introspection data
directly from GLib.

This does introduce a cyclic dependency, which is why it's possible to
build GLib without introspection, then build gobject-introspection, and
finally rebuild GLib.

By having introspection data available during the GLib build, we can do
things like generating documentation; validating newly added API; and
close the loop between adding new API and it becoming available to non-C
consumers of the C ABI (i.e. language bindings).
2023-10-23 11:26:53 +01:00
Emmanuele Bassi
6e771f0e84 docs: Add missing annotation separator 2023-10-23 10:25:31 +01:00
Emmanuele Bassi
c5a1e4f6c3 docs: Remove duplicate interface field 2023-10-23 10:25:31 +01:00
Emmanuele Bassi
d026534753 docs: Replace deprecated Virtual tag
Use the (virtual) symbol annotation.
2023-10-23 10:25:31 +01:00
Emmanuele Bassi
3013a0ef4a docs: Fix the annotation for GSubprocessLauncher 2023-10-23 10:25:31 +01:00
Emmanuele Bassi
d3d69cb8ba docs: Fix annotations for GSimpleProxyResolver
Drop "nullable" from the default-proxy property docblock, and correctly
separate the annotation from the return value's description.
2023-10-23 10:25:31 +01:00
Emmanuele Bassi
cfb11a8d63 docs: Avoid a bare "returns:"
Lines inside a docblock cannot begin with "returns:", as that is the tag
for the documentation of the return value.
2023-10-23 10:25:30 +01:00
Emmanuele Bassi
c86f469c1e Ignore autocleanups when generating introspection data 2023-10-23 10:25:30 +01:00
Philip Withnall
8629024243 tests: Skip appinfo/associations test if update-*-database not installed
If `update-desktop-database` or `update-mime-database` are not
installed, there are a few `GAppInfo` methods for modifying file
associations which will print a `g_warning()` when called. Something
like:
```
GLib-GIO-FATAL-WARNING: Failed to execute child process ‘update-desktop-database’ (No such file or directory)
```

(Example: https://gitlab.gnome.org/zamaudio/glib/-/jobs/3190053)

This will cause the appinfo/associations test to fail, as warnings are
fatal.

If that’s going to happen, skip the test. We can’t hard-depend on these
tools as they are external to GLib and only needed for a few operations.
Instead we have a soft runtime dependency on them; that should be
reflected in the tests.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3148
2023-10-22 23:34:00 +01:00
Damien Zammit
f25a9ca10c Initial test of Hurd CI - (run_tests.sh status ignored) 2023-10-18 23:33:04 +00:00
Philip Withnall
21c6ebf65b Merge branch 'wip/kabus/new-mtime' into 'main'
gio: add a file copy flag for default modification time

Closes #3140

See merge request GNOME/glib!3643
2023-10-18 14:45:49 +00:00
Aleksandr Mezin
b9c90c3a3e GApplicationCommandLine: add print[err]_literal()
GJS (and likely other language bindigs relying on introspection)
can't use `g_application_command_line_print()`/`_printerr()`.
2023-10-18 01:20:23 +03:00
Philip Withnall
130c2d6373 build: Fix -Dlibelf=disabled on Linux
Commit f6c40b1d fixed libelf detection on FreeBSD (where the library has
no pkg-config file and needs to be found via `find_library()`), but
broke `-Dlibelf=disabled` on Linux, as `get_option('libelf')` was no
longer checked.

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

Fixes: #3120
2023-10-17 15:04:19 +01:00
Matthias Clasen
2b22b43edd docs: Move the GDBusInterfaceSkeleton SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:20:20 +01:00
Matthias Clasen
8c7591addf docs: Move the GDBusInterface SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:20:17 +01:00
Matthias Clasen
2d1a9ed5a3 docs: Move the GDBusConnection SECTION
Move contents to struct docs.

Helps: #3037
2023-10-17 11:20:14 +01:00
Matthias Clasen
c0243f7eaa docs: Move the GDBusAuthObserver SECTION
Move contents to struct docs.

Helps: #3037
2023-10-17 11:20:12 +01:00
Matthias Clasen
985bc0fab3 docs: Move the GDBusActionGroup SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:20:10 +01:00
Matthias Clasen
f39640b759 docs: Move the GDataOutputStream SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:20:08 +01:00
Matthias Clasen
8371b893a2 docs: Move the GDataInputStream SECTION
Not much to move.

Helps: #3037
2023-10-17 11:20:06 +01:00
Matthias Clasen
081cc5af25 docs: Move the GDatagramBased SECTION
Move contents to struct docs.

Helps: #3037
2023-10-17 11:20:03 +01:00
Matthias Clasen
926f56c7c7 docs: Move the GCredentials SECTION
Move contents to struct docs.

Helps: #3037
2023-10-17 11:20:00 +01:00
Matthias Clasen
dad6ec9651 docs: Move the GConverterOutputStream SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:19:57 +01:00
Matthias Clasen
b70b164ba6 docs: Move the GConverterInputStream SECTION
Move content to struct docs.

Helps: #3037
2023-10-17 11:19:55 +01:00
Matthias Clasen
174073722e docs: Move the GConverter SECTION
Move the content to the struct docs.

Helps: #3037
2023-10-17 11:19:52 +01:00
Matthias Clasen
747b81409d docs: Move the GCharsetConverter SECTION
Not much to move here.

Helps: #3037
2023-10-17 11:19:49 +01:00
Matthias Clasen
e267653eab docs: Move the GCancellable SECTION
Move the contents into the struct docs.

Helps: #3037
2023-10-17 11:19:46 +01:00
Matthias Clasen
3d5d3bceea docs: Move the GBytesIcon SECTION
Move the contents into the struct docs.

Helps: #3037
2023-10-17 11:19:44 +01:00
Matthias Clasen
93788dfb07 docs: Move the GAppInfoMonitor SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 11:19:41 +01:00
Matthias Clasen
bf9bf0b0cc docs: Move the GBufferedOutputStream SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 11:19:38 +01:00
Matthias Clasen
08990badb6 docs: Move the GBufferedInputStream SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 11:19:27 +01:00
Matthias Clasen
f7b5e3b37e docs: Move the GAsyncResult SECTION
Move the content to the struct docs.

Helps: #3037
2023-10-17 10:57:22 +01:00
Matthias Clasen
331c137ee1 docs: Move the GAsyncInitable SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:57:14 +01:00
Matthias Clasen
840cfd1ab7 docs: Move the GApplicationCommandline SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:57:10 +01:00
Matthias Clasen
75de7e8628 docs: Move the GApplication SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:57:06 +01:00
Matthias Clasen
61d869467f docs: Move the GAppInfo SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:57:01 +01:00
Matthias Clasen
5ab04d05dc docs: Move the GActionMap SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:56:54 +01:00
Matthias Clasen
524610ab6e docs: Move the GActionGroup SECTION
Move the contents to the struct docs.

Helps: #3037
2023-10-17 10:56:50 +01:00
Matthias Clasen
34bdf32b38 docs: Move the GAction SECTION
Move it to the struct docs.

Helps: #3037
2023-10-17 10:56:42 +01:00
Philip Withnall
fa165204ae Merge branch 'fix-warnings-clang-windows' into 'main'
Fix warnings with Clang on Windows and enable --Werror in CI

See merge request GNOME/glib!3635
2023-10-16 21:29:09 +00:00
Khalid Abu Shawarib
c70b8a7500 gio-tool: add a "default-modified-time" option
As with `default-permissions` option, this overrides the `perserve`
option.
2023-10-16 18:12:49 +03:00
Khalid Abu Shawarib
db01c11540 gio: add tests for default modification time flag
Add test cases for the G_FILE_COPY_TARGET_DEFAULT_MODIFIED_TIME
file copy flag.
2023-10-16 18:12:49 +03:00
Khalid Abu Shawarib
8d91430279 gio: add a file copy flag for default modification time
Add a default modification timestamp flag to g_file_copy so that it
doesn't copy the modification time from the source file as it does by
default. Similarly to G_FILE_COPY_TARGET_DEFAULT_PERMS, this flag
overrides the G_FILE_COPY_ALL_METADATA flag.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3140
2023-10-16 18:12:49 +03:00
Emmanuele Bassi
ccc36a2fde build: Simplify MIPS test check
Make the condition more readable, and easy to extend if necessary.

Follow-up to: !3640
2023-10-16 13:11:27 +01:00
Philip Withnall
0a6e19feee Merge branch 'test5-no-mips' into 'main'
GIO/tests: skip test_resources_binary on MIPS platforms

See merge request GNOME/glib!3640
2023-10-16 12:05:06 +00:00
YunQiang Su
8105916998 GIO/tests: skip test_resources_binary on MIPS platform
There are some flavors of MIPS ABIs, such like r6 vs legacy,
nan2008 vs nan1985 etc.

The `cc -r` may not produce the correct elf binaries.
So let's skip this test for MIPS.
2023-10-16 07:20:21 -04:00
Philip Withnall
481839c190 Merge branch 'win32-unicode-api' into 'main'
Windows: Compile with the UNICODE / _UNICODE macros

See merge request GNOME/glib!3623
2023-10-16 08:58:41 +00:00
Khalid Abu Shawarib
dc0af83486 Use g_task_return in task threads 2023-10-12 12:27:28 +00:00
Luca Bacci
8264b13737 tests/cxx: Do not assume that NULL is a pointer type starting with C++11
Many toolchain did not change the definition of NULL to avoid introducing
breaking changes in existing codebases. For example, on Windows NULL is
0 (int) regardless of the C++ standard in use.

Fixes the following warnings on CLang when compiling for Windows:

  ../glib/glib/tests/cxx.cpp:539:34: warning: missing sentinel in function call [-Wsentinel]
    g_test_init (&argc, &argv, NULL);
                                   ^
                                   , nullptr
  ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here
  void    g_test_init                     (int            *argc,
          ^

  ../glib/gio/tests/cxx.cpp:62:34: warning: missing sentinel in function call [-Wsentinel]
    g_test_init (&argc, &argv, NULL);
                                   ^
                                   , nullptr
  ../glib/glib/gtestutils.h:298:9: note: function has been explicitly marked sentinel here
  void    g_test_init                     (int            *argc,
          ^
2023-10-12 11:45:03 +02:00
Luca Bacci
985cab7737 gio/gregistrysettingsbackend.c: Use unsigned data type for bitfields that are only one-bit wide
Fixes the following warnings on CLang:

  ../glib/gio/gregistrysettingsbackend.c:1503:32: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
            child_item->readable = TRUE;
                                 ^ ~~~~
  ../glib/gio/gregistrysettingsbackend.c:1567:28: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
        child_item->readable = TRUE;
                             ^ ~~~~
2023-10-12 11:44:37 +02:00
Luca Bacci
337912072a Windows: Compile with the UNICODE / _UNICODE macros
It's the recommended way to build C/C++ projects on Windows, see
https://learn.microsoft.com/en-us/windows/win32/intl/conventions-for-function-prototypes
2023-10-12 11:32:03 +02:00
Sergey Bugaev
2ec660b2ea Stop using enums in bitfields
The C standard does not specify whether the underlying type of an enum
is signed or unsigned, and until C23 there was no way to control this
explicitly. GCC appears to make enums unsigned unless there is a
negative value among cases of the enum, in which case it becomes signed.
MSCV appears to make enums signed by default.

A bitfield of an enum type (which is not specificied in the C standard
either) behaves as if it was an instance of a numeric type with a
reduced value range. Specifically, a 'signed int val : 2;' bitfield will
have the possible values of -2, -1, 0, and 1, with the usual wraparound
behavior for the values that don't fit (although this too is
implementation-defined).

This causes the following issue, if we have:

typedef enum
{
  G_ZERO,
  G_ONE,
  G_TWO
} GFoo;

struct _GBar
{
  GFoo foo : 2;
};

and then assign bar.foo = G_TWO and read it back, it will have the
expected value of 2 (aka G_TWO) on GCC, but a value of -2 (not matching
any of the enum variants) on MSVC.

There does not seem to be any way to influence signedness of an enum
prior to C23, nor is there a 'unsigned GFoo foo : 2;' syntax. The only
remaining options seems to be never using enums in bitfields, which is
what this change implements.

This corresponds to https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6467
in GTK.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-11 15:05:57 +03:00
Alex Richardson
9abbf2eec2 glib-compile-resources: ensure alignment is at least sizeof(void *)
This triggered a warning from the CHERI compiler since the struct contains
a `void *` but `__attribute__((aligned(8))` reduced alignment to less than
the `void *` alignment (which is 16 for Arm Morello).

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
2023-10-10 08:44:58 -07:00
Philip Withnall
57b41b8fec Merge branch 'g-once-enter-ptr' into 'main'
gthread: introduce g_once_init_{enter,leave}_pointer

See merge request GNOME/glib!3577
2023-10-04 22:22:54 +00:00
Alex Richardson
5ecd3cbe52 gobject: use g_once_init_enter_pointer for GType initializers
GType is either an integer or a pointer, so we have to use the _pointer
version here to support architectures such as Morello.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3578
2023-10-04 14:50:54 +01:00
Alex Richardson
a1dfecf11f Use g_once_init_{enter,leave}_pointer where appropriate
This should not result in any functional changes, but will eventually
allow glib to be functional on CHERI-enabled systems such as Morello.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
2023-10-04 13:57:16 +01:00
Philip Withnall
e00ca9967f tests: Drop unnecessary include from gsubprocess-testprog.c
It’s not actually needed on any platform, and causes compilation
problems on platforms where it’s not available.

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

Fixes: #3111
2023-10-04 10:06:37 +01:00
Florian Müllner
794b18df34 gdesktopappinfo: Do not search Comment field
The Comment field provides a user-visible description of the app,
which usually contains generic words ("and", "or", "not", "is", ...)
that add noise when used for search.

It made some sense to match against the field as a fallback for
Keywords, before that key was well established. However that key
has been around for years now, so hopefully every app where additional
terms are helpful uses it by now.

With that, the downside of added noise outweighs the benefit, so
it's time to stop matching on comments.
2023-10-03 14:05:27 +02:00
Philip Withnall
2f1f97d58d Merge branch 'wip/paveloom/tcp-connection-leak' into 'main'
Make sure the `GTask` is freed on a graceful disconnect

See merge request GNOME/glib!3607
2023-10-03 10:41:16 +00:00
Philip Withnall
c1528778e6 Merge branch 'fix_3116' into 'main'
glocalfileinfo: Preserve microseconds for access/modify times

Closes #3116

See merge request GNOME/glib!3587
2023-10-03 10:00:55 +00:00
Lukáš Tyrychtr
0e8e941e95 glocalfileinfo: Preserve microseconds for access/modify times
When setting the file time using utimensat, don't ignore
microseconds for access/modify times. By doing that, they're preserved
when using g_file_info_set_modification_date_time and then setting the file's
attributes from it.

Fixes #3116
2023-10-03 09:32:44 +01:00
Nelson Benítez León
40f567aa2a GDesktopAppInfo: prioritize match_type over match_category when searching apps
Commit 9e2ad88455 improved app search results by allowing to differentiate
their match_type: prefix match or substring match; while giving more priority
to prefix matches over substring matches, but only when they are in the same
match_category[1].

This was a step forward but, as outlined in #3082, still not enough to get
most relevant results first to the user, because apparently (and for the
specific case of desktop app searching) a prefix match in a lower category
is more relevant to the user than a substring match in a higher category.

So that's what this commit implements, i.e. it makes sure prefix matches
are still preferred over substring matches but this time not only when
in the same category but also across different categories.

[1] Match category is the Desktop file key where the match happened.
    They are shown below from top to lesser priority.
      DESKTOP_KEY_Name
      DESKTOP_KEY_Exec
      DESKTOP_KEY_Keywords
      DESKTOP_KEY_GenericName
      DESKTOP_KEY_X_GNOME_FullName
      DESKTOP_KEY_Comment

Fixes #3082
2023-10-03 09:10:21 +01:00
Nelson Benítez León
3c22e2745c test: improvements for GAppInfo test
· Add a usage output that is printed when called with no argument
   or with '--help' argument. This is helpful as it avoids having
   to read the source code to know how to run the different options.

 · Adds new '--should-show-only' option to 'search' command, to
   better mimick the gnome-shell app search, by not returning
   apps with NoDisplay=true.

  Example for running a desktop app search with the new option from
  inside the GLib build dir:
    $ gio/tests/apps search --should-show-only settings
2023-10-03 09:10:21 +01:00
Emmanuele Bassi
1cd0dfa55b Merge branch '3107-use-portal' into 'main'
gio: Rename GTK_USE_PORTAL to GIO_USE_PORTALS

Closes #3107

See merge request GNOME/glib!3602
2023-10-02 17:27:36 +00:00
Philip Withnall
86fdb4c7bf Merge branch 'ebassi/issue-3130' into 'main'
Check for empty property name in GPropertyAction

Closes #3130

See merge request GNOME/glib!3599
2023-10-02 17:09:55 +00:00
Arjan Molenaar
e9f0259e5d tests: Add a test for initialising GPropertyAction with no name
Helps: #3130
2023-10-02 17:17:24 +01:00
Emmanuele Bassi
3a2af81ced Check for empty property name in GPropertyAction
Make sure to fail consistently in case people created a GPropertyAction
with g_object_new() without passing a property name.

Bindings that construct objects with g_object_new() have no idea if a
property is mandatory.

See: #3130
2023-10-02 17:17:24 +01:00
Philip Withnall
525508be0d gpropertyaction: Split dispose/finalize
This avoids a critical warning from trying to disconnect a signal
handler from a `NULL` object if `paction->object` is `NULL` for whatever
reason (see: the following commit).

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

Helps: #3130
2023-10-02 17:17:24 +01:00
Philip Withnall
5bc6c2035a gio: Rename GTK_USE_PORTAL to GIO_USE_PORTALS
The `GTK_USE_PORTAL` environment variable has started to be misused by
users, which is causing deployment issues (such as portal services
themselves ending up being forced to use portals, which is never going
to work).

Try and sidestep users’ broken configurations by renaming the
environment variable, and also separating it from the old GTK
environment variable, since the GLib one affects a lot more processes.
This environment variable is meant to be used for
debugging and development, and never in production.

GTK already renamed their environment variable in
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4829, so keeping the
`GTK_USE_PORTAL` name in GLib doesn’t make sense anyway.

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

Fixes: #3107
2023-10-02 15:00:23 +01:00
Alessandro Bono
272ec5dbca tests/gsubprocess: Don't rely on PTRACE_O_EXITKILL presence
The PTRACE_O_EXITKILL symbol was introduced in glibc 2.23. CentOS7
has glibc 2.17. Use the symbol only if it is defined.
2023-09-19 12:37:23 +02:00
Pavel Sobolev
cabc494073
Make sure the GTask is freed on a graceful disconnect
This fixes the memory leak in the case the connection has been
successfully closed by the peer.
2023-09-14 15:42:24 +03:00
Philip Withnall
82c764ce2e gthreadedresolver: Fix race between source callbacks and finalize
I had thought that because `g_source_destroy()` was called for the two
sources (cancel and timeout) in the `GTask` finalize function for a
threaded resolver operation, that it would be fine to use a plain
pointer in the source callbacks to point to the `GTask`.

That turns out to not be true: because the source callbacks are executed
in the GLib worker thread, and the `GTask` can be finalized in another
thread, it’s possible for a source callback (e.g. `cancelled_cb()`) to
be scheduled in the worker thread, then for the `GTask` to be finalized,
and then the source callback to continue execution and find itself
doing a use-after-free.

Fix that by using a weak ref to the `GTask` in the source callbacks,
rather than a plain pointer.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3105
2023-09-11 16:02:15 +01:00
Benoit Pierre
6380303779 meson: fix gnetworking.h install tag 2023-09-01 22:24:39 +02:00
Philip Withnall
137956e700 Merge branch '3061-dbus-name-crash' into 'main'
gdbusmessage: Validate required headers have the right type

Closes #3061

See merge request GNOME/glib!3539
2023-08-31 10:14:03 +00:00
Philip Withnall
ed03b1f3f6 gresourcefile: Fix crash if called with a badly escaped URI
Return an invalid `GFile` instead, as is the custom for VFS functions.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3090
2023-08-29 11:22:43 +01:00
Emmanuele Bassi
5f8af01b8b Generate RST anchors for methods, signals, and properties
Don't rely on the titles.
2023-08-28 16:59:32 +01:00
Emmanuele Bassi
5f33ae8901 Generate missing docs for out arguments
The reStructuredText generator is missing the documentation blocks for
out arguments.
2023-08-28 16:59:32 +01:00
Philip Withnall
9f6b77d835 gdbusconnection: Add some assertions about required message fields
The fields are fully validated in `validate_headers()` in
`gdbusmessage.c` now, so the connection code should be able to rely on
the required ones being non-`NULL`.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Helps: #3061
2023-08-28 11:11:37 +01:00
Philip Withnall
eae5c49085 gdbusconnection: Combine two identical variables
`object_path` and `path` were doing exactly the same thing here.

This introduces no functional changes.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-28 11:11:37 +01:00
Philip Withnall
7cca4b1590 gdbusmessage: Validate required headers have the right type
We already validated that the required headers for each type of D-Bus
message were present. However, we didn’t validate that they contained a
variant of the right type. This could lead to functions like
`g_dbus_message_get_path()` returning `NULL` unexpectedly.

This failure could only be hit when using GDBus in peer-to-peer mode, or
with a D-Bus server which didn’t validate the headers itself. The
reference D-Bus server does validate the headers, and doesn’t forward
invalid messages to clients.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3061
2023-08-28 11:11:37 +01:00
Philip Withnall
943972facf Merge branch 'wip/JCWasmx86/gresource-schema' into 'main'
gio: Add gresource.dtd

See merge request GNOME/glib!3540
2023-08-17 14:03:39 +00:00
JCWasmx86
0b4a9db4a7 gio: Add dtdsdir pointing to the directory of gresource.xml
This allows third party projects to look up the location of installed
DTDs without having to hard-code it.
2023-08-17 14:26:34 +01:00
JCWasmx86
f10bb13314 gio: Add gresource.dtd
This allows linting of .gresource.xml files e.g. in the editor.
2023-08-17 14:25:53 +01:00
Michael Catanzaro
77a56b58ed Merge branch 'o-nonblock-more' into 'main'
glib-unix: Accept O_CLOEXEC as well as FD_CLOEXEC in g_unix_open_pipe()

See merge request GNOME/glib!3538
2023-08-16 18:13:13 +00:00
Philip Withnall
07c4b6c68e glib: Pass O_CLOEXEC rather than FD_CLOEXEC to g_unix_open_pipe()
See the previous commit.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-16 14:31:40 +01:00
Philip Withnall
954b15218c Merge branch 'mcatanzaro/l10n-time' into 'main'
gsettingsschema: fix l10n=time attribute

Closes #2575

See merge request GNOME/glib!2422
2023-08-16 13:24:18 +00:00
André
9a6ca0ef75
gdbus-codegen: preserve relative indentation in doc comments
This commit also changes the generators for rst, xml and dockbook
to preserve indentation.

Closes #3032
2023-08-14 23:46:09 -03:00
Philip Withnall
c00d7999b1 Merge branch 'th/use-getservbyname-r' into 'main'
gnetworkaddress: use reentrant getservbyname_r() if available

See merge request GNOME/glib!3526
2023-08-14 09:24:51 +00:00
Thomas Haller
f738c7f3db gio: use reentrant getservbyname_r() if available 2023-08-14 09:32:43 +01:00
Thomas Haller
8aa889dbf1 gio: include missing dependency in "gio/gnetworkingprivate.h"
Otherwise, GResolver typedef is unknown.
2023-08-14 09:32:43 +01:00
Thomas Haller
adb3763592 tests: add case for getservbyname() during g_network_address_parse()
Add test cases that result in lookup of the port via
getservbyname().

As the result depends on "/etc/services", it's not reliably the same on
every system. It requires a workaround.
2023-08-14 09:32:43 +01:00
Philip Withnall
065069191c tests: Disable use of ptrace() in tests on BSD and macOS
Commit cf55c31170 added a new test which
uses `ptrace()` to check some `GSubprocess` behaviour. FreeBSD uses
different symbol names for ptrace symbols, and we haven’t tested whether
the test works (and reproduces the failure) on FreeBSD, so skip the test
for now.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-14 09:27:07 +01:00
Philip Withnall
73d2658191 Merge branch 'thread-safe-menus_get_interface' into 'main'
gmenuexporter: synchronization in org_gtk_Menus_get_interface.

Closes #3051

See merge request GNOME/glib!3529
2023-08-13 14:21:15 +00:00
Philip Withnall
3ee019c036 Merge branch 'gio-tool-info-translator-comments' into 'main'
gio-tool-info: Move translator comments so they’re visible

See merge request GNOME/glib!3528
2023-08-13 14:18:58 +00:00
André
5fb89dd597
gmenuexporter: synchronization in org_gtk_Menus_get_interface.
Protects the mutation inside org_gtk_Menus_get_interface with
g_once_init_{enter,leave}.

Fixes #3051.
2023-08-13 01:21:49 -03:00
Philip Withnall
65e7a10d2a Merge branch 'macos_ci' into 'main'
interim solution for macOS CI

See merge request GNOME/glib!3503
2023-08-12 22:52:57 +00:00
Philip Withnall
faee7d0858 gio-tool-info: Move translator comments so they’re visible
The tooling won’t pick them up unless they’re directly above the gettext
calls.

Spotted by Piotr Drąg in
ec03755355 (note_1808152).

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
2023-08-12 20:01:36 +01:00
Jonas Ådahl
cf55c31170 gio/tests: Add test case for exit status when being ptraced
The test case will fail with the

    g_assert_false (g_subprocess_get_successful (proc));

assert failing. Without the fix, it'll hit sometimes, but rather
unreliably. When running `meson test --repeat 100`, it'll reproduce
anywhere between the first or much later, but mostly before the 20th
iteration on my system.

Helps: #3071
2023-08-12 19:30:00 +01:00
René de Hesselle
439204ed7d Re-enable macOS CI on a new self-hosted runner
Allow two more tests to fail on macOS for the time being:
https://gitlab.gnome.org/GNOME/glib/-/issues/3069
https://gitlab.gnome.org/GNOME/glib/-/issues/3070
2023-08-11 19:33:19 +02:00
Michael Catanzaro
306d4567d2 Replace setlocale() with uselocale() in GSettings l10n tests
It's not safe to use setlocale() to mutate the locale in a threaded
program. Lots of other tests still do this, and I'm not putting in the
effort to fix them comprehensively in the absense of actual failures on
CI, but I figured it'd be good to fix the tests that I was touching.
2023-08-03 09:45:58 -05:00
Michael Catanzaro
736000e49e Remove setenv() use from GSettings l10n tests
This definitely does not do anything on Linux. I bet it's not needed on
other platforms, either. It's unsafe and may crash; there is no safe way
to mutate the environment in threaded programs.
2023-08-03 09:16:27 -05:00
Michael Catanzaro
92de7298c8 Add test for l10n="time" gschema attribute
This is a copy of the existing test_l10n, modified to use LC_TIME
instead of LC_MESSAGES. It's not safe as each call to g_setenv() or
setlocale() could cause the test to crash; there is no safe way to
change a threaded process's environment, and a threaded process's locale
can only be safely changed using uselocale(), not with setlocale().

The calls to g_setenv() are definitely not needed on Linux. I wonder
whether removing these will break the test on other platforms?

The calls to setlocale() should be replaced by a dance of
uselocale() -> duplocale() -> newlocale() -> uselocale() on Linux. But
this is not portable and this is a cross-platform test. We would have to
make the test platform-specific to do this. macOS and at least FreeBSD
provide these functions via xlocale.h, but this isn't portable.
2023-08-03 09:16:26 -05:00
Michael Catanzaro
34e4c4af77 gsettingsschema: fix l10n=time attribute
It's supposed to be possible to translate settings values using LC_TIME
rather than LC_MESSAGES to determine which translation to use, but
Sebastian Keller noticed that it's not working properly. I've
implemented his proposed solution, which is to actually temporarily
change LC_MESSAGES to match LC_TIME for just as long as necessary to
force gettext to use the desired message catalog.

Fixes #2575
2023-08-03 09:10:58 -05:00
Federico Gallo Herosa
89be3d357d
Fix typos
Fix typo in gio/gappinfo (duplicated word)
Fix typo in gio/gtlsdatabase.c (duplicated word)
Fix typo in gio/gapplication.c (duplicated word, previous words rearranged to improve readability)
Fix typo in glib/tests/gvariant.c (duplicated word)
Fix typo in glib/win_iconv.c (duplicated word)
Fix typo in gio/gschema.dtd (meaning, missing letter)
Fix typo in gio/gdbusintrospection.c (duplicated word)
Fix typo in gio/gdbusintrospection.c (duplicated word).
2023-08-01 15:33:21 -03:00
Philip Withnall
02bc1382b2 gnetworkmonitor: Expand guidelines for metered data use
Clarify how much is too much.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-07-29 15:22:15 +03:00
Philip Withnall
39864716d6 Merge branch 'fix_3050' into 'main'
Strip query sections from file: URIs

Closes #3050

See merge request GNOME/glib!3502
2023-07-28 12:52:36 +00:00
Lukáš Tyrychtr
b504cc0841 gfile: Strip query sections from file: URIs
According to https://url.spec.whatwg.org/#file-state
a file URI can have a fragment and query string, so just ignore them
and don't raise an invalid URI error.

Fixes: #3050
2023-07-28 15:04:49 +03:00
Eric van Gyzen
6b4b4cd889 Fix build race between gio subdirs and gversionmacros.h
I made the kqueue failure 100% reliable with `samu -j1` on FreeBSD,
and therefore confirmed this fixes that problem.  Issue #2929 is
an identical failure on win32, so I assume this fixes that, too,
but I haven't confirmed.

Fixes: #2929
2023-07-25 20:28:20 -05:00
Philip Withnall
9b80774ca7 Merge branch 'fileinfo-filepath' into 'main'
gfileinfo: add file_path methods for language bindings

See merge request GNOME/glib!3461
2023-07-22 05:27:12 +00:00
Jason Francis
04b683c34f gfileinfo: add file_path methods for language bindings
Including some tests by Philip Withnall.
2023-07-21 21:24:50 +01:00
Philip Withnall
b4a6343a5c Merge branch 'mcatanzaro/closure-audit' into 'main'
Audit and fix incorrect use of (closure) in glib

See merge request GNOME/glib!3287
2023-07-21 19:20:07 +00:00
Michael Catanzaro
12e48719af Fix scope annotation on g_file_move_async()
Currently the callback is invalid after the call to g_file_move_async(),
before g_file_move_finish() is called. That is no bueno.
2023-07-21 19:04:37 +01:00
Michael Catanzaro
5d738ddcfe Audit and fix incorrect use of (closure) in glib
Following Emmanuele's instructions for use of introspection annotations:

https://www.bassi.io/articles/2023/02/20/bindable-api-2023/

I have audited all uses of the (closure) annotation in glib and
determined that only a handful are correct. This commit changes almost
all of our use of (closure) annotations to conform to Emmanuele's rules.
2023-07-21 19:03:57 +01:00
Michael Catanzaro
a552bf5694 Merge branch 'revert3356' into 'main'
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"

See merge request GNOME/glib!3504
2023-07-20 15:20:58 +00:00
Philip Withnall
2b391227e6 tests: Fix pkg-config test for multiarch binaries on multiarch systems
The test was passing fine when `bindir` was equal to `multiarch_bindir`,
but not when they differ.

For example, on a Debian system, `gio-querymodules` is installed to
`/usr/lib/x86_64-linux-gnu/glib-2.0/gio-querymodules` rather than
`/usr/bin/gio-querymodules` as it is on (say) Fedora.

This was causing the pkg-config tests to fail on Debian.

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

Fixes: #3045
2023-07-20 13:30:34 +01:00
Harald van Dijk
6e29fbec2d
Revert "build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags"
This reverts commit 004f48f4fc.

Per the discussion on #3356, this change was prompted by a
misunderstanding of ldflags/link_args, and it resulted in various other
packages using glib no longer getting symbols exported. This commit
restores the glib 2.76 behaviour.
2023-07-18 18:26:49 +01:00
Corey Berla
a1a00a3071 gdbus-codegen: Error on invalid dbus types
Introduce slightly modified (dbus specific) versions of
variant_is_signature and variant_type_string_scan in order to fail
early on bad type strings.
2023-07-12 15:33:22 -07:00