Commit Graph

26749 Commits

Author SHA1 Message Date
Philip Withnall
6c39f08f37 gstrfuncs: Fix regression in C++ types accepted by g_str_equal()
Further to commit bcd364afef, fix the types accepted by the
`g_str_equal()` macro for C++ too. C++ is more restrictive about
const-correctness.

Add unit tests.

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

Fixes: #2820
2022-11-28 12:58:05 +00:00
Philip Withnall
60ceb48129 Merge branch 'ebassi/issue-2821' into 'main'
docs: Avoid unintended titles in g_object_new()

Closes #2821

See merge request GNOME/glib!3093
2022-11-28 12:28:30 +00:00
Philip Withnall
11a253d1bd Merge branch 'fix-typo' into 'main'
Fix doc typo in g_dbus_connection_signal_subscribe

See merge request GNOME/glib!3091
2022-11-28 12:11:01 +00:00
Emmanuele Bassi
f1b7a52fe2 docs: Avoid unintended titles in g_object_new()
Lines should not start with `#` unless they are titles, as docblocks are
parsed as Markdown.

Fixes: #2821
2022-11-28 11:49:51 +00:00
Philip Withnall
74afeca98b Merge branch 'fix-symlink-path' into 'main'
Fix gmodule/COPYING symlink path

See merge request GNOME/glib!3092
2022-11-28 11:35:25 +00:00
Sonny Piers
29da935c28 Fix doc typo in g_dbus_connection_signal_subscribe 2022-11-28 11:33:09 +00:00
Roman Stratiienko
8c5ca546d4 Fix gmodule/COPYING symlink path
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2022-11-28 12:13:21 +02:00
Philip Withnall
24e1bfba16 Merge branch 'snap-portal-support' into 'main'
portal: Check for snap plugs before accessing portals

See merge request GNOME/glib!3020
2022-11-24 19:49:07 +00:00
Marco Trevisan (Treviño)
92fae633a0 gio/tests: Add tests for flatpak infos
Support testing flatpak infos, we do it by faking /.flatpak-info file in
case we're building in test mode.
2022-11-24 20:03:39 +01:00
Marco Trevisan (Treviño)
e6eebfd9c3 gportalsupport: Force use /usr/bin/snapctl to get snap connection status
Do not search in path for snapctl to avoid it to be potentially
overridden by changing the PATH env variable.

Still allow testing by using an ifdef to check if we're building for the
test files or not.
2022-11-24 20:03:39 +01:00
Marco Trevisan (Treviño)
94ebd9f041 gio/tests/sandbox: Use test portal utils to create fake snap.yaml 2022-11-24 20:03:39 +01:00
Marco Trevisan (Treviño)
b1a2b64e94 gio/tests: Add tests for portal support functions
Test all the snap cases and the unknown sandbox one.

We need to use different test processes as we initialize the portal
type early enough that it can't be changed later.
2022-11-24 20:03:39 +01:00
Robert Ancell
216d7ba042 portal: Check for snap plugs before accessing portals
This is of particular use in the gsettings backend, which is currently using
dconf for all snaps.
Fully confined snaps should use the keyfile backend, as Flatpaks do.

Co-Authored-by: Marco Trevisan <mail@3v1n0.net>
2022-11-24 20:00:18 +01:00
Marco Trevisan (Treviño)
0e4dff445f gsandbox: Mark classic snaps as UNKNOWN sandbox type
Classic snaps are just a kind of packages with no sandbox at all, so
there's no point to mark them as sandboxed.

In this way we can just do IO checks once without having to multiply
them.

Co-Authored-by: Robert Ancell <robert.ancell@canonical.com>
2022-11-24 20:00:18 +01:00
Philip Withnall
2ee44ba1d5 Merge branch 'msvc-cxx-use-native-attribute-specifiers' into 'main'
gmacros: Use C++ namespaces attribute specifier sequences for msvc

See merge request GNOME/glib!3086
2022-11-24 18:12:29 +00:00
Marco Trevisan (Treviño)
5ff02aa5f9 gmacros: Use C++ namespaces attribute specifier sequences for msvc
As we do already for GNU compilers, when using C++ we should use
attribute sequences with msvc namespace.

This is not supported by msvc versions earlier than 2019 16.7 according
to [1], and thus we need to check if `_MSC_VER` is at least 1927 [2].

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2895#note_1572952

[1] https://www.codetd.com/en/article/11761480
[2] https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170&viewFallbackFrom=vs-2019#feedback
2022-11-24 17:47:56 +01:00
Emmanuele Bassi
320b24f1f1 Merge branch 'wip/pwithnall/revert-meson-0.64' into 'main'
Revert dependency bump to use Meson 0.64

