Commit Graph

7909 Commits

Author SHA1 Message Date
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
Marco Trevisan (Treviño)
846e68befd glocalfileinfo: Ensure we always sniff some data to get the content type
In case the XDG database is not initialized yet we may try to sniff a
0-length data, making our content-type routines to mark non-empty files
as `application/x-zerosize`.

This is wrong, so in case the sniff size is not set, let's just
try to read the default value. To avoid false-application/x-zerosize
results (that are not something we want as per legacy assumptions).

See: https://bugzilla.gnome.org/show_bug.cgi?id=755795

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2742
2022-10-18 17:46:38 +02:00
Marco Trevisan
baa766295d Merge branch 'fix-desktop-app-info' into 'main'
tests: Fix minor race in desktop-app-info terminals test

See merge request GNOME/glib!2968
2022-10-18 14:44:42 +00:00
Emmanuele Bassi
52917f57ca Merge branch 'wip/pwithnall/2781-desktop-app-info-proc-bsd' into 'main'
tests: Temporarily disable desktop-app-info terminal test on FreeBSD

See merge request GNOME/glib!2972
2022-10-18 12:33:20 +00:00
Marc-André Lureau
d95cf75bf0 gio/module: ignore module leak
A module must exist forever after it is loaded. If it's not referenced
anywhere, as with some gio tests, ASAN will report direct leaks. Silence
those.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-18 14:31:31 +04:00
Philip Withnall
3235eee0e2 tests: Temporarily disable desktop-app-info terminal test on FreeBSD
It’s often (but not always) failing on the CI machines with a timeout
which looks like the FD sharing via `/proc` isn’t reliably working.

Disable this test (but not the whole `desktop-app-info` test suite) on
FreeBSD until someone who has access to a FreeBSD machine can debug it.

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

Helps: #2781
2022-10-18 10:35:17 +01:00
Marc-André Lureau
3967d1da56 Revert "gio/module: fix leak when there is no cache"
This reverts commit ad0fd6c5d9.

The type system actually keeps a weak reference on the module/plugin.
g_type_module_unuse() documentation is explicit "Once a #GTypeModule is
initialized, it must exist forever."

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-18 10:53:38 +04:00
Philip Withnall
1c42e2da25 tests: Fix minor race in desktop-app-info terminals test
The implementation of `g_desktop_app_info_launch_uris()` will spawn the
exec file once for each URI unless the desktop file has a placeholder in
its Exec line which supports multiple URIs at once.

The fake terminal doesn’t have such a placeholder, so the fake terminal
script is spawned twice in quick succession, once for each URI. Since it
was making two separate printf calls (one to print the output to the
pipe, and one to terminate it with a newline), it’s possible that two
invocations of the script could interleave their printf calls, resulting
in pipe input along the lines of `URI1 URI2 newline newline` rather than
`URI1 newline URI2 newline`.

This would cause the test to fail.

Fix that by making the script atomic by moving the newline into the
first printf call.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2339109:
```
\# Fake 'nxterm' terminal created as: /tmp/bin-path-R6GWT1/nxterm
\# 'nxterm' called with arguments: '-e true nxterm-argument /tmp/bin-path-R6GWT1-e true nxterm-argument /tmp/test_desktop-app-info_CO92T1/desktop-app-info/launch-uris-with-terminal/nxterm/.dirs/data'
Bail out! GLib-GIO:ERROR:../gio/tests/desktop-app-info.c:1294:test_launch_uris_with_terminal: assertion failed (g_strv_length (output_args) == 4): (7 == 4)
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-17 17:40:53 +01:00
Philip Withnall
eef6ea9b3b Merge branch '2726-fuse-remote' into 'main'
glocalfile: Support marking fuse.sshfs filesystems as remote

Closes #2726

See merge request GNOME/glib!2966
2022-10-17 16:17:30 +00:00
Philip Withnall
bcb5eee0ea glocalfile: Support marking fuse.sshfs filesystems as remote
This requires checking the type of a filesystem using `/proc/mounts`
rather than `statfs()`, since `statfs()` doesn’t give the subtype of the
mount. So it only returns `fuse` rather than `fuse.sshfs`.

This commit changes the output of `gio info -f ./path/to/local/sshfs/mount`
from `filesystem::remote: FALSE` to `filesystem::remote: TRUE`.

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

Fixes: #2726
2022-10-17 16:05:58 +01:00
Philip Withnall
be9e268c6a tests: Use g_assert_*() rather than g_assert() in unix-streams
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-17 13:03:26 +01:00
Philip Withnall
0c1fa95827 tests: Fix race condition on cancellation in unix-streams test
The cancellable may be cancelled just after the operation succeeds in a
different thread. So instead of checking whether the cancellable is
cancelled, check whether the operation returned a `CANCELLED` error, and
*then* assert that the cancellable is cancelled.

This should fix
https://pwithnall.pages.gitlab.gnome.org/-/glib/-/jobs/2338552/artifacts/_build/meson-logs/testlog.txt:
```
ok 1 /unix-streams/basic
Bail out! GLib-GIO:ERROR:../gio/tests/unix-streams.c:149:main_thread_skipped: assertion failed (err == (g-io-error-quark, 19)): err is NULL
stderr:
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-17 13:02:02 +01:00
Philip Withnall
09459fa44d gthreadedresolver: Comment on name expansion for SRV targets
See the commit contents. This clarifies the existing code’s behaviour
and doesn’t change it.

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

