Commit Graph

32320 Commits

Author SHA1 Message Date
Philip Withnall
d4c53bb916 ci: Temporarily disable macos-arm64 CI as it has issues creating temp files
As per !4855, tests are failing with messages like:
```
Can't open temp file: Failed to create file '/Volumes/RAM/.F8JEE3': No such file or directory
```
(quotes changed to work around
https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/-/issues/12)

See https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/2091

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-16 13:37:06 +01:00
Philip Withnall
d54816de37 Merge branch 'main' into 'main'
Update British English translation (main)

See merge request GNOME/glib!4849
2025-10-05 20:13:57 +00:00
Philip Withnall
0e7e3830b0 Merge branch 'patch-1' into 'main'
GFile entity tags: Update HTTP reference link to point to RFC9110 ETags description

See merge request GNOME/glib!4847
2025-10-02 11:06:41 +00:00
FeRD (Frank Dana)
9e049b9008 Entity tags: Link to RFC9110 for HTTP ETag reference
The RFC9110 explanation of HTTP ETags is far superior to
the disjoint ramblings found in (now-obsoleted) RFC2616,
and serves as a much better reference for comparison
with GFile entiity tags. Also, link directly to relevant section.
2025-10-02 11:06:41 +00:00
Bruce Cowan
e523944425 Update British English translation 2025-10-02 11:35:57 +01:00
Philip Withnall
2de1882943 Merge branch 'clang64-strfuncs-test' into 'main'
tests: Use integer widths rather than maximum values for strfuncs check

See merge request GNOME/glib!4843
2025-10-01 10:30:08 +00:00
Philip Withnall
131f5d8ffe Merge branch 'tracerpid-abort' into 'main'
gmessages: Check /proc/self/status for TracerPid != 0 before sending SIGTRAP

Closes #3790

See merge request GNOME/glib!4845
2025-10-01 09:12:44 +00:00
Swagtoy
a184d5d375 gmessages: Check /proc/self/status for TracerPid != 0 before sending SIGTRAP
Also might exist on FreeBSD or other systems which support /proc, so this codepath will run on these systems but won't fail since it checks if the file exists anyway
2025-10-01 09:12:44 +00:00
Philip Withnall
a34384976c tests: Fix some uninitialised variable warnings in clang64
```
../glib/tests/gpoll.c:565:52: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  565 |         s += send (opp_sockets[j], (const char *) &t, 1, 0) == 1 ? 1 : 0;
      |                                                    ^
../glib/tests/gpoll.c:513:52: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  513 |         s += send (opp_sockets[j], (const char *) &t, 1, 0) == 1 ? 1 : 0;
      |                                                    ^
../glib/tests/gpoll.c:457:52: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  457 |         s += send (opp_sockets[j], (const char *) &t, 1, 0) == 1 ? 1 : 0;
      |                                                    ^
../glib/tests/gpoll.c:406:52: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  406 |         s += send (opp_sockets[j], (const char *) &t, 1, 0) == 1 ? 1 : 0;
      |                                                    ^
../glib/tests/gpoll.c:356:59: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  356 |       s = send (opp_sockets[activatable], (const char *) &t, 1, 0);
      |                                                           ^
../glib/tests/gpoll.c:303:59: error: variable 't' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
  303 |       s = send (opp_sockets[activatable], (const char *) &t, 1, 0);
      |                                                           ^
6 errors generated.
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-30 23:31:29 +01:00
Philip Withnall
648141d8ff tests: Use integer widths rather than maximum values for strfuncs check
The maximum values can expand to something containing `__extension__` on
some platforms (like msys2-clang64), and the preprocessor can’t
understand that.

So, use the type widths rather than their maximum values instead. This
is equivalent, but definitely won’t expand to `__extension__`.

Should hopefully fix the following compiler error on msys2-clang64:
```
../glib/tests/strfuncs.c:667:5: error: function-like macro '__extension__' is not defined
  667 | #if G_MAXSIZE > G_MAXUINT
      |     ^
glib/glibconfig.h:89:19: note: expanded from macro 'G_MAXSIZE'
   89 | #define G_MAXSIZE       G_MAXUINT64
      |                         ^
../glib/gtypes.h:107:21: note: expanded from macro 'G_MAXUINT64'
  107 | #define G_MAXUINT64     G_GUINT64_CONSTANT(0xffffffffffffffff)
      |                         ^
