Commit Graph

19215 Commits

Author SHA1 Message Date
Philip Withnall
2bd09d56a2 Merge branch 'wip/sadiq/fixes' into 'master'
grefstring: Avoid an unnecessary NUL assignment

See merge request GNOME/glib!206
2018-08-22 11:21:23 +00:00
Emmanuele Bassi
c1d74052f5 Merge branch '1448-g-error-secretly-doesnt-abort' into 'master'
gmessages: Clarify documentation about aborting on fatal log levels

Closes #1448

See merge request GNOME/glib!254
2018-08-22 11:18:44 +00:00
Emmanuele Bassi
d77516df81 Merge branch '1465-bye-bye-g-gnuc-malloc' into 'master'
glib: Drop G_GNUC_MALLOC usage from various allocation functions

Closes #1465

See merge request GNOME/glib!260
2018-08-22 11:17:52 +00:00
Philip Withnall
c849a4ddd3 glib: Drop G_GNUC_MALLOC usage from various other allocation functions
These functions may be OK to leave the G_GNUC_MALLOC attribute on,
because the only valid pointers in the storage areas they return are,
themselves, new pointers.

However, it’s a lot easier to remove the attributes now than to try and
diagnose miscompilations in future. The performance impact of this is
likely to be unmeasurable. If there are performance problems caused by
this, then they can be profiled and fixed case-by-case in future,
bearing in mind the possibility for miscompilation if G_GNUC_MALLOC is
readded.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
082730fc3e glib: Drop G_GNUC_MALLOC usage from various allocation functions
These are our most critically incorrect uses of G_GNUC_MALLOC. See the
previous commit for details.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
c879f50f8a docs: Update the documentation for G_GNUC_MALLOC to reflect recent GCC
Thanks to some great investigation by Benjamin Moody, it’s clear that
our documentation and usage of G_GNUC_MALLOC has fallen behind GCC’s
interpretation of the malloc attribute, meaning that recent versions of
GCC could miscompile code which uses G_GNUC_MALLOC incorrectly.

Update the documentation of G_GNUC_MALLOC to match the current GCC
documentation (for GCC 8.2). Following commits will drop our use of
G_GNUC_MALLOC from inappropriate functions.

Specifically, the change in GCC’s interpretation of the malloc attribute
which could cause miscompilation is that returned storage areas are now
assumed to not contain valid pointers — so realloc() cannot have the
malloc attribute, and neither can a function which returns a newly
allocated structure with fields initialised to other pointers.

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

https://gitlab.gnome.org/GNOME/glib/issues/1465
2018-08-22 11:18:02 +01:00
Philip Withnall
a0456f9c96 gmessages: Clarify documentation about aborting on fatal log levels
Clarify that we actually raise SIGTRAP rather than calling abort(). We
haven’t called abort() since about 2011, when commit
a04efe6afb changed the logic to use
SIGTRAP to make it possible to skip past fatal log messages in the
debugger if they weren’t relevant to the problem being debugged.

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

https://gitlab.gnome.org/GNOME/glib/issues/1448
2018-08-22 10:37:15 +01:00
Philip Withnall
965bc6d857 gmem: Clarify calling convention behaviour of g_clear_pointer() in docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1494
2018-08-22 10:28:47 +01:00
Cheng-Chia Tseng
b2029fa9c7 Update Chinese (Taiwan) translation 2018-08-21 16:17:16 +00:00
John Ralls
5df3f42d7b build: Mismatch between gint64 and int64_t in OSX 64-bit
Check for compile warnings when assigning an int64_t* to a long*,
make gint64 a long long if they occur and assigning an int64_t* to
a long long* doesn't.

Modified by Philip Withnall <withnall@endlessm.com> to support Meson as
well as autotools.

https://gitlab.gnome.org/GNOME/glib/issues/972
2018-08-21 10:25:47 +01:00
Christoph Reiter
f6703db378 Merge branch 'mingw-statbuf-size' into 'master'
gstdio: use _stat64 for GStatBuf on 64bit mingw. Fixes #1476

Closes #1476

See merge request GNOME/glib!226
2018-08-20 10:48:16 +00:00
Christoph Reiter
63d3311c26 gstdio: use _stat64 for GStatBuf on 64bit mingw. Fixes #1476
The size of stat depends on various macros on Windows which leads to
the problem of size mismatches when glib is built with a different configuration
than a program using it.

