Commit Graph

32247 Commits

Author SHA1 Message Date
Philip Withnall
daf3bd7f0a gmappedfile: Avoid calling mmap() with a length of zero
We were previously relying on it returning `EINVAL` so we could return
an error message, but scan-build doesn’t like that, so let’s just
explicitly return the same error anyway to shut scan-build up.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-17 00:03:04 +01:00
Philip Withnall
ca1e32f067 grand: Avoid reading an undefined value from errno
The value of `errno` can apparently be undefined after a successful
function call (according to scan-build), so only check `errno` on
failure.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2025-10-16 23:56:43 +01:00
Philip Withnall
0ab1866145 Merge branch '3798-appinfo-portal-crash' into 'main'
gopenuriportal: Fix a crash when the file can’t be opened

Closes #3798

See merge request GNOME/glib!4859
2025-10-16 21:04:12 +00:00
Philip Withnall
3179f9b57c Merge branch 'gvariant-diagram-reuse-data' into 'main'
Docs: Migrate gvariant-*.svg licenses to comments

See merge request GNOME/glib!4857
2025-10-16 20:26:49 +00:00
Philip Withnall
21179497cf Merge branch 'zero-terminated-annotations' into 'main'
gio: add some nullable / zero-terminated annotations

See merge request GNOME/glib!4789
2025-10-16 20:10:49 +00:00
Philip Withnall
fda9ab69f9 Merge branch 'gapplication-test-check-parameters' into 'main'
gio/tests/gapplication: Check the values received on action activation

See merge request GNOME/glib!4861
2025-10-16 19:51:45 +00:00
FeRD (Frank Dana)
fabe2113c3 Docs: Migrate gvariant-*.svg licenses to comments
Remove the overrides in `.reuse/dep5`, and instead store the license
information in a comment near the top of each file.
2025-10-16 19:37:00 +00:00
FeRD (Frank Dana)
4906e179c1 REUSE: Add missing AFL-2.0 and CC-BY-SA-3.0 texts 2025-10-16 19:37:00 +00:00
François Laignel
7d032f2fde gio: add some nullable / zero-terminated annotations 2025-10-16 19:36:56 +00:00
Philip Withnall
5917bce3de gopenuriportal: Fix a crash when the file can’t be opened
Rather than reporting an error via a new `GTask`, report it via the
`GTask` we’ve already created. This avoids a critical warning about
destroying the `GTask` without returning a result.

Also ensure to disconnect the D-Bus signal subscription first, to avoid
an assertion failure in `call_data_free()`.

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

Fixes: #3798
2025-10-16 20:28:19 +01:00
Marco Trevisan (Treviño)
b3a7c087ee gio/tests/gapplication: Check the values received on action activation
As per commit 0144feb41 the activate action paramter may pack multiple
values but while the behavior was checked we did not check the content
of the values we were receiving in the action callback.

So, also ensure that the variant values we receive are matching the
expectations.
2025-10-16 19:16:26 +00:00
Marco Trevisan
6c7193acb3 Merge branch 'document-portal-fix-symlink-names' into 'main'
gio/gdocumentportal: Use the target name when opening a symlink

See merge request GNOME/glib!4823
2025-10-16 21:11:01 +02:00
Marco Trevisan (Treviño)
085deb7697 gio/tests/documentportal: Add tests covering portal failures
In case the portal fails to create what we expect, or we can't read the
files we should fail. Add test cases for this too.
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
fb0ee7562b gio/gdocumentportal: Get portal file name by listing the mount point
Instead of guessing the portal file name by using the original file name
let's just inspect the portal document ID directory and get the actual
file name
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
a3b99ce554 gio/tests/fake-document-portal: Really create fake files
In order to properly test the document portal, let's also create some
dummy files that are named after the FDs we receive and using the
document-id path as the real portal does
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
eb78cfeeca gio/tests/fake-document-portal: Test that the app-id matches the request
Ensure that the app-id requiring the document matches the one we want,
so that we can actually test the code in GDesktopAppInfo that does the
mapping
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
3eb2abb406 fake-document-portal: Fix signature of function callback
We were missing a parameter, as per the generated bindings
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
352cfe600a gio/gdocumentportal: Use the target name when opening a symlink
When an URI to a symlink is added to the portal, we open it and we send
the FD (of the target) to the portal. This one has no clue about the original
symlink and so it mounts a file that is named like the target.

