Commit Graph

23155 Commits

Author SHA1 Message Date
Philip Withnall
9a34c35c2b Merge branch 'wip/smcv/gdbus-test-leak' into 'master'
gdbus-serialization: Don't leak string containing first serialization

See merge request GNOME/glib!1906
2021-01-29 16:31:42 +00:00
Simon McVittie
de87bcf7ff gdbus-serialization: Don't leak string containing first serialization
We format the message into a string twice, once for each byte-order,
but only return the one corresponding to the last byte-order to the
caller. This means we need to free the first one.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-28 21:39:23 +00:00
Simon McVittie
82adfd7e3a Add test coverage for G_SPAWN_SEARCH_PATH
For manual test coverage that would reproduce the bug fixed in !1902,
copy /bin/true (or any other harmless executable) to
/usr/bin/spawn-test-helper.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-28 18:37:45 +00:00
Philip Withnall
628435eb16 Merge branch 'wip/autoconf-serial' into 'master'
m4macros: Increment serial number of glib-2.0.m4

See merge request GNOME/glib!1903
2021-01-28 17:39:09 +00:00
Philip Withnall
13839f75d3 Merge branch 'ci-check-remote-exist' into 'master'
Check if the remote already exists before adding it.

See merge request GNOME/glib!1901
2021-01-28 17:24:06 +00:00
Philip Withnall
9ea75d10d4 Merge branch '344-gdbus-completion' into 'master'
[gdbus-tool] Check object path validity during completion inside print_paths

Closes #344

See merge request GNOME/glib!1897
2021-01-28 17:02:15 +00:00
Simon McVittie
7ff0fb3af5 spawn: Don't set a search path if we don't want to search PATH
do_exec() and g_execute() rely on being passed a NULL search path
if we intend to avoid searching the PATH, but since the refactoring
in commit 62ce66d4, this was never done. This resulted in some spawn
calls searching the PATH when it was not intended.

Spawn calls that go through the posix_spawn fast-path were unaffected.

The deprecated gtester utility, as used in GTK 3, relies on the
ability to run an executable from the current working directory by
omitting the G_SPAWN_SEARCH_PATH flag. This *mostly* worked, because
our fallback PATH ends with ".". However, if an executable of the
same name existed in /usr/bin or /bin, it would run that instead of the
intended test: in particular, GTK 3's build-time tests failed if
ImageMagick happens to be installed, because gtester would accidentally
run display(1) instead of testsuite/gdk/display.

Fixes: 62ce66d4 "gspawn: Don’t use getenv() in async-signal-safe context"
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977961
2021-01-28 16:49:06 +00:00
Xavier Claessens
4273c43902 glib_typeof: It is an API break that should be opt-in
That changes the return type of functions like g_object_ref() that can
break C++ applications like Webkit. Note that it is not an ABI break.

It must thus be opt-in the same way we did when adding this to
g_object_ref() for GNU C compilers in the first place. Unfortunately it
cannot be done directly in gmacros.h because GLIB_VERSION_2_68 is not
defined there, and gversionmacros.h cannot be included there because
there is some strict ordering in which those headers must be included.

This means that applications that does not define
GLIB_VERSION_MIN_REQUIRED will still get an API break, so we encourage
them to declare their minimum requirement to avoir such issues in the
future too.
2021-01-27 09:26:39 -05:00
Xavier Claessens
d95885d91e atomic: Fix type error with clang++
clang++ checks the 2nd args of __atomic_compare_exchange_n() has the
same type as the first, which fails when 2nd arg is nullptr which is of
type nullptr_t.

Ideally it should do `glib_typeof (*(atomic)) gapcae_oldval = (oldval);`
to ensure oldval and atomic have compatible types but unfortunately that
does not work neither.

Since that function never has been typesafe, and it is not even
attempting to use glib_typeof in case __ATOMIC_SEQ_CST is not defined,
drop it in __atomic_ case too.

