Commit Graph

30853 Commits

Author SHA1 Message Date
Philip Withnall
c5e196f0c0
tests: Add more G_RESOURCE_ERROR_NOT_FOUND unit tests
Add coverage for handling of this situation for more API entry points.

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

Helps: #3465
2024-09-09 17:38:55 +01:00
Philip Withnall
7ed386a10b
tests: Add test for decompression failure in GResource
This was one of the code paths not currently covered by unit tests, so
let’s add a test for it.

This tests what happens when a structurally valid GResource file, but
with a corrupt entry for a compressed file, is loaded.

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

Helps: #3465
2024-09-09 17:37:52 +01:00
Philip Withnall
f1c639c7dc
tests: Re-indent block in resources test
It was slightly over-indented.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-09-09 17:36:24 +01:00
Philip Withnall
8b13f8854a
gresource: Remove unnecessary errors from g_resources_lookup_data()
This is slightly more involved than the previous couple of commits, as
`g_resource_lookup_data()` can return two errors: one if the resource is
not found, and another if decompression fails.

We want to avoid allocating the `G_RESOURCE_ERROR_NOT_FOUND` error, as
`g_resources_lookup_data()` will be looping through multiple
`GResource`s trying to find the given path, and all but one of them will
return `G_RESOURCE_ERROR_NOT_FOUND`. For a large application, this can
amount to a lot of `GError`s allocated and then immediately freed on
startup.

Use the split from the previous commit to replace the call to
`g_resource_lookup_data()` with its two constituent parts. We can then
handle errors from them separately, ignoring the `NOT_FOUND` error from
`do_lookup()`, while paying attention to any errors from
`resource_to_bytes()`.

This should result in no functional difference to
`g_resources_lookup_data()`, but fewer allocations overall.

Spotted by Christian Hergert.

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

Helps: #3465
2024-09-09 17:36:18 +01:00
Emmanuele Bassi
0630b8145d Collation keys are not encoded in UTF-8
The value returned when generating a collation key is an opaque binary
blob that is only meant to be used for byte-wise comparisons; we should
not imply it's a nul-terminated, UTF-8 string.

This is especially true for language bindings that try to convert C
strings returned by GLib into UTF-8 encoded strings.

Ideally, the collation functions should return a byte array, but the
closest thing we have is the OS native encoding type that we use for
paths and environment variables.

See: https://github.com/gtk-rs/gtk-rs-core/issues/1504
2024-09-09 16:58:38 +01:00
Philip Withnall
2ec62d638d Merge branch 'main' into 'main'
Update British English translation (main)

See merge request GNOME/glib!4254
2024-09-09 10:24:49 +00:00
Philip Withnall
e2dba45bda Merge branch 'main' into 'main'
Update Bulgarian translation

See merge request GNOME/glib!4253
2024-09-09 10:18:39 +00:00
Philip Withnall
f4f8a7b8fd Merge branch 'input-stream-doc' into 'main'
gio: Fix overindented docstring of buffer argument

See merge request GNOME/glib!4252
2024-09-09 10:17:11 +00:00
Philip Withnall
963e271da0 Merge branch 'urbalazs-main-patch-41523' into 'main'
Update Hungarian translation

See merge request GNOME/glib!4257
2024-09-09 10:04:37 +00:00
Balázs Úr
23dcc59290 Update Hungarian translation 2024-09-09 06:50:13 +00:00
Aurimas Černius
69901d7cd1 Updated Lihuanian translation 2024-09-08 19:32:11 +00:00
Bruce Cowan
3135592423 Update British English translation 2024-09-08 19:13:22 +00:00
twlvnn kraftwerk
d1a5ac8205 Update Bulgarian translation
Proof-read via D-L.
2024-09-08 18:25:59 +02:00
Guido Günther
10910cc896 gio: Improve linking for g_io_input_stream_read_all*
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-09-08 10:19:07 +02:00
Guido Günther
cdd807aaa8 gio: Fix overindented docstring of buffer argument
Otherwise it'll be rendered as verbatim block

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2024-09-08 10:18:44 +02:00
Michael Catanzaro
8810cf7a24 Merge branch 'gerror-improvements-dir' into 'main'
dir: Avoid some allocations

