Commit Graph

24356 Commits

Author SHA1 Message Date
Emmanuel Fleury
22037bfab2 Fix set but unused parameter warning in gio/tests/gio-du.c
gio/tests/gio-du.c: In function 'main':
gio/tests/gio-du.c:74:11: error: parameter 'argc' set but not used
   74 | main (int argc, char **argv)
      |       ~~~~^~~~
2021-11-17 14:40:38 +01:00
Emmanuel Fleury
dea0ec3df6 Fix signedness warning in gio/ginputstream.c
gio/ginputstream.c: In function 'g_input_stream_real_skip':
gio/ginputstream.c:433:31: error: comparison of integer expressions of different signedness: 'goffset' {aka 'long long int'} and 'long long unsigned int'
  433 |               (start + count) > (guint64) end)
      |                               ^
2021-11-17 14:40:38 +01:00
Emmanuel Fleury
8c35109a21 Fix signedness warnings in glib/gutf8.c
glib/gutf8.c: In function 'g_utf8_get_char_extended':
glib/gutf8.c:626:39: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'}
  626 |   if (G_UNLIKELY (max_len >= 0 && len > max_len))
      |                                       ^
glib/gmacros.h:1091:27: note: in definition of macro 'G_UNLIKELY'
 1091 | #define G_UNLIKELY(expr) (expr)
      |                           ^~~~
glib/gutf8.c:628:21: error: comparison of integer expressions of different signedness: 'guint' {aka 'unsigned int'} and 'gssize' {aka 'int'}
  628 |       for (i = 1; i < max_len; i++)
      |                     ^
2021-11-17 14:40:38 +01:00
Emmanuel Fleury
264055f3c0 Fix signedness warnings in gio/gwin32appinfo.c
gio/gwin32appinfo.c: In function 'uwp_package_cb':
gio/gwin32appinfo.c:3383:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
   for (i = 0; i < supported_extgroups->len; i++)
                 ^
gio/gwin32appinfo.c:3389:29: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
       for (i_ext = 0; i_ext < grp->extensions->len; i_ext++)
                             ^
gio/gwin32appinfo.c:3430:35: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
           for (i_verb = 0; i_verb < grp->verbs->len; i_verb++)
                                   ^
gio/gwin32appinfo.c:3463:33: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
       for (i_hverb = 0; i_hverb < ext->verbs->len; i_hverb++)
                                 ^
gio/gwin32appinfo.c:3478:17: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
   for (i = 0; i < supported_protocols->len; i++)
                 ^
gio/gwin32appinfo.c:3541:33: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
       for (i_hverb = 0; i_hverb < url->verbs->len; i_hverb++)
                                 ^
gio/gwin32appinfo.c: In function 'g_win32_app_info_launch_internal':
gio/gwin32appinfo.c:4799:37: warning: comparison of integer expressions of different signedness: 'gint' {aka 'int'} and 'guint' {aka 'unsigned int'}
           for (p_index = 0; p_index <= g_strv_length (envp); p_index++)
                                     ^~
2021-11-17 14:40:38 +01:00
Emmanuel Fleury
f9b4a557b1 Fix signedness warning in gio/gwin32packageparser.c
gio/gwin32packageparser.c: In function 'WIN32_FROM_HRESULT':
gio/gwin32packageparser.c:99:30: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'long int'
   if ((hresult & 0xFFFF0000) == MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, 0) ||
                              ^~
2021-11-17 14:40:28 +01:00
Philip Withnall
927c7e4e58 Merge branch 'subprocess-path-envp' into 'main'
gsubprocess: Add G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP

See merge request GNOME/glib!2333
2021-11-17 12:27:46 +00:00
Hristo Venev
9bd4730008 gsubprocess: Add G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP 2021-11-17 12:27:46 +00:00
Philip Withnall
a2d878053e Merge branch '1231-gobject-alignment' into 'main'
gobject: Assert that GObjects are at least as aligned as basic types

Closes #1231

See merge request GNOME/glib!2321
2021-11-17 12:17:41 +00:00
Philip Withnall
bc04b57eed gtypes: Rework checked arithmetic handling
Rather than using the fixed-type compiler builtins
(`__builtin_uadd_overflow()`, etc.), use the generic versions
(`__builtin_add_overflow()`). This avoids issues with matching the
definition of GLib types (such as `guint` and particularly `gsize`) to
basic C types (`int`, `long`, `long long`), as the mapping can vary
between platforms.

See https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html

Adjust the fallback inline functions similarly.

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

