Commit Graph

22830 Commits

Author SHA1 Message Date
Krzesimir Nowak
a2525129a7 tests: Update the expected count in file test
We added another desktop file, so update the file count.
2021-01-09 16:00:50 +01:00
Krzesimir Nowak
cdf0a50c69 gdesktopappinfo: Fix validation of XDG_CURRENT_DESKTOP
Split out XDG_CURRENT_DESKTOP handling to a separate function and make
sure that it drops all the invalid entries properly. Earlier a bad
entry could slip through the checks by sitting just after another bad
entry, like in env being set to `invalid1!:invalid2!`, where
`invalid2!` could slip the checks.
2021-01-09 15:39:09 +01:00
Philip Withnall
46097e9b8e Merge branch 'wip/baedert/gparam' into 'master'
glocalfile: Fix an uninitialized variable

See merge request GNOME/glib!1860
2021-01-08 14:07:57 +00:00
Philip Withnall
477905912a Merge branch 'gaction-group-activation-doc-fix' into 'master'
docs: update g_action_group_activate_action() remote activation semantics

See merge request GNOME/glib!1859
2021-01-08 11:07:16 +00:00
crvi
e789e50f12 docs: update g_action_group_activate_action() remote activation semantics
Refer https://gitlab.gnome.org/GNOME/glib/-/issues/2284
2021-01-08 11:07:16 +00:00
Sebastian Dröge
e1a99c7f75 Merge branch 'connection-slow-debugging' into 'master'
tests: Add more debug information to gdbus-connection-slow

See merge request GNOME/glib!1865
2021-01-08 09:10:59 +00:00
Philip Withnall
d90d914fc5 tests: Add more debug information to gdbus-connection-slow
It occasionally fails in CI with output like:
```
196/274 glib:gio / gdbus-connection-slow        FAIL     0.54 s (killed by signal 6 SIGABRT)

--- command ---
G_TEST_BUILDDIR='/builds/pwithnall/glib/_build/gio/tests' G_TEST_SRCDIR='/builds/pwithnall/glib/gio/tests' GIO_MODULE_DIR='' /builds/pwithnall/glib/_build/gio/tests/gdbus-connection-slow
--- stdout ---
\# random seed: R02S4eb186e89e2472eedd11538b37192543
1..2
\# Start of gdbus tests
\# Start of connection tests
Bail out! GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
--- stderr ---
**
GLib-GIO:ERROR:../gio/tests/gdbus-connection-slow.c:98:test_connection_flush: assertion failed (error == NULL): Child process killed by signal 11 (g-exec-error-quark, 19)
cleaning up pid 12991
```

which is not very helpful. Add some more debug output to print the
stdout and stderr of the child process, to hopefully give an insight
into why it’s dying with signal 11 (sigsegv).

I can’t reproduce the sigsegv locally.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 17:55:21 +00:00
Philip Withnall
f22b136b11 2.67.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 16:51:43 +00:00
Emmanuele Bassi
673c514e63 Merge branch 'wip/pwithnall/error-tests-nonliteral' into 'master'
tests: Ignore -Wformat-nonliteral warning in new GError tests

See merge request GNOME/glib!1863
2021-01-07 16:48:24 +00:00
Philip Withnall
885d65077e tests: Only run g_error_new_valist() programmer error test on Linux
On FreeBSD it always crashes due to the platform’s `vasprintf()`
implementation being less forgiving than Linux’s. That’s fine.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 16:17:28 +00:00
Philip Withnall
5000193cf3 tests: Ignore -Wformat-nonliteral warning in new GError tests
See !1861.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-07 15:47:59 +00:00
Philip Withnall
20c2a0539c Merge branch '2168-io-module-default' into 'master'
gio: Ignore various environment variables when running as setuid

Closes #2168