See merge request GNOME/glib!4248
2024-09-06 15:59:17 +00:00
Matthias Clasen
5d986fd42a dir: Avoid some allocations
If no error is passed, we don't need to do charset conversions.
2024-09-06 10:49:31 -04:00
Philip Withnall
68a9b9d3ca
gresource: Split g_resource_lookup_data() into two internal helpers
It’s now a call to `do_lookup()` followed by a call to
`resource_to_bytes()`. This makes no functional changes, but will be
useful in the following commit.

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

Helps: #3465
2024-09-05 12:14:15 +01:00
Philip Withnall
87af31604b
gresource: Remove unnecessary errors from g_resources_get_info()
As with the previous commit:

The error here can only ever be `G_RESOURCE_ERROR_NOT_FOUND`, which
`g_resources_get_info()` immediately frees. So let’s avoid allocating
the error in the first place.

Spotted by Christian Hergert.

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

Helps: #3465
2024-09-05 12:09:21 +01:00
Philip Withnall
77ba62c832
gresource: Remove unnecessary errors from g_resources_open_stream()
The error here can only ever be `G_RESOURCE_ERROR_NOT_FOUND`, which
`g_resources_open_stream()` immediately frees. So let’s avoid allocating
the error in the first place.

Spotted by Christian Hergert.

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

Helps: #3465
2024-09-05 12:03:18 +01:00
Philip Withnall
a839737fc8
gresource: Factor out common error setting code
This makes it a bit easier to make sure all the translatable strings are
kept in sync. It introduces no functional changes.

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

Helps: #3465
2024-09-05 12:01:14 +01:00
Philip Withnall
ced5c6d960 Merge branch 'main' into 'main'
Update Galician translations for main

See merge request GNOME/glib!4239
2024-09-04 12:07:14 +00:00
Fran Diéguez
1360d47138 Update gl.po 2024-09-04 09:56:45 +00:00
Philip Withnall
2c7624fafb Merge branch 'translation/main/fr_FR' into 'main'
Update French translation

See merge request GNOME/glib!4237
2024-09-03 15:07:47 +00:00
Vincent Chatelain
d6acea5de5 Update french translation 2024-09-03 11:06:25 +00:00
Philip Withnall
85286f4f57 Merge branch 'cherry-pick-4229-4234-translations-main' into 'main'
Cherry pick Polish and Brazilian Portuguese translations from glib-2-82 to main

See merge request GNOME/glib!4236
2024-09-03 09:36:52 +00:00
Rafael Fontenelle
1cf1b2f04b Update Brazilian Portuguese translation 2024-09-03 10:06:34 +01:00
Piotr Drąg
1df8df0cce Update Polish translation 2024-09-03 10:06:34 +01:00
Philip Withnall
396ffaa9ba Merge branch 'update_uk1' into 'main'
Update Ukrainian translation

See merge request GNOME/glib!4235
2024-09-03 08:54:47 +00:00
Yuri Chornoivan
485002bd2e Update Ukrainian translation 2024-09-02 21:55:28 +03:00
Philip Withnall
8fdb8c44c3 Merge branch 'mcatanzaro/gspawn-close' into 'main'
gspawn: close child_err_report_fd before exiting on error

See merge request GNOME/glib!4227
2024-09-01 17:43:48 +00:00
Philip Withnall
f505d3df98 Merge branch 'cs-update' into 'main'
Update Czech translation

See merge request GNOME/glib!4225
2024-09-01 17:33:12 +00:00
Philip Withnall
007879405c Merge branch 'patch-pt-1' into 'main'
Update Portuguese translation