Fixes: #2622
2022-10-17 12:46:01 +01:00
Marc-André Lureau
ad0fd6c5d9 gio/module: fix leak when there is no cache
GIOModule is a helper object, we keep it around when there is a cache,
but we should free it otherwise.

Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 14:32:15 +04:00
Marc-André Lureau
60b8916fee tests/gmenumodel: fix various leaks
Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 14:11:36 +04:00
Philip Withnall
292c117b98 Merge branch 'w32-tests' into 'main'
Various win32 test fixes

See merge request GNOME/glib!2952
2022-10-17 09:53:44 +00:00
Marc-André Lureau
30e7a00017 tests/contenttype: icon name text/plain doesn't have text-x-generic on win32
The g_content_type_get_icon() function for win32 can lookup the
DefaultIcon associated with .txt and return a different result.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:01:00 +04:00
Marc-André Lureau
f23d8a9087 gio/locafileinfo: fix set_mtime_atime on win32
Use a similar behaviour as the utime()/posix implementation and query
the current times to allow modifying only usec/nsecs parts.

Fixes tests/g-file-info on win32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 10:52:11 +04:00
Marc-André Lureau
c3494ce5dc tests/file-thumbnail: make it work with win32 paths
On Win32, we get paths with mixed \\ and /, use GFile to resolve and
normalize the paths before comparing.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 10:43:59 +04:00
Philip Withnall
4bc284fca6 Merge branch 'wip/smcv/deprecated-prop-followup' into 'main'
Run tests with G_ENABLE_DIAGNOSTIC=1

See merge request GNOME/glib!2889
2022-10-15 21:31:29 +00:00
Philip Withnall
1e9cf21b30 Merge branch 'desktop-app-info-terminal-tests' into 'main'
tests/desktop-app-info: Add tests to verify if launching with terminal works

See merge request GNOME/glib!2884
2022-10-14 15:30:04 +00:00
Philip Withnall
6fab8a8cd9 Merge branch 'macos-gio-modules' into 'main'
giomodule: Automatically detect modules on macOS

See merge request GNOME/glib!2848
2022-10-14 15:29:04 +00:00
Xavier Claessens
4e44cea486 gdbus example: Every DLL must have its own visibility macro 2022-10-13 20:53:56 -04:00
Xavier Claessens
8733d172a3 Do not define GIO_COMPILATION for executables
It must only be defined when building libgio. This requires some
workaround to allow include of some gio private headers.

When GIO_COMPILATION is not defined we cannot include individual gio
headers. We workaround that by defining __GIO_GIO_H_INSIDE__ in some
places. Also gdbusprivate.h is not an installed header, so it's fine to
include it directly.
2022-10-13 20:53:56 -04:00
Xavier Claessens
90fcbc7dfc giomodules: g_io_module_* must always be exported
Those symbols are not used by GIO itself but by external modules.
2022-10-13 20:53:56 -04:00
Xavier Claessens
e5565f6635 Rename all visibility macros 2022-10-13 20:53:56 -04:00
Xavier Claessens
dcfc9f689e Fix symbol visibility macros on Windows
There is currently no `dllimport` attribute on any of our function,
which prevents MSVC to optimize function calls.

To fix that issue, we need to redeclare all our visibility macros for
each of our libraries, because when compiling e.g. GIO code, we need
dllimport in GLIB headers and dllexport in GIO headers. That means they
cannot use the same GLIB_AVAILABLE_* macro.

