Commit Graph

7931 Commits

Author SHA1 Message Date
Philip Withnall
e8c068db50 gnotificationbackend: Fix a GDBusConnection leak
`g_notification_backend_new_default()` adds a reference on
`backend->dbus_connection` (if non-`NULL`), but nothing ever unreffed
that.

Fix that by adding a dispose method.

In practice this is not really a problem, because the notification
backend is held alive by a `GApplication`, which lives as long as the
process. It’ll be a problem if someone is to ever add unit tests for
`GNotificationBackend`s though. So let’s fix it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
683c7d05a3 gnotification: Fix a couple of minor typos in a documentation comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
18574d1ba9 gnotification: Improve docs around GVariant ownership
Add a few missing introspection annotations too.

This doesn’t change any of the ownership handling behaviour, just
documents what’s there. What’s there seems to be correct, to the extent
that I can see.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-16 10:12:05 +00:00
Philip Withnall
af6bf2dc02 ggtknotificationbackend: Fix a minor typo in a comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
716189c4c7 gfdonotificationbackend: Improve internal docs around floating GVariants
The code is correct, but from a quick read-through it wasn’t entirely
clear to me how it handled floating `GVariant`s in object state or the
`parameter` argument.

Add an assertion and some comments to hopefully clarify things a little.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
d470e7227a gaction: Improve documentation around floating GVariants
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
4748db5fd3 gaction: Improve docs formatting for g_action_parse_detailed_name()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
5ac06ac8ea gaction: Add missing annotations to g_action_parse_detailed_name()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-15 17:59:36 +00:00
Philip Withnall
55c1fc7dfc Merge branch 'wip/smcv/hidden-inotify' into 'main'
gio: Use hidden symbol visibility in static libraries

Closes #2811

See merge request GNOME/glib!3069
2022-11-14 13:21:51 +00:00
Alexander Kanavin
a9fa7589c6 tests: Work around Meson bug with using exe_wrapper
Do not use can_run_host_binaries() as it returns true even though
custom_target() does not currently correctly wrap target-built
tool binaries with exe_wrapper so they can be run on the host.

See https://github.com/mesonbuild/meson/issues/11029
2022-11-14 13:01:47 +00:00
Simon McVittie
c1ee1a99bc gio: Use hidden symbol visibility in static libraries
Building GLib 2.75.0 on Linux adds various inotify-related internal
symbols to the ABI, which doesn't seem to have been intentional.
I went through the other libraries in the build system, and it looks
as though the BSD kqueue backend would have the same problem.

GNU symbol visibility probably doesn't do anything for gio/win32, but
for completeness I've set that to use hidden symbols too, on the basis
that it'll be easier to get this right if we're consistent.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2811
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-14 12:36:22 +00:00
Xavier Claessens
b65d6f497d gio: Fix missing visibility header dependency 2022-11-12 10:20:49 -05:00
Philip Withnall
9b68c31b38 tests: Add a missing g_task_return_boolean() in gdbus-server-auth tests
Otherwise the task never returned a value.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/385

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-10 14:25:47 +00:00
Philip Withnall
fe89940572 gtask: Emit a debug message if a GTask is finalised without returning
This typically indicates a bug in the program, where a GTask has been
created, but a bug in the control flow has caused it to not return a
value.

There is one situation where it might be legitimate to finalise a GTask
without returning: if an error happens in your *_async() start function
after you’ve created a GTask, but before the async operation returns to
the main loop; and you report the error using g_task_report_*error()
rather than reporting it using the newly constructed GTask.

Another situation is where you are just using GTask as a convenient way
to move some work to another thread, without the complexity of creating
and running your own thread pool. GDBus does this with
g_dbus_interface_method_dispatch_helper(), for example.

In most other cases, it’s a bug. Emit a debug message about it, but not
a full-blown warning, as that would create noise in the legitimate
cases.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2022-11-10 14:25:47 +00:00
Ray Strode
4a00ac91c6 tests: Shorten internal codegen test timeout
the gio dbus codegen test has 10 test cases in it.
Each test case is given 100 seconds to complete.

That is far longer than they should need.

Furthermore, the entire test is only given 60s
to complete.

