Commit Graph

27595 Commits

Author SHA1 Message Date
Philip Withnall
077b87aa9c tools: Drop check-abis.sh script
It hasn’t been used for years, and isn’t really needed since we changed
to explicitly exporting symbols (using `GLIB_AVAILABLE_IN_*`) rather than
implicitly exporting them unless they were hidden.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 10:44:01 +00:00
Danial Behzadi
babd275330 Update Persian translation 2023-03-22 10:34:36 +00:00
Philip Withnall
2aaa3250c9 Merge branch '2907-revert-gfileinfo-criticals' into 'main'
gfileinfo: Temporarily downgrade missing attribute criticals to debugs

See merge request GNOME/glib!3338
2023-03-21 16:15:37 +00:00
Philip Withnall
4cad66580b gfileinfo: Temporarily downgrade missing attribute criticals to debugs
This partially reverts ed8e86a7d4.

The change to add the criticals (commit ed8e86a7d4) is correct, but
landed too late in the cycle. Let’s downgrade the criticals to debugs
for now, to stop applications seeing a lot of new criticals in their
output. Those criticals are particularly disruptive for command line
applications and unit tests.

Early in the next cycle, the debugs will be re-upgraded to criticals.
This will give applications a whole additional cycle to fix their
ambiguous use of API.

It turned out that a lot of applications have latent bugs around
calling `g_file_info_get_*()` without checking whether an attribute
is set first, and were hence relying on the ‘unknown’ return value
also being an appropriate default for them.

This was compounded by the fact that several non-local GVFS backends
were not setting `GFileInfo` attributes all the time, which caused the
‘missing attribute’ code path to be hit more frequently. For example,
they would only call `g_file_info_set_is_hidden()` with a true value and
never bother with a false one.

It was further compounded by the fact that, while this change landed for
the 2.75.4 release, there did not seem to be extensive integration
testing of that release, and distributions and downstreams went straight
to 2.76.0. That meant we missed the window between 2.75.4 and 2.76.0 to
change, fix or revert this behaviour. GLib relies on distros and
downstreams doing integration testing of unstable releases. We test with
downstream GNOME as part of gnome-build-meta, but do not have the
resources to do integration testing for everybody.

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

See: #2907
See: #2932
See: #2934
See: #2945
See: #2948
2023-03-21 15:01:10 +00:00
Philip Withnall
2630b7d2d5 Merge branch '352-file-enumerator-docs' into 'main'
gfileenumerator: Clarify termination condition for next_files_async()

Closes #352

See merge request GNOME/glib!3339
2023-03-21 14:58:45 +00:00
Marco Trevisan
076e656f30 Merge branch 'strfuncs-check-results' into 'main'
tests: Check a few results in strfuncs tests

See merge request GNOME/glib!3330
2023-03-21 14:52:59 +00:00
Marco Trevisan
8d0c92e65e Merge branch '159-strstr-len-docs' into 'main'
gstrfuncs: Clarify haystack_len behaviour of g_strstr_len()

Closes #159

See merge request GNOME/glib!3331
2023-03-21 14:52:16 +00:00
Marco Trevisan
fc5fc89841 Merge branch '2948-gio-is-hidden' into 'main'
gio: Add some missing file info attribute checks in gio-list and gio-tree

Closes #2948

See merge request GNOME/glib!3336
2023-03-21 14:47:47 +00:00
Philip Withnall
6a1c7b7c2e meson: Move msvc_recommended_pragmas.h to a subdirectory
It’s cluttering up the root directory.

This should introduce no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 14:21:18 +00:00
Philip Withnall
a046492a19 gfileenumerator: Add an example of using next_files_async() to the docs
This is written in pseudocode C which omits all the callback boilerplate
for the async calls. This should hopefully make the overall structure of
the loop more obvious.

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

Helps: #352
2023-03-21 14:07:08 +00:00
Owen Taylor
67a9367598 gfileenumerator: Clarify termination condition for next_files_async()
As suggested on #352 by Owen Taylor (commit put together by Philip
Withnall, but in Owen’s name as it’s his wording).

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

Fixes: #352
2023-03-21 13:56:52 +00:00
Philip Withnall
2953c08261 gfileinfo: Zero GTimeVal when failing g_file_info_get_modification_time()
Before commit ed8e86a7d4, this function would have silently returned a
zero-valued `GTimeVal` if the correct attributes weren’t present.

That partially regressed in commit ed8e86a7d4, which made it return with
a critical warning, but without zeroing the `GTimeVal`. The critical
warning can be ignored by users (it doesn’t abort the process unless
`G_DEBUG=fatal-criticals` is set), but the change in behaviour of
zeroing the `GTimeVal` could cause bugs.

See: #2907

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 12:15:50 +00:00
Philip Withnall
2029d7e900 gpollfilemonitor: Add missing attribute checks for g_file_info_get_size()
Missed from the fixes for #2907.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 12:15:50 +00:00
Philip Withnall
4ba3470269 gio: Add some missing file info attribute checks in gio-list and gio-tree
Further fallout from #2907.

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

