Commit Graph

18454 Commits

Author SHA1 Message Date
Ondrej Holy
3edc50498f glocalfilemonitor: Fallback to poll file monitor for NFS
GLib currently tries to use FAM volume monitor for monitoring files
within home on NFS. If FAM support is not available, it fallbacks by
default to GInotifyFileMonitor. I think we should fallback to
GPollFileMonitor instead, because inotify is not reliable on NFS,
which may cause issues for dconf. With this patch, it should be safe to
not build libgiofam and still be sure that dconf works properly if home
is mounted on NFS. I think this might be a first step to remove FAM
support from GLib completely, because gamin is buggy and dead for
several years already. Gamin just polls files on NFS anyway. This
change applies on files only, because GPollFileMonitor seems doesn't
support dirs, however it should be enough for dconf. The other
drawback is that one can't set poll timeout currently. Just a note
that this can still be overwritten by GIO_USE_FILE_MONITOR.
2018-08-02 13:14:10 +02:00
Philip Withnall
3126f73c80 Merge branch '1368-codegen-interface-info' into 'master'
gdbus-codegen: Add a mode to generate GDBusInterfaceInfo structures

Closes #1368

See merge request GNOME/glib!13
2018-06-15 10:35:46 +00:00
Christoph Reiter
45f9b5a336 Merge branch 'strlcpy' into 'master'
Meson: Add check for strlcpy/strlcat

See merge request GNOME/glib!111
2018-06-15 05:22:54 +00:00
Christoph Reiter
ee5a37f657 Merge branch 'threads-none' into 'master'
Remove unused THREADS_NONE

See merge request GNOME/glib!110
2018-06-15 04:55:17 +00:00
Christoph Reiter
efb5d50010 Merge branch 'struct-member' into 'master'
Meson: Add missing checks for struct members

See merge request GNOME/glib!113
2018-06-15 04:51:06 +00:00
Xavier Claessens
5ee54589e2 Meson: Add missing checks for struct members 2018-06-14 14:32:49 -04:00
Xavier Claessens
76a7f7dca3 Remove unused THREADS_NONE
Thread implementation is mandatory and configure will abort. So there is
no point in having a THREADS_NONE conditional/define.
2018-06-14 14:07:40 -04:00
Xavier Claessens
5ebcfdf447 Meson: Add check for strlcpy/strlcat
I don't know why it runs the code in autotools instead of only checking
if it links, but let's copy the same logic for now.
2018-06-14 14:00:43 -04:00
Philip Withnall
0e3b137210 codegen: Fix a minor Python linting warning
This introduces no functional changes.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
3a1536ba34 codegen: Suppress the old --xml-files option in the --help output
Since it’s deprecated in favour of positional arguments, including it in
the help output is confusing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
8916874ee6 codegen: Add --interface-info-[body|header] modes
These generate basic .c and .h files containing the GDBusInterfaceInfo
for a D-Bus introspection XML file, but no other code (no skeletons,
proxies, GObjects, etc.).

This is useful for projects who want to describe their D-Bus interfaces
using introspection XML, but who wish to implement the interfaces
manually (for various reasons, typically because the skeletons generated
by gdbus-codegen are too simplistic and limiting). Previously, these
projects would have had to write the GDBusInterfaceInfo manually, which
is painstaking and error-prone.

The new --interface-info-[body|header] options are very similar to
--[body|header], but mutually exclusive with them.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
99b64d4014 codegen: Support Since and name changing annotations on annotations
Recursive annotations do seem to be supported, so we should support them
properly in the type system representation. This currently introduces no
behavioural changes, but will be used in upcoming commits.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795304
2018-06-14 18:57:53 +01:00
Philip Withnall
c36c55dbd6 Merge branch 'fdonotif-fix-backend-dispose-race' into 'master'
gfdonotificationbackend: hold a strong ref on backend

See merge request GNOME/glib!106
2018-06-14 17:49:29 +00:00
Philip Withnall
7830b65c5f Merge branch 'triple_dash' into 'master'
goption: Reject group options specified with three dashes

Closes #1418

See merge request GNOME/glib!108
2018-06-14 17:43:53 +00:00
Philip Withnall
6dc543c6d3 Merge branch 'issue-699' into 'master'
Deprecate g_type_class_add_private()

Closes #699

See merge request GNOME/glib!7
2018-06-14 17:27:30 +00:00
Nathan Miller
0b09890bff goption: Reject group options specified with three dashes
Commandline option parsing would recognize group options specified
with three dashes (i.e. ---foo 42).  This behaviour was limited to group
options.
2018-06-14 10:49:31 -05:00
Xavier Claessens
2fe4fa6cd0 Merge branch 'meson-version' into 'master'
build: Bump Meson dependency to 0.46.1

See merge request GNOME/glib!107
2018-06-14 13:44:51 +00:00
Philip Withnall
9c840fedd8 build: Bump Meson dependency to 0.46.1
We don’t strictly require this, but given that our CI runs it, we
essentially never test with 0.46.0, so it might as well be broken.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-06-14 13:02:18 +01:00
Emmanuele Bassi
7e5db31d36 Deprecate g_type_class_add_private()
It's been 4 years and 8 development cycles since we introduced
G_ADD_PRIVATE and offset-based private data access. It is now
time to finally deprecate the old mechanism.

Closes: #699
2018-06-14 11:33:53 +01:00
Philip Withnall
d8c003dea6 Merge branch 'G_SOURCE_FUNC-macro' into 'master'
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type

See merge request GNOME/glib!82
2018-06-14 09:34:12 +00:00
Will Thompson
039fa6897b
Add G_SOURCE_FUNC cast macro which suppresses -Wcast-function-type
This is the workaround suggested by
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcast-function-type

This warning is not enabled by default during the GLib build, but
applications may want to opt into it.
2018-06-14 10:11:12 +01:00
Arnaud Rebillout
5a73eef749 gfdonotificationbackend: hold a strong ref on backend
This is to avoid race between dispose() being called on the
GFdoNotificationBackend instance, and any pending operations which are
still waiting on a D-Bus reply when it’s disposed.

(thx to Philip Withnall for pointing that out)

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
2018-06-14 11:28:17 +07:00
Philip Withnall
c26558c1b1 Merge branch 'g_dbus_is_supported_address-assertion-failure' into 'master'
g_dbus_is_supported_address(): set error if returning FALSE

See merge request GNOME/glib!101
2018-06-13 11:31:41 +00:00
Will Thompson
ba7b035f5b
g_dbus_is_supported_address(): set error if returning FALSE
Previously, calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", NULL)

correctly returned FALSE; but calling:

    g_dbus_is_supported_address ("some-imaginary-transport:", &error)

crashed with:

    GLib-GIO:ERROR:../gio/gdbusaddress.c:434:g_dbus_is_supported_address:
    assertion failed: (ret || (!ret && (error == NULL || *error != NULL)))

This was because, if the address component did not start with a known
transport, no error was set. Fix this, reusing an error string used by
the corresponding else branch in g_dbus_address_connect(), and adjust
the test to pass both NULL and non-NULL GError **s to this function in
every test case. This case:

    g_assert (!g_dbus_is_supported_address ("some-imaginary-transport:foo=bar;unix:path=/this/is/valid", NULL));

would have caught this bug with a non-NULL GError **.
2018-06-13 11:01:56 +01:00
Philip Withnall
e48a3920d4 Merge branch 'fdonotif-segfault-fix' into 'master'
gfdonotificationbackend: Fix possible invalid pointer in dbus callback

See merge request GNOME/glib!90
2018-06-13 09:27:11 +00:00
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