Commit Graph

24245 Commits

Author SHA1 Message Date
Yuri Chornoivan
9aaaf719da Update Ukrainian translation 2021-11-23 07:47:07 +00:00
Fran Dieguez
5c3ebf3689 Update Galician translation 2021-11-22 21:31:37 +00:00
Goran Vidović
d37706f34a Update Croatian translation 2021-11-22 16:16:50 +00:00
Philip Withnall
b0923398f8 Merge branch 'mcatanzaro/gtlsdatabase-docs' into 'main'
Improve some documentation related to GTlsDatabase

See merge request GNOME/glib!2326
2021-11-22 16:09:14 +00:00
Michael Catanzaro
82999879bc gtlsconnection: warn about footguns of using a non-default database
Since
https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/173,
there is now a really surprising implication to using a non-default
GTlsDatabase: your database could do nothing at all other than wrap the
default database, which you would expect to result in no behavior
changes, but in fact it causes fewer security checks to be performed
during certificate verification. This is because certificate
verification moved from GTlsDatabase to GTlsConnection, allowing for
more security checks to be performed. But if using a non-default
GTlsDatabase, we have to fall back to letting GTlsDatabase to the
verification, as before.

This is the best we can do. It's not a regression for applications,
because it means applications get the previous pre-2.72 behavior. But it
does mean that new security checks added in 2.72 are not applied, which
is unfortunate, so we should warn developers about this.
2021-11-22 15:56:56 +00:00
Michael Catanzaro
a6a41cfc17 gtlscertificate: tone down warning about g_tls_certificate_verify() 2021-11-22 15:56:56 +00:00
Michael Catanzaro
5f585225a2 gtlsdatabase: tone down warning about g_tls_database_verify_chain()
This is only true for the default GnuTLS backend. It is not true for the
OpenSSL backend, so let's say "may" instead of "will."
2021-11-22 15:56:56 +00:00
Michael Catanzaro
3b3d56a45c gtlsdatabase: remove stray "Since: 2.70"
This feature has been reverted for now because I messed up the
implementation and it was doing sync I/O during async API calls. Oops!
Since it's not present in 2.70 nor in 2.72, let's remove the reference
to the exact GLib version that this behavior was introduced in. I'd like
to get it working properly for 2.74, but it's not ready yet and just
changing the version to 2.74 feels optimistic.
2021-11-22 15:56:56 +00:00
Sebastian Dröge
6d8045ddb4 Merge branch 'gdbus-call-interactive' into 'main'
gdbus: Add --interactive option to `gdbus call`

See merge request GNOME/glib!2329
2021-11-22 13:58:46 +00:00
Sebastian Dröge
84d02b1c86 Merge branch 'wip/pwithnall/test-converter-stream-fail' into 'main'
tests: Fix a flaky wait in converter-stream

See merge request GNOME/glib!2352
2021-11-22 13:57:29 +00:00
Sebastian Dröge
c3f4f9c215 Merge branch 'reformat-enums' into 'main'
tests: Reformat mkenums.py slightly to make run-black.sh happy

See merge request GNOME/glib!2342
2021-11-22 13:54:42 +00:00
Philip Withnall
8e185e12c9 tests: Fix a flaky wait in converter-stream
Rather than waiting for a fixed period of time, poll in a loop until the
condition the test is expecting is true.

A better solution would be to use a `GSource` and wait until that’s
dispatched. But doing so might affect the behaviour of the
`GInputStream` under test, so busy-wait instead.

Fixes this CI failure: https://gitlab.gnome.org/GNOME/glib/-/jobs/1630758

```
(some socket debug output)
Bail out! GLib-GIO:ERROR:../gio/tests/converter-stream.c:1037:test_converter_pollable: assertion failed (res == -1): (1 == -1)
```