Since that's a lot of boilerplate to copy/paste after each version bump,
this MR generate all those macros using a python script.

Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'`
keyword argument instead of passing the cflag manually.

This leaves only API index to add manually into glib-docs.xml when
bumping GLib version. That file cannot be generated because Meson does
not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg
unfortunately.
2022-10-13 20:53:56 -04:00
Piotr Brzeziński
af83c6571e giomodule: Automatically detect modules on macOS
Makes use of relocatable prefixes, allowing gio to find modules
automatically without needing to set the GIO_EXTRA_MODULES env var.
2022-10-14 05:21:09 +05:30
Philip Withnall
c16f524034 Merge branch 'static' into 'main'
tests: skip shared libs if default_library=static

See merge request GNOME/glib!2867
2022-10-12 16:19:02 +00:00
Alyssa Ross
1dc8d69edb tests: skip shared libs if default_library=static
Otherwise, the build will fail when the toolchain is static-only, even
with -Ddefault_library=static.  I talked to a Meson developer in their
IRC channel, who told me that the correct fix was to ensure that
shared_library is only used if default_library != static.
2022-10-12 16:49:39 +01:00
Philip Withnall
057a9e5773 Merge branch 'test-actions-parallel-fix' into 'main'
tests/desktop-app-info: Use unique temporary paths for action files

See merge request GNOME/glib!2885
2022-10-12 14:41:27 +00:00
Philip Withnall
5d504709ab Merge branch 'more-gio-thumbnail-sizes' into 'main'
glocalfileinfo: Add support for xx-large and x-large thumbnails

Closes #2767

See merge request GNOME/glib!2941
2022-10-12 13:43:07 +00:00
Philip Withnall
e90733a457 Merge branch 'atomic-older-cplusplus' into 'main'
gatomic: fix the atomic compare_and_exchange macros on older C++ standard versions

See merge request GNOME/glib!2864
2022-10-12 09:56:19 +00:00
Marco Trevisan (Treviño)
3f1724d832 tests/desktop-app-info: Add tests to verify if launching with terminal works
Simulate launching applications using terminals by creating scripts on
the fly that are named as the terminals that we support, ensuring that
these are called with the arguments that we expect.

Related to: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839
2022-10-11 21:46:01 +02:00
Marco Trevisan (Treviño)
e7a68531b3 glocalfileinfo: Add support for xx-large and x-large thumbnails
Co-Authored-by: António Fernandes <antoniof@gnome.org>

Closes: #2767
2022-10-11 20:58:58 +02:00
Marco Trevisan (Treviño)
9bb1410c54 gio/tests: Add file-thumbnail tests
Check if thumbnails are created in the path we expect and that we can
retrieve their information, but also that we try to get the biggest size
available when multiple are available.
2022-10-11 20:58:58 +02:00
Marco Trevisan
cf4d8a3bdc Merge branch 'osx-declaration-mixes-fix' into 'main'
gosxcontenttype: Do not mix declarations with code

Closes #2759

See merge request GNOME/glib!2909
2022-10-11 13:24:57 +00:00
Marco Trevisan (Treviño)
60587d5965 tests/file: Include config.h so tests checking HAVE_* definitions are ran
We have tests depending on HAVE_UTIMES and HAVE_UTIMENSAT that were
currently not compiled because these were always undefined
2022-10-11 14:37:12 +02:00
Marco Trevisan (Treviño)
b1d4b4bb3b glocalfileinfo: Avoid getting unused type values 2022-10-11 14:24:17 +02:00
Jared Wahlstrand
15cb123c82 glocalfileinfo: don't call both utimes and utimensat
also split us precision and ns precision code to make this cleaner
2022-10-11 14:10:28 +02:00
Marco Trevisan
db259b5925 Merge branch 'atime' into 'main'
tests: skip g-file-info test if atime unsupported

See merge request GNOME/glib!2866
2022-10-10 15:32:06 +00:00
Philip Withnall
1d2ea6518c Merge branch 'fix-unix-streams-error-leak' into 'main'
tests/unix-streams: Free the cancelled error on cancelled cancellable

