Commit Graph

25517 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
44dbd43170 GAppInfo: Add async API to get default Application for content type
Make possible to fetch the Application for default content type in a
thread without using blocking I/O.
2022-06-22 20:07:30 +02:00
Marco Trevisan (Treviño)
abae8c1f05 gio/tests: Add test cases for g_file_query_default_handler[_async]
Simulating having default handlers, however this is tested only in unix
as windows may behave differently, so let's just skip it for now.
2022-06-22 20:07:30 +02:00
Marco Trevisan (Treviño)
22e951e6ac gfile: Add Async API to create a temporary directory and return as GFile
While it's possible to create a directory synchronously via
g_dir_make_tmp(), there's no such API that performs it asynchronously.

So implement it using GFile, using a thread to perform such task.
2022-06-22 20:07:30 +02:00
Marco Trevisan (Treviño)
fa24391529 gfile: Add API to create a new temporary file asynchronously
Make possible to create a new gfile with a temporary name in async
way, using the same API of g_file_new_tmp().
2022-06-22 20:07:30 +02:00
Marco Trevisan (Treviño)
2a05fd0cb0 gioerror: Rely on GFileError to compute GIOErrorEnum from errno
Avoid re defining cases for GIoErrorEnum when we already handle them
through GFileError, so remove code duplication and just rely on
g_file_error_from_errno() to compute the file error and then use
g_io_error_from_file_error() to get the possible IOError.

In case it's something not handled as GFileError, we can use the same
logic as before.

This is now a safe change to do as we have covered all the supported
cases in tests.
2022-06-22 20:07:30 +02:00
Marco Trevisan (Treviño)
b64fd312da gerror: Add an utility function to get the GIO Error from GFileError
When GIO functions are using GLib file utils functions we expect to
return a GIO Error, so provide a way to map such error values.
2022-06-22 20:07:25 +02:00
Philip Withnall
91c7dbab24 Merge branch 'update-doap' into 'main'
docs: Sync glib.doap to set of users listed in CODEOWNERS

See merge request GNOME/glib!2755
2022-06-22 15:30:37 +00:00
Philip Withnall
d312647230 docs: Sync glib.doap to set of users listed in CODEOWNERS
Listing a user in `glib.doap` is important for ensuring their access
rights are correct in GitLab (as they are synced from the DOAP file by a
sysadmin script).

When `CODEOWNERS` was written, we were assuming that GNOME’s GitLab
would get support for the `CODEOWNERS` feature in GitLab. Unfortunately,
that’s not happened, and it remains an enterprise-only feature.

As such, that means that listing a co-maintainer of GLib in `CODEOWNERS`
is not sufficient to grant them permissions to actually merge MRs or
triage issues. That means they can’t really do any co-maintaining.

So fix that by updating the DOAP from `CODEOWNERS`. This doesn’t change
the list of co-maintainers at all, or the amount of trust assumed of
anybody.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-22 15:54:49 +01:00
Philip Withnall
ebfbef1acd 2.73.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 14:02:39 +01:00
Philip Withnall
f805635e11 Merge branch 'coverity-signal-emissions' into 'main'
gsignal: Change signal instance ref semantics under static analysis

See merge request GNOME/glib!2762
2022-06-21 12:54:41 +00:00
Philip Withnall
95d548ab03 gsignal: Change signal instance ref semantics under static analysis
As with commit 0932f71460, which did this for refs/unrefs of the
object in `g_object_notify()`, we need to do a similar thing for
refs/unrefs of the instance with `g_signal_emit()`, for all the same
reasons.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 13:27:52 +01:00
Emmanuele Bassi
55a5a82655 Merge branch 'tls-certificate-refs' into 'main'
gtlscertificate: Hold a ref on the root certificate when building chains

See merge request GNOME/glib!2761
2022-06-21 12:09:22 +00:00
Emmanuele Bassi
be7d824053 Merge branch '2672-accel-group-crash' into 'main'
gobject: Fix crash when disposing a GtkAccelGroup

See merge request GNOME/glib!2756
2022-06-21 12:03:02 +00:00
Philip Withnall
1aaf1e7de1 tests: Allow signal-handler performance tests to be smoketested
As with the previous commit, allow them to be smoketested when run
without `-m perf`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
421c238e81 tests: Allow utf8-performance tests to be smoketested
As with the previous commit, allow them to be smoketested when run
without `-m perf`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
e51c80591b tests: Allow mutex performance tests to be smoketested
As with the previous commit, allow them to be smoketested when run
without `-m perf`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
419f882952 tests: Allow bitlock performance test to be smoketested
Allow it to be run with a reduced iteration count when not run as `-m
perf`, in order to check that the test still works.

Previously it would do nothing when run without `-m perf`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
6f435e40cd tests: Run GObject performance tests under meson test
Pass arguments to them so that they take minimal time. This will not
produce useful performance profiling results, but will smoketest that
the tests still run, don’t crash, and therefore probably aren’t
bitrotting too badly.