See merge request GNOME/glib!3089
2022-11-24 12:31:27 +00:00
Philip Withnall
5d20725774 docs: Update Meson version policy to mention freedesktop SDK
To avoid this happening again:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-24 12:13:21 +00:00
Philip Withnall
3fad4d45bf Revert "build: Bump Meson dependency to 0.64.0"
This reverts commit 91f14cd058.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:10:07 +00:00
Philip Withnall
66499d2199 Revert "build: Don’t define redundant built-in variables in pkgconfig calls"
This reverts commit 7e3e591d43.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:10:03 +00:00
Philip Withnall
b4231844a2 Revert "build: Use fs.copyfile() instead of configure_file()"
This reverts commit 19353017a7.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:09:55 +00:00
Philip Withnall
b646b1cab7 Revert "meson: Use gnome.mkenum_simple()"
This reverts commit 756b424cce.

The freedesktop SDK, which is used by gnome-build-meta, only has Meson
0.63. Bumping GLib’s Meson dependency to 0.64 means that, at the moment,
GLib is not buildable in gnome-build-meta and hence can’t be tested in
nightly pipelines against other projects, etc.

That’s bad for testing GLib.

It’s arguably bad that we’re restricted to using an older version of
Meson than shipped by Debian Testing, but that’s a separate discussion
to be had.

Revert the Meson 0.64 dependency until the freedesktop SDK ships Meson ≥
0.64. This also means reverting the simplifications to use of
`gnome.mkenum_simple()`.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1601064
2022-11-24 12:06:10 +00:00
Marco Trevisan (Treviño)
660242af07 tests/sandbox: Use isolated-directories
So we don't have to bother to manually remove the created artifacts.
2022-11-24 05:38:32 +01:00
Robert Ancell
4ba188c906 portal: Rename function to not be flatpak specific
It will also read snap information
2022-11-24 05:38:32 +01:00
Simon McVittie
78d0ac4237 Merge branch 'valgrind-fd-fun' into 'main'
gspawn: Ignore invalid FDs when using safe_fdwalk()

See merge request GNOME/glib!3076
2022-11-23 17:34:05 +00:00
Simon McVittie
a241226f2e Merge branch 'gdbus-tests-isolate-dirs' into 'main'
tests: Add G_TEST_OPTION_ISOLATE_DIRS to almost all gdbus tests

See merge request GNOME/glib!3088
2022-11-23 17:20:44 +00:00
Philip Withnall
7248c88b2c Merge branch 'mkenum' into 'main'
meson: Use gnome.mkenum_simple()

See merge request GNOME/glib!2917
2022-11-23 13:29:59 +00:00
Xavier Claessens
756b424cce meson: Use gnome.mkenum_simple()
Meson now uses find_program() to get glib-mkenum from glib instead of
from system. That was already fixed at least in >=0.60 which is our
current minimum requirement.
2022-11-23 08:02:34 -05:00
Xavier Claessens
6dd5c5002a Merge branch 'wip/pwithnall/meson-0.64' into 'main'
build: Bump Meson dependency to 0.64.0

See merge request GNOME/glib!3077
2022-11-23 11:48:51 +00:00
Philip Withnall
fd27c8dc6e tests: Add G_TEST_OPTION_ISOLATE_DIRS to almost all gdbus tests
This is a spiritual follow-up to commit 8cff531520, which
added `G_TEST_OPTION_ISOLATE_DIRS` to the `gdbus-connection-flush` test
to avoid its D-Bus cookie lock file from being erroneously deleted by
other tests running in parallel.

The same failure mode could affect any of the other D-Bus tests which
connect to a bus. As an easy fix, enable `G_TEST_OPTION_ISOLATE_DIRS`
for all of them.

The only test it’s not (yet) enabled for is `gdbus-address-get-session`
as that messes around with `XDG_RUNTIME_DIR` to test finding the session
bus. It might be possible to use `G_TEST_OPTION_ISOLATE_DIRS` with it,
but that would take longer than I have right now.

In any case, the more tests (which try to connect to a bus) that this is
enabled for, the lower the chances of spurious test failure due to them
conflicting over shared resources.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-23 11:15:20 +00:00
Philip Withnall
19353017a7 build: Use fs.copyfile() instead of configure_file()
Because Meson complains about using `configure_file(copy: true)`.

Includes improvements by Xavier Claessens.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-23 10:40:32 +00:00
Philip Withnall
7e3e591d43 build: Don’t define redundant built-in variables in pkgconfig calls
This is deprecated since Meson 0.62.0, since Meson does this
automatically for us.

This fixes a Meson configure warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-23 10:39:58 +00:00
Philip Withnall
91f14cd058 build: Bump Meson dependency to 0.64.0
It will fix dependency ordering issues found in
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2917#note_1559190.

As per `docs/meson-version.md`, we can depend on Meson ≤0.64.0 now as
it’s in Debian Testing.