See merge request GNOME/glib!2892
2022-10-10 12:02:56 +00:00
Marco Trevisan (Treviño)
5a6ce16142 gicon: Do not mark g_icon_to_string() as to_tokens() invoker
That's not strictly true as they've different signature, and this leads
to some introspection and documentation errors.
2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
c3ebf6cdca gicon: Add virtual invokers for equal() and serialize() 2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
7ea5e4c293 gicon: Force g_icon_hash argument to be Gio.Icon for bindings 2022-10-06 17:25:13 +02:00
Marco Trevisan (Treviño)
19cfc55847 gicon: Add introspection for to_tokens / from_tokens vfunc's
The GIconIface virtual functions were not introspectable as they use
complex parameters that GI isn't able to compute alone.

So provide introspection metadata to the two function pointers
definitions.

GIcon::from_tokens is a static virtual function so it won't actually
work until GI support for it [1] is merged.

[1] https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/361
2022-10-06 17:25:10 +02:00
Peter Williams
7f7171e68a gio: properly guard use of utimensat()
Closes #2766.
2022-09-21 11:56:33 -04:00
Simon McVittie
25d21edb32 gio/tests: Disable deprecation warnings where necessary
The defaultvalue test sets all properties, even the deprecated ones.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:19:31 +01:00
Simon McVittie
88e160dfe4 tests: Move common test environment variables to top level
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21 11:19:28 +01:00
Marco Trevisan
87b4771d1f Merge branch 'install-tag-2' into 'main'
meson: Set install_tag remaining installed files

See merge request GNOME/glib!2905
2022-09-21 10:05:18 +00:00
Xavier Claessens
a73ca336aa meson: Set install_tag on remaining installed files 2022-09-20 11:30:12 -04:00
Xavier Claessens
c00df192ee meson: Set install_tag on installed tests files
This could be done automatically by Meson, this commit can be reverted
when we have that Meson PR in our CI:
https://github.com/mesonbuild/meson/pull/10829
2022-09-20 11:30:02 -04:00
Marco Trevisan (Treviño)
5fc8a476c8 gosxcontenttype: Do not mix declarations with code
Fixes: #2759
2022-09-20 15:41:08 +02:00
Marco Trevisan
7b53edbf26 Merge branch 'local-output-stream-prevent-double-fd-close' into 'main'
glocalfileoutputstream: Do not double-close an fd on unlink error

See merge request GNOME/glib!2901
2022-09-20 13:19:04 +00:00
Marco Trevisan
51cf76ebb0 Merge branch 'kjellahl/gio-launch-desktop-clang' into 'main'
gio-launch-desktop: Fix the G_STATIC_ASSERT expressions for clang

Closes #2740

See merge request GNOME/glib!2898
2022-09-19 15:04:21 +00:00
Marco Trevisan
65abaa76c5 Merge branch 'task_get_cancellable_nullable' into 'main'
gio: make g_task_get_cancellable return value (nullable)

See merge request GNOME/glib!2899
2022-09-19 15:02:39 +00:00
Marco Trevisan
22f0522c10 Merge branch 'mcatanzaro/gtype-criticals' into 'main'
Replace most GObject warnings with criticals

See merge request GNOME/glib!2852
2022-09-19 14:35:12 +00:00
Marco Trevisan (Treviño)
2401e1a090 glocalfileoutputstream: Do not double-close an fd on unlink error
In case we fail unlinking a file we could close again an FD that has
been already just closed. So avoid this by unsetting it when closing.

Coverity CID: #1474462
2022-09-16 15:11:47 +02:00
Jason Francis
9cd9787c52
gio: make g_task_get_cancellable return value nullable 2022-09-16 01:27:12 -04:00
Kjell Ahlstedt
37dba1c425 gio-launch-desktop: Fix the G_STATIC_ASSERT expressions for clang
The clang compiler requires the static_assert expression to be an integral
constant expression. `"text"` is not, but `sizeof "text"` is.