For example the autotools build defaults to _FILE_OFFSET_BITS=64 and a program
not defining  _FILE_OFFSET_BITS will allocate a too small struct on the stack,
leading to stack corruption when glib writes to it.

To make the size the user sees always match the default mingw build define GStatBuf
as _stat64 (same as _FILE_OFFSET_BITS=64) under mingw+64bit.
2018-08-20 12:40:21 +02:00
Philip Withnall
3736139358 Merge branch 'mingw-file-offset-64' into 'master'
meson: define _FILE_OFFSET_BITS=64 for MinGW. See #1476

See merge request GNOME/glib!228
2018-08-20 10:25:53 +00:00
Philip Withnall
769326e1f1 Merge branch 'wip/lantw/fix-gtestdbus-crash-on-freebsd'
Manually rebased.

https://gitlab.gnome.org/GNOME/glib/merge_requests/251
2018-08-20 11:13:23 +01:00
Ting-Wei Lan
9147403893 gtestdbus: Fix watcher crash on FreeBSD
In file gio/gtestdbus.c, function watch_parent, there is a loop which
waits for commands sent from the parent process and kills all processes
recorded in 'pids_to_kill' array on parent process exit. The detection
of parent process exit is done by calling g_poll and checking whether
the returned event is G_IO_HUP. However, 'revents' is a bit mask, and
we should use a bitwise-AND check instead of the equality check here.

It seems to work fine on Linux, but it fails on FreeBSD because the
g_poll returns both G_IO_IN and G_IO_HUP on pipe close. This means the
watcher process continues waiting for commands after the parent process
exit, and g_io_channel_read_line returns G_IO_STATUS_EOF with 'command'
set to NULL. Then the watcher process crashes with segfault when calling
sscanf because 'command' is NULL. Since the test result is already
reported by the parent process as 'OK', this kind of crash is likely to
be unnoticed unless someone checks dmesg messages after the test:

pid 57611 (defaultvalue), uid 1001: exited on signal 11
pid 57935 (actions), uid 1001: exited on signal 11
pid 57945 (gdbus-bz627724), uid 1001: exited on signal 11
pid 57952 (gdbus-connection), uid 1001: exited on signal 11
pid 57970 (gdbus-connection-lo), uid 1001: exited on signal 11
pid 57976 (gdbus-connection-sl), uid 1001: exited on signal 11
pid 58039 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58043 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58047 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58051 (gdbus-exit-on-close), uid 1001: exited on signal 11
pid 58055 (gdbus-export), uid 1001: exited on signal 11
pid 58059 (gdbus-introspection), uid 1001: exited on signal 11
pid 58065 (gdbus-names), uid 1001: exited on signal 11
pid 58071 (gdbus-proxy), uid 1001: exited on signal 11
pid 58079 (gdbus-proxy-threads), uid 1001: exited on signal 11
pid 58083 (gdbus-proxy-well-kn), uid 1001: exited on signal 11
pid 58091 (gdbus-test-codegen), uid 1001: exited on signal 11
pid 58095 (gdbus-threading), uid 1001: exited on signal 11
pid 58104 (gmenumodel), uid 1001: exited on signal 11
pid 58108 (gnotification), uid 1001: exited on signal 11
pid 58112 (gdbus-test-codegen-), uid 1001: exited on signal 11
pid 58116 (gapplication), uid 1001: exited on signal 11
pid 58132 (dbus-appinfo), uid 1001: exited on signal 11

If the watcher process crashes before killing the dbus-daemon process
spawned by the parent process, the dbus-daemon process will keep running
after all tests complete. Due to the implementation of 'communicate'
function in Python subprocess, it causes meson to crash. 'communicate'
assumes the stdout and stderr pipes are closed when the child process
exits, but it is not true if processes forked by the child process
doesn't exit. It causes Python subprocess 'communicate' function to
block on the call to poll until the timeout expires even if the test
finishes in a few seconds. Meson assumes the timeout exception always
means the test is still running. It calls 'communicate' again and
crashes because pipes no longer exist.

https://gitlab.gnome.org/Infrastructure/GitLab/issues/286
https://github.com/mesonbuild/meson/issues/3967
https://bugs.python.org/issue30154
2018-08-20 11:13:19 +01:00
Philip Withnall
282ad30c0c gslist: Fix a minor documentation syntax problem
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-20 11:00:54 +01:00
Philip Withnall
e81f4c2ace glist: Mention -Wcast-function-type problems with g_*list_copy_deep()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1492
2018-08-20 11:00:29 +01:00
Philip Withnall
a7ffddbaf9 Merge branch 'fix-gnotification-tests' into 'master'
tests: fix gnotification tests broken due to the recent icon name fallback changes