Fixes issue #2226.
2021-01-27 09:23:48 -05:00
Xavier Claessens
51003d409b Use C++11 decltype where possible
There are various places glib uses __typeof__ for type safety, but
that's a GNUC extension. C++11 has standard decltype() that does a
similar job, at least for cases we care about.

This avoids C++ code to always have to cast return value of
g_object_ref() which was causing type kind of error:

error: invalid conversion from ‘gpointer’ {aka ‘void*’} to
‘GstElementFactory*’ {aka ‘_GstElementFactory*’} [-fpermissive]
2021-01-27 09:23:48 -05:00
Simon McVittie
25f297111e m4macros: Increment serial number of glib-2.0.m4
aclocal's ability to compare the version of macros and use the latest
version relies on the serial number being incremented on every change,
or at least on every functional change.

Fixes: 6f26637e "m4macros: replace obsolete macros AC_TRY_RUN and AC_TRY_LINK in glib-2.0.m4"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-01-27 11:55:37 +00:00
Frederic Martinsons
81e2fff49c Check if the remote already exists before adding it.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-27 09:13:11 +01:00
Sebastian Dröge
fdc192f460 Merge branch 'fix/darwin-nosigpipe-regression' into 'master'
gsocket: Fix SO_NOSIGPIPE regression on Darwin

See merge request GNOME/glib!1894
2021-01-27 07:35:04 +00:00
Frederic Martinsons
1c7c849d34 Correct memory leaks of error in completion case.
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-26 19:42:21 +00:00
Frederic Martinsons
43c2d747a3 Check object path validity during completion inside print_paths.
Closes #344

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-26 19:42:21 +00:00
Philip Withnall
742e55b754 Merge branch 'fix/gwin32appinfo-printf-length-sub-specifier' into 'master'
gwin32appinfo: Fix printf length sub-specifier

See merge request GNOME/glib!1893
2021-01-26 17:52:10 +00:00
Philip Withnall
4dc7603b3e Merge branch 'autoconf-obsolete-macros' into 'master'
m4macros: replace obsolete macros AC_TRY_RUN and AC_TRY_LINK in glib-2.0.m4

See merge request GNOME/glib!1899
2021-01-26 13:16:42 +00:00
Philip Withnall
9e5b9a8f70 Merge branch 'wip/g-test-path' into 'master'
gtestutils: Add g_test_get_path() API

See merge request GNOME/glib!1898
2021-01-26 11:05:31 +00:00
Simon Marchi
6f26637e83 m4macros: replace obsolete macros AC_TRY_RUN and AC_TRY_LINK in glib-2.0.m4
Running autoconf 2.70 with -Wall,error on a configure.ac that uses
AM_PATH_GLIB_2_0 gives:

    configure.ac:261: warning: The macro `AC_TRY_RUN' is obsolete.
    configure.ac:261: You should run autoupdate.
    ./lib/autoconf/general.m4:2996: AC_TRY_RUN is expanded from...
    /usr/share/aclocal/glib-2.0.m4:11: AM_PATH_GLIB_2_0 is expanded from...
    configure.ac:261: the top level
    configure.ac:261: warning: The macro `AC_TRY_LINK' is obsolete.
    configure.ac:261: You should run autoupdate.
    ./lib/autoconf/general.m4:2919: AC_TRY_LINK is expanded from...
    /usr/share/aclocal/glib-2.0.m4:11: AM_PATH_GLIB_2_0 is expanded from...
    configure.ac:261: the top level

Run autoupdate on glib-2.0.m4 to change AC_TRY_RUN and AC_TRY_LINK into
the suggested alternative, and adjust the formatting a little bit.

The macros used in the alternative existed for long enough that there
shouldn't be a problem with backwards compatibility.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
2021-01-25 16:13:08 -05:00
Fran Dieguez
7be2e6bd80 Update Galician translation 2021-01-25 18:59:49 +00:00
Jonas Ådahl
657d18fdbb gtestutils: Add g_test_get_path() API
I found myself wanting to know the test that is currently being run,
where e.g. __func__ would be inconvenient to use, because e.g. the place
the string was needed was not in the test case function. Using __func__
also relies on the test function itself containing the whole path, while
loosing the "/" information that is part of the test path.
2021-01-25 16:34:12 +01:00
Philip Withnall
2d6eed3a61 Merge branch '2011-add-unit-test-watch' into 'master'
Extend dbus watching name tests with auto start flags and use of closures.