Fixes #2740
2022-09-15 12:55:18 +02:00
Marco Trevisan (Treviño)
1cbe7a6734 meson: Build C++ tests for the currently supported C++ standard versions
We've various macros definitions that are depending using C++ features
that may not work in all the standard versions, so recompile the cxx
tests that we have in all the ones we want to support.
2022-09-15 01:18:40 +02:00
Alyssa Ross
7c74fe4c1d
tests: skip based on g_file_info_has_attribute
Per review request.  Matches the style for the newly introduced skip
check in test_g_file_info_access_time.
2022-09-14 13:21:53 +00:00
Alyssa Ross
7162b3c496
tests: skip g-file-info test if atime unsupported
For example, g_file_query_info will not be able to determine access
time for files on ZFS with atime=off.
2022-09-14 13:21:39 +00:00
Marco Trevisan (Treviño)
c8e2d4a38d unix-streams: Ensure we get cancelled errors if the cancellable is cancelled 2022-09-13 16:30:12 +02:00
Marco Trevisan (Treviño)
d40ef833e3 tests/unix-streams: Free the cancelled error on cancelled cancellable
Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-13 16:29:20 +02:00
Marco Trevisan (Treviño)
02de235059 tests/desktop-app-info: Use unique temporary paths for action files
desktop-app-info test may fail when repeated with multiple concurrent
processes because the actions test relies on checking the existence of
in the shared build directory, so by doing something like:

  meson test -C _build desktop-app-info -t 0.3 --repeat 80

We may end up in timeout errors, because we are waiting for files that
have been already deleted by other processes.

To avoid this, let's rely on writing the files on `$G_TEST_TMPDIR` env
variable, that is always set and unique, given that we're using the
G_TEST_OPTION_ISOLATE_DIRS test option.
2022-09-13 02:44:25 +02:00
Xavier Claessens
a1c78d63ef meson: Set install_tag on all tools
Those tools are not needed at runtime for typical applications,
distributions typically package them separately.

This makes `meson install --tag runtime` skip installation of those
tools. Omitting `--tag` argument will still install them, as well as
with `--tag bin,bin-devel`.

See https://mesonbuild.com/Installing.html#installation-tags.
2022-09-12 09:50:31 -04:00
Luca Bacci
24572c93c2 Merge branch 'g-win32-app-info-fixes' into 'main'
GWin32AppInfo: Add missing g_spawn_close_pid

See merge request GNOME/glib!2881
2022-09-08 14:12:05 +00:00
Emmanuele Bassi
07a08d5cf5 Merge branch 'coverity-build-fix' into 'main'
gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed

See merge request GNOME/glib!2879
2022-09-07 14:07:45 +00:00
Marco Trevisan (Treviño)
07c808ad90 gioenumtypes: Only define GLIB_DISABLE_DEPRECATION_WARNINGS if needed 2022-09-07 15:31:38 +02:00
Matthias Clasen
1f4188f0ab Merge branch 'fgets-error-ignore' into 'main'
gio-tool-mount: Return early on fgets EOF

Closes #2737

See merge request GNOME/glib!2870
2022-09-06 17:22:15 +00:00
Andy Holmes
1eb1a47a50
GActionGroup: Fix ownership transfer annotation for query_action()
The `(transfer none)` behaviour for `parameter_type` and `state_type`
parameters is implicit with the `const` attribute, but was incorrectly
determined to be `(transfer full)` in the GIR.

Add explicit `(transfer none)` annotations for these two parameters.
2022-09-04 17:29:39 -07:00
Emmanuele Bassi
bafd025811 Merge branch 'ebassi/gcc-12-fixes' into 'main'
Fix array-bounds compiler warnings with GCC 12

See merge request GNOME/glib!2873
2022-09-02 23:17:25 +00:00
Marco Trevisan (Treviño)
221f22b6e1 gdesktopappinfo: Unref the GDBus call results
On our GDBus call callback wrapper we were completing the gdbus call but
ignoring the returned value, that was always leaked.

Fix this.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
026a69905e gdesktopappinfo: Unref GDBus call result GVariant if no callback is set
When launching URIs via dbus we may ignore the callback if one was not
provided, however in such case we were also leaking the return value for
the gdbus call.

Unref it properly.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
e268ff39b6 gio/tests/gdbus-peer: Unref cached property GVariant value
Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 21:21:34 +02:00
Marco Trevisan (Treviño)
1da208cddc gio/tests/gdbus-proxy-threads: Unref GVariant's that we own
This test is leaking various GVariant's that we are supposed to unref,
leading the valgrind CI job to complain about.

Helps with: https://gitlab.gnome.org/GNOME/glib/-/issues/333
2022-09-02 20:26:06 +02:00
Marco Trevisan
88d4b3b365 Merge branch 'fix-doc-portal-add-leak' into 'main'
documentportal: Fix small leak in add_documents with empty URI list

Closes #2733