Fixes: #2948
2023-03-21 12:15:50 +00:00
Philip Withnall
23a009b2cb Merge branch '919-variant-dict-lookup-docs' into 'main'
gvariant: Document failure behaviour of g_variant_dict_lookup() better

Closes #919

See merge request GNOME/glib!3334
2023-03-21 12:07:20 +00:00
Philip Withnall
ec03755355 gio-tool-info: Fix a duplicate attribute name in the UI
`gio info` currently prints ‘display name:’ twice. One of those should
be ‘edit name:’ — this regressed in commit
a374b7c806.

Various translations still have the old string, but some unfortunately
do not, so this is effectively a new translatable string again.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-21 11:31:38 +00:00
Jan Beich
f6c40b1d27 meson: allow -Dlibelf=enabled without pkg-config
gio/meson.build:933:0: ERROR: Dependency "libelf" not found, tried pkgconfig
2023-03-20 14:57:36 +00:00
Colin Walters
8d7c1f9b75 tests: Finish update of gdbus-example-proxy-subclass to new GDBus API
This fixes bug #624696.

Incorporates a more recent change from 1dc774a653 to drop the
`g_type_init()` call, and reformats the indentation a bit.

Fixes: #322
2023-03-20 13:03:04 +00:00
Philip Withnall
7d090d1510 gvariant: Document failure behaviour of g_variant_dict_lookup() better
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #919
2023-03-20 12:16:54 +00:00
Philip Withnall
3d7e88a77d build: Drop old .gitignore files from test directories
They just listed built files. Since the move to Meson, these are all
kept in a separate build directory, not the source tree, so don’t need
to be ignored.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-20 12:09:02 +00:00
Philip Withnall
7dfde773f6 gstrfuncs: Clarify haystack_len behaviour of g_strstr_len()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #159
2023-03-20 11:55:53 +00:00
Philip Withnall
5fdacf78e2 tests: Check a few results in strfuncs tests
This fixes some written-but-never-read warnings from `scan-build`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-20 10:43:25 +00:00
Philip Withnall
7df41f6a1c tests: Re-enable mainloop test under AddressSanitizer
This is a partial revert of commit f378352051.

The leak of a `GMainLoop` which prompted it has been fixed by commit
4f5da83381 in merge request !2535.

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

See: #2598
Fixes: #2307
2023-03-17 15:44:14 +00:00
Emmanuele Bassi
e979fd9a15 Merge branch '2943-g-test-init-docs' into 'main'
gtestutils: Clarify docs about calling g_test_init() before anything

Closes #2943

See merge request GNOME/glib!3327
2023-03-17 11:29:29 +00:00
Philip Withnall
045bc7adde gtestutils: Clarify docs about calling g_test_init() before anything
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2943
2023-03-17 11:03:09 +00:00
Philip Withnall
98a567ce7f Merge branch 'queue-test' into 'main'
tests: Reduce number of iterations in queue test

See merge request GNOME/glib!3324
2023-03-16 17:45:22 +00:00
Philip Withnall
790fbfab4c Merge branch 'xry111/issue2936' into 'main'
gstrfuncs: Improve inline version of g_strdup() to avoid breaking C++ code

Closes #2936

See merge request GNOME/glib!3322
2023-03-16 12:13:10 +00:00
Philip Withnall
9d7c796f1e Merge branch 'fix-monitor-root-directory-fail' into 'main'
inotify: Avoid empty root directory string

See merge request GNOME/glib!3241
2023-03-16 12:12:01 +00:00
Philip Withnall
eff90c09f5 tests: Simplify a helper function in queue test
Remove an unnecessary intermediate variable.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
ea852e2683 tests: Fix signed/unsigned comparisons and assignments in queue test
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
2d89f84267 tests: Reduce number of iterations in queue test
Unless `-m thorough` is passed to the tests, reduce the number of
iterations in the random test.

This one test case takes the bulk of the time to run the `queue` test
suite, and is sometimes causing timeouts when running on CI
(particularly under valgrind). Reduce it to a fifth.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Philip Withnall
1f6a4d60d4 tests: Add copyright/licensing header to queue tests
This is put together through git archaeology:
```
git log glib/tests/queue.c
git log -- tests/queue-test.c
```

The following commits were too trivial to have meaningful copyright:
 - 8f02fac4ad
 - d81ac5339f
 - 29f2ced8eb
 - 1a2c5e155d
 - 8a90f5e9f6
 - 45dae4b506
 - 2aa71ab63b
 - 3a74ad128e

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