This is useful because a fair amount of work has gone into these
performance tests, and they’re useful every few years to analyse and
compare GObject performance. We don’t want them to bitrot between uses.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:57:33 +01:00
Philip Withnall
6747702d77 tests: Fix use of deprecated threading API in performance-threaded
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
6b8240f061 tests: Fix performance-threaded test when run for zero seconds
When running the test with `-s 0` it would previously crash. Fix that,
and make it so that it only does a single test run in that case.

This will be useful in an upcoming commit for smoketesting the test to
avoid bitrot.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
74e71c78c0 tests: Fix a non-TAP formatted debug message in the basics-gobject test
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
011202dbc5 tests: Encode invalid UTF-8 before outputted in a test message
`g_test_message()` requires correctly encoded arguments, but some of the
strings in the `uri` test are (deliberately) not valid UTF-8. Encode
them before printing them.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
b82bfe7642 tests: Fix an invalid UTF-8 sequence in the uri tests
This sequence was meant to be valid, but was incorrectly just the octal
form of the desired Unicode codepoint, not the UTF-8 encoding of that
codepoint.

This was causing `g_test_message()` to print an `[Invalid UTF-8]`
warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
d48470df52 tests: Fix TAP output from spawn-singlethread test
The output from the echo program ends up being outputted with the stdout
from the unit test in some tests. Ensure that the input to the echo
program is therefore a valid TAP comment, rather than garbage, so that
it’s safely ignored by a TAP parser looking at the output from the test.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
75a39114d8 tests: Fix non-TAP output from socket test
This was breaking strict TAP parsers, such as Meson’s.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
8dde15a5b3 tests: Fix gengiotypefuncs.py helper script
It seems this script has potentially never worked properly under Python
3. It’s supposed to list all the `_get_type()` functions it can find in
the GIO headers, but since the regex string passed to `re.search()` was
not a Python regex, nothing was matching.

Fix that, and do another few small cleanups to the script.

This makes the `defaultvalue` test not skip all the types.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
f977ddf34f tests: Fix non-TAP output from debugcontroller test
When running under a strict TAP parser this was previously producing
problematic non-conforming output.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
1b377e6574 build: Drop MALLOC_PERTURB_ from test environments
It’s set already by Meson, to an actually random value.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-21 12:50:31 +01:00
Philip Withnall
12ed2aa982 Merge branch 'fix-once-memcheck-test' into 'main'
tests: Reduce number of threads in once test under valgrind

See merge request GNOME/glib!2729
2022-06-21 11:36:50 +00:00
Philip Withnall
2c75c392eb gtlscertificate: Hold a ref on the root certificate when building chains
This is unlikely to be a bug in practice, as the certificate pointed to
by `root` should have a ref held on it as the issuer of another
certificate in the chain.

However, we can’t guarantee that’s how the `GTlsCertificate`
implementation behaves, so keep a temporary ref on `root` until it’s no
longer needed.

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

Coverity CID: #1489985
2022-06-21 12:11:27 +01:00
Philip Withnall
fb377b70d0 Merge branch 'gio-dont-include-gtrace' into 'main'
gio: Don't bundle gtrace in static builds

See merge request GNOME/glib!2758
2022-06-21 09:56:18 +00:00
Olivier Crête
1cc685abc4 gio: Don't bundle gtrace in static builds
They're already in the libglib.a file and it prevents the build
from completing.
2022-06-20 16:09:51 -04:00
Philip Withnall
9a2bedb22c Merge branch 'update-codeowners' into 'main'
docs: Add Marco Trevisan as a co-maintainer

See merge request GNOME/glib!2754
2022-06-20 16:03:07 +00:00
Philip Withnall
9cc2859e08 docs: Add Marco Trevisan as a co-maintainer 2022-06-20 16:03:01 +00:00
Philip Withnall
01ac1d902f gobject: Fix crash when disposing a GtkAccelGroup
This is a partial revert of commit fa8c7c0da using the approach
suggested (and tested) by Kjell Ahlstedt.

It is intended to be temporary pending a proper dig into what’s causing
the regression, just so we can get the 2.73.1 release out.

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

Helps: #2672
2022-06-20 16:32:00 +01:00
Philip Withnall
150a63e6b5 Merge branch 'iss2655' into 'main'
gdatetime: Pad numbers with numeric space

Closes #2655

See merge request GNOME/glib!2698
2022-06-20 14:03:57 +00:00
Maksym Hazevych
7169f6e1e5 gdatetime: Use figure space for %e
Helps: #2655
2022-06-20 14:46:23 +01:00
Maksym Hazevych
7074122f30 gdatetime: Pad numbers with numeric space
Padding numbers with a typical space character doesn't align them well
because it has a different size. Instead, we need to use the "U+2007"
figure (numeric) space that has the same size as a numerical digit.
This is only visible when using the `tnum` font feature that
makes numbers monospace.

Closes #2655
2022-06-20 14:28:09 +01:00
Philip Withnall
f1916032e4 tests: Add tests for modifiers for GDateTime’s %l placeholder
They were missing.

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

