Commit Graph

29468 Commits

Author SHA1 Message Date
Philip Withnall
33c10e8711 docs: Move the windows SECTION
Move it to a separate file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
3532e3ca1c docs: Move the warnings SECTION
Move it to a separate file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
877b0affb6 docs: Move the numerical SECTION
Move it to a separate Markdown file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
3957b47e59 docs: Move the checkedmath SECTION
Move it to a separate Markdown file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
b93e35dc17 docs: Move the datalist and dataset SECTIONs
Move them to a separate page as they don’t really have a ‘class’ struct
each to hang docs off.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
790131687c docs: Move the unix SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
244721baf9 docs: Move the misc_utils SECTION
Move it to a separate page, with a massive great list of all the misc
utils. Not a great documentation page, but equivalent to what we had
before, and it can be improved in future.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
74de872bb9 docs: Move the spawn SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
6dca578f9d docs: Move the memory SECTION
Move it to a separate page.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
cbbd06fee7 docs: Drop the SECTION for tracing
All this API is internal to GLib, so the section was never actually
exposed in the public API documentation. Keep the documentation, just
don’t tag it as a SECTION.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
25a4205d9d docs: Move the ghostutils SECTION
Sadly, this is about hostnames rather than ghosts. 😞

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
425731f766 docs: Move the string_utils SECTION
Move it to a mega separate file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
cf52727f03 docs: Move the shell SECTION
Move it to a separate file.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
214853d6df docs: Move the GVariant SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
229b76a388 docs: Move the version SECTION
Move it to a separate documentation file, since most of what’s covered
isn’t introspectable.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
194db3f096 docs: Move the GVariantType SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
359c1034e0 docs: Move the GUuid SECTION
Move it to a separate page as there’s no public struct to hang the
docs off.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
be783fdc2a docs: Move the GUri SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
43588fcdd9 docs: Move the grand SECTION
Move it to a separate page so the difference between `g_rand_*()` and
`g_random_*()` can be explained.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
8179688c07 docs: Move the GTrashStack SECTION
Move it to the struct docs.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
1625c24d58 docs: Drop the hooks SECTION
It was one paragraph which mentioned `GHookList` and `GHook`, both of
which have their own adequate documentation sections.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
158ec5be34 docs: Move the gfileutils SECTION
Move it to a separate page so more detail can be provided about all the
groups of API.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
c850d25d67 docs: Move the gatomic SECTION
Move it to a standalone page.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
ac91b8f4a2 docs: Move the base64 SECTION
Move it to a separate file as there is no struct to hang the docs off.

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

Helps: #3037
2023-11-28 13:52:05 +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
552f62a059 docs: Move the threads-deprecated SECTION
Move it to a separate page so an overview of the deprecated threading
API can be given.

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

Helps: #3037
2023-11-28 13:52:05 +00:00
Philip Withnall
f8122da6c9 Merge branch 'migrate-to-gi-docgen13' into 'main'
gwin32: Un-hide symbols when building GIR

See merge request GNOME/glib!3723
2023-11-28 13:49:42 +00:00
Philip Withnall
eb189bcec0 ci: Make the Alpine CI name more consistent
The image uses `alpine:latest`, so let’s drop the ‘stable’ moniker. This
also makes the container registry ID match the Dockerfile name.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-28 11:51:30 +00:00
Philip Withnall
8f6f382940 Merge branch 'test-trap-subprocess-envp' into 'main'
gtestutils: Add g_test_trap_subprocess_with_envp() for testing envs

See merge request GNOME/glib!3721
2023-11-28 11:49:11 +00:00
Philip Withnall
e4fe837bae Merge branch 'migrate-to-gi-docgen12' into 'main'
gdir, gstrvbuilder: Add refcounting support and a boxed type

See merge request GNOME/glib!3722
2023-11-28 11:47:11 +00:00
Philip Withnall
40ca773fa5 Merge branch 'stop-spamming' into 'main'
gspawn: Stop spewing debug messages

See merge request GNOME/glib!3732
2023-11-28 11:44:48 +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
Matthias Clasen
f79c53f953 gspawn: Stop spewing debug messages
My GTK testlogs are filled with

GLib-DEBUG: g_unix_open_pipe() called with FD_CLOEXEC; please migrate to using O_CLOEXEC instead

Lets take the hint, and migrate to using O_CLOEXEC.
2023-11-27 21:03:49 -05:00
Artur S0
20400bc503 Update Russian translation 2023-11-27 16:26:55 +00:00
Philip Withnall
cdc37f051c Merge branch 'wip/pwithnall/fix-bsd-string-test' into 'main'
tests: Fix string test failure on BSDs

See merge request GNOME/glib!3731
2023-11-27 16:24:25 +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
5070f3fe80 Merge branch '3186-gpt-sniff-buffer' into 'main'
glocalfileinfo: Increase size of the content-type sniff buffer to 16KiB

