Commit Graph

27346 Commits

Author SHA1 Message Date
Philip Withnall
1461c29301 Merge branch 'win32-network-monitor-error' into 'main'
gwin32networkmonitor: Fix returning address of local variable

See merge request GNOME/glib!3425
2023-05-09 12:27:05 +00:00
Philip Withnall
e59e8ebf31 gwin32networkmonitor: Fix returning address of local variable
Something has changed recently which causes this error to now be emitted
when building on Windows msys2-mingw32:
```
../gio/gwin32networkmonitor.c: In function 'win_network_monitor_get_ip_info':
../gio/gwin32networkmonitor.c:92:15: error: storing the address of local variable 'prefix' in '*dest' [-Werror=dangling-pointer=]
   92 |         *dest = (guint8 *) &prefix.Prefix.Ipv4.sin_addr;
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

If `IP_ADDRESS_PREFIX` is defined as a scalar rather than a pointer,
that could explain the problem.

Change the function to always operate on a pointer to avoid any
potential such issues.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-09 12:52:42 +01:00
Patrick Griffis
de2ff26454 Merge branch '116-utf8-docs' into 'main'
docs: Document high-level UTF-8 requirements for GLib

Closes #116

See merge request GNOME/glib!3414
2023-05-02 19:20:30 +00:00
Patrick Griffis
8725d6ef4c Merge branch 'wiki-links' into 'main'
docs: Update various broken/redirected links and fix list formatting

See merge request GNOME/glib!3419
2023-05-02 19:18:46 +00:00
Philip Withnall
ff315e8407 docs: Fix list formatting in supported-platforms.md
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-02 14:34:21 +01:00
Philip Withnall
377e8a2d9e docs: Update various broken/redirected links
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-02 14:26:52 +01:00
Luca Bacci
cad4f85be9 Merge branch 'codeowners-lb90' into 'main'
docs: Add lb90 as a Windows maintainer

See merge request GNOME/glib!3418
2023-05-02 12:13:35 +00:00
Philip Withnall
85af9b73c9 tests: Zero the rlimit in standalone tests which are expected to abort
This should hopefully stop the kernel spending a lot of memory and disk
bandwidth creating coredumps for them unnecessarily, which slows down
the rest of the tests and generally wastes resources.

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

Fixes: #2939
2023-05-02 12:53:13 +01:00
Peter Eisenmann
e25a4f995f use g_timeout_add_seconds_once()
Use the newly added g_timeout_add_seconds_once() where appropriate.
2023-05-02 13:42:54 +02:00
Peter Eisenmann
467b917719 gtimeout: use helper for seconds_full variant
Use timeout_add_full() helper to deduplicate code
2023-05-02 13:42:54 +02:00
Peter Eisenmann
3abf23b2a7 add g_timeout_add_seconds_once
Add a new call combing behaviors of g_timeout_add_seconds and
g_timeout_add_once.
2023-05-02 13:42:54 +02:00
Philip Withnall
5803a24826 docs: Add lb90 as a Windows maintainer
They’ve been actively doing good work.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-02 11:19:31 +01:00
Philip Withnall
e8c1bdbf4f tests: Add copyright/licensing header to assert-msg-test
This is put together through git archaeology:
```
git log -- glib/tests/assert-msg-test.c tests/assert-msg-test.c
```

The following commits were too trivial to have meaningful copyright:
 - 8e59d8602c
 - 44c004c84e
 - 207b8cb8a5
 - a1bee97d4f

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

Helps: #1415
2023-05-02 11:03:49 +01:00
Philip Withnall
a1bee97d4f tests: Reformat assert-msg-test.c to follow coding style
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-05-02 11:03:00 +01:00
Philip Withnall
0e941418d1 docs: Document high-level UTF-8 requirements for GLib
I’ve finally found the right place in the docs to put this stuff.

This doesn’t auto-link this section from every string in the GLib
documentation, but I think that at this point (with gtk-doc in
maintenance mode, and gi-docgen not fully applied to GLib) I don’t think
we can do any better. The perfect is the enemy of the good, and having
this stuff documented somewhere means that someone can link to it from
multiple places in future *somehow*.

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

Fixes: #116
2023-05-02 10:41:50 +01:00
Philip Withnall
1f044e1cbd Merge branch '2855-test-socket-rename' into 'main'
Rename confusing socket test filenames

Closes #2855

See merge request GNOME/glib!3415
2023-05-02 09:38:25 +00:00
Philip Withnall
c86fde7e02 Merge branch 'registry-translation' into 'main'
gregistrysettingsbackend: Remove translatable pspec nick/blurb

See merge request GNOME/glib!3407
2023-05-02 09:28:07 +00:00
Philip Withnall
c0d80b956b Merge branch 'gtestutils-docs-section-hashes' into 'main'
gtestutils: Fix section marker in documentation

See merge request GNOME/glib!3416
2023-05-02 08:31:44 +00:00
Arnaud Rebillout
d6faa002a5 gtestutils: Fix section marker in documentation
Apparently 3 hashes is too many, and as a result this line is not
displayed properly in the HTML documentation. 2 hashes seems to be
just right, as can be seen with:

  $ git grep '^ \* ##' | wc -l
  65
  $ git grep '^ \* ###' | wc -l
  1
2023-05-02 13:21:17 +07:00
Mike Salmela
dea11643a9 Rename confusing socket test filenames
The gio/tests/socket-client.c doesn't use GSocketClient, which makes the
filename confusing. What the file actually tests is the GSocket. Rename
it to socket-testclient.c
The corresponding GSocket server test file naming doesn't conflict with other
class names, but rename it to socket-testserver.c for consistency.

Closes #2855
2023-04-29 21:48:03 +03:00
Patrick Griffis
8a67f0c5c2 Merge branch 'old-txt-docs' into 'main'
docs: Update/Drop txt documents from docs directory

See merge request GNOME/glib!3408
2023-04-29 03:31:05 +00:00
Patrick Griffis
f009d8e368 Merge branch '2289-setuid-docs' into 'main'
docs: Document that GIO should not be used in privileged processes

Closes #2289

See merge request GNOME/glib!3413
2023-04-29 03:28:10 +00:00
Patrick Griffis
0dced93503 Merge branch '2958-thread-pool-docs' into 'main'
gthreadpool: Document that g_thread_pool_new() will spawn a thread

Closes #2958

See merge request GNOME/glib!3412
2023-04-29 03:26:52 +00:00
Andre Klapper
12c35bc2f3 DOAP: GNOME Discourse is a developer-forum, not a mailing-list 2023-04-28 16:18:43 +02:00
Philip Withnall
f42e04d247 docs: Document that GIO should not be used in privileged processes
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2289
2023-04-28 11:11:03 +01:00
Philip Withnall
e43b2452b9 docs: Add high-level documentation about malloc failure
While I’m here.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-28 11:01:25 +01:00
Philip Withnall
3b9fc71644 docs: Mention that calls after fork() must be async-signal-safe
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2958
2023-04-28 11:00:33 +01:00
Philip Withnall
e7398198c5 gthreadpool: Document that g_thread_pool_new() will spawn a thread
Otherwise it might look like it would only start spawning threads when
jobs are enqueued.

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

Helps: #2958
2023-04-28 10:52:22 +01:00
Philip Withnall
9b8369852b Merge branch 'html-doc-flag' into 'main'
meson: wrap html documentation generation with gtk_doc option

See merge request GNOME/glib!3399
2023-04-28 01:09:04 +00:00
James Knight
0fa17ec3c7 meson: wrap html documentation generation with gtk_doc option
By default, if a host environment has the `rst2html5` application
available, builds will automatically perform some HTML documentation
generation from the documentation's glib reference content (e.g.
creating `gvariant-specification-1.0.html`). The creation of this
documentation is not required for all use cases.

This commit tweaks the building of the HTML-based GLIB specification
document to be guarded by `gtk_doc`.

Signed-off-by: James Knight <james.d.knight@live.com>
2023-04-27 20:23:30 -04:00
Philip Withnall
dda319c7db docs: Port docs/macros.txt to Markdown and update it
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-28 00:07:12 +01:00
Philip Withnall
dc95b911f3 docs: Drop outdated docs/debugging.txt
Most of the document was about traps, which have not existed since
commit 58cdf0b474, 10 years ago.

The rest of the document was about `GOBJECT_DEBUG`, and that information
would be more easily findable in the full GObject documentation — so
move it there and update it a bit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 23:56:59 +01:00
Philip Withnall
b38ddf5087 gregistrysettingsbackend: Remove translatable pspec nick/blurb
The file was not listed in `POTFILES.in` (as pointed out by Piotr Drąg
in
fee0a7679a (note_1722885)),
so either it needs to be added to `POTFILES.in` or the translatable
strings need to be removed.

Recent prior art from GTK shows that there’s actually no longer any
point in setting the nick/blurb as no tools use them (and if they did,
it would result in a rubbish user experience). See
https://gitlab.gnome.org/GNOME/gtk/-/issues/4904.

Hence, drop the strings entirely.

See #2991 for tracking this across all of GIO.

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

Helps: #2991
2023-04-27 23:33:47 +01:00
Patrick Griffis
473063383d Merge branch 'thread-pool-docs-fix' into 'main'
gthreadpool: Clarify that item_free_func is not normally called

See merge request GNOME/glib!3406
2023-04-27 17:31:58 +00:00
Michael Catanzaro
91af1c180a Merge branch 'threaded-resolver-assertion-fix' into 'main'
gthreadedresolver: Remove some incorrect assertions

See merge request GNOME/glib!3405
2023-04-27 15:56:45 +00:00
Philip Withnall
7adca698d8 gthreadpool: Clarify that item_free_func is not normally called
If you’re only quickly looking at the API signature, it looks like
`item_free_func` will be called for all items enqueued to the thread
pool.

As it happens, it’s actually only called for the items which are still
enqueued when the thread pool is destroyed. The user’s `GFunc` is
responsible for freeing items which are successfully dequeued and
processed during the lifetime of the thread pool.

That’s a bit of a gotcha, so document it more explicitly.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 15:48:07 +01:00
Philip Withnall
865cbe3714 gthreadedresolver: Remove some incorrect assertions
If a timeout executes on the same main context iteration as completion
or cancellation of a resolver lookup, `has_returned` will be set
multiple times. That’s fine (the `GCond` will be notified multiple
times, but that’s fine). It was triggering an incorrect assertion, so
remove that.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 14:41:26 +01:00
Philip Withnall
7922d3200c Merge branch 'resolver-thread-pool' into 'main'
gthreadedresolver: Switch to using a separate thread pool and support timeouts

See merge request GNOME/glib!3397
2023-04-27 12:46:53 +00:00
Philip Withnall
6c1cbdff63 Merge branch 'task-tracking' into 'main'
gtask: Track pending GTasks if G_ENABLE_DEBUG is defined

See merge request GNOME/glib!3404
2023-04-27 12:46:37 +00:00
Philip Withnall
d231ce0364 Merge branch '2951-reinstate-fileinfo-criticals' into 'main'
Revert "gfileinfo: Temporarily downgrade missing attribute criticals to debugs"

Closes #2951

See merge request GNOME/glib!3379
2023-04-27 11:27:43 +00:00
Philip Withnall
e73c5ed5e1 gresolver: Set timeout on default resolver to 30s
The default for the class is still to have no timeout, but it seems more
practical for most use cases to set a non-infinite timeout on the
default resolver.

If applications have a more specific use case, they can change the
timeout or replace the default resolver.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3397#note_1731387

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
1c4384aec5 tests: Fix cancellation source handling in resolver manual test
If `async_cancel()` was invoked, it would remove the IO watch source,
which would cause the `g_source_remove()` call at the end of `main()` to
warn about an unknown source ID.

Fix that by handling the source as a pointer instead of a handle.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
2ac66413a4 tests: Support --timeout argument in resolver manual test
For testing timeouts.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
ef08e8dd81 gthreadedresolver: Document design of GThreadedResolver
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
c3209f1d84 gthreadedresolver: Re-add cancellation and add timeout support
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
7b18e6205a gthreadedresolver: Switch to using a separate thread pool
Rather than running lookups in the global shared thread pool belonging
to `GTask`, run them in a private thread pool.

This is needed because the global shared thread pool is constrained to
only 14 threads. If there are 14 ongoing calls to
`g_task_run_in_thread()` from any library/code in the process, and then
one of them asks to do a DNS lookup, the lookup will block forever.

Under certain circumstances, particularly where there are a couple of
deep chains of dependent tasks running with `g_task_run_in_thread()`,
this can livelock the program.

Since `GResolver` is likely to be called as a frequent leaf call in
certain workloads, and in particular there are likely to be several
lookups requested at the same time, it makes sense to move resolver
lookups to a private thread pool.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
84074ce757 gthreadedresolver: Centralise GTask return handling in worker threads
This will make it simpler to handle timeouts and cancellation in future,
as all the logic for working out whether to return will all be in one
place, and all the lookup-specific code is now implemented in simple
sync functions which don’t need to care about `GTask`s.

This commit introduces no functional changes, it’s just setting up for
the following commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
694394207c gthreadedresolver: Combine closure structs for different lookup types
This introduces no functional changes, but will make a reorganisation of
the code simpler in the next commit.

Rather than dealing with three different closure types, this changes the
code to deal with one which is a tagged union of the three.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
6e499764e4 gthreadedresolver: Port to G_DECLARE_FINAL_TYPE
The class and its header are not public, so this should not be an API or
ABI break.

This just simplifies the code a little and allows for easy extension of
the object’s private data in future commits.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-04-27 12:23:25 +01:00
Philip Withnall
bf92bae481 gresolver: Add GResolver:timeout property
Without a timeout, some lookup requests can go on forever, typically due
to bugs in underlying systems.

This can have particularly significant effects on the Happy Eyeballs
algorithm in `GSocketClient`, which relies on multiple name lookups as
its first step.

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

Helps: #2866
2023-04-27 12:23:25 +01:00