Helps: #2655
2022-06-20 14:27:06 +01:00
Philip Withnall
4101770274 Merge branch 'mcatanzaro/xdgmime-corruption' into 'main'
xdgmime: fix double free

See merge request GNOME/glib!2753
2022-06-20 12:48:30 +00:00
Philip Withnall
46a6f49066 Merge branch 'meson-add-test-setup' into 'main'
build: Use add_test_setup() to allow tests to be run under valgrind

See merge request GNOME/glib!2752
2022-06-20 11:09:55 +00:00
Philip Withnall
f5baecdb36 build: Use add_test_setup() to allow tests to be run under valgrind
This means we can specify the standard options for testing GLib under
valgrind consistently, so that developers can use `meson test
--setup=valgrind` to run them.

Port the existing valgrind CI to use them (this will not change its
functional behaviour).

Suggested by Marco Trevisan at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2717#note_1478891.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-20 11:54:10 +01:00
Philip Withnall
b2f4df95e8 Merge branch 'coverity-is-stupid' into 'main'
gobject: Change GObject notify semantics under static analysis

See merge request GNOME/glib!2747
2022-06-17 15:47:39 +00:00
Michael Catanzaro
f95ca6cb71 xdgmime: fix double free
We free xdg_dirs[i] twice, but fail to free xdg_dirs itself.

Also, since free() is NULL-safe, there is no need for the second check
here.

Discovered in: https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/16#note_1432025
2022-06-17 08:49:03 -05:00
Philip Withnall
4a8120ec22 Merge branch 'meson-dependency-lookups' into 'main'
meson: simplify iconv/intl lookups using Meson's builtin dependency lookup

See merge request GNOME/glib!2734
2022-06-17 10:36:29 +00:00
Eli Schwartz
1532c5878e
NEWS: add stub entry for iconv option deprecation
As per review comment, this is miscellaneous enough that it could be
forgotten about at release time, but should still be mentioned.
Guarantee it by starting work on that now.
2022-06-16 12:07:03 -04:00
Eli Schwartz
26435b570f
meson: simplify intl lookups using Meson's builtin dependency lookup
intl is complicated to look up. Some of that complexity now resides in
Meson, since 0.59.0, via a `dependency('intl')` lookup, so use that
instead.

The Meson lookup doesn't include all the checks here, but likewise this
meson.build doesn't include all the checks in Meson. Particularly, the
following are different:

- Meson accurately detects support built into libc, even if that
  conflicts with an external library version (which should be detected as
  broken and thus not-found, but glib does not do so).

  The problem here is that depending on which libintl.h header is first
  in the search path, the *gettext symbols may be the libc ABI, or they
  may be renamed to libintl_*gettext, then additionally take over the
  *gettext names via a macro, in order to invoke the external library
  version even on systems where there is a libc builtin. This means that
  checking for `cc.has_function()` correctly reports that there is such
  a function in libc, but that unfortunately does not mean it is usable,
  because source code referencing `ngettext` etc. will expect to be
  linked to `libintl_ngettext`.

- glib checks whether the found intl requires pthread, rather than
  simply trusting the result of `cc.find_library()` for the external
  library case.

Do the heavy lifting by using Meson to check for intl, and select the
correct implementation, but do a post-discovery check if the symbol is
linkable both with/without pthread.

The logic is still a bit hairy, and eventually more of the logic could
be moved into Meson. But it's better than before.

Fixes incorrect detection of intl on musl-based systems (which have a
less capable libc intl), when GNU libintl is installed as an external
library.
2022-06-16 12:04:59 -04:00
Eli Schwartz
24ec80cfb4
meson: simplify iconv lookups using Meson's builtin dependency lookup
iconv is complicated to look up. That complexity now resides in
Meson, since 0.60.0, via a `dependency('iconv')` lookup, so use that
instead.

No effort is made to support the old option for which type of iconv to
use. It was a false choice, because if only one was available, then
that's the only one you can use, and if both are available, the external
iconv shadows the builtin one and renders the builtin one unusable,
so there is still only one you can use.

This meant that when configuring glib with -Diconv=libc on systems that
had an external iconv, the configure check would detect a valid libc
iconv, try to use it, and then fail during the build because iconv.h
belongs to the external iconv and generates machine code using the
external iconv ABI, but fails to link to the iconv `find_library()`.
Meson handles this transparently.
2022-06-16 12:04:59 -04:00
Philip Withnall
ccc7006d53 Merge branch 'fix-unix-open-pipes-introspection' into 'main'
glib-unix: Mark GLib.unix_open_pipe fds input array as fixed-size

See merge request GNOME/glib!2751
2022-06-16 11:17:28 +00:00
Philip Withnall
594a70bf5f Merge branch 'gvdb-as-wrap' into 'main'
build: Move gvdb to a subproject

See merge request GNOME/glib!2733
2022-06-16 09:29:43 +00:00