This commit makes the internal timeout more consistent
with the external timeout, by giving each of the 10
test cases 6 seconds instead of 100s.
2022-11-08 13:08:53 -05:00
Philip Withnall
e2b9e28ece Merge branch 'wip/3v1n0/meson-fix-tests-binary-dependencies' into 'main'
test/meson: Add tests dependencies on built programs, libraries and modules

See merge request GNOME/glib!3015
2022-11-08 12:30:53 +00:00
Philip Withnall
42c9e8218b gio: Change content type of zero-sized files to application/x-zerosize
That’s what xdgmime uses for zero-sized files (see `XDG_MIME_TYPE_EMPTY`).

Historically, GLib explicitly used `text/plain` for empty files, to
ensure they would open in a text editor. But `text/plain` is not really
correct for an empty file: the content isn’t text because there is no
content. The file could eventually become something else when written
to.

Text editors which want to be opened for new, empty files should add
`application/x-zerosize` to their list of supported content types.

Users who want to set a handler for `application/x-zerosize` on their
desktop should use
```sh
gio mime application/x-zerosize  # to see the current handler
gio mime application/x-zerosize org.gnome.gedit.desktop  # to set it
```

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

Fixes: #2777
2022-11-07 13:21:28 +00:00
Philip Withnall
5af339aedf gio: Check __APPLE__ in a few places instead of HAVE_COCOA
`HAVE_COCOA` should be used only in the places where we’re actually
depending on the Cocoa toolkit. It should not be used as a general way
of detecting building on a Darwin-based OS such as macOS.

Conversely, there are a few places in the code where we do want to
specifically detect the Cocoa toolkit (and others where we specifically
want to detect Carbon), so keep `HAVE_COCOA` and `HAVE_CARBON` around.

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

Helps: #2802
2022-11-07 11:30:32 +00:00
Philip Withnall
7b52ccbfc4 Revert "gio, glib: Use G_OS_DARWIN for code that is for such environments"
This reverts commit 476e33c3f3.

We’ve decided to remove `G_OS_DARWIN` in favour of recommending people
use `__APPLE__` instead. As per the discussion on #2802 and linked
issues,
 * Adding a new define shifts the complexity from “which of these
   platform-provided defines do I use” to “which platform-provided
   defines does G_OS_DARWIN use”
 * There should ideally be no cases where a user of GLib has to use
   their own platform-specific code, since GLib should be providing
   appropriate abstractions
 * Providing a single `G_OS_DARWIN` to cover all Apple products (macOS
   and iOS) hides the complexity of what the user is actually testing:
   are they testing for the Mach kernel, the Carbon and/or Cocoa user
   space toolkits, macOS vs iOS vs tvOS, etc

Helps: #2802
2022-11-07 11:30:32 +00:00
Michael Catanzaro
24f2cfba25 gtask: don't use g_task_set_static_name() unless allowed
Need to check GLIB_VERSION_MIN_REQUIRED before inlining use of something
newer.

Fixes #2805
2022-11-03 19:06:40 -05:00
Simon McVittie
32b0dd24e3 Add a SPDX LicenseRef for the license historically used for tests
Some of GLib's unit tests are under an apparently GLib-specific
permissive license, vaguely similar to the BSD/MIT family but with the
GPL's lack-of-warranty wording. This is not on SPDX's list of
well-known licenses, so we need to use a custom license name prefixed
with LicenseRef if we want to represent this in SPDX/REUSE syntax.

Most of the newer tests seem to be licensed under LGPL-2.1-or-later
instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-11-02 12:34:19 +00:00
Philip Withnall
7ee767213b Merge branch 'mcatanzaro/#2799' into 'main'
gproxyresolver: lookup_finish() should better parallel lookup_async()

Closes #2799

See merge request GNOME/glib!3045
2022-11-02 09:47:32 +00:00
Xavier Claessens
f6edb52bda Merge branch 'wip/3v1n0/some-meson-fixmes' into 'main'
meson: Handle various build system FIXME's

See merge request GNOME/glib!3012
2022-11-01 23:36:04 +00:00
Michael Catanzaro
7f85fd126b gproxyresolver: lookup_finish() should better parallel lookup_async()
In g_proxy_resolver_lookup_async() we have some error validation that
detects invalid URIs and directly returns an error, bypassing the
interface's lookup_async() function. This is great, but when the
interface's lookup_finish() function gets called later, it may assert
that the source tag of the GTask matches the interface's lookup_async()
function, which will not be the case.

