Commit Graph

19193 Commits

Author SHA1 Message Date
Arnaud Rebillout
57e070f874 gfdonotificationbackend: Fix possible invalid pointer in dbus callback
The way things were before: a FreedesktopNotification struct is
allocated before the dbus call, and this same struct is possibly re-used
for other dbus calls. If the server becomes unavailable, the callback
will be invoked after the call times out, which leaves a long time where
other dbus calls can happen, re-using the same FreedesktopNotification
as user data. When the first call times out, the callback is invoked,
and the user data is freed. Subsequent calls that used the same user
data will time out later on, and try to free a pointer that was already
freed, hence segfaults.

This bug can be reproduced in Cinnamon 3.6.7, as mentioned in:
<https://github.com/linuxmint/Cinnamon/issues/7491>

This commit fixes that by always allocating a new
FreedesktopNotification before invoking dbus_call(), ensuring that the
callback always have a valid user data.

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2018-06-13 08:32:30 +07:00
Xavier Claessens
0d0e23328f Merge branch '776583-win32-notifications-warn-once' into 'master'
gwin32notificationbackend: Only warn once

See merge request GNOME/glib!96
2018-06-12 23:09:59 +00:00
Philip Withnall
e660355d25 Merge branch 'tests-remove-perl' into 'master'
tests: Port gen-casefold-txt.pl and gen-casemap-txt.pl to Python 3. See #1332

See merge request GNOME/glib!37
2018-06-12 20:31:43 +00:00
Christoph Reiter
a580185cdc tests: Port gen-casefold-txt.pl and gen-casemap-txt.pl to Python 3. See #1332
I've tried to keep the code structure roughly the same.
2018-06-12 22:18:03 +02:00
Philip Withnall
603d40467c Merge branch '303-win32-spawn' into 'master'
gspawn: Make error codes on Windows more specific

Closes #303

See merge request GNOME/glib!100
2018-06-12 19:10:52 +00:00
Philip Withnall
d157102a54 gspawn: Factor out error code conversion function
This will be used in gspawn-win32.c too in an upcoming commit.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 16:13:51 +01:00
Philip Withnall
6c8da69443 gspawn: Make error codes on Windows more specific
A slightly modified patch originally written by Morten Welinder
<terra@gnome.org> to make the error codes returned by g_spawn_*()
functions more specific when on Windows. They are already this specific
on Linux.

Add a unit test for the ENOENT case.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 16:13:44 +01:00
Philip Withnall
f4d2051fc1 gspawn: Fix errno saving in Windows implementation
The error number was saved after some g_debug() and g_free() calls, in
various places, which meant it could have been overwritten since the
error we care about happened.

https://gitlab.gnome.org/GNOME/glib/issues/303

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-12 15:33:35 +01:00
Daniel Mustieles
8259ad9907 Updated Spanish translation 2018-06-12 15:56:27 +02:00
Philip Withnall
39382c7889 gwin32notificationbackend: Only warn once
Use a GOnce to make sure we only warn about notifications not being
supported on Windows once, rather than on each attempted notification.

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

Helps: https://gitlab.gnome.org/GNOME/glib/issues/1234
2018-06-12 12:45:35 +01:00
Christoph Reiter
fded2090e2 Merge branch '811-content-type-docs' into 'master'
docs: Add (transfer full) annotation to g_content_type_get_mime_type()

Closes #811

See merge request GNOME/glib!84
2018-06-12 08:52:56 +00:00
Philip Withnall
54498aa7ae Merge branch 'lrn/binary-tests' into 'master'
Force binary mode for stdout in printf tests

See merge request GNOME/glib!89
2018-06-11 15:06:25 +00:00
Philip Withnall
815478a74e Merge branch 'refcount-types' into 'master'
Reference counting types

See merge request GNOME/glib!54
2018-06-11 14:20:46 +00:00
Руслан Ижбулатов
ce1e32ec34 Force binary mode for stdout in printf tests
This allows test calls to produce output with \n
line separators on Windows, instead of \r\n.
Reduces the number of ifdefs, since all checks
can be done against one template on all platforms.
2018-06-11 14:20:34 +00:00
Emmanuele Bassi
927de4433e Port GHashTable to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
e67e4cb849 Port GBytes to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
439ee4822e Port GArray and friends to gatomicrefcount
Use the newly added API for reference counting instead of rolling our
own.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
09e2247d3f Add tests for refcount types
Test that the API behaves as expected, especially when we get to
saturation.

Additionally, check that both the function and the macro versions of the
API behave identically.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
827c208cbf Use macros for refcount types API
If we're using GCC we can use __extension__ to inline the grefcount and
gatomicrefcount API, and avoid the function call.

