27775 Commits

Author SHA1 Message Date
Simon McVittie
0df62f58d0 tests: Add test coverage for signals that match the message bus's name
This is a special case of unique names, even though it's syntactically
a well-known name.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-07 16:21:47 +01:00
Simon McVittie
dfe0515ede tests: Add a test-case for what happens if a unique name doesn't exist
On GNOME/glib#3268 there was some concern about whether this would
allow an attacker to send signals and have them be matched to a
GDBusProxy in this situation, but it seems that was a false alarm.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-07 16:21:47 +01:00
Simon McVittie
2a128c7ce0 tests: Add support for subscribing to signals from a well-known name
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-07 16:21:47 +01:00
Simon McVittie
b6a68c0e42 tests: Add a data-driven test for signal subscriptions
This somewhat duplicates test_connection_signals(), but is easier to
extend to cover different scenarios.

Each scenario is tested three times: once with lower-level
GDBusConnection APIs, once with the higher-level GDBusProxy (which
cannot implement all of the subscription scenarios, so some message
counts are lower), and once with both (to check that delivery of the
same message to multiple destinations is handled appropriately).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-05-07 16:21:47 +01:00
Philip Withnall
952852081d gdbusmessage: Cache the arg0 value
Technically we can’t rely on it being kept alive by the `message->body`
pointer, unless we can guarantee that the `GVariant` is always
serialised. That’s not necessarily the case, so keep a separate ref on
the arg0 value at all times.

This avoids a potential use-after-free.

Spotted by Thomas Haller in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3720#note_1924707.

[This is a prerequisite for having tests pass after fixing the
vulnerability described in glib#3268, because after fixing that
vulnerability, the use-after-free genuinely does happen during
regression testing. -smcv]

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

Helps: #3183, #3268
(cherry picked from commit 10e9a917be7fb92b6b27837ef7a7f1d0be6095d5)
2024-05-07 16:21:47 +01:00
Simon McVittie
336bca622e CI: Ignore MSYS2 CI failures for this older stable-branch
Release branches older than the current stable release are intended
for long-term-supported OS distributions such as Debian, RHEL or
Ubuntu LTS where GLib is part of the OS itself, and therefore an
OS vendor that wants to minimize regression risk in other OS components
might reasonably prefer to backport high-impact bug fixes instead of
upgrading to new GLib branches.

MSYS2 does not fall into that category: it is an add-on to an operating
system that does not contain GLib as OS functionality (namely, Windows),
making its maintainers less change-averse than LTS distribution vendors,
and in reality it has already upgraded its packaged GLib to 2.80.x.

Making these CI jobs non-blockers ensures that security fix releases
for LTS Linux distributions do not get held back by build failures on
a platform that is no longer interested in the relevant branch.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-05-07 16:16:12 +01:00
Ekaterine Papava
a963d3a8b5 Update Georgian translation 2024-03-25 04:54:25 +00:00
Ekaterine Papava
f8c50fd3ae Update Georgian translation 2024-03-19 07:48:35 +00:00
Philip Withnall
032f2a9135 Merge branch 'cherry-pick-41af4271' into 'glib-2-78'
gcontenttype: Make filename valid utf-8 string before processing

See merge request GNOME/glib!3960
2024-03-13 14:23:44 +00:00
Philip Withnall
227257515d tests: Remove variable-length lookbehind tests for GRegex
PCRE2 10.43 has now introduced support for variable-length lookbehind,
so these tests now fail if GLib is built against PCRE2 10.43 or higher.

See
e8db6fa713/ChangeLog (L94).

Rather than making the tests conditional on the version of PCRE2 in use,
just remove them. They are mostly testing the PCRE2 code rather than
any code in GLib, so don’t have much value.