As suggested by Philip, we need to check for this situation in
g_proxy_resolver_lookup_finish() and avoid calling into the interface
here if we did the same in g_proxy_resolver_lookup_async(). This can be
done by checking the source tag.

I added a few new tests to check the invalid URI "asdf" used in the
issue report. The final case, using async GProxyResolver directly,
checks for this bug.

Fixes #2799
2022-11-01 13:40:35 -05:00
Matthias Clasen
13e48ff963 tests: Tweak the task tests
Tweak the g_task_set_name test to use a non-literal string,
so we don't test g_task_set_static_name twice.
2022-11-01 11:48:52 +00:00
Matthias Clasen
525e3953ef tests: Add a test for g_task_set_static_name()
The test checks that the original string
is returned by g_task_get_name().
2022-11-01 11:48:46 +00:00
Matthias Clasen
99c7d60869 gtask: Add g_task_set_static_name()
Similar to g_source_set_static_name, this avoids
strdup overhead for debug-only information in
possibly hot code paths.

We also add a macro wrapper for g_task_set_name that
uses __builtin_constant_p to decide whether to use
g_task_set_name or g_task_set_static_name.
2022-11-01 11:48:38 +00:00
Matthias Clasen
794ee60306 gdbusconnection: Set a name on all sources
We already set names on most sources, this
one was just forgotten. This lets us set
a static name, and prevents g_task_attach_source
from setting a non-static one.
2022-11-01 11:48:33 +00:00
Matthias Clasen
01f2c5aec9 gtask: Don't overwrite source names
Only set a name in g_task_attach_source
if the source does not already have one.

Including a new test by Philip Withnall.
2022-11-01 11:48:08 +00:00
Robert Ancell
bfd7074dfc gio: Fix formatting 2022-11-01 10:20:36 +00:00
Robert Ancell
5a83f384d1 Fix meson formatting 2022-11-01 10:20:36 +00:00
Robert Ancell
568763e776 gio: Create a sandbox checking function 2022-11-01 10:20:36 +00:00
Marco Trevisan (Treviño)
c490e3c522 gio/tests/meson: Add resource plugin as test dependency 2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
407c45ddaf gio/tests/meson: Add fake-service-name as gdbus-names dependency
It uses a fake name owner that we didn't depend on
2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
ed013f9550 gio/tests/meson: Make giomodule test to depend on built modules
These are loaded dynamically so we need to ensure they're available at
test time
2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
ff195b6e0d gio/tests/meson: Add dbus-launch as dependency of gdbus-address-get-session 2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
fd2b4e4ca4 gio/tests/meson: Add glib-compile-schemas as dependency for gsettings test 2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
0525a32c09 gio/tests/meson: Add fake-document-portal as dependency of dbus-appinfo
It uses the portal, but it doesn't depend on it.
2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
cb85b26dd2 gio/tests/meson: Add gdbus-connection-flush-helper as dependency of connection tests 2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
01349e8e7f gio/tests/meson: Add gdbus-testserver prog as dependency of GDbus tests
Most gdbus tests launch the gdbus-testserver binary, so add it as
dependency of such tests.
2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
caf75d8f9c gio/tests/meson: Add basic-application as prerequisite of gapplication
It's currently commented code, but in any case it's better to build it
earlier
2022-11-01 01:56:27 +01:00
Marco Trevisan (Treviño)
97b0e96577 gio/tests/meson: Add gsubprocess-testprog as gsubprocess dependency
It launches such binary, so add it as prerequisite.
2022-11-01 01:56:20 +01:00
Marco Trevisan (Treviño)
e1e4084ecb gio/tests/meson: Add appinfo-test and apps as appinfo tests dependency
We need to make sure that such binaries are built and available at test time
or we may fail some tests requiring them (directly or through desktop file).

As per this, and because now generated desktop files are available both
at build and install time, don't skip some tests we were used to, but
actually enforce they are running.
2022-11-01 01:56:10 +01:00
Marco Trevisan (Treviño)
a1a0a9d75a gio/meson: Make possible for test to depend on extra programs
We have some test programs on which some tests depend on, for example
appinfo-test is a tool that is used by the desktop-app-info tests.