Closes #2011

See merge request GNOME/glib!1885
2021-01-25 14:35:55 +00:00
Philip Withnall
5463436fc7 Merge branch 'fix/gfile-kernel-headers-compat' into 'master'
gfile: Add Linux kernel headers compatibility kludge

See merge request GNOME/glib!1843
2021-01-25 14:25:59 +00:00
Frederic Martinsons
d890b1ce5f Extend dbus watching name tests:
- use watcher auto start flag.
  - use watch_name_on_connection_with_closures.
  - use an existing service name for auto start.

Closes #2011

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-25 15:00:12 +01:00
Francesco Tamagni
f6ce5739f8 gsocket: Fix SO_NOSIGPIPE regression on Darwin
Where the early call to g_socket_set_option() fails because of
check_socket() failing due to `inited` still being FALSE.

This brings 634b692 back into working order, by fixing the regression
introduced in 39f047e.

Co-authored-by: Ole André Vadla Ravnås <oleavr@gmail.com>
2021-01-21 21:17:24 +01:00
Ole André Vadla Ravnås
9b2ab509da gwin32appinfo: Fix printf length sub-specifier
warning: format string '%x' requires an argument of type 'unsigned int',
but variadic argument 1 has type 'gsize'.
2021-01-21 20:10:50 +01:00
Emmanuel Fleury
0c49122949 Fix signedness warning in gio/gdatainputstream.c:read_data()
gio/gdatainputstream.c: In function ‘read_data’:
gio/gdatainputstream.c:313:35: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  313 |   g_warn_if_fail (res == size);
      |                       ^~
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
579e9e49c5 Fix several warnings in gio/gapplicationimpl-dbus.c:g_application_impl_command_line()
gio/gapplicationimpl-dbus.c: In function ‘g_application_impl_command_line’:
gio/gapplicationimpl-dbus.c:772:3: error: ‘static’ is not at beginning of declaration
  772 |   const static GDBusInterfaceVTable vtable = {
      |   ^~~~~
gio/gapplicationimpl-dbus.c:774:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  774 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
cf5a6cfe3a Fix several warnings in gio/gapplicationimpl-dbus.c:g_application_impl_attempt_primary()
gio/gapplicationimpl-dbus.c: In function ‘g_application_impl_attempt_primary’:
gio/gapplicationimpl-dbus.c:364:3: error: ‘static’ is not at beginning of declaration
  364 |   const static GDBusInterfaceVTable vtable = {
      |   ^~~~~
gio/gapplicationimpl-dbus.c:368:3: error: missing initializer for field ‘padding’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  368 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
7d81742339 Fix missing initializer warning in gio/gmenuexporter.c:g_dbus_connection_export_menu_model()
gio/gmenuexporter.c: In function ‘g_dbus_connection_export_menu_model’:
gio/gmenuexporter.c:787:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  787 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
5af79a84e3 Fix signedness warning in gio/gsocketlistener.c:g_socket_listener_close()
gio/gsocketlistener.c: In function ‘g_socket_listener_close’:
gio/gsocketlistener.c:1019:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
 1019 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
a68fbcc002 Fix signedness warning in gio/gsocketlistener.c:g_socket_listener_set_backlog()
gio/gsocketlistener.c: In function ‘g_socket_listener_set_backlog’:
gio/gsocketlistener.c:993:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  993 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
cd540a228a Fix signedness warning in gio/gsocketlistener.c:add_sources()
gio/gsocketlistener.c: In function ‘add_sources’:
gio/gsocketlistener.c:612:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  612 |   for (i = 0; i < listener->priv->sockets->len; i++)
      |                 ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
887f59ebc0 Fix missing initializer in gio/gactiongroupexporter.c:g_dbus_connection_export_action_group()
gio/gactiongroupexporter.c: In function ‘g_dbus_connection_export_action_group’:
gio/gactiongroupexporter.c:542:3: error: missing initializer for field ‘get_property’ of ‘GDBusInterfaceVTable’ {aka ‘const struct _GDBusInterfaceVTable’}
  542 |   };
      |   ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
8236b66a5d Fix signedness warning in gio/gnetworkmonitornetlink.c:remove_network()
gio/gnetworkmonitornetlink.c: In function ‘remove_network’:
gio/gnetworkmonitornetlink.c:272:21: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’}
  272 |       for (i = 0; i < nl->priv->dump_networks->len; i++)
      |                     ^