The FreeBSD runners have to be changed to explicitly install the right
version of Meson using `pip3`, as the system-installed version is not
quite new enough. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3077#note_1596257.

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

Helps: !2917
2022-11-23 10:39:13 +00:00
Marco Trevisan
ad755e7489 Merge branch 'c-cxx-std-versions' into 'main'
Expose C and C++ standard versions and add macros to check them

See merge request GNOME/glib!2895
2022-11-22 21:10:34 +00:00
Marco Trevisan
b7344e374b Merge branch '2786-deprecate-options' into 'main'
build: Deprecate -Druntime_libdir option

Closes #2786

See merge request GNOME/glib!3087
2022-11-22 18:54:22 +00:00
Marco Trevisan
291ca47bd5 Merge branch 'wait-for-nothing' into 'main'
tests: Remove a manual timeout from desktop-app-info test

See merge request GNOME/glib!3083
2022-11-22 17:58:04 +00:00
Marco Trevisan
8fba287c81 Merge branch 'wip/pwithnall/2777-zerosize' into 'main'
gio: Change content type of zero-sized files to application/x-zerosize

Closes #2777

See merge request GNOME/glib!3053
2022-11-22 17:52:47 +00:00
Marco Trevisan
1e5178b002 Merge branch '2793-clear-annotations' into 'main'
gmem: Fix introspection annotations for g_clear_pointer() and g_clear_fd()

Closes #2793

See merge request GNOME/glib!3085
2022-11-22 17:27:34 +00:00
Marco Trevisan (Treviño)
ff49707501 gmacros: Use G_C_STD_CHECK_VERSION to define C-std dependent items 2022-11-22 17:45:56 +01:00
Philip Withnall
e71ecc8771 build: Remove deprecated -Diconv option
It was deprecated in GLib 2.74, so we can now remove it.

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

Helps: #2786
2022-11-22 16:32:42 +00:00
Philip Withnall
8d77591d89 build: Deprecate -Druntime_libdir option
It’s been broken since we ported to Meson and nobody has complained, so
let’s deprecate it this cycle and remove it in GLib ≥ 2.78.

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

Fixes: #2786
2022-11-22 16:31:28 +00:00
Philip Withnall
e535f22b08 gmem: Fix introspection annotations for g_clear_pointer() and g_clear_fd()
They were mixing up `(optional)` and `(nullable)`, and didn’t correctly
annotate the arguments as `(inout)` or `(transfer full)`.

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

Fixes: #2793
2022-11-22 16:25:39 +00:00
Marco Trevisan (Treviño)
633561ada2 macros: Add a generic way to get and check the supported C standard
Try to get the value of __STDC_VERSION__ if supported, if not just
fallback to the oldest standard that any compiler should handle.
2022-11-22 17:23:14 +01:00
Marco Trevisan (Treviño)
14ba699508 meson: Compile some tests with multiple C standards
We need to ensure that all the expected macros and utilities are working
with all the supported C standards, so just repeat the tests with all
the ones the compiler supports.
2022-11-22 17:23:14 +01:00
Marco Trevisan (Treviño)
641256ea22 gmacros: Prioritize the usage of [[noreturn]] in C++11
We defined G_NO_RETURN as [[noreturn]] in the C++ case, but only after
trying the __attribute__ syntax, so it was never used in GNUC compatible
compilers.

Give it priority instead when supporting a C++11 compiler and onwards.

As per this we need to adapt the code in the places where it was not
properly used (leading to compilation warnings).
2022-11-22 17:23:13 +01:00
Marco Trevisan (Treviño)
372ab7a964 glib: Use G_CXX_STD_VERSION to check how to behave with C++ compilers 2022-11-22 17:23:12 +01:00
Philip Withnall
ebfbd9c56a tests: Remove a manual timeout from desktop-app-info test
It sometimes fails under valgrind, and is pointless: if the test is
wedged, it’s better to catch that with the timeout at the level of
`meson test`, which can be tailored (using `-t`) to the test environment
and wrapper.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2961#note_1600072

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-22 16:11:49 +00:00
Marco Trevisan
3af38a3a1a Merge branch 'coverity-fixes' into 'main'
gthreadpool: Mark an explicit leak as to be ignored

See merge request GNOME/glib!3081
2022-11-22 16:10:01 +00:00
Marco Trevisan
8aef5fc099 Merge branch '2809-str-equal-api-break' into 'main'
gstrfuncs: Fix regression in types accepted by g_str_equal()

Closes #2809

See merge request GNOME/glib!3082
2022-11-22 16:08:58 +00:00
Philip Withnall
3ee8dafb27 gspawn: Fold in safe_fdwalk_with_invalid_fds() helper function
Since it’s now always called the same way after safe_fdwalk() has been
called. This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-22 14:35:12 +00:00