So test can now have an 'extra_programs' key where the extra program
names can be included.

This could have been handled manually via 'depends', but this allows
to avoid repeating code and be sure that all is defined when extra
programs targets are checked.
2022-11-01 01:56:09 +01:00
Philip Withnall
176f66502d tests: Reduce an unnecessary sleep from desktop-app-info test
`g_app_info_launch_default_for_uri_async()` has already returned by this
point, so waiting a long time is not really going to help.

Wait for 3× as long as the successful case took, which should allow for
long enough to catch true negatives, with a bit of variance.

On my system, this means waiting for about 14ms, rather than the 100ms
which this previous slept for. This speeds the test up by about 5%.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-11-01 00:33:40 +00:00
Marco Trevisan (Treviño)
e9cbcfff80 gio/tests/meson: Always generate desktop files for local builds
We were generating .desktop files with different content when installed
tests were enabled, and thus making impossible to test some cases
because there was no built file until installed.

To avoid this, always generate both versions of desktop files while
install only the one containing the install path prefix if needed.
2022-11-01 01:31:49 +01:00
Marco Trevisan (Treviño)
359c705fc6 gio/tests/meson: Make desktop-app-info depend on gio-launch-desktop
We actually use it to launch applications so it has to be built at test
time
2022-11-01 01:31:49 +01:00
Philip Withnall
cbf17c9422 Merge branch 'wip/3v1n0/support-can-fail-tests' into 'main'
meson, ci: Support tests that can fail under certain conditions

See merge request GNOME/glib!2987
2022-10-31 14:28:02 +00:00
Marco Trevisan (Treviño)
be665cdce0 glib,gio/tests: Mark some spawn tests as flaky under windows
It a may fail at times, but it generally works:

 See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346261
 See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346262
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
3c56d661d8 meson: Use test setup environment instead of repeating it everywhere 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
3e227fb528 glocalfileinfo: Define errsv only if it's used 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
b30430970a tests: Mark should_fail tests as can_fail
Even if they are expected to fail, we should not use an inverse logic
for treating their return codes.
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
8d5ae3ae83 ci: Mark failing mingw tests as can-fail and do not ignore test failures 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
54a9e797fe ci: Mark failing windows tests as can-fail and do not ignore test failures 2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
b9e085537d meson: Expose library build type as global variables
Given that it can be computed using an error-prone strings comparisons it
is better to provide a variable everywhere, so that we don't have the
risk of comparing values that are always false.
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
914bb06ab4 gio: mark codegen test as can-fail in freebsd
See: https://gitlab.gnome.org/GNOME/glib/-/issues/2764
2022-10-31 14:08:31 +01:00
Marco Trevisan (Treviño)
62dca6c1cf meson, ci: Support tests that can fail under certain conditions
We have tests that are failing in some environments, but it's
difficult to handle them because:
 - for some environments we just allow all the tests to fail: DANGEROUS
 - when we don't allow failures we have flacky tests: A CI pain

So, to avoid this and ensure that:
 - New failing tests are tracked in all platforms
 - gitlab integration on tests reports is working
 - coverage is reported also for failing tests

Add support for `can_fail` keyword on tests that would mark the test as
part of the `failing` test suite.
Not adding the suite directly when defining the tests as this is
definitely simpler and allows to define conditions more clearly (see next
commits).

Now, add a default test setup that does not run the failing and flaky tests
by default (not to bother distributors with testing well-known issues) and
eventually run all the tests in CI:
 - Non-flaky tests cannot fail in all platforms
 - Failing and Flaky tests can fail

In both cases we save the test reports so that gitlab integration is
preserved.
2022-10-31 14:08:29 +01:00
Marco Trevisan
4339df0583 Merge branch 'portal-support-missing-guards' into 'main'
portal: Fix broken header guard