Fixes: #2523
2021-11-17 11:57:09 +00:00
Philip Withnall
7a8756d247 gobject: Add advice on larger alignment requirements for GObject members
We now guarantee that GObjects will always be allocated at least as
aligned as the basic types. If you want to put an element in your
GObject which has higher alignment requirements, we can’t guarantee it
will be aligned*. If you need it to be aligned, you’ll need to put it on
the heap (aligned appropriately), or add appropriate padding in your
GObject struct.

*Actually, GSlice will guarantee that the whole GObject is aligned to at
least the power of 2 greater than or equal to the size of the GObject,
which means any element in the GObject struct should always be
appropriate aligned if the compiler pads it appropriately. If malloc()
is used, however, it doesn’t make that guarantee, so we can’t make that
guarantee overall.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1231
2021-11-17 11:56:20 +00:00
Philip Withnall
ed553e8e30 gtype: Eliminate -Wcast-align warnings with G_TYPE_CHECK_INSTANCE_CAST
Regardless of the actual alignment of the GTypeInstance in question,
these do a runtime check on the type, so if the type was originally
aligned correctly when allocated, it should be aligned correctly if the
type check succeeds. -Wcast-align is meant to warn about casts between
types, which this isn’t (if the check succeeds).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1231
2021-11-17 11:56:20 +00:00
Philip Withnall
0749643daa gobject: Assert that GObjects are at least as aligned as basic types
See the reasoning in the patch for why we believe GObjects *are*
(already) as aligned as the basic types.

We want to make this guarantee so that it’s guaranteed to be safe for
people to ignore -Wcast-align warnings for GObjects which contain basic
types. This typically happens with gdouble on 32-bit ARM platforms.

The checks are slightly complicated by the need to support GObjects with
custom constructors. We should expect that a custom construction
function will chain up to g_object_constructor (which calls
g_type_create_instance() as normal), but it’s possible that someone has
done something crazy and uses a custom allocator which doesn’t return
with the same alignment as GSlice. Hand them a warning in that case. If
that is true, the code which uses their custom-constructed GObject can
presumably already deal with the alignment it gets given.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #1231
2021-11-17 11:56:20 +00:00
Philip Withnall
c6dca3459b tests: Reformat mkenums.py slightly to make run-black.sh happy
This should remove some warnings from the CI, making it easier to see
legitimate CI failures.

For example, see https://gitlab.gnome.org/GNOME/glib/-/jobs/1621041.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-17 10:37:07 +00:00
Sebastian Dröge
e7e2949f31 Merge branch 'test-failure-gdbus-proxy' into 'main'
tests: Wait for gdbus-testserver to die when killing it

See merge request GNOME/glib!2341
2021-11-17 07:45:51 +00:00
Philip Withnall
511c5f5bf0 tests: Wait for gdbus-testserver to die when killing it
This was previously done (by commit 63038d1e4c) in one of the cases
where `kill_test_service()` was called — but not the other.

This meant that one instance of `gdbus-testserver` could still be
around when (as it happens, due to the order of the tests) the
`/gdbus/proxy/no-match-rule` test was run. It would start a second
instance of `gdbus-testserver`, which would exit early due to the test
name still being owned on the bus. The first (killed) instance of
`gdbus-testserver` would then exit, leaving no test servers running, and
hence the new test would fail.

This was being seen as frequent CI failures, particularly on FreeBSD
(must have slightly different timing for process signalling and
termination from Linux).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-16 22:47:15 +00:00
Philip Withnall
743b600311 Merge branch 'mcatanzaro/validation-flags' into 'main'
Document potential footgun with GTlsCertificateFlags and deprecate certain usages

See merge request GNOME/glib!2214
2021-11-16 16:17:54 +00:00
Philip Withnall
65368ca448 Merge branch 'main' into 'main'
Better detection of the cleanup attribute.

See merge request GNOME/glib!2223
2021-11-16 15:35:05 +00:00
Michael Catanzaro
d1e9e0c094 gsocketclient: deprecate tls-validation-flags property
It doesn't work as expected, and you shouldn't be trying to use it
anyway.
2021-11-16 15:21:22 +00:00
Michael Catanzaro
38de97c148 gtlsclientconnection: deprecate validation-flags property
It doesn't work as expected, and you shouldn't be trying to use it
anyway.
2021-11-16 15:21:21 +00:00
Michael Catanzaro
780af9cff3 Document potential footgun with GTlsCertificateFlags
Once upon a time, we tried to return all possible certificate errors,
but it never actually worked reliably and nowadays we have given up.
This needs to be documented because a reasonable developer would not
expect it.