See merge request GNOME/glib!252
2018-08-20 09:05:18 +00:00
Christoph Reiter
6b833bc2f1 tests: fix gnotification tests broken due to the recent icon name fallback changes
In !72 themed icons were changed to fall back to the symbolic variant.
The gnotification tests were still testing for the old list of names.
2018-08-19 20:04:41 +02:00
Daniel Șerbănescu
abae9a4851 Update Romanian translation 2018-08-19 15:15:10 +00:00
Matthias Clasen
dd3e565e94 Use an existing enum value
We have an enum for this, no need to hardcode numbers.
2018-08-18 20:16:03 -04:00
Philip Withnall
f876f4174f Merge branch 'master' into 'master'
gio: icons should fallback to non-preferred style appropriately.

See merge request GNOME/glib!72
2018-08-17 12:49:03 +00:00
Philip Withnall
b0278604f8 Merge branch '328-file-system-full' into 'master'
Resolve "filesystem::{free,size,used} not set for full FAT fs"

Closes #328

See merge request GNOME/glib!163
2018-08-17 12:37:02 +00:00
Philip Withnall
61a348f287 glocalfile: Only ignore FS full information for FUSE and ncpfs
Previously, glocalfile.c would not set file system metadata for
the free/used key for file systems which reported 0 free space. This is
because some file systems don’t set that metadata when you call
statfs(), so we can’t reliably report it. However, some do, and they
can legitimately set f_bavail and f_bfree to 0 if the file system is
full.

In order to avoid that, always set the file system metadata unless the
file system is FUSE or ncpfs.

This is a partial revert of commit 0b9f24c1e1: instead of the changes
made in that commit, I think we should maintain a blacklist of file
systems which are known to not correctly report free space.

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

https://gitlab.gnome.org/GNOME/glib/issues/328
2018-08-17 12:41:20 +01:00
Rafael Fontenelle
d1618c93fa Update Brazilian Portuguese translation 2018-08-17 08:30:15 +00:00
Matthias Clasen
76419d7d7d Merge branch 'network-monitor-fix' into 'master'
network monitor portal: update properties initially

See merge request GNOME/glib!248
2018-08-16 23:31:57 +00:00
Matthias Clasen
18997de7e9 network monitor portal: update properties initially
With version 2, we need to query the values explicitly.
The properties made this automatic.
2018-08-16 21:36:13 +00:00
Philip Withnall
1a30a6a1d0 Merge branch 'fix-gdbus-unix-address' into 'master'
Fix failing tests when G_MESSAGES_DEBUG is set (again)

See merge request GNOME/glib!247
2018-08-16 21:27:47 +00:00
Xavier Claessens
9a3c7eca14 Merge branch '1444-install-tests' into 'master'
Resolve "the meson build doesn't support installed tests"

Closes #1444

See merge request GNOME/glib!245
2018-08-16 20:01:06 +00:00
Xavier Claessens
9f208e9f2b Fix failing tests when G_MESSAGES_DEBUG is set (again)
Similar issue was fixed with commit f929d148, but it's happening again.
Define G_MESSAGES_DEBUG=all when running CI to ensure we won't regress
anymore.
2018-08-16 15:55:51 -04:00
Xavier Claessens
c908ce8f8c Meson: install gio tests 2018-08-16 10:53:31 -04:00
Philip Withnall
faa383936e Merge branch '1454-gvdb-corruption' into 'master'
gvdb: Fix error handling in gvdb_table_new()

Closes #1454

See merge request GNOME/glib!214
2018-08-16 14:52:50 +00:00
Matthias Clasen
3664b017e3 Merge branch '1488-o-cloexec-again' into 'master'
gspawn: Use fcntl() to work around systems which don’t support O_CLOEXEC

Closes #1488

See merge request GNOME/glib!242
2018-08-16 12:31:27 +00:00
Philip Withnall
59a23bf24d gclosure: Minor documentation formatting improvements
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-16 10:59:45 +01:00
Philip Withnall
5b7c109e1c gclosure: Clarify when destroy notifiers are called in documentation
They’re called in finalize, not invalidate.

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

https://gitlab.gnome.org/GNOME/glib/issues/277
2018-08-16 10:58:43 +01:00
Philip Withnall
ed6903f6fb Merge branch 'bindung-unbind-fix' into 'master'
g_binding_unbind: make it more introspection friendly; allow calling it multiple times. Fixes #1373

