Commit Graph

5327 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
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
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
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
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
Philip Withnall
037f286713 glib-compile-resources: Clarify --help output for --sourcedir argument
Make the --help output more consistent with the man page, making it more
obvious that --sourcedir only applies to the files referenced in FILE,
not to the location of FILE itself.

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

https://gitlab.gnome.org/GNOME/glib/issues/1406
2018-06-08 11:42:52 +01:00
Ondrej Holy
13e751cab4 glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic
Change G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic to be consistent
with recent g_local_file_trash changes, i.e. set this to FALSE for
locations on system-internal mounts.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 11:24:23 +02:00
Ondrej Holy
d1eaf72c00 glocalfile: Allow trashing only for locations supported by trash:///
New bugs appears periodically in nautilus/gvfs/glib components that not
all trashed files are shown in trash:///. It used to be problem mostly
for "bind mounts" and btrfs subvolumes only. Currently, it is also
problem for nfs, cifs and other filesystems, which have been recently
added by commmit 0d69462f on the list of system internal filesystems.

This happens because the trash backend doesn't monitor files on system
internal mounts. Such behavior is not against the trash-spec, however,
we should be consistent within GNOME.

This behavior has the nice side-effect that it solves issues with hangs
on network filesystems: https://gitlab.gnome.org/GNOME/glib/issues/605,
because those are currently on the system internal filesystem list.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-08 11:24:20 +02:00
Philip Withnall
da3daf2803 Revert "Merge branch 'wip/oholy/trashing-locations' into 'master'"
This reverts merge request !49
2018-06-07 16:42:57 +00:00
Xavier Claessens
b04142a24f Merge branch 'fam' into 'master'
Meson: Build fam module

See merge request GNOME/glib!71
2018-06-07 15:18:38 +00:00
Xavier Claessens
077e9f04c1 Meson: Build fam module
gio-querymodules-wrapper.py is copied from glib-networking. This python
wrapper script is needed because meson.build cannot check for DESTDIR
env variable itself, unlike Makefile.am. It is used to update
giomodule.cache file when installing GIO modules like fam.
2018-06-07 10:38:20 -04:00
Gaurav
cbde046018 Fix a warning reported by static analyzer tool 2018-06-07 13:45:55 +00:00
Xavier Claessens
11822c40bc Meson: Remove config.h.meson template
It became useless because glib_conf is not used anymore for generating
pkgconfig files. See issue #1313.
2018-06-07 09:28:03 -04:00
Philip Withnall
be43436435 Merge branch '1400-g_file_attribute_unix_is_mountpoint-is-false-for-root' into 'master'
Resolve "G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT is False for /"

Closes #1400

See merge request GNOME/glib!51
2018-06-07 09:22:07 +00:00
Will Thompson
0c5f084200
fileinfo: make UNIX_IS_MOUNTPOINT be TRUE for /
The previously implementation considered a file to be a mountpoint if
its parent is on a different device. / is its own parent, so by this
definition it is not a mountpoint.

But / is (generally) listed in fstab, and fstab(5) defines the
directories it contains to be mountpoints. This attribute should follow
that definition (and reasonable expectation): the root directory is a
mountpoint.

So, add a special-case for the case where the file's parent has the same
st_dev and st_ino as the file, which is true only at the root.

Test this attribute at / (only on POSIX), /proc (but only on Linux), and
at many files and directories created by the test suite (which cannot be
mountpoints).
2018-06-07 06:38:23 +01:00
Philip Withnall
6f5c8f6f33 Merge branch 'wip/lantw/freebsd-du-problems' into 'master'
tests: Don't fail when not using du from GNU coreutils

See merge request GNOME/glib!68
2018-06-07 01:16:07 +00:00
Ting-Wei Lan
f288898485 tests: Use g_idle_add to call g_main_loop_quit
Sometimes file monitor events may be slow to emit. Using g_idle_add
makes it less possible for events to be scheduled later than the main
loop quit, preventing test failure caused by missing events.