See merge request GNOME/glib!3035
2022-10-31 12:31:01 +00:00
Robert Ancell
0239417935 portal: Fix broken header guard
This wouldn't have caused an issue with the current header contents, but could have triggered a future bug.
2022-10-31 12:08:41 +01:00
Marco Trevisan (Treviño)
dd422a0588 gio/tests/win32-streams: Avoid doing sign casting when we can
the offset can be just an unsigned parameter so that we don't have to cast
the sizeof (DATA) result.
2022-10-31 12:02:57 +01:00
Philip Withnall
9f10881574 Merge branch 'wip/smcv/autofd' into 'main'
gstdio: Silence "Not available before" warnings for inline functions

Closes #2796

See merge request GNOME/glib!3026
2022-10-27 21:55:09 +00:00
Marco Trevisan
d0b3021f7f Merge branch 'nirbheek/gmodule-suffix-deprecation' into 'main'
Improve g_module_open(), deprecate G_MODULE_SUFFIX

Closes #520 e #1413

See merge request GNOME/glib!2950
2022-10-27 16:27:42 +00:00
Nirbheek Chauhan
958d0f9b9b tests: Fix resources test on macOS
The content type detection is not very specific on macOS.
2022-10-27 20:26:53 +05:30
Nirbheek Chauhan
d941558ee9 Improve g_module_open(), deprecate G_MODULE_SUFFIX
G_MODULE_SUFFIX is deprecated now because you will get the wrong
results using it most of the time:

1. The suffix on macOS is usually 'dylib', but it's 'so' when using
   Autotools, so there's no way to get the suffix correct using
   a pre-processor macro.
2. Prefixes also vary in a platform-specific way. You may or may not have
   a 'lib' prefix for the name on Windows and on Cygwin the prefix is
   'cyg'.
3. The library name itself can vary per platform. For instance, you may
   want to load foo-1.dll on Windows and libfoo.1.dylib on macOS. This
   is for libraries, not modules, but that is still a use-case that
   people use the GModule API for.

g_module_build_path() does take care of (2) on Cygwin, but it
fundamentally cannot handle the possibility of multiple options for
the module name, since it does not do any I/O. Hence, it is also
deprecated.

Instead, g_module_open() has been improved so that it takes care of
all this by searching the filesystem for combinations of possible
suffixes and prefixes on each platform. Along the way, the
documentation for it was also improved to make it clearer what it
does.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/520

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1413
2022-10-27 20:26:53 +05:30
Simon McVittie
a62dd272d8 tests: Test that we can include all headers with an old MAX_VERSION
In principle we could script this so that each max-version.c is compiled
26 times, once per possible MAX_VERSION, but I haven't implemented
that here: just pinning to the oldest possible version is sufficient to
reproduce #2796.

These aren't included in the installed-tests, since they don't really
do anything at runtime (the important thing is that they compile
without warnings).

Reproduces: #2796
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-27 14:50:48 +01:00
Maxime Gervais
ae65753b16 Add kgx (gnome console) known terminals lists 2022-10-27 00:21:39 +02:00
Simon McVittie
65016fddd9 Replace all uses of G_VA_COPY with Standard C va_copy
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-26 18:07:55 +01:00
Marco Trevisan
b9e68b0bd4 Merge branch 'support-xdg-terminal-exec' into 'main'
Add support for xdg-terminal-exec for handling desktop applications using 'Terminal=true'

See merge request GNOME/glib!2839
2022-10-26 17:03:12 +00:00
Max Gautier
dd9bc7cf59 gio: test xdg-terminal-exec usage 2022-10-26 18:41:26 +02:00
Max Gautier
22e1b9bcc0 gio: add xdg-terminal-exec as a known terminal
Allow users to select their terminal of choice by using the
xdg-terminal-exec wrapper.

It is a temporary temporary solution while waiting for the
xdg-default-apps specification
(https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/54), in
accordance with this comment:
https://gitlab.gnome.org/GNOME/glib/-/issues/338#note_1076172
2022-10-26 18:41:26 +02:00
Max Gautier
b64347d279 gio: add support for terminal with no option
Introduce support for terminals executing commands without an option,
i.e., the command is passed directly as argument to the terminal emulator.
This is needed for xdg-terminal-exec.
2022-10-26 18:41:26 +02:00
Max Gautier
eb2d1d8fc8 gio: Refactor the known terminals search
Get rid of multiple conditionals branch by using a loop and storing the
options needed by particular terminal emulators directly in an array.
Remove intermediate variable term_argv as we don't need it.