Because mistakes could be security-critical, I decided to copy the same
warning in several different places rather than relying only on
cross-referencese.
2021-11-16 15:21:21 +00:00
Alvarito050506
03753cda79 Better detection of the cleanup attribute.
Use g_macro__has_attribute to detect it instead of
hardcoding __GNUC__ || __clang__. This adds support
for a few compiler and is consistent with the rest
of the gmacros.h file.
2021-11-16 15:13:07 +00:00
Sebastian Dröge
42f5a3ec20 Merge branch '2530-namespaced-journald' into 'main'
gmessages: Support namespaced journals

Closes #2530

See merge request GNOME/glib!2338
2021-11-16 15:11:09 +00:00
Emmanuele Bassi
2ebdf599a1 Merge branch 'wip/pwithnall/macos-ci' into 'main'
ci: Bump Meson version to 0.60.1 on macOS

See merge request GNOME/glib!2339
2021-11-16 14:54:02 +00:00
Philip Withnall
fc4070a047 gmessages: Support namespaced journals
Spotted and diagnosed by Ilya Basin.

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

Fixes: #2530
2021-11-16 14:43:12 +00:00
Sebastian Dröge
6a7187cae4 Merge branch 'actions-test-fix' into 'main'
tests: Drop arbitrary and flaky waits from actions tests

See merge request GNOME/glib!2336
2021-11-16 14:37:24 +00:00
Philip Withnall
1f1bf730a2 Merge branch 'mauriceackel-main-patch-88459' into 'main'
Fix GSettings dict error macOS

Closes #2527

See merge request GNOME/glib!2325
2021-11-16 14:21:00 +00:00
Maurice
366597a10d Fix GSettings dict error macOS 2021-11-16 14:21:00 +00:00
Philip Withnall
d1fc42eb88 ci: Bump Meson version to 0.60.1 on macOS
This is an attempt to fix a persistent error on the macOS CI:
```
Objective-C compiler for the host machine: cc (clang 10.0.0)
Objective-C linker for the host machine: APPLE ld 409.12
WARNING: No include directory found parsing "cc -xobjc -E -v -" output
meson.build:761:2: ERROR: Fatal warnings enabled, aborting
```

For example, seen on https://gitlab.gnome.org/GNOME/glib/-/jobs/1618966.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-16 14:09:07 +00:00
Philip Withnall
4eafbaba94 tests: Fix two small leaks in the actions test
These are known leaks, as they were being done in tests which were
checking precondition failures.

However, since we know what happens when the failures occur, we can
still free the input data reliably, so do that.

This improves the valgrind output for `actions` to show zero definite
leaks.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-16 14:03:36 +00:00
Philip Withnall
c8fa295f6a tests: Drop arbitrary and flaky waits from actions tests
The `actions` test previously waited an arbitrary 100ms for various
D-Bus messages to be sent/received, before checking the results of those
messages.

Normally, this would work, but on heavily loaded CI systems, it would
sometimes fail. For example,
https://gitlab.gnome.org/GNOME/glib/-/jobs/1611701.

Fix that by waiting for the condition being checked to evaluate to true,
rather than waiting an arbitrary period of time. On faster machines,
this will speed the tests up too.

Assume that the global default `GMainContext` is in use, so a
`GMainContext*` pointer doesn’t have to be passed around.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-16 14:01:24 +00:00
Sebastian Dröge
e9acc6a7f9 Merge branch '2529-special-dirs-annotation' into 'main'
gutils: Add missing (nullable) annotation to g_get_user_special_dir()

Closes #2529

See merge request GNOME/glib!2334
2021-11-16 12:30:08 +00:00
Philip Withnall
88ed83c61e gutils: Add missing (nullable) annotation to g_get_user_special_dir()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2529
2021-11-16 12:05:53 +00:00
Emmanuele Bassi
c3a87f171c Merge branch 'main' into 'main'
Changed gendered terms to be gender-neutral

See merge request GNOME/glib!2332
2021-11-13 21:48:00 +00:00
gonyere
5eeac53793 Changed gendered terms to be gender-neutral 2021-11-12 21:32:21 -05:00
Emmanuel Fleury
9e3a08b222 Fix signedness warning in gio/gcontenttype-win32.c
gio/gcontenttype-win32.c: In function 'get_registry_classes_key':
gio/gcontenttype-win32.c:66:78: warning: comparison of integer expressions of different signedness: 'DWORD' {aka 'long unsigned int'} and 'int'
               if (ExpandEnvironmentStringsW (wc_temp, wc_temp_expanded, len) == len)
                                                                              ^~