glib/glibconfig.h:70:34: note: expanded from macro 'G_GUINT64_CONSTANT'
   70 | #define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
      |                                  ^
../glib/gmacros.h:62:26: note: expanded from macro 'G_GNUC_EXTENSION'
   62 | #define G_GNUC_EXTENSION __extension__
      |                          ^
1 error generated.
```

(as seen in https://gitlab.gnome.org/GNOME/glib/-/jobs/5608465)

Co-authored by: Luca Bacci <luca.bacci982@gmail.com>
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-30 23:17:18 +01:00
Philip Withnall
7019af92e5 Merge branch 'forwardport-4839-romanian-translation-main' into 'main'
Forward-port !4839 “Update Romanian translation” to main

See merge request GNOME/glib!4844
2025-09-30 16:07:51 +00:00
Philip Withnall
5b88afa767 Merge branch 'keep-suffix-name-when-trashing' into 'main'
GLocalFile: keep suffix name when trashing

See merge request GNOME/glib!4838
2025-09-30 16:00:01 +00:00
Philip Withnall
bfc4dee85f Merge branch 'pattern_uint' into 'main'
gpattern: Support patterns/strings longer than G_MAXUINT

See merge request GNOME/glib!4840
2025-09-30 15:53:13 +00:00
Antonio Marin
804b2204bd Update Romanian translation 2025-09-30 16:31:12 +01:00
Philip Withnall
b7d8d88931 Merge branch 'file-equal-docs' into 'main'
gfile: Expand documentation around file equality

See merge request GNOME/glib!4815
2025-09-30 15:29:59 +00:00
Michael Catanzaro
c9a0bc1b25 Merge branch '3745-fix-union-offsets' into 'main'
girnode: Fix computation of union member offsets

Closes #3745

See merge request GNOME/glib!4841
2025-09-29 18:27:20 -05:00
Philip Chimento
d632c3ab3d girnode: Fix computation of union member offsets
Regression from 501ff95c. Union member offsets are always 0, but we need
to mark them as 'COMPUTED' otherwise they are not written to the
typelib, which results in gi_field_info_get_offset() returning 0xffff.

Since gi_field_info_get/set_field() cannot check that the offset is
within the size of the struct or union, that means poking into invalid
memory addresses.

This also adds some basic tests for GIFieldInfo which would have caught
this bug.

Closes: #3745
2025-09-29 10:50:25 -07:00
Tobias Stoeckmann
b9eee47954 gpattern: Support arbitrary amount of jokers
If a pattern with more than 4 GB question marks is parsed, then the
counter would overflow. Turn to a size_t for arbitrary amount on 64 bit
systems.
2025-09-28 17:07:12 +02:00
Tobias Stoeckmann
2bbcf78126 gpattern: Set max_length to G_MAXSIZE for wildcard
If a wildcard is seen, se max_length to G_MAXSIZE, otherwise strings
longer than G_UINTMAX would not match.
2025-09-28 16:27:05 +02:00
wangrong
05012cd1c4 GLocalFile: keep suffix name when trashing
Keeping the suffix name makes it easier to get the correct content-type.
2025-09-26 14:34:16 +08:00
Philip Withnall
e5de125a09 Merge branch 'clang21-warning' into 'main'
tests: Fix another clang compiler warning

See merge request GNOME/glib!4837
2025-09-25 19:52:19 +00:00
Tobias Stoeckmann
de6e8f0a45 tests: Fix another clang compiler warning
Compiling with clang 21.1.2 leads to following warning:

```
../glib/tests/cxx.cpp:566:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
  566 | }