See merge request GNOME/glib!2871
2022-09-02 18:24:48 +00:00
Sebastian Keller
27203e48c9 documentportal: Fix small leak in add_documents with empty URI list
When called with an empty URI list (or only inaccessible files),
g_document_portal_add_documents would not call g_variant_builder_end,
leaking the memory allocated by the variant builder.

Closes: https://gitlab.gnome.org/GNOME/glib/-/issues/2733
2022-09-02 19:48:36 +02:00
Marco Trevisan (Treviño)
511627b735 tests/dbus-appinfo: Add test case for flatpak opening an invalid file
We were testing the case in which we were opening an actual file, and so
potentially using a fd-list, however we were missing the case in which a file
was not existent.

And in such case we are incidentally hitting a leak now.
2022-09-02 19:48:36 +02:00
Emmanuele Bassi
e08c954693 Fix check before a memcpy
The search_total_results address is always going to be non-zero, so the
check will always evaluate to true, and GCC is kind enough to point this
out to us.

The appropriate fix is checking if the size of the search results array
is larger than zero, and if so, copy them into the total results array.
2022-09-02 12:59:22 +01:00
Luca Bacci
e112bdb247 GWin32AppInfo: Add missing g_spawn_close_pid 2022-09-02 12:35:17 +02:00
Marco Trevisan
2ef66ba386 Merge branch 'main' into 'main'
gio-launch-desktop: replace static_assert with G_STATIC_ASSERT

Closes #2713

See merge request GNOME/glib!2858
2022-08-31 15:06:27 +00:00
Marco Trevisan (Treviño)
a0e71ff86f gio-tool-mount: Return early on fgets EOF
As per commit a5390002 we're exiting with error in case fgets failed,
however it could also fail because of EOF (like on ^D), so in such case
we can just return early treating it as a non-error.

Otherwise still exit with error.

Fixes: #2737
2022-08-30 16:33:29 +02:00
Matthias Clasen
56236d708f Merge branch 'use-cloexec-epoll' into 'main'
gio-unix: Use EPOLL_CLOEXEC by default

See merge request GNOME/glib!2868
2022-08-27 16:37:11 +00:00
Luca Bacci
e1e9bc9429 Merge branch 'g-win32-app-info-launch-uris-async' into 'main'
GWin32AppInfo: Implement launch_uris_async

Closes gtk#4400