This should fix CI runs on msys2-mingw32, which updated to PCRE2 10.43 2
days ago.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-03-13 14:11:24 +00:00
Juliano de Souza Camargo
36b81fbfb6 Update Brazilian Portuguese translation 2024-03-11 17:01:47 +00:00
Ondrej Holy
3bcc985987 gcontenttype: Make filename valid utf-8 string before processing
The `g_content_type_guess_for_tree` function segfaults currently when
processing filenames that are not valid unicode strings. Let's use the
`g_filename_to_utf8` and `g_utf8_make_valid` functions before other
processing to prevent that.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/3168


(cherry picked from commit 41af42717531a2af6dfd7a4f7b5c5fc228e85f0d)
2024-03-08 14:02:24 +00:00
Andi Chandler
557f0d9442 Update British English translation 2024-02-28 11:45:57 +00:00
Emmanuele Bassi
a4c9f9ac5e Merge branch 'wip/pwithnall/drop/freebsd-12-ci-glib-2-78' into 'glib-2-78'
glib-2-78: ci: Drop FreeBSD 12 CI runner as it’s EOL

See merge request GNOME/glib!3825
2024-01-22 10:44:35 +00:00
Philip Withnall
00edb7f745
2.78.4
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.78.4
2024-01-21 19:48:20 +00:00
Philip Withnall
b9c6564154 ci: Temporarily disable --fatal-meson-warnings on FreeBSD CI
For the same reasons as in commit 71061fdcb33b8c26f5f8467c, but in this
case we can’t downgrade the version of Meson on the CI runner, so just
tell it to shut up instead.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-16 13:18:55 +00:00
Philip Withnall
aad088531d ci: Drop FreeBSD 12 CI runner as it’s EOL
It’s EOL and accordingly nobody wants to maintain the runner. We still
have the FreeBSD 13 runner to test against (on this branch and on
`main`).

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3740#note_1957840

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-01-15 21:53:33 +00:00
Michael Catanzaro
e93fd4cfc3 Merge branch 'backport-3750-regex-status-glib-2-78' into 'glib-2-78'
Backport !3750 “gregex: clean up usage of _GRegex.jit_status” to glib-2-78

See merge request GNOME/glib!3766
2023-12-18 21:58:47 +00:00
James Haggerty
d2d898d17b gregex: clean up usage of _GRegex.jit_status 2023-12-18 11:33:51 +00:00
Michael Catanzaro
d034b672ff Merge branch 'backport-3753-gdb-plugin-glib-2-78' into 'glib-2-78'
Backport !3753 “gobject_gdb.py: Do not break bt on optimized build” to glib-2-78

See merge request GNOME/glib!3759
2023-12-12 19:30:12 +00:00
Jens Georg
30efe593a1 gobject_gdb.py: Do not break bt on optimized build
Symptom:
20 0x00007ffff756337b in gtk_widget_size_allocate_with_baseline (widget=0xd7a0c0 [DirectWindow], allocation=, baseline=) at
gdb.error: value has been optimized out
2023-12-12 18:01:49 +00:00
Michael Catanzaro
f3ff370d1b Merge branch 'gtkdoc' into 'glib-2-78'
docs/reference: depend on a native gtk-doc

See merge request GNOME/glib!3756
2023-12-11 21:08:59 +00:00
Michael Catanzaro
f786d276e1 Merge branch 'backport-3751-rst-anchors-glib-2-78' into 'glib-2-78'
Backport !3751 “Fix generated RST anchors for methods, signals and properties” to glib-2-78

See merge request GNOME/glib!3754
2023-12-11 17:48:50 +00:00
Philip Withnall
a714556b3e tests: Re-format codegen.py with black
This is just the result of running `black $(git ls-files '*.py')`.