```

Add the theoretically missing return statement, even though the if-block
should always be reached. Since no other compiler warned about the
unreachable statement with this change, this should be okay.
2025-09-25 21:11:35 +02:00
Philip Withnall
991e08f5a8 Merge branch 'patch-pt-2' into 'main'
Update Portuguese translation

See merge request GNOME/glib!4835
2025-09-24 10:08:55 +00:00
Philip Withnall
1e01b5c270 Merge branch 'stdck_intsafe' into 'main'
gtypes: Support more overflow check implementations

See merge request GNOME/glib!4832
2025-09-24 10:05:00 +00:00
Hugo Carvalho
af1e0dff65 Update Portuguese translation 2025-09-24 10:12:08 +01:00
Philip Withnall
11ac1c4ae3 Merge branch 'user-dirs-duplicates' into 'main'
utils: Fix a leak when user-dirs.dirs declares a variable twice

See merge request GNOME/glib!4819
2025-09-24 07:28:00 +00:00
Marco Trevisan
2015c9b2f8 Merge branch 'c23' into 'main'
macros: Add C23/C++23 standards

See merge request GNOME/glib!4831
2025-09-23 21:40:55 +02:00
Tobias Stoeckmann
68e2278bd9 macros: Add C23/C++23 standards
Since C23 and C++23 standards are finalized, add them to list of
possible standards.

While at it, drop 2b and add 2c for next standard to follow.

The C++23 standard version is correctly set with gcc 14 and
newer, so keep that in mind in tests for older versions.
2025-09-23 20:57:36 +02:00
Tobias Stoeckmann
03bab2805c gtypes: use intsafe.h as fallback if available
Windows systems have the intsafe.h header, defining optimized
overflow checks for the platform. Since the Visual Studio compiler
lacks support for __builtin overflow check macros and also has no C23
support as of version 19, use intsafe.h to still have fast overflow
checks.
2025-09-23 19:43:42 +02:00
Tobias Stoeckmann
609a8885ef gtypes: Use stdckdint.h if possible
The ckd_add/ckd_mul functionality has been introduced with C23. Use
it for overflow checks if it is available. If not, fall back
to __builtin macros. If these are not available either, fall back to
custom code.
2025-09-23 19:34:02 +02:00
Michael Catanzaro
844fb89628 Merge branch 'giowin32-uninit' into 'main'
giowin32: Fix uninitialised variable error on msys2-clang64

See merge request GNOME/glib!4830
2025-09-23 10:32:09 -05:00
Philip Withnall
2414ca69d2 giowin32: Fix uninitialised variable error on msys2-clang64
I guess a compiler upgrade on msys2 has happened, because this wasn’t a
problem before, and the code hasn’t changed.

Fixes the warning:
```
../glib/giowin32.c:1828:47: error: variable 'c' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
 1828 |   channel->is_writeable = WriteFile (handle, &c, 0, &count, NULL);
      |                                               ^
1 error generated.
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-23 16:09:38 +01:00
Philip Withnall
2eb853a40d Merge branch 'win_typos' into 'main'
docs: Fix typos in win32-build.md

See merge request GNOME/glib!4829
2025-09-23 14:43:25 +00:00
Tobias Stoeckmann
5285c18b88 docs: Fix typos in win32-build.md
Fixed some grammar typos.

While "continue to use" is correct, "continue using" is a better
fitting form in this context.
2025-09-23 13:45:24 +02:00
Philip Withnall
3c16bc92af Merge branch 'ghostutils_ascii' into 'main'
ghostutils: Treat 0x80 (and above) as non-ASCII

See merge request GNOME/glib!4827
2025-09-22 16:36:52 +00:00
Tobias Stoeckmann
a4a32bbeaa ghostutils: Treat 0x80 (and above) as non-ASCII
Any ASCII character above 0x7F should be treated as UTF-8 in
ghostutils functions because GLib expects host names to be either
punycode encoded or in valid UTF-8 format.

The checks in gutf8.c already treat 0x80 as non-ASCII, but two checks
in ghostutils.c erroneously check for "great than" not "greater than or
equal to".

Clarify this by adding a new macro which is reused by PUNICODE_IS_BASIC
for better documentation in code.
2025-09-22 17:57:50 +02:00
Marco Trevisan
ed36f4c642 Merge branch 'wip/suppress-missing-lock-coverity' into 'main'
gdbus-codegen: Supress coverity warning in skeleton finalization

See merge request GNOME/glib!4825
2025-09-21 13:35:26 +02:00
Carlos Garnacho
592082ef1d gdbus-codegen: Supress coverity warning in skeleton finalization
This commit has the potential to close a thousand Coverity issues.
On generated code from gdbus-codegen, Coverity typically warns on
skeleton->priv->changed_properties_idle_source happening outside
the skeleketon->priv->lock during finalize(), while it's protected
by this mutex in other parts.

Presumably if the object is in finalization, there should be no
other threads poking at it, so the code is actually safe for the
intended use and the warning moot.

To address this, change gdbus-codegen to prefer g_clear_pointer()
with glib >= 2.38 (should be most often the case nowadays) so this
access is reserved to a single line of code, and mark this line of
code with a Coverity code annotation in order to suppress the
warning.
2025-09-21 12:02:58 +02:00
Philip Withnall
d6b160e443 tests: Add a test for g_reload_user_special_dirs_cache()
This test specifically checks whether the documented behaviour of
deliberately leaking old special dirs strings (which might still be
pointed to in user code) works.