See merge request GNOME/glib!1862
2021-01-07 15:15:46 +00:00
Philip Withnall
793f824a2e gsettingsschema: Ignore GSETTINGS_SCHEMA_DIR when running setuid
As with previous commits, this could have been used to load private data
for an unprivileged caller.

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

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
e2b5094cdb gresource: Ignore G_RESOURCE_OVERLAYS when running as setuid
It could have been used to load private data which would not normally be
accessible to an unprivileged caller.

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

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
45d01e5aa9 gdesktopappinfo: Validate XDG_CURRENT_DESKTOP before using it
Its components are used to build filenames, so if the value of
`XDG_CURRENT_DESKTOP` comes from an untrusted caller (as can happen in
setuid programs), using it unvalidated may be unsafe.

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

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
dba585d020 gdbusaddress: Ignore D-Bus addresses from the environment when setuid
As with the previous commit, it’s unsafe to trust the environment when
running as setuid, as it comes from an untrusted caller. In particular,
with D-Bus, the caller could set up a fake ‘system’ bus which fed
incorrect data to this process.

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

Helps: #2168
2021-01-07 15:02:25 +00:00
Philip Withnall
ba414ee100 giomodule: Ignore GIO_MODULE_DIR when running as setuid
Even if the modules in the given directory never get chosen to be used,
loading arbitrary code from a user-provided directory is not safe when
running as setuid, as the process’ environment comes from an untrusted
source.

Also ignore `GIO_EXTRA_MODULES`.

Spotted by Simon McVittie.

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

Fixes: #2168
2021-01-07 15:02:24 +00:00
Sebastian Dröge
95729db0e1 Merge branch 'error-tests' into 'master'
More GError tests

See merge request GNOME/glib!1861
2021-01-07 14:11:27 +00:00
Sebastian Dröge
65271eb93d Merge branch 'fix/default-windows-socket-udp-behavior' into 'master'
gsocket: Improve default UDP behavior on Windows

See merge request GNOME/glib!1844
2021-01-07 14:09:19 +00:00
Philip Withnall
a93c667056 Merge branch '1105-fix-codegen-unused' into 'master'
Annotate function parameters with G_GNUC_UNUSED when necessary

Closes #1105

See merge request GNOME/glib!1858
2021-01-06 18:48:50 +00:00
Frederic Martinsons
16dfd2033f Annotate function parameters with G_GNUC_UNUSED when necessary
(Tweaked by Philip Withnall to reformat code with `black`)