This fixes test failure on FreeBSD.
2018-06-07 00:38:07 +08:00
Ting-Wei Lan
41259ac173 kqueue: Only fallback to polling on /media and /run/media
The check in _ke_is_excluded, which causes GKqueueFileMonitor to
fallback to GPollFileMonitor when it returns TRUE, was made to prevent
file monitor from blocking unmount of removable drives on systems not
supporting O_EVTONLY flag in open. However, since g_mount_can_unmount
always returns TRUE on Unix-like platforms, the check always returns
TRUE on non-standard mount points, which is very likely to cause all
programs on the desktop to use the polling fallback if GNOME is
installed in a different prefix for development. This makes the desktop
sluggish and results in bad developer experience on *BSD.
2018-06-07 00:38:07 +08:00
Ting-Wei Lan
70e4ca0340 tests: Don't run file creation and deletion test on kqueue
Kqueue isn't good at detecting rapid file creation and deletion. It
tends to miss events because events returned by the kernel don't include
filename information. Since the size of struct kevent is fixed, it is
probably not possible to extend the API to include file names without
breaking ABI. Therefore, we disables the test here to avoid test failure
that is impossible to fix in a reliable way.
2018-06-07 00:38:07 +08:00
Ting-Wei Lan
bfbeb6f0f5 tests: Don't fail when not using du from GNU coreutils
The test 'file' uses non-standard '--bytes' option when running du,
which may cause error on non-GNU systems. To keep the test working,
we skips the du check as if we don't find a du command when du fails.
2018-06-07 00:37:28 +08:00
Chun-wei Fan
4bb173b297 build: Remove leftovers of Visual Studio project stuff
There are more leftover preconfigured stuff that we ought to remove...
2018-06-06 23:54:13 +08:00
Chun-wei Fan
f658e94e65 build: Drop Visual Studio projects
In master, it is already possible to build GLib using Visual Studio
using Meson[1] for some time, so we should focus on maintaining only the
Meson build files for building GLib with Visual Studio.

[1]: There are caveats when building with Visual Studio 2008, namely
     that one needs to use the mt command to embed the manifests that
     are generated with the .exe/DLLs, for all builds, and that in the
     case where the compilation hangs on Visual Studio 2008 x64, as a
     workaround, should stop the build by terminating all cl.exe tasks
     and change the compiler optimization flag from /O2 (full speed) to
     /O1 (optimize for size), due to compiler optimization issues.
2018-06-06 23:54:13 +08:00
Philip Withnall
205059b9c0 Merge branch 'wip/oholy/trashing-locations' into 'master'
glocalfile: Allow trashing only for locations supported by trash:///

See merge request GNOME/glib!49
2018-06-06 10:58:22 +00:00
Ondrej Holy
f7e80f8d0c 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-06 12:18:30 +02:00
Gaurav
4ade09416b Fix potential Null pointer dereference.
if "match" is NULL, it is dereferenced in match_free() (L:457)
2018-06-05 14:01:47 +00:00
Ondrej Holy
6dfd0a00e7 glocalfile: Update G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic
Change G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH logic to be consistent
with recent g_local_file_trash changes, i.e. set this to FALSE for
locations on system-internal mounts.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-05 14:53:15 +02:00
Ondrej Holy
15a47afb0e glocalfile: Allow trashing only for locations supported by trash:///
New bugs appears periodically in nautilus/gvfs/glib components that not
all trashed files are shown in trash:///. It used to be problem mostly
for "bind mounts" and btrfs subvolumes only. Currently, it is also
problem for nfs, cifs and other filesystems, which have been recently
added by commmit 0d69462f on the list of system internal filesystems.

This happens because the trash backend doesn't monitor files on system
internal mounts. Such behavior is not against the trash-spec, however,
we should be consistent within GNOME.

This behavior has the nice side-effect that it solves issues with hangs
on network filesystems: https://gitlab.gnome.org/GNOME/glib/issues/605,
because those are currently on the system internal filesystem list.

https://gitlab.gnome.org/GNOME/glib/issues/251
2018-06-05 14:53:15 +02:00
Christoph Reiter
553df9dcaf Merge branch 'fix-gdbus-unix-addresses-test' into 'master'
Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set