Closes #3186

See merge request GNOME/glib!3730
2023-11-27 14:14:40 +00:00
Philip Withnall
2c4be841d7 tests: Fix string test failure on BSDs
As with `test-printf`, the `vasprintf()` placeholder checks on BSDs
(including macOS) are less strict than on Linux (glibc), so the expected
critical message is not seen.

Change the test to not expect it on BSDs.

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

Helps: #3187
2023-11-27 13:26:51 +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
062f1a888e Merge branch '3187-vasprintf-checks' into 'main'
gprintf: Fix invalid size allocation in `g_vasprintf()`

Closes #3187

See merge request GNOME/glib!3729
2023-11-27 13:09:16 +00:00
Philip Withnall
707ae4bd79 gstring: Add critical warning to g_string_append_vprintf()
It was previously possible for this to silently fail, which isn’t great
for program correctness. Instead, raise a critical warning so the
programmer knows to either validate their Unicode inputs, or fix their
format placeholders.

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

Helps: #3187
2023-11-27 12:20:50 +00:00
Philip Withnall
c56bc6d8d9 gstrfuncs: Add missing annotations to g_strdup_vprintf()
It’s possible for the function to fail for the same reasons
`g_vasprintf()` would fail.

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

Helps: #3187
2023-11-27 12:20:50 +00:00
Philip Withnall
3c6052f318 gprintf: Fix invalid size allocation in g_vasprintf()
As per the previous commit, it’s possible for
`g_printf_string_upper_bound()` to return an error. We need to catch and
handle that error in `g_vasprintf()` to avoid it trying to write to a
`NULL` string allocation and crashing.

So, call `g_vsnprintf()` directly instead of calling
`g_printf_string_upper_bound()`, so that the error case can be handled.

There was already a test for some of this behaviour
(`test_vasprintf_invalid_format_placeholder()`). Because it tested an
invalid format string, the `_g_vsprintf()` call bailed out before
checking whether the buffer it had been passed was `NULL`. The new test
has a valid format string, but an invalid arg.

When running the tests locally, I have disabled the `USE_SYSTEM_PRINTF`
and `HAVE_VASPRINTF` code paths in `g_vasprintf()`.

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

Fixes: #3187
2023-11-27 12:20:12 +00:00
Philip Withnall
e2cd0962c2 gmessages: Document error case for g_printf_string_upper_bound()
Spotted in https://gitlab.gnome.org/GNOME/glib/-/issues/3187.

In an ideal world, this API would have been designed with an error
return path to begin with — perhaps by returning a `GError` or a
`gssize`. We can’t change the API now, though, which leads to this
slightly awkward “0 indicates an error or success” pattern.

I think that’s justified in this case because:
 - This API does not see much use.
 - Format strings tend to be literals, and almost always are
   non-zero-length, so it tends to be statically possible to determine
   that the function won’t return zero on success.
 - If callers do need to differentiate the two zero return value cases,
   they can just call `g_vsnprintf()` directly instead.

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

Helps: #3187
2023-11-27 12:20:06 +00:00
Philip Withnall
40081f9b62 Merge branch 'collate-crash' into 'main'
collate: Don't segfault on bad input

Closes #3185

See merge request GNOME/glib!3725
2023-11-26 22:41:26 +00:00
Matthias Clasen
81ec27c33b collate: Don't segfault on bad input 2023-11-26 22:41:26 +00:00
Philip Withnall
e67a36c479 Merge branch 'wip/pwithnall/fix-ftruncate64' into 'main'
tests: Fix fileutils build on FreeBSD and macOS

See merge request GNOME/glib!3726
2023-11-26 22:23:36 +00:00
Philip Withnall
a8df4183e4 tests: Fix fileutils build on FreeBSD and macOS
The test needs to call `ftruncate64()` (not `ftruncate()`) to guarantee
it’s using the 64-bit version on Linux, but this doesn’t exist on other
platforms.

Test to see if it exists and, if not, skip the test.

Fixes commit cf5e371c67, and fixes CI
failures like https://gitlab.gnome.org/GNOME/glib/-/pipelines/602930.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-11-26 22:10:22 +00:00
Philip Withnall
50d432c77b gwin32: Un-hide symbols when building GIR
The win32-specific APIs in GLib are only defined when building for
Windows. Unfortunately, this means they can not show up in `GLib-2.0.gir`
if it’s build on Linux (which is what mostly happens).

Consequently, that means they’re not present in the API documentation,
which is a bit of a problem.

Make the symbols in the header available on other platforms
(particularly Linux) if building with `g-ir-scanner` (but not
otherwise). This means the win32 symbols show up in `GLib-2.0.gir` and
hence in the documentation.

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

Helps: #3037
2023-11-23 16:18:47 +00:00