These macros are only enabled if G_DISABLE_CHECKS is defined, as they
remove critical warnings when the reference counters achieve saturation.
2018-06-11 14:59:39 +01:00
Emmanuele Bassi
9e5a53d576 Add reference counting types
We have a common pattern for reference counting in GLib, but we always
implement it with ad hoc code. This is a good chance at trying to
standardise the implementation and make it public, so that other code
using GLib can take advantage of shared behaviour and semantics.

Instead of simply taking an integer variable, we should create type
aliases, to immediately distinguish the reference counting semantics of
the code; we can handle mixing atomic reference counting with a
non-atomic type (and vice versa) by using differently signed values for
the atomic and non-atomic cases.

The gatomicrefcount type is modelled on the Linux kernel refcount_t
type; the grefcount type is added to let single-threaded code bases to
avoid paying the price of atomic memory barriers on reference counting
operations.
2018-06-11 14:59:39 +01:00
Philip Withnall
8bbc38b497 Merge branch '878-timezone-transitions' into 'master'
Resolve "glib uses wrong timezone transition with zoneinfo 2014c"

Closes #878

See merge request GNOME/glib!94
2018-06-11 13:48:47 +00:00
Xavier Claessens
73b229ab3a Merge branch 'wip/jehan/android-master-v3' into 'master'
Wip/jehan/android master v3

See merge request GNOME/glib!93
2018-06-11 13:37:55 +00:00
Paul Eggert
137dd7789b gtimezone: port to tzcode 2014c
Problem reported by Marien Zwart in:
https://gitlab.gnome.org/GNOME/glib/issues/878
Derived from a fix by John Ralls proposed in that bug report.
2018-06-11 14:30:16 +01:00
Jehan
866275f56b gio: fix various "warning: unused variable". 2018-06-11 15:13:55 +02:00
Jehan
f96417e470 gio: UNIX_PATH_MAX may be defined.
On an Android build, API 22, at least, I got a:
> warning: "UNIX_PATH_MAX" redefined

We were currently defining it as:
> #define UNIX_PATH_MAX sizeof (((struct sockaddr_un *) 0)->sun_path)
Whereas Android's headers define this variable of sockaddr_un as:
> char sun_path[UNIX_PATH_MAX];
So by definition, we will still get the right result in the end by just
using the original value of UNIX_PATH_MAX.
2018-06-11 15:13:55 +02:00
Jehan
631035342d gio: C_IN is defined in recent Android headers.
C_IN macro was added years ago in bcbaf1bef0, using same value as the
internal code of Android with the reasonning that "some parts of the API
used by the resolver objects is not public in the Android NDK (yet)".
Well since then things are changed, since it is definitely available (at
least on the API 22 of Android which I am using) in the public header
arpa/nameser_compat.h.
Let's just add a #ifndef to handle both cases when you build with an
older or recent API.
2018-06-11 15:13:55 +02:00
Philip Withnall
ad957b6630 Merge branch 'wip/piotrdrag/unicode-typography' into 'master'
Fix tests for Unicode strings

Closes #1212

See merge request GNOME/glib!75
2018-06-11 11:03:43 +00:00
Philip Withnall
18a34845b5 Merge branch 'classify-test-suites' into 'master'
Classify the tests

See merge request GNOME/glib!91
2018-06-11 11:02:09 +00:00
Philip Withnall
15a490755e Merge branch 'wip/lantw/freebsd-socket-tests' into 'master'
socket: Fix get_available_bytes on systems other than Linux and Windows

See merge request GNOME/glib!70
2018-06-11 10:58:25 +00:00
Philip Withnall
262b153c41 Merge branch 'wip/lantw/freebsd-meson-builds' into 'master'
Fix meson build files for FreeBSD

See merge request GNOME/glib!73
2018-06-11 10:53:10 +00:00
Philip Withnall
379e8fd22d Merge branch 'wip/lantw/freebsd-gettext-tests' into 'master'
tests: Set both environment variable and locale when running tests

See merge request GNOME/glib!69
2018-06-11 10:51:35 +00:00
Chun-wei Fan
2358ee17b5 README.win32: Mention about /utf-8 and GIT
Let people know that Visual Studio 2015 and later provide a /utf-8
option to eliminate the need to set the System's non-Unicode locale and
the subsequent reboot.

Also let people know that it is recommended to have GIT for Windows
installed so that some dependencies' sources can be downloaded and built
along with GLib et al when needed.