I haven’t gone back and used this new unit test with an older version of
GLib, but I suspect the ‘deliberate leak’ code hasn’t worked for a
while. See the changes in the previous few commits, which were necessary
to get this unit test to pass.

The previous `test_user_special_dirs()` test has been deleted, as what
it was testing has been entirely subsumed into the new test.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:43 +01:00
Philip Withnall
bd3418647c tests: Factor out a helper function in the utils tests
This introduces no functional changes, it just factors out a helper to
set a mock `user-dirs.dirs` file, so that we can do the same in multiple
tests.

It does add a little more error checking to the helper code though; in
particular it checks that the test is running with
`G_TEST_OPTION_ISOLATE_DIRS`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:39 +01:00
Philip Withnall
1c32cad71b gutils: Move the special case default value for G_USER_DIRECTORY_DESKTOP
Otherwise it isn’t set on every code path, and it’s possible for a
caller to receive `NULL` when they call `g_get_user_special_dir
(G_USER_DIRECTORY_DESKTOP)`, i.e. after calling
`g_reload_user_special_dirs_cache()`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:34 +01:00
Philip Withnall
38dac960c7 gutils: Fix deliberate-leak code in g_reload_user_special_dirs_cache()
It seems it wasn’t behaving as advertised: it was freeing all the old
string values unless they were strcmp-equal to the new ones, in which
case the new ones were discarded.

What’s actually documented is that the old values are always leaked,
unless they’re strcmp-equal to the new ones.

Adjust the code to match the documentation. A unit test will be added in
a following commit.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:30 +01:00
Philip Withnall
474b90d4ff gutils: Fix a leak when user-dirs.dirs declares a variable twice
Found by the oss-fuzz test for this parser,
`fuzzing/fuzz_special_dirs.c`.

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

oss-fuzz#445870121
oss-fuzz#445848222
2025-09-19 16:53:26 +01:00
Philip Withnall
f7fca2e9b6 tests: Fix a minor leak in the utils test
Found with `meson test --setup valgrind`, although I also had to change
relevant lines in `glib/tests/meson.build` temporarily to avoid the
other tests in the file taking forever:
```
  'utils' : {
    'c_standards': c_standards.keys(),
    'args': ['-p', '/utils/user-special-dirs'],
  },
```

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:21 +01:00
Philip Withnall
2258775871 tests: Rename a couple of tests for consistency
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:17 +01:00
Philip Withnall
f70ed97806 tests: Move user-special-dirs test from utils-isolated.c to utils.c
`utils-isolated.c` is meant for testing the behaviour of
`G_TEST_OPTION_ISOLATE_DIRS`, not testing the general behaviour of
`gutils.c`. My mistake for not noticing this at code review time when
the test was added.

This introduces no functional changes, just moves a test around.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 16:53:12 +01:00
Philip Withnall
e04e8cac51 Merge branch 'wip/smcv/debbug1115617' into 'main'
gio/tests: Fix a race condition in /gdbus/connection/flush

See merge request GNOME/glib!4820
2025-09-19 13:49:54 +00:00
Philip Withnall
fe1c1222f8 tests: Use G_TEST_OPTION_ISOLATE_DIRS for utils tests
Another test isolated.

This does mean moving one of the test cases from the suite out into a
separate suite, as it explicitly relies on running without
`G_TEST_OPTION_ISOLATE_DIRS`, and I think that makes sense. The other
test cases run fine when isolated.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-09-19 13:51:32 +01:00
Simon McVittie
67dc482f8a gio/tests: Wait up to 10 seconds for a signal to be received
If the build/test machine is slow, heavily-loaded or otherwise
inconvenienced, it might take a few seconds for the signal to be sent
by the subprocess, received by the message bus, re-broadcasted by the
message bus and received by the test code. Wait a few more seconds
before giving up.

If this test is successful, increasing this timeout will not slow it
down: we stop waiting for the signal as soon as we receive it. This will
only make any difference if the test would have failed.

Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:37 +01:00
Simon McVittie
73224802b3 gio/tests: Convert the time to wait for expected signal into a constant
No functional change.

Signed-off-by: Simon McVittie <smcv@debian.org>
2025-09-19 13:44:30 +01:00