2021-01-21 11:59:09 +01:00
Emmanuel Fleury
f885d80ea3 Fix missing initializer warning in gio/gtask.c
gio/gtask.c:2153:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’}
 2153 | };
      | ^
2021-01-21 11:59:09 +01:00
Philip Withnall
3791add329 Merge branch 'feature/glib-debug-build-option' into 'master'
build: Add glib_debug option

See merge request GNOME/glib!1889
2021-01-20 19:01:43 +00:00
Emmanuele Bassi
caf2343fae Merge branch 'gtype-docs' into 'master'
gtype: Improve formatting of GType documentation

See merge request GNOME/glib!1890
2021-01-20 15:54:20 +00:00
Philip Withnall
d4a875d8cd gtype: Improve formatting of GType documentation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-20 15:42:55 +00:00
Ole André Vadla Ravnås
670b84ca30 build: Add glib_debug option
To allow disabling debug infrastructure in builds with debug symbols.
2021-01-20 16:05:36 +01:00
Philip Withnall
8bdd7438e5 Merge branch '968-add-gdbus-obj-path-escape' into 'master'
Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape

Closes #968

See merge request GNOME/glib!1871
2021-01-20 13:23:25 +00:00
MARTINSONS Frederic
47355c358d Add g_dbus_utils_object_path_escape and g_dbus_utils_object_path_unescape
These two APIs are useful to publish an object which path content is not
controlled (e.g. dynamically built or coming from external source).

Closes #968

(Rebased and tweaked by Frederic Martinsons)

Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
2021-01-20 13:23:24 +00:00
Philip Withnall
b6a1fa47fe Merge branch 'settings-test-cleanups' into 'master'
Various memory leak cleanups to GSettings tests

See merge request GNOME/glib!610
2021-01-20 13:15:26 +00:00
Philip Withnall
5cafd748e3 tests: Remove incorrect unref from tls-bindings tests
`g_tls_backend_get_default()` does not return a reference to the
backend, so don’t drop one.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-20 12:51:41 +00:00
Philip Withnall
1cde07b978 gsettings: Fix a minor memory leak when getting GSettingsAction:state
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-01-20 12:51:41 +00:00
Philip Withnall
98274e09de tests: Free GSettingsBackend singleton at end of gsettings tests
This makes the tests a whole lot closer to being valgrind-clean, and
revealed a few legitimate memory leaks in amongst the noise caused by
keeping the singleton GSettingsBackend around for the lifetime of the
process.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-01-20 12:51:41 +00:00
Philip Withnall
22b924b64a giomodule: Don’t mandatorily cache GIOModule implementations
While all of the current callers of _g_io_module_get_default() want to
cache the returned GObject for the lifetime of the process, that doesn’t
necessarily have to be the case, so let callers make that decision on a
case-by-case basis.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2021-01-20 12:51:41 +00:00
Philip Withnall
86aec50c0a Merge branch 'feature/qnx-support' into 'master'
Port to QNX

See merge request GNOME/glib!1847
2021-01-20 12:28:54 +00:00
Philip Withnall
c5eec23ee2 Merge branch 'fix/support-for-systems-without-ipv6' into 'master'
ginetaddress: Handle systems without IPv6 support

See merge request GNOME/glib!1853
2021-01-20 12:18:01 +00:00
WorksButNotTested
f4ca92df2b ginetaddress: Handle systems without IPv6 support 2021-01-20 01:11:07 +01:00