See merge request GNOME/glib!2760
2022-08-27 14:11:10 +00:00
Luca Bacci
53515197df GWin32AppInfo: Instantiate ApplicationActivationManager out-of-process
This is recommended on MSDN
2022-08-26 11:33:22 +02:00
Luca Bacci
d12cf95836 GDesktopAppInfo: Tidy up code a bit
* Remove an unneeded field from LaunchUrisData and add annotations
* Rename local GError* variables to local_error
* Use g_set_object
* Fix indentation
2022-08-26 11:33:22 +02:00
Luca Bacci
361b4a8fc9 GAppInfo: Clarify that GAppInfo launch methods can spawn multiple instances
...of the application if many URI's are provided. This is important to note
because the GAppLaunchContext signals may be emitted multiple times during
a single launch operation.
2022-08-26 11:33:22 +02:00
Luca Bacci
42a76e1631 GWin32AppInfo: Check for task cancellation
We cannot cancel a spawn operation, but sometimes we have to
spawn the target application mutiple times (e.g. in case the
target app only supports one URI in its command-line, but we
were given multiple URI's), in that case continuously check
the cancellation status before attempting any spawn operation
2022-08-26 11:33:22 +02:00
Luca Bacci
cff3e660c1 GWin32AppInfo: Emit GAppLaunchContext signals for all code paths 2022-08-26 11:33:09 +02:00
Colin Walters
426fab1eca gio-unix: Use EPOLL_CLOEXEC by default
First, there's no reason not to use the new `epoll_create1` system call,
which quickly obsoleted `epoll_create` which has an obsolete and
unused size argument.

But more specifically, it offers `EPOLL_CLOEXEC` which we want
to use for general hygeine - there's no reason to potentially
leak this file descriptor to forked processes.

(GLib itself carefully closes file descriptors when forking child
 processes, but it may be linked with other software that doesn't;
 notably in my case for example the Rust standard library does not
 do this and hence relies more on the application code using
 `O_CLOEXEC` and variants)

This is just a drive-by fix; I saw the system call when I was using
`strace` to debug something else in rpm-ostree.
2022-08-26 04:10:22 -04:00
Luca Bacci
f0ff6a6af0 GWin32AppInfo: Add g_win32_app_info_launch_uris_impl utility function
This utility function will be called by both launch_uris and
launch_uris_async, passing a from_task parameter respectively
as NULL and non-NULL. The from_task parameter will be needed
to know whether GAppLaunchContext signals should be emitted
directly (from_task == NULL) or scheduled for emission on the
main thread (from_task != NULL).
2022-08-16 12:29:18 +02:00
Marco Trevisan
813ce7f0b5 gio-launch-desktop: preserve static_assert message 2022-08-15 17:02:06 +00:00
Owen Rafferty
c850a06ea2
gio-launch-desktop: replace static_assert with G_STATIC_ASSERT 2022-08-15 01:41:50 -05:00
Luca Bacci
bf13a5e0a4 GWin32AppInfo: Implement launch_uris_async
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4400
2022-08-12 18:33:20 +02:00
Michael Catanzaro
0ffe86a1f7 Replace most GObject warnings with criticals
All of these warnings indicate programmer error, so critical is most
appropriate here.

Exceptions: deprecation warnings are just warnings. Also, warnings that
are worded with uncertainty can remain warnings rather than criticals.
2022-08-09 13:18:47 -05:00
Marco Trevisan (Treviño)
bcddc56c41 gtlscertificate: Update reference to G_TLS_CERTIFICATE_NO_FLAGS
G_TLS_CERTIFICATE_FLAGS_NONE was removed as part of commit aa65fc2537.
2022-08-06 01:33:15 +02:00
Marco Trevisan
a4f60709d5 Merge branch 'mcatanzaro/tls-exporter' into 'main'
Expose tls-exporter channel binding

See merge request GNOME/glib!2853
2022-08-05 22:01:37 +00:00
Michael Catanzaro
9d37075a00 Expose tls-exporter channel binding
Required for glib-networking#191
2022-08-05 16:02:09 -05:00
Marco Trevisan
6965f6457e Merge branch 'iss2588' into 'main'
gio-tool: -d option to delete attribute

Closes #2588

See merge request GNOME/glib!2845
2022-08-05 19:21:58 +00:00
Luca Bacci
d3ae4cc809 GWin32AppInfo: Ensure COM is initialized when activating UWP apps
Using the Application Activation Manager coclass. Its threading model
is marked as 'both', so it can be instantiated in any apartment type
without marshaling.
2022-08-04 21:35:08 +02:00
Luca Bacci
cdb8e5e9c5 Fix warnings in GCancellable test 2022-08-03 20:38:59 +02:00
Luca Bacci
a1737ece06 Fix GCancellable tests for Windows 64bit
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2703
2022-08-03 20:33:46 +02:00
Luca Bacci
0cb43a4965 Merge branch 'g-win32-app-info-launched-signal-actually-report-pid' into 'main'
GWin32AppInfo: Fix PID reporting in launched signal

See merge request GNOME/glib!2299
2022-08-02 14:51:26 +00:00
Luca Bacci
45bdeeddff GWin32AppInfo: Actually report the GPid in the GAppLaunchContext::launched signal
We need to pass the G_SPAWN_DO_NOT_REAP_CHILD flag to g_spawn_async,
otherwise the returned child_pid will always be 0.
2022-08-02 16:38:32 +02:00
codeboybebop
ece66f11fc gio-tool: -d option to delete attribute
gio tool has support for deleting attributes of the file. To delete attribute user
should specify type '--type="unset"'. This is not mentioned in help and therefore not
intuitive. By adding '-d' option, we make this process more obvious.

closes #2588
2022-07-31 13:19:50 -05:00
Emmanuele Bassi
a9394bd68e Implement GFileIface.set_display_name() for resource files
Resource files cannot be renamed, and GFileIface.set_display_name() is
mandatory.

Fixes: #2705
2022-07-30 20:06:07 +01:00
madmurphy
b295c53769 gfileinfo: Implement xattr attribute removal
Fixes: #1187
2022-07-26 07:58:32 +00:00
Emmanuele Bassi
8f68c1e646 Rename G_MARKUP_PARSE_FLAGS_NONE
The prefix for GMarkupParseFlags enumeration members is G_MARKUP; this
means that G_MARKUP_PARSE_FLAGS_NONE gets split into
GLib.MarkupParseFlags.PARSE_FLAGS_NONE by the introspection scanner.

The `/*< nick=none >*/` trigraph attribute is a glib-mkenum thing, and
does not affect the introspection scanner; it would also only affect the
GEnumValue nickname, which is not used by language bindings to resolve
the name of the enumeration member. Plus, GMarkupParseFlags does not
have a corresponding GType anyway.
2022-07-25 22:30:22 +01:00
Emmanuele Bassi
aa65fc2537 Rename G_TLS_CERTIFICATE_FLAGS_NONE
The prefix is G_TLS_CERTIFICATE, not G_TLS_CERTIFICATE_FLAGS. Having
G_TLS_CERTIFICATE_FLAGS_NONE leads to a FLAGS_NONE nick in the GType,
and a FLAGS_NONE member name in the introspection data.
2022-07-25 22:30:22 +01:00
Emmanuele Bassi
09234b50fe Introduce G_APPLICATION_DEFAULT_FLAGS
Enumeration members should either have the name of the type as their
prefix, or they should all have the same prefix.

The "default flags" enumeration member for GApplicationFlags is
unfortunately named G_APPLICATION_FLAGS_NONE, while every other member
of the same type has a G_APPLICATION prefix. The result is that the nick
name of the enumeration member is "flags-none", and that language
bindings will have to use something like
Gio.ApplicationFlags.FLAGS_NONE.

To fix this API wart, we can deprecate the FLAGS_NONE member, and add a
new DEFAULT_FLAGS.
2022-07-25 22:30:22 +01:00
Simon McVittie
94e05f7f28 gio-launch-desktop: Only replace fds that point to the Journal
If stdout is the Journal but stderr is not, then we probably only want
to redirect stdout, or vice versa.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 10:21:35 +01:00
Philip Withnall
30c840a755 Merge branch 'wip/smcv/gio-launch-desktop-sd-journal' into 'main'
Bring back gio-launch-desktop, use it to redirect stdout/stderr to the Journal

Closes #2682

See merge request GNOME/glib!2819
2022-07-24 23:31:27 +00:00
Philip Withnall
9c1b2399ec Merge branch 'iss2542' into 'main'
gio-tool: Flatten the outputed string

Closes #2542

See merge request GNOME/glib!2834
2022-07-24 23:13:06 +00:00
Simon McVittie
f736414825 gio-launch-desktop: Don't alter stdout/stderr if not already the Journal
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:54 +02:00
Simon McVittie
763643ceaa gio-launch-desktop: Redirect stdout, stderr to systemd Journal
This prevents a launched process's output from being mixed up with the
output of the parent process, which can lead to the wrong program being
blamed for warning messages.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:54 +02:00
Simon McVittie
ae15c800ce Install gio-launch-desktop in a non-PATH location
This is an internal helper executable, which users shouldn't invoke
directly (see glib#1633).

When building for a single-architecture distribution, we can install
it as ${libexecdir}/gio-launch-desktop.

When building for a multiarch distribution, installing it into an
architecture-specific location and packaging it alongside the GLib
library avoids the problem discussed in glib#1633 where it would either
cause a circular dependency between the GLib library and a common
cross-architecture package (libglib2.0-bin in Debian), or require a
separate package just to contain gio-launch-desktop, or cause different
architectures' copies to overwrite each other.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
8157668eac gdesktopappinfo: Don't trust $GIO_LAUNCH_DESKTOP if setuid
gio-launch-desktop was removed before checking GIO for potentially
unsafe environment variable references, so reverting its removal brought
this one back. If a setuid program is using GAppInfo then something is
probably already horribly wrong, but let's be careful anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
e4e21f20e2 gio-launch-desktop: Fix a compiler warning
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
6620d28333 gio-launch-desktop: Add SPDX-License-Identifier
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
6751392934 tests: Avoid using deprecated meson.build_root
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00
Simon McVittie
d0967c1d4a Revert "gdesktopappinfo: Use sh rather than gio-launch-desktop"
A shell one-liner was enough to set GIO_LAUNCHED_DESKTOP_FILE_PID,
but ideally we also want to do the equivalent of sd_journal_stream_fd()
to set up its standard output and standard error streams.

Ideally we would call sd_journal_stream_fd() in a process that will
exec the real program, otherwise it will report the wrong process ID
in the Journal, but we can't easily do that in a forked child when
using posix_spawn() for subprocesses.

This reverts commit 2b533ca99a.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-07-25 01:00:53 +02:00