2021-11-12 14:58:52 +01:00
Yaron Shahrabani
ef3ff298f4 Update Hebrew translation 2021-11-11 22:33:21 +00:00
Philip Withnall
b75a16b048 gdbus: Add --interactive option to gdbus call
This allows the flag to allow interactive auth to be set. Previously, it
was unconditionally unset.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-11 11:26:22 +00:00
Goran Vidović
22e438b37e Update Croatian translation 2021-11-11 09:52:29 +00:00
Milo Casagrande
b4b5b3d029 Update Italian translation 2021-11-09 08:14:26 +00:00
Hugo Carvalho
c57d31288b Update Portuguese translation 2021-11-07 22:14:02 +00:00
Emmanuele Bassi
15aff433cc Merge branch 'fix_pcre' into 'main'
Fix link to pcre-8.37.tar.bz2

See merge request GNOME/glib!2324
2021-11-07 19:45:34 +00:00
Albert Astals Cid
e5dc299701 Fix link to pcre-8.37.tar.bz2
ftp.pcre.org FTP site is no longer available
2021-11-07 20:30:05 +01:00
Yuri Chornoivan
ce093edcc5 Update Ukrainian translation 2021-11-05 18:50:51 +00:00
Philip Withnall
044229e1c1 Merge branch '1109-no-match-rule' into 'main'
gdbusproxy: Add G_DBUS_PROXY_FLAGS_NO_MATCH_RULE flag

Closes #1109

See merge request GNOME/glib!2322
2021-11-04 14:42:44 +00:00
Philip Withnall
746ce4e042 Merge branch 'fix_garray_warning' into 'main'
Fix always true comparison warning in glib/garray.c

See merge request GNOME/glib!2311
2021-11-04 14:18:03 +00:00
Emmanuel Fleury
12113f398a Fix always true comparison warning in glib/garray.c
glib.git/glib/garray.c: In function ‘g_array_new’:
glib.git/glib/garray.c:184:34: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  184 |   g_return_val_if_fail (elt_size <= G_MAXSIZE / 2 - 1, NULL);
      |                                  ^~
glib.git/glib/gmacros.h:1090:25: note: in definition of macro ‘G_LIKELY’
 1090 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib.git/glib/garray.c:184:3: note: in expansion of macro ‘g_return_val_if_fail’
  184 |   g_return_val_if_fail (elt_size <= G_MAXSIZE / 2 - 1, NULL);
      |   ^~~~~~~~~~~~~~~~~~~~
glib.git/glib/garray.c: In function ‘g_array_sized_new’:
glib.git/glib/garray.c:265:34: error: comparison is always true due to limited range of data type [-Werror=type-limits]
  265 |   g_return_val_if_fail (elt_size <= G_MAXSIZE, NULL);
      |                                  ^~
glib.git/glib/gmacros.h:1090:25: note: in definition of macro ‘G_LIKELY’
 1090 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib.git/glib/garray.c:265:3: note: in expansion of macro ‘g_return_val_if_fail’
  265 |   g_return_val_if_fail (elt_size <= G_MAXSIZE, NULL);
      |   ^~~~~~~~~~~~~~~~~~~~
2021-11-04 14:50:24 +01:00
Lubomir Rintel
a107a328e4 gdbusproxy: Add G_DBUS_PROXY_FLAGS_NO_MATCH_RULE flag
D-Bus has an upper limit on number of Match rules and it's rather easy to hit
with a big number of proxies with signal subscriptions. This happens with
NetworkManager with hundreds of devices or connection settings. By passing
G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE to g_dbus_connection_signal_subscribe(), the
user can call AddMatch with a less granular match instead of a match per every
proxy.

Tests subsequently added by Philip Withnall.

Fixes: #1109
2021-11-04 11:44:18 +00:00
Michael Catanzaro
caf777984b Merge branch '2426-delayed-settings-null-handling' into 'main'
gdelayedsettingsbackend: Fix applying after calling g_settings_reset()

Closes #2426

See merge request GNOME/glib!2161
2021-11-03 18:03:21 +00:00
Philip Withnall
7be79cb840 Merge branch '2310-xdgmime-leaks' into 'main'
gcontenttype: Ignore intentional one-time leaks from xdgmime

Closes #2310

See merge request GNOME/glib!2268
2021-11-03 15:42:20 +00:00
Philip Withnall
fd080d8564 Merge branch 'list-model-doc-fixes' into 'main'
docs: Fix the GListModel description

See merge request GNOME/glib!2319
2021-11-03 11:46:28 +00:00