Closes #1105

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-06 18:35:17 +00:00
Philip Withnall
2cbcb2bda5 tests: Add various tests to bring GError coverage up to 100%
This is mostly to cover historic code, but also includes a couple of
additional tests for extended error domains (see #14).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-06 17:54:30 +00:00
Philip Withnall
e233859544 gerror: Drop a redundant condition
At this point, if `dest` is non-`NULL` then we can guarantee
`*dest != NULL` due to `g_propagate_error()` succeeding.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-06 17:24:00 +00:00
Philip Withnall
7f7512b62e gerror: Drop a redundant branch
At this point, `src` is guaranteed to be non-`NULL` due to the
	precondition check.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-06 17:23:31 +00:00
Timm Bäder
c983ded09f glocalfile: Fix an uninitialized variable
Clang says:

../gio/glocalfile.c:2090:11: warning: variable 'success' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      if (trashdir == NULL)
          ^~~~~~~~~~~~~~~~
../gio/glocalfile.c:2133:12: note: uninitialized use occurs here
      if (!success)
           ^~~~~~~
../gio/glocalfile.c:2090:7: note: remove the 'if' if its condition is always true
      if (trashdir == NULL)
      ^~~~~~~~~~~~~~~~~~~~~
../gio/glocalfile.c:2041:23: note: initialize the variable 'success' to silence this warning
      gboolean success;
                      ^
                       = 0

So just do that.
2021-01-06 17:36:32 +01:00
Philip Withnall
8a5cc02142 Merge branch 'extended-error' into 'master'
Extended error

See merge request GNOME/glib!1304
2021-01-06 16:02:27 +00:00
Krzesimir Nowak
80014804e2 gerror: Inform valgrind about our memory trickery
This is mostly duplicated code from gtype.c.
2021-01-06 15:44:59 +00:00
Krzesimir Nowak
3ee17447cf glib.supp: Ignore allocations while adding quarks 2021-01-06 15:44:59 +00:00
Krzesimir Nowak
3af6849881 glib.supp: Ignore one-off allocations in error registration. 2021-01-06 15:44:59 +00:00
Krzesimir Nowak
ae72f9de35 gerror: Add support for extended errors
This commit adds a G_DEFINE_EXTENDED_ERROR macro and
g_error_domain_register() functions to register extended error
domains.
2021-01-06 15:44:59 +00:00
Jordi Mas
0ea95b7cb4 Update Catalan translation 2021-01-06 16:04:48 +01:00
Sebastian Dröge
587b46fec3 Merge branch 'sophie-h-master-patch-90719' into 'master'
Add nullable annotation for g_file_get_uri_scheme

See merge request GNOME/glib!1840
2021-01-06 08:55:47 +00:00
Sophie Herold
b3740ac5b0 Add nullable annotation for g_file_get_uri_scheme 2021-01-06 08:55:47 +00:00
Sebastian Dröge
b777b4caaa Merge branch 'fix/socket-use-after-close' into 'master'
gsocket: Fix use-after-close

See merge request GNOME/glib!1845
2021-01-06 08:42:01 +00:00
Sebastian Dröge
86c9691a0a Merge branch 'fix/ssize-detection-on-old-glibc' into 'master'
build: Fix ssize_t detection on older versions of glibc

See merge request GNOME/glib!1855
2021-01-06 08:35:42 +00:00
Sebastian Dröge
609d1e292f Merge branch 'fix/android-system-checks' into 'master'
build: Fix Android system checks

See merge request GNOME/glib!1856
2021-01-06 08:34:52 +00:00
Sebastian Dröge
179679837b Merge branch 'fix/assert-not-reached-on-msvc' into 'master'
gtestutils: Fix g_assert_not_reached() on MSVC

See merge request GNOME/glib!1857
2021-01-06 08:32:58 +00:00
Sebastian Dröge
392dc7f145 Merge branch 'feature/disable-tests' into 'master'
build: Add option for disabling tests

See merge request GNOME/glib!1850
2021-01-06 08:27:18 +00:00
Sebastian Dröge
1810761d8e Merge branch 'fix/always-use-windows-unicode-apis' into 'master'
gwin32: Always use unicode APIs

See merge request GNOME/glib!1848
2021-01-06 08:26:18 +00:00
Sebastian Dröge
82d3b49438 Merge branch 'feature/clang-native-mutex' into 'master'
gthread: Port native mutex to Clang

See merge request GNOME/glib!1842
2021-01-06 08:11:02 +00:00
Ole André Vadla Ravnås
d35a606852 gtestutils: Fix g_assert_not_reached() on MSVC
When building with G_DISABLE_ASSERT.
2021-01-06 01:17:31 +01:00
Ole André Vadla Ravnås
ea0c4bf045 build: Fix inconsistent Android host system checks
To match the value in the Meson reference table for "Operating system
names", and our checks elsewhere.
2021-01-06 01:12:31 +01:00
Ole André Vadla Ravnås
7b7f987a36 build: Add missing host system checks for Android 2021-01-06 01:06:28 +01:00
Ole André Vadla Ravnås
6837c81d0e build: Fix ssize_t detection on older versions of glibc 2021-01-06 01:02:16 +01:00
Sebastian Dröge
6a6d82505a Merge branch 'fix/gthread-win32-incorrect-cast' into 'master'
gthread: Fix incorrect cast

See merge request GNOME/glib!1841
2021-01-05 22:33:01 +00:00
Ole André Vadla Ravnås
04b168846f build: Add option for disabling tests 2021-01-05 21:54:20 +01:00
Ole André Vadla Ravnås
0ab51f8d4e gwin32: Always use unicode APIs
Instead of the legacy ANSI ones. This also means GLib behaves correctly
when built with unicode preprocessor defines.
2021-01-05 21:42:59 +01:00
Ole André Vadla Ravnås
17c53b5f16 gsocket: Don't call WSAEnumNetworkEvents if socket is closed
Makes Application Verifier happy.
2021-01-05 21:20:38 +01:00
Ole André Vadla Ravnås
d01588f37e gsocket: Don't bother updating select mask if socket is closed 2021-01-05 21:20:34 +01:00
Pascal Buhler
9cd134d9fb gsocket: Improve default UDP behavior on Windows
An ICMP port unreachable will result in a socket error, which is a
really bad default for UDP sockets.
2021-01-05 21:08:15 +01:00