See merge request GNOME/glib!4226
2024-09-01 17:27:41 +00:00
Hugo Carvalho
a0fa016c64 Update Portuguese translation 2024-09-01 18:17:42 +01:00
Michael Catanzaro
ddeb4a211b gspawn: close child_err_report_fd before exiting on error
When the child process is going to exit on error after fork() but before
exec(), let's close the child_err_report_fd. The practical value of this
is to placate valgrind --track-fds=yes.
2024-08-30 11:42:12 -05:00
AsciiWolf
18f8588d4f Update Czech translation 2024-08-30 12:18:33 +02:00
Philip Withnall
58844c7919 Merge branch 'catalan' into 'main'
Update Catalan translation

See merge request GNOME/glib!4224
2024-08-30 08:00:29 +00:00
Philip Withnall
cc4673d791 Merge branch '20240830-update-ko' into 'main'
Update Korean translation

See merge request GNOME/glib!4223
2024-08-30 07:59:30 +00:00
Jordi Mas
cb7b650205 Update Catalan translation 2024-08-30 06:09:59 +02:00
Changwoo Ryu
4205d1b9f4 Update Korean translation 2024-08-30 09:00:00 +09:00
Emmanuele Bassi
14ed56fde8 Merge branch '3460-readme-link' into 'main'
docs: Clarify link in README.md

Closes #3460

See merge request GNOME/glib!4222
2024-08-29 08:35:46 +00:00
Philip Withnall
0df6e9d684
docs: Clarify link in README.md
The new merge request link only works when logged in to a GitLab
account, unfortunately. Make that clear in the readme.

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

Fixes: #3460
2024-08-29 08:58:36 +01:00
Philip Withnall
6c41e77913 Merge branch 'bash' into 'main'
tests: Run lint tests with detected bash

See merge request GNOME/glib!4219
2024-08-28 09:49:35 +00:00
Michael Catanzaro
42802d32de Merge branch '3456-mountinfo-files-in-tests' into 'main'
tests: Test against a sample mtab file in unix-mounts for getmntent()

Closes #3456

See merge request GNOME/glib!4217
2024-08-27 18:46:02 +00:00
Benjamin Gilbert
ca77a1625d tests: Run lint tests with detected bash
When we invoke a shell script directly, the system selects a bash binary
that might be different from the one detected by find_program('bash').
Explicitly use the one detected by Meson, matching the behavior of our
other test() invocations on shell scripts.

Fixes test failure on Windows in GitHub Actions CI:

    stdout: 1: UNKNOWN: Windows Subsystem for Linux has no installed distributions.
    stdout: 2: UNKNOWN: Distributions can be installed by visiting the Microsoft Store:
    stdout: 3: UNKNOWN: https://aka.ms/wslstore

Found-by: Benoit Pierre <benoit.pierre@gmail.com>
Fixes: d7601f7eed ("Incorporate some lint checks into `meson test`")
2024-08-27 11:40:18 -07:00
Philip Withnall
43940d88f4 Merge branch 'persian-l10n' into 'main'
Persian l10n

See merge request GNOME/glib!4218
2024-08-27 15:26:55 +00:00
Danial Behzadi
687b8fac1b Persian l10n 2024-08-27 15:26:55 +00:00
Philip Withnall
2135a2419d Merge branch 'wip/chergert/g_ref_string_equal' into 'main'
refstring: add GEqualFunc for ref-counted strings

See merge request GNOME/glib!4196
2024-08-27 13:51:06 +00:00
Philip Withnall
27c02a0be4
tests: Test against a sample mtab file in unix-mounts for getmntent()
The test in `unix-mounts` to see whether `g_unix_mounts_get_from_file()`
can parse an example file was working fine when GLib is built with
libmount, but not when built without it (and hence typically using
`getmntent()`).

This is because libmount supports mountinfo files (like
`/proc/self/mountinfo`), but `getmntent()` only supports mount files
(like `/proc/mounts`). The test was written only with the former.

So, change the test to use mount files when GLib is built without
libmount support.

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

Fixes: #3456
2024-08-27 12:13:35 +01:00
Christian Hergert
6ad7bcfc36 refstring: add GEqualFunc for ref-counted strings
This is the same as g_str_equal() except that it will first check the
string length for equality before dereferencing string contents.
2024-08-27 11:36:21 +01:00