Commit Graph

27569 Commits

Author SHA1 Message Date
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
Philip Withnall
cb7089d461 Merge branch 'wip/abono/always-inline-fallback' into 'main'
gmacros: Add GCC < 5 fallback for __always_inline__

See merge request GNOME/glib!3318
2023-03-10 15:33:11 +00:00
Philip Withnall
66492ec02e Merge branch 'dab_disable_fuzzing_tests' into 'main'
fuzzing: do not build tests if build_tests is false

See merge request GNOME/glib!3319
2023-03-10 15:32:45 +00:00
Philip Withnall
8a9ada6639
2.76.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-10 14:33:15 +00:00
Stéphane Cerveau
52b9af5fd9 fuzzing: do not build tests if build_tests is false 2023-03-10 12:11:11 +01:00
Alessandro Bono
13b564d027 gmacros: Add GCC < 5 fallback for __always_inline__
Commit 15cd0f0461 introduced a check
for the __always_inline__ attribute. However, we don't define a
fallback for GCC < 5.
2023-03-09 14:33:43 +01:00
Alessandro Bono
3bbd728868 gmacros: Sort alphabetically 2023-03-09 14:30:38 +01:00
Luca Bacci
061da06118 GWin32AppInfo: Add NULL string checks
Fixes #2922
2023-03-09 14:29:38 +01:00
Jordi Mas i Hernandez
d9a01931c3 Update Catalan translation 2023-03-07 20:57:29 +00:00
Ondrej Holy
1e4a8d3271 Merge branch '2934-false-null-file-attributes' into 'main'
glocalfile: Set various file attributes if their value is FALSE

Closes #2934

See merge request GNOME/glib!3313
2023-03-07 15:33:59 +00:00
Philip Withnall
e35f4a04cc tests: Change the time function used in the bookmark tests
The current comparison has been seen to fail on vs2017-x86
(https://gitlab.gnome.org/pwithnall/glib/-/jobs/2643197):
```
not ok /bookmarks/deprecated - GLib:ERROR:../glib/tests/bookmarkfile.c:921:test_deprecated: assertion failed (t >= now): (1678122080 >= 1678122081)
```

I guess this is caused by a mismatch between the system clock as used by
`time (NULL)` and `g_get_real_time ()` (which is ultimately what
`g_bookmark_file_set_added()` uses) on Windows.

Attempt to fix that by using `g_get_real_time()` in the test harness
too, so the clock being used is consistent.

If that doesn’t work, my next guess is that some of the code in
`test_deprecated()` is being reordered by the compiler. But that
shouldn’t happen, because the `time()` call has side-effects, and
`g_bookmark_file_set_added()` has side-effects, so they shouldn’t be
reordered with respect to each other. And certainly not so that the
latter one (in code order) ends up being called 1s after the other.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-06 18:25:42 +00:00
Philip Withnall
ff2fad77ef Merge branch 'wip/oholy/lost-and-found-is-hidden' into 'main'
glocalfileinfo: Mark the lost+found dir as hidden again

See merge request GNOME/glib!3310
2023-03-06 17:47:46 +00:00
Philip Withnall
ab3076a242 Merge branch '2932-check-etag-attributes' into 'main'
gfile: Check ETag attribute is present before trying to get it

Closes #2932

See merge request GNOME/glib!3312
2023-03-06 17:42:01 +00:00
Philip Withnall
335d3a4c04 Merge branch 'wip/oholy/is-backup-false' into 'main'
glocalfileinfo: Ensure that is-backup is always set

See merge request GNOME/glib!3311
2023-03-06 17:41:35 +00:00
Philip Withnall
7187243b8e Merge branch 'wip/oholy/btrfs-copy-fix' into 'main'
gfile: Fix file size detection when copying on btrfs

See merge request GNOME/glib!3309
2023-03-06 17:40:45 +00:00
Sabri Ünal
48a68890e0 Update Turkish translation 2023-03-06 16:37:24 +00:00
Philip Withnall
303d79989c gresourcefile: Fix a missing newline in GResourceFile
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-06 16:10:50 +00:00
Philip Withnall
a4e597520a glocalfileinfo: Set is-backup attribute on Windows
Previously it was only being set on non-Windows platforms. For
consistency, always set it on Windows too.

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

Helps: #2934
2023-03-06 16:10:50 +00:00
Philip Withnall
8c473c5353 glocalfile: Set various file attributes if their value is FALSE
Following on from #2907, set various boolean attributes if they have
been requested, or are known for sure, and their value is `FALSE`.

Previously the `FALSE` value would have been implicitly returned by the
getter function, but now doing that without the attribute being
explicitly set will trigger a critical warning.

*Don’t* set these attributes if their value is unknown or there was an
error querying it.

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

Fixes: #2934
2023-03-06 16:10:50 +00:00
Ondrej Holy
c965bf23a8 glocalfileinfo: Set is-backup attribute also on Windows
The `is-backup` attribute isn't currently set on Windows. It would
be nice to set such basic attributes on all platforms. Let's set
the attribute to `FALSE` there.
2023-03-06 14:33:39 +01:00
Ondrej Holy
448a163bee glocalfileinfo: Ensure that is-backup is always set
Currently, the `G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP` attribute is set
only when its value is `TRUE`. This is wrong with the latest changes as
the `GLib-GIO-CRITICAL **: 00:54:07.260: GFileInfo created without
standard::is-backup` errors are printed now from the
`g_file_info_get_is_backup` function among others. Let's set this
aattribute also when it is `FALSE`.

Related: https://gitlab.gnome.org/GNOME/glib/-/issues/2934
2023-03-06 14:33:39 +01:00
Ondrej Holy
43066d6960 glocalfileinfo: Mark the lost+found dir as hidden again
The lost+found dir isn't detected as hidden currently. This is regression
caused by the commit 728ad64b. Let's change the code a bit to be sure that
the lost+found dir is marked as hidden again.
2023-03-06 14:10:13 +01:00
Philip Withnall
4e62e55d6d gfile: Check ETag attribute is present before trying to get it
A regression from issue #2907.

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

Fixes: #2932
2023-03-06 13:02:41 +00:00
Ondrej Holy
406143b072 gfile: Fix file size detection when copying on btrfs
When the `g_file_copy` function is used with files on BTRFS, the
`GLib-GIO-FATAL-CRITICAL: GFileInfo created without standard::size`
error is printed. This is because the `g_file_get_size` function
is used to obtain the file size for the progress callback, but it uses
the wrong `GFileInfo` object that is meant for attributes to be copied
with the file. The file size attribute is missing there obviously. Let's
obtain the file size over the `fstat` call the same way as it is done in
the `splice_stream_with_progress` function to get rid of those errors
and to fix the progress reporting.
2023-03-06 10:30:20 +01:00
Marek Černocký
e75ba524fd Update Czech translation 2023-03-05 22:10:44 +00:00
Piotr Drąg
2dad35ff83 Update Polish translation 2023-03-05 16:52:04 +00:00
Alexander Shopov
58a3243f03 Update Bulgarian translation 2023-03-04 17:40:33 +00:00