For some reason, the `sh-and-py-check` CI job didn’t run on merge
request !3751, so this non-standard formatting slipped through onto
`main`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3754#note_1939914

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-11 16:56:14 +00:00
Philip Withnall
737b08e96f tests: Use textwrap.dedent to indent expected strings pleasingly
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2023-12-11 16:56:14 +00:00
Ross Burton
54b081248a docs/reference: depend on a native gtk-doc
In a cross-compiled environment we don't need a target gtk-doc, but a
native gtk-doc.
2023-12-11 16:28:17 +00:00
tytan652
4e4471663c tests: Add tests for gdbus-codegen generated RST
Those tests check if methods, signals and properties documentation are
properly generated.
2023-12-11 14:21:29 +00:00
tytan652
a3189ec5c8 Fix generated RST anchors for methods, signals and properties 2023-12-11 14:21:29 +00:00
Philip Withnall
03f7c1fbf3
2.78.3
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.78.3
2023-12-06 18:03:55 +00:00
Michael Catanzaro
171d65dffa Merge branch 'backport-3742-xdgmime-glib-2-78' into 'glib-2-78'
Backport !3742 “xdgmime: Update to upstream commit c2c814d4051f232” to glib-2-78

See merge request GNOME/glib!3747
2023-12-06 17:55:01 +00:00
Philip Withnall
facc4f06a3 xdgmime: Update to upstream commit c2c814d4051f232
(Modulo the changes in
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/10 which are
still under discussion. Plus the proposed warning fixes from
https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/33.)

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

Fixes: #3191
2023-12-06 16:33:39 +00:00
Philip Withnall
eb14755943
2.78.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.78.2
2023-12-05 14:22:57 +00:00
Michael Catanzaro
e1aef8bfea Merge branch 'backport-3725-collate-checks-glib-2-78' into 'glib-2-78'
Backport !3725 “collate: Don't segfault on bad input” to glib-2-78

See merge request GNOME/glib!3727
2023-11-26 22:58:03 +00:00
Matthias Clasen
312352ed34 collate: Don't segfault on bad input 2023-11-26 22:46:04 +00:00
Michael Catanzaro
d8e89043c8 Merge branch 'backport-3714-xdgmime-glib-2-78' into 'glib-2-78'
Backport !3714 “xdgmime: Handle buggy type definitions with circular inheritance” to glib-2-78

See merge request GNOME/glib!3718
2023-11-22 16:04:33 +00:00
Alex Henrie
b382d059ee xdgmime: Add continue statements after goto labels in_xdg_mime_(cache_)mime_type_subclass
To fix the Android build.
2023-11-22 10:37:50 +00:00
Alex Henrie
e03abe7457 xdgmime: Handle buggy type definitions with circular inheritance
This fixes a stack overflow reported by a user who had both the
definition of text/javascript from shared-mime-info 2.3 and the
definition of text/javascript from shared-mime-info 2.4 installed at the
same time. In 2.3, text/javascript is a subtype of
application/ecmascript, but in 2.4 application/ecmascript is a subtype
of text/javascript. Having both at the same time resulted in circular
inheritance.