Advantages:
- simpler logic, less branching
- the terminal emulator list is more readable, by virtue of being
  condensed in one array. Launch options to execute a terminal program
  are also more explicitly specified
- the logic become independent from the order
- one less allocation
2022-10-26 18:15:26 +02:00
Xavier Claessens
b8a0ffa1b9 meson: Add missing install tags 2022-10-26 11:55:56 -04:00
Marco Trevisan (Treviño)
e955cd4842 gio: Install empty glib gio modules dir on install
This requires to keep the relative path around not to have to play with
paths too much at python level.
2022-10-26 17:39:23 +02:00
Philip Withnall
010d831e0e Merge branch 'fix-desktop-app-info-leak' into 'main'
gio/gdesktopappinfo: Free the wrapped argv array on launch failure

See merge request GNOME/glib!3008
2022-10-26 09:28:08 +00:00
Marco Trevisan (Treviño)
dafd6602dc gio/gdesktopappinfo: Free the wrapped argv array on launch failure
We create an array that we never free, ensure this is the case.
The previous commit gives CI a chance to check this with valgrind job.

Found as part of another review:
 - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839#note_1524922
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
37e61d66c3 gio/tests/desktop-app-info: Add test to check failure on launch as manager
Trying to use invalid Fd's numbers so that this would fail early.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
6bbc72d2c4 gio/tests/desktop-app-info: Add a TestLaunchContext to improve SN testing
Add a custom launch context implementation so that we can test the
startup notification code better.
2022-10-25 14:33:25 +02:00
Marco Trevisan (Treviño)
ec67c7dbf2 desktop-app-info: Run test without display, they work with no issue 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
d4a31897ab tests/desktop-app-info: Check if launched signal is emitted 2022-10-25 14:31:02 +02:00
Marco Trevisan (Treviño)
836fd0563d meson: Remove unneeded install_tag's on headers
Meson is able to handle this automatically when we're installing in the
include-dir prefix.
2022-10-24 21:09:49 +02:00
Marco Trevisan (Treviño)
6dd222e753 meson: Cleanup include-dir paths, use base path without repetitions
Avoid setting the subdir all the times, just use the global definition
plus the specific module subdir
2022-10-24 21:09:09 +02:00
Marco Trevisan (Treviño)
341895a19e glib, gmodule, gobject: Add generated headers to the lib dependency
This requires changing them from being generated sources at compile time
to custom targets, but it also ensures that they are actually there when
needed, in fact currently we may instead try to compile files that requires
them without having been generated yet.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346914 (glib)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2344802 (gmodule)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2345205 (gobject)
2022-10-23 18:04:56 +02:00
Simon McVittie
662661a8d0 Merge branch 'wip/pwithnall/macos-file-info-test-fixed' into 'main'
build: Mark the g-file-info test as succeeding

See merge request GNOME/glib!3004
2022-10-21 18:56:12 +00:00
msizanoen1
9151fe94cb gio: remove pointless use of g_unix_socket_address_abstract_names_supported with unix:tmpdir=
There's no point in checking for
g_unix_socket_address_abstract_names_supported now that unix:tmpdir=
always use non-abstract sockets.
2022-10-21 22:09:06 +07:00
msizanoen1
c0a1a3b384 gio/gdbusserver: use non-abstract socket for unix:tmpdir=
This implements https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/350
for GDBus's server implementation.

Abstract sockets belong to the network namespace instead of the mount
namespace. As a result, mount namespace-based sandboxes (e.g. Flatpak)
cannot restrict access to abstract sockets (and therefore GDBus's
unix:tmpdir= server addresses), at least for applications with network
access permission, which may result in sandbox escapes unless the
application running the GDBus server explicitly check that the connecting
process is not in a sandbox. As of the time of writing, no known
applications using GDBusServer does this.

Fix this by always using non-abstract sockets for unix:tmpdir=, which is
allowed by the DBus specification.
2022-10-21 22:08:11 +07:00
Philip Withnall
d0eaccccad build: Mark the g-file-info test as succeeding
Previously it was marked as failing on macOS, but commit
ed3998b390 seems to have fixed that. yay!

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