Closes #1373

See merge request GNOME/glib!244
2018-08-16 09:38:04 +00:00
Christoph Reiter
0319dac01d g_binding_unbind: make it more introspection friendly; allow calling it multiple times. Fixes #1373
g_object_bind_property() (transfer none) returns a GBinding with an existing internal
reference which is active as long as the "binding" is. This allows to optionally use
the binding without any memory management, as it will remove itself when it is no longer
needed.

There are currently three ways to remove the "binding" and as a result the reference:

1) Either the source or target dies and we get notified by a weakref callback
2) The user unrefs the binding until it is destroyed (which is semi-legal,
   but worked and is used in the test suite)
3) The user calls g_binding_unbind()

In case (3) the problem was that it always calls unref even if the "binding" is already
gone, leading to crashes when called from bindings multiple times.
In #1373 and !197 it was noticed that a function always unrefs which would be a
"transfer full" annotation, but the problem here is that it should only remove the
ref when removing the "binding" and the annotation should stay "transfer none".

As a side effect of this fix it is now also possible to call g_binding_unbind() multiple
times where every call after the first is a no-op.

This also adds explicit tests for case (1) and (3) - only case (3) is affected by this change.
2018-08-16 11:27:34 +02:00
Xavier Claessens
44228dbc3c Meson: install gobject tests 2018-08-15 09:45:06 -04:00
Mario Blättermann
9eb483b82d Update German translation 2018-08-15 12:54:14 +00:00
Ondrej Holy
4a77dd6799 Merge branch 'fix-overlayfs-trashing-1027' into 'master'
Fix trashing on overlayfs

Closes #1027

See merge request GNOME/glib!182
2018-08-13 18:01:31 +00:00
Iain Lane
1152d99ded Fix trashing on overlayfs
In order to determine whether to trash a file to the home directory, we
compare its st_dev to our home directory's st_dev field.

This is the wrong thing to do on overlayfs when deleting files, because
st_dev contains the ID of the filesystem providing the file (which can
be the lower or upper filesystem), but directories always return the ID
of the overlayfs. Thus the comparison fails and we are unable to trash
the file.

Fix this by checking st_dev of the parent directory when we are deleting
a file.

Also adjust `test_trash_not_supported` for this - make its st_dev check
look at the parent directory's `st_dev` rather than the temporary file's
own.

Fixes #1027.
2018-08-13 17:41:59 +01:00
Iain Lane
93f3cb7c6d Revert "glocalfile: Check that parent device is the same when trashing"
This reverts commit 15cdcd2e0b.
2018-08-13 17:23:21 +01:00
Philip Withnall
614adf8a75 gvdb: Fix error handling in gvdb_table_new()
The documentation was unclear about what error codes would be returned
on attempting to open an empty or corrupt GVDB file. Previous versions
of the documentation incorrectly said that corrupt GVDB files were
considered equivalent to empty ones.

A recent commit has clarified the documentation to include its error
handling behaviour.

Update the two users of GVDB within GLib, GResource and GSettingsSource,
to follow this change, and add unit tests for them both.

Other users of the GVDB copylib will need to update their copy and make
appropriate changes if they have bugs in their handling of this
situation. dconf is one example of this. GVDB should be updated from
https://gitlab.gnome.org/GNOME/gvdb.

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

https://gitlab.gnome.org/GNOME/glib/issues/1454
2018-08-13 15:38:34 +01:00
Philip Withnall
c652d45c97 gsettingsschema: Port to new GVDB API
This should introduce no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 15:37:05 +01:00
Philip Withnall
705dd2b9a9 gresource: Port to new GVDB API
This should introduce no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 15:37:05 +01:00
Philip Withnall
ce86a3aed7 glib-compile-schemas: Fix a minor memory leak
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 15:37:05 +01:00
Philip Withnall
c9834f234d Merge remote-tracking branch 'gvdb/master' into update-gvdb
Minor merge conflicts in gvdb-reader.c with the documentation.
2018-08-13 15:35:52 +01:00
Philip Withnall
57962aac85 docs: Clarify error values for empty files when loading
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 14:34:19 +01:00
Philip Withnall
d2f0461ec0 docs: Use ‘Returns:’ instead of the invalid ‘@returns’
This is based on the commit 59a24ab5a3 in GLib.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 14:34:19 +01:00
Philip Withnall
c78664e101 Update FSF’s address
(This is based on commit 892fc2e4 from dconf.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-13 14:34:19 +01:00