Please see MR !65 for a discussion on the reasoning why GIT for Windows
is recommended.
2018-06-11 10:34:52 +08:00
Emmanuele Bassi
16d1a3d28c Classify the tests
Meson has the ability to classify tests according to "suites", a list of
tags. This is especially useful when we want to run specific sets of
tests — e.g. only GLib's tests — instead of the whole test suite. It
also allows us to classify special tests, like "slow" ones, so that we
can only run them when needed.
2018-06-10 15:33:06 +01:00
Ting-Wei Lan
293c103a7d socket: Fix get_available_bytes on systems other than Linux and Windows
FIONREAD ioctl on Linux reports the size of payload on UDP sockets.
However, other systems usually add internal header size to the reported
size, which vary between different operating systems and socket types.
To make it work on more systems, we should follow what we do on Windows
instead of using this unreliable FIONREAD ioctl.

This fixes socket test on FreeBSD.
2018-06-09 10:02:50 +08:00
Ting-Wei Lan
a77790330b meson: libelf.pc is not always available
libelf, just like libc, is not a single project. It is an interface
which can be implemented independently by different operating systems.
Therefore, we cannot expect all systems to provide a .pc file, and we
should fallback to cc.find_library and cc.has_function like what we
already do in autotools build.
2018-06-09 09:40:51 +08:00
Philip Withnall
e22bffb522 Merge branch 'wip/oholy/trashing-locations2' into 'master'
Resubmit of reverted trash related changes and tests

See merge request GNOME/glib!83
2018-06-09 00:28:09 +00:00
Philip Withnall
e3280675f5 Merge branch 'wip/lantw/freebsd-kqueue-simple' into 'master'
FreeBSD kqueue file monitor fixes: the simple parts

See merge request GNOME/glib!76
2018-06-08 21:36:27 +00:00
Philip Withnall
d1e2ef56ea Merge branch 'meson-distcheck' into 'master'
Update list of meson files to distcheck

See merge request GNOME/glib!86
2018-06-08 20:50:01 +00:00
Xavier Claessens
cb10eacedf Update list of meson files to distcheck 2018-06-08 15:29:20 -04:00
Ting-Wei Lan
6f2b3503a5 tests: Set both environment variable and locale when running tests
Non-glibc gettext implementation seems to decide the language from
LC_MESSAGES environment variable instead of LC_MESSAGES locale, so
we should set both environment variable and locale when running tests
which need translation from specific languages.
2018-06-09 02:40:01 +08:00
Ting-Wei Lan
313a0fffe5 tests: Use de_DE.UTF-8 instead of de_DE in gsettings test
FreeBSD doesn't have a de_DE locale without encoding suffix.
2018-06-09 02:40:01 +08:00
Piotr Drąg
b974cccdaf Revert "Partially revert 10c490cdfe3ae042f747bd00f787492e2bdb7ed0"
This reverts commit 2d56c49b10.
2018-06-08 16:15:54 +02:00
Piotr Drąg
0bb3cacacb Fix tests for Unicode strings
Based on a patch by Simon McVittie <simon.mcvittie@collabora.co.uk>.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1212
2018-06-08 16:13:52 +02:00
Philip Withnall
6775fe2555 docs: Add (transfer full) annotation to g_content_type_get_mime_type()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/811
2018-06-08 14:05:40 +01:00
Ondrej Holy
1cbb5dd95f glocalfile: Fix error code when trash not found
G_IO_ERROR_NOT_SUPPORTED is used as parameter for g_set_io_error(),
however, errno is expected instead and thus error code is set to 0,
which is wrong. Let's use ENOTSUP instead.
2018-06-08 14:15:18 +02:00
Philip Withnall
e1eaea3eea Merge branch '1406-compile-resources-help' into 'master'
glib-compile-resources: Clarify --help output for --sourcedir argument

Closes #1406

See merge request GNOME/glib!81
2018-06-08 11:48:21 +00:00
Ondrej Holy
15cdcd2e0b glocalfile: Check that parent device is the same when trashing
To be honest, I am not sure why, but in some special environments (e.g.
our CI integration) can happen, that file device number is different from
parent device number. Return "Unable to find or create trash directory for
%s" error from g_local_file_trash() in that case and also set
G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH appropriately.
2018-06-08 13:27:13 +02:00
Ondrej Holy
83ca61a421 glocalfile: Add test case for g_file_trash
g_local_file_trash has been changed to return G_IO_ERROR_NOT_SUPPORTED
for locations on system-internal mounts. Let's verify that.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 13:27:13 +02:00
Philip Withnall
ebcb434c75 Merge branch 'master.nomsvcproj' into 'master'
Remove glib-zip.in (from Issue #1409)

See merge request GNOME/glib!80
2018-06-08 10:52:38 +00:00
Philip Withnall
c251c719b6 glib-compile-resources: Minor string improvements to --help output
Fix some capitalisation problems, and one missing space.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-08 11:43:44 +01:00