Helps: #1392
2022-10-21 15:48:33 +01:00
Ross Burton
ed3998b390 gio/tests/g-file-info: don't assume million-in-one events don't happen
The access and creation time tests create a file, gets the time in
seconds, then gets the time in microseconds and assumes that the
difference between the two has to be above 0.

As rare as this may be, it can happen:

$ stat g-file-info-test-50A450 -c %y
2021-07-06 18:24:56.000000767 +0100

Change the test to simply assert that the difference not negative to
handle this case.

This is the same fix as 289f8b, but that was just modification time.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2022-10-20 14:41:56 +01:00
Philip Withnall
e6fa40bf99 Merge branch 'wip/3v1n0/add-darwin-os' into 'main'
meson: Define G_OS_DARWIN when compiling under OSX or iOS

See merge request GNOME/glib!2981
2022-10-20 11:41:48 +00:00
Philip Withnall
5b01b47c34 Merge branch 'gicon-introspect-vfuncs' into 'main'
gicon: Add introspection for to_tokens / from_tokens vfunc's

See merge request GNOME/glib!2937
2022-10-20 11:39:04 +00:00
Marco Trevisan (Treviño)
476e33c3f3 gio, glib: Use G_OS_DARWIN for code that is for such environments
While we preserved the COCOA/CARBON cases when specific libraries are
needed.
2022-10-20 03:37:21 +02:00
Philip Withnall
4b6cc2d87b Merge branch 'gtask-bitfields-fix' into 'main'
gtask: Use unsigned bit-field struct values to avoid warnings

See merge request GNOME/glib!2979
2022-10-19 11:32:25 +00:00
Ray Strode
8f85fa163b tests: Check for public.text not text/plain on OSX
The "content type" on OSX is a Uniform Type Identifier not a MIME
type, so make sure to use the right format in the empty file test.
2022-10-18 16:02:49 -04:00
Ray Strode
9d0d30c9d2 tests: Don't run du on osx
The du command that ships on OS X doesn't understand
--bytes, so don't try to use du on that platform.
2022-10-18 16:02:02 -04:00
Marco Trevisan (Treviño)
4398d140c7 gtask: Use unsigned bit-field struct values to avoid warnings
In recent Clang we may get a build warning as per:

  ../gio/gtask.c: warning: implicit truncation from 'int' to a
    one-bit wide bit-field changes value from 1 to -1
    [-Wsingle-bit-bitfield-constant-conversion]

This is because we use gboolean (and thus a signed type) for bit-fields.
Now, this is not an issue in practice for the way we're using them, but
still better to mute such compiler warns in the right way.
2022-10-18 21:28:00 +02:00
Ray Strode
11ca3da091 Merge branch 'halfline/test-case-pipe-confusion' into 'main'
tests/desktop-app-info: Make sure scripts writes to the right end of the pipe

See merge request GNOME/glib!2969
2022-10-18 17:57:52 +00:00
Marco Trevisan
2c90a563ae Merge branch 'unix-streams-fixes' into 'main'
tests: Fix race condition on cancellation in unix-streams test

See merge request GNOME/glib!2963
2022-10-18 16:30:19 +00:00
Marco Trevisan
337763bcf3 Merge branch 'always-sniff-xdg-mime' into 'main'
glocalfileinfo: Ensure we always sniff some data to get the content type

Closes #2742

See merge request GNOME/glib!2887
2022-10-18 16:27:25 +00:00
Ray Strode
04c8a6bc61 Revert "tests: Temporarily disable desktop-app-info terminal test on FreeBSD"
Since we no longer require /proc for the desktop-app-info test, we can
run it on FreeBSD again.

This reverts commit 3235eee0e2.
2022-10-18 12:15:10 -04:00
Ray Strode
4657e9bf60 tests/desktop-app-info: Use named pipe instead of /proc
Freebsd doesn't always have /proc mounted, so relying on
/proc for the tests isn't ideal.

This commit changes the desktop-app-info tests to use
mkfifo instead of /proc/../fd/.. to relay terminal
arguments.

Might help with this error message I'm seeing in CI:

/tmp/bin-path-H1UQT1/gnome-terminal: cannot create /proc/38961/fd/6: No such file or directory
2022-10-18 12:15:10 -04:00