I could not reproduce the failure remotely with a few hundred
invocations of the test, so it might only present itself on BSD, which
presumably has different socket timing behaviour from Linux.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-22 13:22:25 +00:00
Philip Withnall
40037ebbfc tests: Use g_assert_*() rather than g_assert() in converter-stream.c
`g_assert()` is compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-22 13:20:17 +00:00
Philip Withnall
de2f692846 Merge branch 'main' into 'main'
gutf8: add string length check when ending character offset is -1

See merge request GNOME/glib!2328
2021-11-22 12:22:54 +00:00
Philip Withnall
fc05d08b39 Merge branch 'fix-timeout' into 'main'
gio/tests/codegen.py: bump timeout to 100 seconds

See merge request GNOME/glib!2348
2021-11-22 11:17:56 +00:00
Philip Withnall
d455ece99f Merge branch 'improve-win32-version' into 'main'
gutils.c: Improve g_get_os_info() for Windows 10/Server 2008 R2+

Closes #2443

See merge request GNOME/glib!2351
2021-11-22 11:16:04 +00:00
Philip Withnall
6d324cb081 Merge branch 'getenv-nullable' into 'main'
Annotate `g_getenv()` and `g_environ_getenv()` return value as `nullable`

See merge request GNOME/glib!2349
2021-11-22 10:52:11 +00:00
Chun-wei Fan
7540bed89e gutils.c: Improve g_get_os_info() for Windows Server 2008+
Instead of Windows 7/8/8.1 Server, use the proper names Server 2008
R2/2012/2012 R2 so that things are clearer to people.  Since nowadays
GLib requires Windows 7 (_WIN32_WINNT 0x0601, meaning the server
counterpart is Server 2008 R2), we include Server 2008 in the list for
completeness' sake, but exclude the Server 2003/2003R2 from the list.
2021-11-22 12:54:52 +08:00
Chun-wei Fan
5f56477cc7 gutils.c: Improve Windows Server 2016/10 20H2+ detection
This improves how we obtain the Windows release versions in
get_windows_version(), in turn g_get_os_info() for Windows Server 2016
and later, and Windows 10 20H2 (2009) and later and Windows 11, by doing
the following:

*  Check the build number.  For Windows 11, the build number is 22000+;
   for Windows Server 2022, the build number is 20348, and for Windows
   Server 2019, the build number is 17763.  We know what OS build
   numbers to check for by the Windows OS type that we obtained by using
   g_win32_check_windows_version().  Show the actual server release
   string (i.e. Windows Server 20xx yyyy) as appropriate, as a result.
*  Check the DisplayVersion entry in the registry under
   SOFTWARE\Microsoft\Windows NT\CurrentVersion if we obtained "2009"
   from the ReleaseId entry, since DisplayVersion replaces ReleaseId
   after Windows 10/Server 2019 20H2 (2009).  This makes things more
   clear for Windows releases after 20H2, where previously 20H2
   and 21H1 were all identified as Windows 10 [Server] 2009.

This should fix issue #2443.
2021-11-22 12:16:14 +08:00
Sebastian Dröge
07151049aa Annotate g_getenv() and g_environ_getenv() return value as nullable 2021-11-20 11:11:01 +02:00
Chun-wei Fan
045b4b80df gwin32.c: Split out call to RtlGetVersion()
Unfortunately, we may well be likely to need to call RtlGetVersion() via
GetModuleHandle() + GetProcAddress(), so split out the call to RtlGetVersion()
into a private function of its own, so that we can reuse the same code in other
parts of GLib, so that we can:

*  Determine better in a more fine-tuned way to determine whether we are on
   Windows 10/11 and/or Server 2016/2019/2022, since we need to rely on the
   build number.

*  Just call RtlGetVersion() once, when needed, as that is all that is needed.
   We could re-use the same function once to compare what we got when we
   called RtlGetVersion() and do what is necessary there.