The new logic keeps a list of all parents that have already been
checked, which is more comprehensive than the old workaround that was
implemented in commit 38869ece2 ("xdgmime: Prevent infinite loops from
badly-formed MIME registrations").

https://bugs.archlinux.org/task/80279
2023-11-22 10:37:50 +00:00
Philip Withnall
b8ef341a93 Merge branch 'backport-3685-sh-exec-glib-2-78' into 'glib-2-78'
Backport !3685 “tests: Don't assume that sh optimizes simple commands into exec” to glib-2-78

See merge request GNOME/glib!3686
2023-11-01 22:57:28 +00:00
Simon McVittie
82e4bfa134 tests: Don't assume that sh optimizes simple commands into exec
Depending on the operating system, /bin/sh might either be bash (for
example on Fedora or Arch) or dash (for example on Debian or Ubuntu)
or some other POSIX shell.

When bash is asked to run a simple command with no shell keywords or
metacharacters, like this one, it replaces itself with the program
via execve(), but dash does not have that optimization and treats it
like any other program invocation in a larger script: it will fork,
exec the program in the child, and wait for the child in the parent.

This seems like it conflicts with sleep_and_kill() assuming that it can
use the subprocess's process ID as the sleep(1) process ID. Specifically,
if it sends SIGKILL, it will go to the sh(1) process and not the sleep(1)
child, which could result in the sh(1) process being terminated and
its sleep(1) child being leaked.

To get the bash-like behaviour portably, explicitly use the exec builtin
to instruct the shell to replace itself with sleep(1), so that the
process ID previously used for the shell becomes the process ID of the
sleep process.

This appears to resolve an intermittent hang and test timeout on Debian
machines (especially slower ones), although I'm not 100% clear on the
mechanics of how it happens.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/3157
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-11-01 22:35:22 +00:00
Michael Catanzaro
910916189a Merge branch 'backport-3669-ptrace-check-again-glib-2-78' into 'glib-2-78'
Backport !3669 “meson: Improve PTRACE_O_EXITKILL presence check” to glib-2-78

See merge request GNOME/glib!3673
2023-11-01 16:51:18 +00:00
Michael Catanzaro
1a275aeb11 Merge branch 'backport-3678-signalgroup-side-effects-glib-2-78' into 'glib-2-78'
Backport 3678 “gsignalgroup: Avoid function call with side effect in g_return_* macro” to glib-2-78

See merge request GNOME/glib!3681
2023-11-01 15:16:49 +00:00
Michael Catanzaro
42348e657a Merge branch 'backport-3677-quark-leak-glib-2-78' into 'glib-2-78'
Backport !3677 “Make GQuark register intentional leaks” to glib-2-78

See merge request GNOME/glib!3680
2023-11-01 15:16:01 +00:00
Kleis Auke Wolthuizen
a5ea4d4c74 gsignalgroup: Avoid function call with side effect in g_return_* macro 2023-11-01 10:56:05 +00:00
Seppi Wilhelmi
7713f37678 Make GQuark register intentional leaks 2023-11-01 10:35:12 +00:00
Alessandro Bono
1fe18a72f5 meson: Improve PTRACE_O_EXITKILL presence check
The PTRACE_O_EXITKILL symbol in sys/ptrace.h is an enum member, not
a macro. The #ifdef check added to the GSubprocess test-case in
272ec5dbca8ec957ced2cdca45bde69f47fb4df9 will not detect it.

Use cc.has_header_symbol() to properly detect it. According to the
documentation: "Symbols here include function, variable, #define,
type definition, etc.".

Fixes: 272ec5dbca8ec957ced2cdca45bde69f47fb4df9
Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/3156
2023-10-29 20:30:48 +00:00
Yuri Chornoivan
ea71087141 Update Ukrainian translation 2023-10-29 12:09:11 +00:00
Philip Withnall
21624e78f0
2.78.1 2.78.1 2023-10-25 12:33:59 +01:00
Michael Catanzaro
85f3135a75 Merge branch 'backport-3650-file-truncate-glib-2-78' into 'glib-2-78'
Backport !3650 “gfileutils: Add a missing ftruncate() call when writing files” to glib-2-78

See merge request GNOME/glib!3659
2023-10-22 23:28:57 +00:00
Philip Withnall
addda9e7ac gfileutils: Add a missing ftruncate() call when writing files
When calling `g_file_set_contents_full()` without
`G_FILE_SET_CONTENTS_CONSISTENT`, the file is written by opening it,
`write()`ing to it, then closing it.

This is fine as long as the file is not longer than the new content you
want to set its contents to. If it is, the last bit of the old content
remains, because `g_file_set_contents_full()` was missing an
`ftruncate()` call.

Fix that, and change the tests to catch truncation failures in future.

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

Fixes: #3144

(Backport 2.78: Unmark new translatable string as translatable, to avoid
adding need for translations.)
2023-10-22 23:44:56 +01:00
Ekaterine Papava
005c4c6d12 Update Georgian translation 2023-10-20 05:51:40 +00:00