g_document_portal_add_documents(), however returns a path that contains
the original name and that one is what is sent to the applications when
used via GDesktopAppInfo.

Basically, this is the situation:
  - /tmp/symlink -> /tmp/target
  - An application is launched to open file:/tmp/symlink
  - The portal creates file:/$XDG_RUNTIME_DIR/doc/ID/target
  - Gio converts the path to file:/$XDG_RUNTIME_DIR/doc/ID/symlink

Now, since we can't just pass the symlink to the portal without also
changing the logic there, it's just better to do the conversion ourself,
and so, we use the already-opened fd to figure out the real path of the
opened file, and we return a document file URI that uses the target
basename instead
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
d81701de56 gio/tests: Add document portal tests
While this can be tested using desktop apps, adding some unit tests
makes simpler to verify the edge cases
2025-10-16 20:29:32 +02:00
Marco Trevisan (Treviño)
ddc324da03 gio/tests/fake-document-portal: Use a sequential ID for docs
It makes things clearer to test
2025-10-16 20:29:32 +02:00
Philip Withnall
ea31be5472 Merge branch 'disable-mingw32-ci' into 'main'
ci: Temporarily disable msys2-mingw32 CI

See merge request GNOME/glib!4863
2025-10-16 17:41:20 +00:00
Philip Withnall
558a34d619 ci: Temporarily disable msys2-mingw32 CI
It routinely fails with subproject fetch errors, typically at least
every second CI run. This wastes a lot of CI machine time, and a little
bit of developer time and energy each time (in noticing that it’s
failed, context switching, checking the failure, retrying it, context
switching again).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
See: https://gitlab.gnome.org/GNOME/glib/-/issues/3715
2025-10-16 16:39:16 +01:00
Philip Withnall
c4a162851d Merge branch 'filename-encodings-diag' into 'main'
Docs: New file-name-encodings image: light/dark, color

See merge request GNOME/glib!4851
2025-10-16 15:07:06 +00:00
Philip Withnall
e77f0a04c5 Merge branch 'glib-compile-resources-print-error-message' into 'main'
glib-compile-resources: print error message when the temp file cannot be created

See merge request GNOME/glib!4855
2025-10-16 14:34:00 +00:00
FeRD (Frank Dana)
c2f6337d8f Docs: New file-name-encodings image: light/dark, color
- Redid the old StarOffice-format drawing file in OpenDocument
  format, and updated with two different `-light` and `-dark`
  versions.
  - Added color to the rectangles
  - Bolded all of the text
  - Added background transparency
- Exported both as `file-name-encodings-{light,dark}.svg`
- Tweaked in Inkscape to simplify SVG structure, scale to
  fixed pixel sizes, align to page dimensions.
- Added License/Copyright data as Custom Document Properties
  in OpenDocument sources, comments in SVG source.
  - Federico Mena Quintero, uploader of the originals, is
    credited in the `SPDX-FileCopyrightText` data, along
    with myself.
  - License chosen was `CC0-1.0`, because again I don't believe
    these files are complex enough to actually be copyrightable.
- Added data for `.odg` files to `/.reuse/dep5` file, as
  reuse can't extract license data from that format.
- Updated `character-set.md` and `glib.toml.in` to use
  new SVGs in place of old PNG.
2025-10-16 13:35:12 +00:00
Luca Bacci
b623031e22 glib-compile-resources: print error message when the temp file cannot be created 2025-10-16 13:16:58 +00:00
Philip Withnall
f086b2e114 Merge branch 'disable-macos-ci' into 'main'
ci: Temporarily disable macos-arm64 CI as it has issues creating temp files

See merge request GNOME/glib!4862
2025-10-16 13:16:24 +00:00
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