See merge request GNOME/glib!50
2018-06-01 15:31:25 +00:00
Xavier Claessens
f929d14826 Fix failing gdbus-unix-addresses test when G_MESSAGES_DEBUG is set
This test assumes the subprocess does not print anything else on stdout
other than the dbus address, otherwise g_test_trap_assert_stdout()
fails to match. But if the env running tests has G_MESSAGES_DEBUG=all
then it will also print "PATH=%s".
2018-06-01 10:23:12 -04:00
Gaurav
593eeff55e Fix a warning reported by static analyser tool:
Assignment of a signed value which has type 'time_t' to a variable of a bigger integer type 'guint64'
2018-05-31 08:25:31 +00:00
Christoph Reiter
a2aa91ae5d win32: Remove all remaining WinXP compat code
Remove all code which is no longer built with Windows 7+
2018-05-29 17:16:38 +02:00
Emmanuele Bassi
61ccf733cc Merge branch 'wip/rishi/issue-1073' into 'master'
Revert "Return folder as icon for directories"

See merge request GNOME/glib!36
2018-05-29 07:43:56 +00:00
Philip Withnall
c3846b33d7 Merge branch 'identifier-typo-fix' into 'master'
gio: Fix some typos in the documentation

See merge request GNOME/glib!31
2018-05-28 16:58:13 +00:00
Philip Withnall
6730309826 Merge branch 'wip/hadess/g-drive-identifier' into 'master'
gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE

See merge request GNOME/glib!10
2018-05-28 16:31:42 +00:00
Bastien Nocera
75950d70c9 gio: Deprecate G_VOLUME_IDENTIFIER_KIND_HAL_UDI
HAL itself has long been deprecated.
2018-05-28 17:20:21 +02:00
Debarshi Ray
25af5ad1da Revert "Return folder as icon for directories"
This workaround is no longer necessary because it was fixed in
shared-mime-info three years ago:
https://bugs.freedesktop.org/show_bug.cgi?id=89150

This reverts commit 90025254fd.

https://gitlab.gnome.org/GNOME/glib/issues/1073
2018-05-28 17:19:59 +02:00
Bastien Nocera
4c84eac38e gio: Add G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE
It's a synonym of G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE.
It doesn't change anything except not feeling dirty from using a wrongly
prefixed constant for the object type.

See: #182
2018-05-28 17:13:30 +02:00
Philip Withnall
137ae066fe Merge branch 'wip/oholy/gio-mount-stop' into 'master'
gio-tool: Add support for stopping drives

See merge request GNOME/glib!17
2018-05-28 14:03:37 +00:00
Ondrej Holy
9ac1ba56a3 gio-tool: Fix GMountOperation leaks
GMountOperation is used on various places, but it is not properly unrefed.
Let's fix the leaks.
2018-05-28 14:44:07 +02:00
Ondrej Holy
fe9c6192c4 gio-tool: Add support for stopping drives
There is not currently an option for stopping drives, however it
would be really useful for testing. Let's add that possibility
for "gio mount".
2018-05-28 14:44:07 +02:00
Ondrej Holy
2cb2a617f1 gio-tool: Print help if no arguments are given
Help is usually printed from tools if no arguments are given and there
is not default action. However "gio mount" and "gio trash" just silently
return. Let's print "No locations given" error and show help consistently.
2018-05-28 13:50:55 +02:00
Ondrej Holy
bc365c9b4e gio-tool: Use "…" consistently
"gio help COMMAND" shows some arguments with "..." and some with "…",
which looks weird, e.g.:

$ gio help mount
gio mount [OPTION…] [LOCATION...]

Let's use "…" consitently.
2018-05-28 13:50:55 +02:00
Philip Withnall
dc4e63930f gio: Fix some typos in the documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-05-28 10:26:06 +01:00
Nirbheek Chauhan
545641a8fb glib-compile-resources: Use g_fprintf() instead of fprintf()
G_GSIZE_FORMAT and friends cannot always be used with fprintf(), they
require gnu/C99 implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=796283
2018-05-26 13:16:13 +05:30
Philip Withnall
d9df5d72e1 Merge branch '1354-volume-nullable' into 'master'
Resolve "Missing nullable annotation on the return value of gio_volume_get_mount"

Closes #1354

See merge request GNOME/glib!4
2018-05-25 14:15:18 +00:00
Xavier Claessens
c627fb4926 Fix missing osx files when running "make dist"
Fixes #528, #1381.
2018-05-25 03:06:07 +00:00