2021-11-19 16:01:54 +08:00
Goran Vidović
674966bb6e Update Croatian translation 2021-11-18 18:42:52 +00:00
Chen Guanqiao
9adbdd45d7 gutf8: add string length check when ending character offset is -1
Some function such as atk_text_get_text, use -1 to indicate the end of the
string. And an crash occurs when the -1 is passed to g_utf8_substring.

Call Trace:
  0  __memmove_avx_unaligned_erms
  1  memcpy
  2  g_utf8_substring
  3  impl_GetText
  4  handle_other
  5  handle_message
  6  _dbus_object_tree_dispatch_and_unlock
  7  dbus_connection_dispatch
  8  dbus_connection_dispatch
  9  ()
  10 g_main_dispatch
  11 g_main_context_dispatch
  12 g_main_context_iterate
  13 g_main_context_iteration
  14 g_application_run
  15 main

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
2021-11-19 00:52:07 +08:00
Emmanuele Bassi
3ec896b6f4 Merge branch 'wip/pwithnall/macos-werror' into 'main'
gutils: Disable some dead code on macOS

See merge request GNOME/glib!2345
2021-11-18 14:48:07 +00:00
Philip Withnall
b891266d69 ci: Enable --werror on macOS
There are no compiler warnings when building on macOS CI at the moment,
so let’s keep it that way by turning any future ones into errors.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
97e3d366bc gosxutils: Add missing prototype
Fixes a `-Wmissing-prototypes` warning on macOS.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
249e654b96 build: Pass warning and warning-disabling arguments to C++ and ObjC too
Previously they were only passed to the C compiler, which meant disabled
warnings were still emitted when (for example) including C headers from
C++ and ObjC files.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
cc0e2978a4 build: Disable -Wvariadic-macros
We explicitly require support for variadic macros; see
https://wiki.gnome.org/Projects/GLib/CompilerRequirements.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 14:32:09 +00:00
Philip Withnall
e5719fd667 gosxutils: Add newline at end of file
Fixes a `-Wnewline-eof` warning when building on macOS.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 13:52:24 +00:00
Alexander Kanavin
e161c62292 gio/tests/codegen.py: bump timeout to 100 seconds
This may be necessary on overloaded CI systems.
2021-11-18 14:07:11 +01:00
Philip Withnall
c94f24cadd Merge branch 'fm/gsettings-output-sorted' into 'main'
Sort output of gsettings command-line tool

Closes #1781

See merge request GNOME/glib!2346
2021-11-18 12:40:40 +00:00
Philip Withnall
6554af0320 gutils: Disable some dead code on macOS
This code isn’t used when building on macOS, so ifdef it out to avoid a
compiler warning.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-11-18 10:57:37 +00:00
Philip Withnall
81a31fd062 Merge branch '2523-checked-arithmetic' into 'main'
gtypes: Rework checked arithmetic handling

Closes #2523

See merge request GNOME/glib!2343
2021-11-18 10:54:54 +00:00
Frederic Martinsons
296a8c6522 Sort output of gsettings command-line tool
Closes #1781

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-11-18 08:59:55 +01:00
Philip Withnall
30c3f05532 Merge branch 'back_to_werror' into 'main'
Get back to '-werror' with warnings at level 3

Closes #1735

See merge request GNOME/glib!2270
2021-11-17 16:17:19 +00:00
Philip Withnall
eba54436f7 Merge branch 'main' into 'main'
guri: Improve performance of remove_dot_segments() algorithm

Closes #2526

See merge request GNOME/glib!2327
2021-11-17 15:20:28 +00:00
Sebastian Wilhelmi
21b45d6ac2 guri: Improve performance of remove_dot_segments() algorithm 2021-11-17 15:20:28 +00:00
Emmanuel Fleury
b5dade12c9 Get back to '-werror' with warnings at level 3
Closes: #1735
2021-11-17 16:19:28 +01:00
Philip Withnall
b09ccc4635 Merge branch 'fix_all_warnings' into 'main'
Fix final warnings in Windows code

See merge request GNOME/glib!2323
2021-11-17 15:15:46 +00:00
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