Helps: #1415
2023-03-16 12:05:07 +00:00
Philip Withnall
8b25142cb2 tests: Use g_assert_*() rather than g_assert() in queue tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-16 12:05:07 +00:00
Guillaume Desmottes
6b39af34aa glib: unicode: add some empty string tests 2023-03-15 15:14:53 +00:00
Guillaume Desmottes
deb495de42 glib: unicode: add tests for g_utf8_normalize()
Test corner cases and some examples from Unicode Standard Annex #15
http://unicode.org/reports/tr15/
2023-03-15 15:14:53 +00:00
Guillaume Desmottes
221bbde429 glib: unicode: fix unicode standard link 2023-03-15 15:14:53 +00:00
Philip Withnall
f535d0915f tests: Add a test for creating a file monitor on the root directory
While we can’t check for any events on it, this at least tests that
creating a file monitor works. It should cover the fix from the previous
commit.

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

Helps: !3241
2023-03-15 14:45:10 +00:00
Marco Trevisan
7fec23ed5e Merge branch 'desktop-app-info-startup-id' into 'main'
gdesktopappinfo: Add a missing NULL check

See merge request GNOME/glib!3325
2023-03-15 14:03:58 +00:00
Philip Withnall
1a9be3a1c8 tests: Add a test for D-Bus activating an unknown app with a context
This should catch regressions in the critical warning fixed in the
previous commit.

The launch has to have several conditions:
 - Session bus is running (to avoid the launch happening via the spawn
   codepath)
 - Use a non-existent D-Bus name (to trigger a launch error)
 - Use a launch context (to hit the critical warning code path)
 - Not have a startup ID specified in the platform data — this implies
   having an empty launch context
 - Use an async launch, as that provides an error handling path

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-15 13:50:51 +00:00
Xi Ruoyao
cc7f2f81cc
gstrfuncs: Improve inline version of g_strdup() to avoid breaking C++ code
Wrap the logic into a G_ALWAYS_INLINE function, instead of using a
complex statement-expression which is not allowed in braced initializer
lists and expanded into some bad thing when it's used as
`::g_strdup(...)`.

We cannot use `__builtin_constant_p (str)` because GCC documentation
clearly states that it always produces 0 when str is a const char *
argument of an inline function.  But `__builtin_constant_p (!str)`,
`__builtin_constant_p (!!str)`, and
`__builtin_constant_p (strlen (str))` functions properly with `-O1` or
above enabled.

Fixes #2936.
2023-03-15 15:18:34 +08:00
Philip Withnall
7cd57b3e85 gdesktopappinfo: Add a missing NULL check
It’s possible for the startup ID to be `NULL` if one wasn’t provided in
the platform data passed to `launch_uris_with_dbus()`.

Passing `NULL` to `g_app_launch_context_launch_failed()` causes a
critical warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-14 14:37:14 +00:00
Philip Withnall
8fbb8dc442 Merge branch 'test-failures' into 'main'
tests: Fix timeout sources in gdbus-auth and gapplication tests

See merge request GNOME/glib!3323
2023-03-14 10:26:27 +00:00
Philip Withnall
764f8426d4 tests: Remove explicit timeout handler from gdbus-auth tests
The timeout runs for the entire duration of the test, which is a
function that Meson’s test harness already provides for us.

Meson’s timeout can be easily adjusted by a factor to allow for running
tests more slowly under valgrind. The timeout in the code cannot, which
leads to spurious failures like
https://gitlab.gnome.org/GNOME/glib/-/jobs/2645271.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-13 11:21:17 +00:00
Philip Withnall
642ee744b8 tests: Fix g_source_remove() of non-existent source in gapplication test
If the timeout callback was executed, it would remove the timeout
source, leaving the `g_source_remove()` call in the main function with a
dangling source ID.

Fixes commit 73205b8bbd.

Spotted in https://gitlab.gnome.org/GNOME/glib/-/jobs/2645271.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-13 11:19:56 +00:00
Marco Trevisan
dc59380561 Merge branch 'bookmarkfile-timings' into 'main'
tests: Change the time function used in the bookmark tests

See merge request GNOME/glib!3315
2023-03-13 11:00:13 +00:00
Philip Withnall
b65b9255bb Merge branch 'rtld-next-cygwin' into 'main'
tests: only build messages-low-memory if RTLD_NEXT is available

See merge request GNOME/glib!3321
2023-03-13 10:48:13 +00:00
Christoph Reiter
94fd305dbd tests: only build messages-low-memory if RTLD_NEXT is available
This fixes the build under cygwin which doesn't have RTLD_NEXT.
Use the existing have_rtld_next to skip the test program in that case.
2023-03-12 12:29:03 +01:00
Sabri Ünal
ed256d6447 Update Turkish translation 2023-03-10 18:39:48 +00:00
Guillaume Bernard
d05417e3f1 Update French translation 2023-03-10 17:17:40 +00:00
Philip Withnall
618c340726 Merge branch 'fix-issue-2922' into 'main'
GWin32AppInfo: Add NULL string checks

Closes #2922

See merge request GNOME/glib!3317
2023-03-10 16:05:03 +00:00