Commit Graph

5103 Commits

Author SHA1 Message Date
Colin Walters
cb8bfa758f gdbus-codegen: Call abspath() earlier
The previous change from https://bugzilla.gnome.org/show_bug.cgi?id=786785
didn't actually work (for me at least) in the `/bin/gdbus-codegen` case
as the relative `/bin/../share` path works, but then `os.path.abspath()`
breaks it (as it's not doing `realpath()`, and let's not go there).

Fix this by doing the `abspath` first.

Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1507661

https://bugzilla.gnome.org/show_bug.cgi?id=789723
2017-11-06 11:57:52 +00:00
Rico Tzschichholz
df66b25301 GSeekable: Fix g_seekable_truncate invoker reference
https://bugzilla.gnome.org/show_bug.cgi?id=573251
2017-11-04 20:05:37 +01:00
Daniel Macks
d88d90c3c8 Exec=true (seach via PATH) instead of hardcoding /bin/true
...otherwise this .desktop is omitted on platforms that have it
elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=731705
2017-11-03 20:16:52 +00:00
Uwe Helm
5448ef5326 gio: Add FS magic number for FUSE
https://bugzilla.gnome.org/show_bug.cgi?id=740826
2017-11-03 19:50:19 +00:00
Tomas Kotal
ea2901abf8 gio: GPollFileMonitor is not cleaning up correctly
https://bugzilla.gnome.org/show_bug.cgi?id=789820
2017-11-03 14:07:57 +00:00
Jiří Techet
9bcd7800a1 gio: Eliminate warnings in cstring conversion on OS X
create_cstr_from_cfstring_with_fallback() is allowed to be called when str == NULL
but create_cstr_from_cfstring() isn't which leads to warnings in the console.
Fix this by adding NULL checks into create_cstr_from_cfstring_with_fallback().

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Jiří Techet
6acaca8831 gio: Show icons based on file's mime type on OS X
The patch basically just grabs the implementation of g_content_type_get_icon_internal()
from gcontenttype.c - the only difference is that it first converts UTI to MIME using
g_content_type_get_mime_type() and at the end frees this temporary MIME type.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-11-03 12:04:33 +00:00
Colin Walters
96ebcee8c4 Build with old libmount too
Downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1508056

This is an easy change, and lets us build with RHEL7's libmount.

See also cee57a0268
2017-11-01 14:22:18 -04:00
Will Thompson
41112ef00d GSeekable: improve g_seekable_[can_]truncate docs
I was not born next to a PDP-11, either, but I think this is marginally more informative!

https://bugzilla.gnome.org/show_bug.cgi?id=573251
2017-11-01 15:29:22 +00:00
Tom Schoonjans
663a5cc95f gio/gasynchelper.c: fix cast from pointer to smaller int type on win64
https://bugzilla.gnome.org/show_bug.cgi?id=777310
2017-11-01 12:54:14 +00:00
Руслан Ижбулатов
53bd6a359f W32: Add a stat() implementation for private use
This commit adds new W32-only functions to gstdio.c,
and a new header file, gstdioprivate.h.
These functions are:
g_win32_stat_utf8()
g_win32_lstat_utf8()
g_win32_fstat()
and they fill a private structure, GWin32PrivateStat,
which has all the fields that normal stat has, as well as some
extras.

These functions are then used throughout glib and gio to get better
data about the system. Specifically:
* Full, 64-bit size, guaranteed (g_stat() is forced to use 32-bit st_size)
* Full, 64-bit file identifier (st_ino is 0 when normal stat() is used, and still is)
* W32 File attributes (which stat() doesn't report); in particular, this allows
  symlinks to be correctly identified
* Full, 64-bit time, guaranteed (g_stat() uses 32-bit st_*time on 32-bit Windows)
* Allocated file size (as a W32 replacement for the missing st_blocks)

st_mode remains unchanged (thus, no S_ISLNK), so when these are given back to
glib users (via g_stat(), for example, which is now implemented by calling g_win32_stat_utf8),
this field does not contain anything unexpected.

g_lstat() now calls g_win32_lstat_utf8(), which works on symlinks the way it's supposed to.

Also adds the g_win32_readlink_utf8() function, which behaves like readlink()
(including its inability to return 0-terminated strings and inability to say how large
the output buffer should be; these limitations are purely for compatibility with
existing glib code).

Thus, symlink support should now be much better, although far from being complete.

A new W32-only test in gio/tests/file.c highlights the following features:
* allocated size
* 64-bit time
* unique file IDs

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-11-01 12:46:38 +00:00
Christoph Reiter
fed574a0c8 introspection: Add more filename type annotations for strings which can contain filenames
This continues the changes done in https://bugzilla.gnome.org/show_bug.cgi?id=767245

This makes it possible to pass Python path types as process arguments and env vars
in PyGObject and and makes it clear that the values are not strictly utf-8 and need
to be validated/converted first.

https://bugzilla.gnome.org/show_bug.cgi?id=788863
2017-10-26 18:51:51 +02:00
Debarshi Ray
7339a09376 docs: Mention the idiomatic way of invoking a GAsyncReadyCallback
The GAsyncResult documentation didn't specify the context in which the
GAsyncReadyCallback is expected to be invoked. Since asynchronous
operations can be implemented in various ways involving GSources,
threads and coroutines, it is useful to mention what the standard
expections are.

Unfortunately, since this was left undefined for so long, we can only
phrase it as a suggestion, and not as a hard requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 14:08:42 +02:00
Debarshi Ray
09d936c528 docs: Explain how GAsyncReadyCallbacks are, and should be, invoked
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 14:08:42 +02:00
Debarshi Ray
61ea1e7ca4 docs: Don't be vague about where GTask dispatches the result
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 13:48:39 +02:00
Debarshi Ray
3c5b59ddca docs: Clarify the thread-default GMainContext where the result is sent
https://bugzilla.gnome.org/show_bug.cgi?id=783825
2017-10-26 13:48:39 +02:00
Philip Withnall
3eacec1587 Use hash tables as sets in various places
Where we were already treating GHashTables as sets, modify them to use
the set-specific APIs g_hash_table_add() and g_hash_table_contains(), to
make that usage more obvious and less prone to being broken.

Heavily based on patches by Garrett Regier <garrettregier@gmail.com>.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749371
2017-10-26 12:27:17 +01:00
Stef Walter
0f82ff12ea gdbus-proxy: Fix erroneous timeout during following tests
Modified by Philip Withnall to amend a second instance in the same
file.

https://bugzilla.gnome.org/show_bug.cgi?id=711809
2017-10-26 12:01:05 +01:00
Philip Withnall
767296db9c gio: Add autoptr declarations for GUnixMountEntry and GUnixMountPoint
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Philip Withnall
1e4221a3f7 gio: Add API for identifying system FS types and device paths
This is needed by gnome-control-center and gnome-settings-daemon; it
makes existing checks from gunixmounts.c public.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788927
2017-10-26 00:19:23 +01:00
Michael Catanzaro
4b07869462 socket: actually remove fd from poll when socket is closed
In my previous patch, I failed to call g_source_remove_unix_fd() in
order to actually stop polling the fd of the closed socket.

The test did not catch this, because the test only checks that the right
source callback is dispatched properly. I don't know how to test this.

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-25 09:36:07 -05:00
Michael Catanzaro
c5202bc5e9 Add socket postmortem test
Checks that after a GSocket is closed, a source created off it
with g_socket_create_source() will dispatch exactly once with
G_IO_NVAL.

Based on a patch by Mikhail Zabaluev

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-24 09:02:02 -05:00
Michael Catanzaro
f99045fd03 socket: Don't poll the socket fd after close
This prevents polling on file descriptors that are no longer in use
or have been reused for something else.

Based on a patch by Mikhail Zabaluev

https://bugzilla.gnome.org/show_bug.cgi?id=723655
2017-10-24 09:02:02 -05:00
Emmanuele Bassi
5c13bf9bcf build: Use subdir-objects with Autotools
We're eventually going to drop Autotools, but in the meantime we should
probably use idiomatic options and reduce warnings.

GLib is pretty much already safe for subdir-objects to be enabled,
except in the GIO tests, where the build references files that are
generated in a different level. For that, we can use the same solution
employed by GTK+, and link the appropriate file in the right
sub-directory.

https://bugzilla.gnome.org/show_bug.cgi?id=788989
2017-10-24 13:30:41 +01:00
Xiang Fan
3d4fb44653 gsettings: make g_settings_bind() documentation clearer
https://bugzilla.gnome.org/show_bug.cgi?id=789245
2017-10-23 12:20:02 +01:00
Friedrich Beckmann
37c0610b4d MacOS: gosxappinfo.c Fix some memory leaks. Fix failure condition.
Ensure that the debug call won't crash if create_cstr_from_cfstring
returns NULL, fix the leak of that CFArrayRef, and make explicit the
failure condition of LSFindApplicationForInfo.

https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-10-17 14:10:31 +01:00
Friedrich Beckmann
2bd423c54c MacOS: create_cstr_from_cfstring uses safe conversion - use CFStringGetCString
During testing with gdk-pixbuf I noticed failures during content type
to mime conversion. The root reason was the unsafe conversion used
in create_cstr_from_cfstring. The problem was addressed in commit
c60226e0a1 but that was reverted. I noticed the commit only
when I had fixed the problem. In addition I added a test to check
the content type to mime conversion on MacOS. This problem is
discussed in Bug #788936.

See: https://bugzilla.gnome.org/show_bug.cgi?id=788936
2017-10-17 14:10:31 +01:00
Julien Isorce
ea725a6414 gio: add g_socket_join_multicast_group_ssm (IGMPv3 SSM)
It adds support for source-specific multicast IGMPv3.

Allow receiving data only from a specified source when joining
a multicast group.

g_socket_join_multicast_group_ssm can be called multiple times
to allow receiving data from more than one source.

Support IPv4 and IPv6.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740791
2017-10-16 11:14:57 +01:00
Friedrich Beckmann
e55efa35e3 OSX: Use xdgmime system to guess content type from data
Closes: Bug #788401

The problem is described here:

https://bugzilla.gnome.org/show_bug.cgi?id=788401

This patch introduces the use of the xdgmime system to guess
the content type from data. So you can guess for example the
type public.svg-image from the file content of a svg file.
This patch only applies to MacOS. A test for the regression
is also included.
2017-10-14 09:11:01 +01:00
Philip Withnall
13c6d9fedf Revert "[MacOS] Fallback to CFStringGetCSTring if CFStringGetCStringPtr fails."
This reverts commit c60226e0a1.

Pushed without review. This should be reviewed on bug #788936 first.
Several issues with the patch:
 • Takes the string length unnecessarily early.
 • Calls CFRelease(str) before g_strdup(cstr) which could lead to
   use-after-free.
 • Code style issues.
 • Don’t want to encourage pushing patches without review.
2017-10-14 09:04:43 +01:00
John Ralls
c60226e0a1 [MacOS] Fallback to CFStringGetCSTring if CFStringGetCStringPtr fails. 2017-10-13 14:04:02 -07:00
Philip Withnall
0d69462f14 gunixmounts: Update list of virtual file systems to ignore
Synchronise it with the list in gnome-settings-daemon, which has seen
more recent updates than this one.

https://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/housekeeping/gsd-disk-space-helper.c

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

https://bugzilla.gnome.org/show_bug.cgi?id=788880
2017-10-13 11:01:30 +01:00
Rico Tzschichholz
65e443da65 gio: Mark callback_data of GFileReadMoreCallback as closure
In conjunction with 77fbc10da6

https://bugzilla.gnome.org/show_bug.cgi?id=629347
2017-10-12 09:20:17 +01:00
Beniamino Galvani
aeecd81dd1 gio: fix race condition in GDBusObjectManagerClient
priv->map_object_path_to_object_proxy must be protected to avoid
concurrent access by multiple threads. Move the hash table insertion
into the critical section.

https://bugzilla.gnome.org/show_bug.cgi?id=788368
2017-10-11 16:36:20 +01:00
Rico Tzschichholz
1fb56be6ab gio: Mark g_task_get_source_object as nullable
In conjunction with ca4fe5942a

Reviewed-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 17:14:11 +02:00
Philip Withnall
3d8296940a tests: Fix case of a string comparison
Fixup to commit 12e32e96a3.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 14:05:21 +01:00
Simon McVittie
331f73c26d gio/tests/gdbus-proxy: sleep longer when testing that we time out
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get scheduled in a window between (100ms|250ms) and 500ms.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:48 +01:00
Simon McVittie
7d5c738dba gio/tests/file: increase an arbitrary timeout
On slow ARM machines doing parallel builds, there's no guarantee that
we'll get through this in 5 seconds.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=769674
2017-10-11 13:32:41 +01:00
Florian Müllner
77fbc10da6 introspection: Add more annotations for GFile
Add annotations fixing warnings in GFile.

https://bugzilla.gnome.org/show_bug.cgi?id=629347
2017-10-11 13:26:15 +01:00
Christian Dywan
0ef7174e74 Document that pre-unmount may not be emitted
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=636210
2017-10-11 13:18:49 +01:00
Daniel Macks
b8ccbd9a3c Fix variable-scoping to avoid declaring on platforms where not used
"len" is only used by some platforms' implementations (as controlled
by various autoconf/#ifdef tokens) and only in a small codeblock in
those cases, but was declared based on a looser #ifdef heuristic and
in a larger scope. The result is an unused-variable warning when built
on some platforms. Move declaration to the local codeblocks that use
the variable, which also restricts it to the narrower set of platforms
where those codeblocks are used.

https://bugzilla.gnome.org/show_bug.cgi?id=689323
2017-10-11 13:12:36 +01:00
Philip Withnall
e34884e364 gsettingsschema: Add a missing (nullable) annotation
Spotted as part of https://bugzilla.gnome.org/show_bug.cgi?id=725014.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:53 +01:00
Philip Withnall
5876cdff25 gsettingsschema: Fix some incorrect whitespace
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:40 +01:00
Philip Withnall
ee1d38ce64 docs: Fix an incorrect function name in GSettings documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 13:09:15 +01:00
Evan Nemerson
ca4fe5942a gio: mark the GAsyncResult source_object as nullable
https://bugzilla.gnome.org/show_bug.cgi?id=740223
2017-10-11 13:00:43 +01:00
Руслан Ижбулатов
4a77eb16ce Replace all instances of ssize_t with gssize
ssize_t is supported widely, but not universally, so use gssize instead.
Currently only one piece of code actually *needs* this change to be compilable
with MSVC, the rest are mostly in *nix parts of the code, but these are changed
too, for symmetry.

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-10-11 12:56:11 +01:00
Руслан Ижбулатов
6abdc06da6 W32: Bump target NT version to 0x601 (7 or newer)
Also remove now-unnecessary if_nametoindex() implementation
(the HAVE_IF_NAMETOINDEX configure check didn't work correctly, it turned out),
which prevents glib from building. if_nametoindex() is available in lphlpapi since
Vista[1], so we don't need a compatibility function for it anymore, as Windows 7
is the new minimally-required version.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/bb408409(v=vs.85).aspx

https://bugzilla.gnome.org/show_bug.cgi?id=788180
2017-10-11 12:29:55 +01:00
Nirbheek Chauhan
b444ae0de2 meson: Improve gdbus-codegen custom target dependencies
Ensure that the custom targets that use gdbus-codegen get rebuilt when
any of the gdbus-codegen files are changed.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 16:55:39 +05:30
Philip Withnall
faf9440908 gdbus-tool: Add tab completion support to gdbus emit
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
51e91e35c1 gdbus-tool: Fix some invalid indentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
b3acf58779 gdbus-tool: Fix tab-completion for non-message-bus connections
• `gdbus monitor` can’t work at all for non-message-bus connections,
   since it can’t subscribe to signals.
 • Other tab completions for names depend on the connection being a
   message bus connection, but we still need to print `--dest` (etc.)
   when tab completing them, even if we can’t print a list of
   available names.

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

https://bugzilla.gnome.org/show_bug.cgi?id=788594
2017-10-11 12:18:14 +01:00
Philip Withnall
181b58c46d build: Fix build with srcdir ≠ builddir
Broken by commit a71f51dece. My fault for
not reviewing thoroughly enough.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-11 10:52:44 +01:00
Cor-Paul Bezemer
a71f51dece build: Add gdbus-codegen files as dependencies in generated code rule
So gdbus-daemon-generated.[ch] get regenerated appropriately if any of
them change.

https://bugzilla.gnome.org/show_bug.cgi?id=752239
2017-10-11 10:33:45 +01:00
Maks Naumov
12e32e96a3 Don't skip invalid enum values in schemas
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>

https://bugzilla.gnome.org/show_bug.cgi?id=742997
2017-10-11 10:22:23 +01:00
Jan Alexander Steffens (heftig)
30b25a6fd9 meson: Fix permissions of installed scripts
configure_file preserves the attributes, so the templates need to be
executable for the (installed) outputs to be executable.

https://bugzilla.gnome.org/show_bug.cgi?id=787671
2017-10-11 09:49:26 +01:00
Nirbheek Chauhan
b9f2ea4235 gdbus-codegen: Don't assume bindir and datadir share prefix
This assumption breaks when, for instance:

* Called as /bin/gdbus-codegen
* Installed on Windows in a directory that is not `bin/`

For such cases, we cannot make any assumptions about the directory
structure, and must hard-code the datadir.

https://bugzilla.gnome.org/show_bug.cgi?id=786785
2017-10-11 09:48:38 +01:00
grindhold
5b64522fcb socket: fix typo in get_remote_address docs
fixed the following typo:
"remove address" → "remote address"

https://bugzilla.gnome.org/show_bug.cgi?id=788766
2017-10-10 11:31:49 +01:00
Chun-wei Fan
2c6c03290f gio: Fix gio-tool-open.c on Windows/Cocoa
Commit 7384e37 broke builds on these platforms as *NIX-only APIs are
being used unconditionally.  Fix the build by building these portions
when not on Windows or Cocoa.

https://bugzilla.gnome.org/show_bug.cgi?id=780296
2017-10-09 09:10:48 +08:00
Philip Withnall
0a10f7375f glocalfileinfo: Use g_strcmp0() for some comparisons which might be NULL
The return value from g_get_user_special_dir() might be NULL. Safest to
use g_strcmp0() uniformly everywhere.

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

https://bugzilla.gnome.org/show_bug.cgi?id=661442
2017-10-06 11:17:40 +01:00
Ondrej Holy
1508db2f66 gio: Add hack to close up dbus-daemon race
If gio open exits before the program it starts fully activates, then
the dbus-daemon may avoid doing the activating method call.

This commit works around the problem by pinging the activated application,
and waiting for a reply.

Same workaround is used in gtk-launch and was used in gvfs-open before
it was replaced by gio open.

https://bugzilla.gnome.org/show_bug.cgi?id=780296
2017-10-05 16:19:31 +02:00
Jiro Matsuzawa
acea147cbc gsettings: Suppress error messages of completion
https://bugzilla.gnome.org/show_bug.cgi?id=695681
2017-10-05 14:41:24 +01:00
Philip Withnall
55905db86a gfile: Fix typo in documentation for g_file_set_attribute()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-10-05 13:46:41 +01:00
Philip Withnall
b0cbd21b25 glib-compile-resources: Fix leak of a GHashTable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=788138
2017-10-02 15:30:23 +01:00
Ondrej Holy
f6fa90fb0d gunixmounts: Fix mount points generation
Commit 53ed180 improved mtab processing, however, also introduced bug
in code obtaining mount points. mtab was used by mistake also for
g_unix_mount_points_get implementation, which is obviously wrong and
fstab has to be used instead...

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-10-02 12:19:51 +02:00
Philip Withnall
330e6911b5 goutputstream: Add missing (optional) annotations to bytes_written args
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-27 10:31:34 +01:00
Nelson Benítez León
c1a31c3aaa gio/gunixmounts.c: Don't use mtime to monitor mounts on /proc/
Fix get_mounts_timestamp() to not use a stat'ed mtime for /proc/ files.
Instead, use mount_poller_time if /proc/ watch is running, or otherwise
return a new generated timestamp to always assume mounts-changed, which
is safer than previous behaviour of always assuming mounts-not-changed
(as mtime never changes for /proc/ files when queried from the same
process).

We say it's safer because allows caches depending on:

g_unix_mounts_get(&time_read)
g_unix_mounts_changed_since()

to drop possibly outdated/duplicated values, as that was the case for the
GIO mounts cache used in gio/glocalfile.c which provides mount info for
g_file_query_filesystem_info() call, as described in below referenced bug.

This fix complements related commit bd9e266e11

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Nelson Benítez León
32a9b88b20 gio/tests: Add testcase for bug 787731
Add testcase for function g_file_query_filesystem_info()
reporting outdated info for "filesystem::readonly" attribute
when said attribute was different in a previous mounted
partition in the same device (as GIO maintains a mounts cache
per 'st_dev' stat() member).

To trigger a mount operation, testcase uses program 'bindfs'
instead of 'mount --bind' as bindfs does not require root
privileges. And 'fusermount -u' command is used to unmount said
bindfs mount.

As a reference in Fedora, 'bindfs' is installed from 'bindfs'
package and 'fusermount' from 'fuse' package (this one is installed
by default as being part of 'System Tools' group).

The test creates a directory with a file in it, then mounts it
readonly over another directory (the mountpoint), it then checks
that g_file_query_filesystem_info() for the file in it indeed reports
"filesystem::readonly" as TRUE. Then unmounts and mounts again this
time rw (not readonly), it then checks again if g_file_query_filesystem_info()
is reporting "filesystem::readonly" as TRUE, if that's the case, it
confirms the bug by opening said file in write mode.

Testcase is only added for Unix builds.

https://bugzilla.gnome.org/show_bug.cgi?id=787731
2017-09-22 20:28:44 +05:00
Philip Withnall
09796b3ccc Partially revert "gio: Add missing (array length) annotations"
This reverts commit 8028494335.

Adding (array length=…) to a gchar* parameter causes the GIR file to
contain an array of strings, rather than an array of characters. While
we fix GIR, revert those changes.

Some of the other changes in the file (which have an explicit
(element-type) already) are fine.

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

https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 12:05:06 +01:00
Alisa Maas
8028494335 gio: Add missing (array length) annotations
https://bugzilla.gnome.org/show_bug.cgi?id=765063
2017-09-21 11:08:12 +01:00
Robert Ancell
db2ae64636 Fix comment/docs grammar: incase -> in case 2017-09-15 13:50:41 +12:00
Chun-wei Fan
a7a6449f4d meson: Install items according to their relevance
The m4 and bash completion items are usable and relevant
depending on the host system's configuration.  So, we check for the
presence of the programs that these items depend on, and only install
them when those programs are found.

For the Valgrind suppression files, we don't install them on Windows as
Valgrind is currently not supported on Windows.

Als fix the path where the GDB helpers are installed, as the path is
incorrectly constructed.

This will fix the "install" stage when building on Visual Studio at
least as there are some post-install steps that are related to them,
which will make use of these programs.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-09-14 16:02:03 +08:00
Philip Withnall
5e55a4e243 gtlsbackend: Default to indicating no support for DTLS in GTlsBackend
I’m unsure what the original reasoning for returning TRUE by default
from supports_dtls was, but it is not backwards-compatible. If a
pre-existing GTlsBackend implementation never implements the
supports_dtls vfunc, the supports_dtls() method will magically return
TRUE rather than FALSE.

Since any backend which does implement DTLS should be implementing the
supports_dtls vfunc (and no DTLS-supporting backends have actually been
merged yet; see bug #697908), it seems safer to make this slight API
break in the name of backwards compatibility than to leave it as
returning TRUE incorrectly.

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

https://bugzilla.gnome.org/show_bug.cgi?id=787485
2017-09-13 17:38:42 +01:00
Sam Thursfield
bb26bc29e3 Make GListModelInterface::get_item usable from GObject Introspection bindings
Language bindings have so far been unable to implement the GListModel
interface because the ::get_item virtual function returns a
non-bindable type (gpointer). The `gpointer` type gets translated into
`void` by G-I meaning that get_item() implementations can't return any
items.

We can set the return type of the get_item() vfunc explicitly to
GObject, which fixes the issue.

This patch also removes the existing (type GObject) annotation on
g_list_model_get_item(), which is necessary because if its return type
matches that of the get_item() vfunc, G-I connects the two and
propagates the 'skip' annotation from one to the other resulting in the
get_item() vfunc being hidden. There's no API break here because the
'skip' annotation makes g_list_model_get_item() invisible to G-I users
anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=787271
2017-09-12 12:32:20 +01:00
Philip Chimento
7b9503a4f8 docs: Clarify relationship of quit() to hold count
Calling g_application_quit() ignores the hold count; this patch adds a
warning to the documentation about other code having a hold on the
application and expecting it to exist.

https://bugzilla.gnome.org/show_bug.cgi?id=737278
2017-09-11 22:26:04 +01:00
Daniel Macks
b8f9c08a09 Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids
-Wunused-but-set-variable but this specific trick is now caught by
-Wself-assign. Instead, actually use the value or don't bother
assigning it at all:

gdbusauthmechanismsha1.c: #ifdef a var decl to match its actual use use
gdbusauthmechanismsha1.c: call g_ascii_strtoll() in void context

https://bugzilla.gnome.org/show_bug.cgi?id=745723
2017-09-11 22:18:42 +01:00
Daniel Macks
190f64a0fb Avoid setting unused variables (-Wself-assign)
Setting a variable and then assigning it to itself avoids
-Wunused-but-set-variable but this specific trick is now caught by
-Wself-assign. Instead, actually use the value or don't bother
assigning it at all:

gdbusauth.c: call g_data_input_stream_read_byte() in void context
gdbusauthmechanismsha1.c: value is actually used
gdbusmessage.c: use consistent preprocessor-token protection
gthreadedresolver.c: skip over bytes in data blob
httpd.c: do something useful with the value

https://bugzilla.gnome.org/show_bug.cgi?id=745723
2017-09-11 22:14:18 +01:00
Emmanuele Bassi
5d9ccf162e gio: Annotate GDBusObjectManagerClient signal appropriately
https://bugzilla.gnome.org/show_bug.cgi?id=756009
2017-09-11 21:31:13 +01:00
Philip Withnall
1275b94fe7 gsettings: Fix copy-paste error in property documentation
This should fix the introspection binding for that property too.

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

https://bugzilla.gnome.org/show_bug.cgi?id=656502
2017-09-11 21:28:40 +01:00
Mikhail Zabaluev
e5db8ec787 Skip g_subprocess_launcher_set_child_setup() in introspection
It's not likely that the runtime of a bound language using the
introspection supports running in a process forked by a foreign
library, so that a closure programmed in that language would work
safely.

Any programming environment supporting that would probably have
its own advanced facilities for process spawning, or be able
to access the GLib spawning APIs via raw C bindings (still
represented in the introspection, (skip) only adds a flag)
and do any low-level preparatory dances as necessary for the
forked runtime.

Note that there are other APIs making use of GSpawnChildSetupFunc,
but they are usable with the closure nullified, and we cannot annotate
the closure parameters away because that would break the annotated API
for bindings; accordingly to bug #738176 comment #3, the current bindings'
users are expected to pass null.
2017-09-11 21:07:09 +01:00
Mikhail Zabaluev
48cf1d32c6 Fix up closure annotations for GSpawnChildSetupFunc
https://bugzilla.gnome.org/show_bug.cgi?id=738176
2017-09-11 21:07:08 +01:00
Alberto Ruiz
df8350b316 GSubprocessLauncher: add (transfer none) annotation
https://bugzilla.gnome.org/show_bug.cgi?id=753521
2017-09-11 20:23:13 +01:00
Philip Withnall
52dd98475c gtlsbackend: Add missing preconditions for DTLS virtual methods
Make it a bit more obvious when the DTLS methods aren’t implemented by a
particular TLS backend; return an invalid type rather than crashing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=752240
2017-09-11 19:15:15 +01:00
Cosimo Cecchi
88a39670e7 GSettingsBackend: use a GWeakRef during dispatch
Instead of a full reference, which causes problems for clients that
expect a GSettings instance to stop firing signals once they drop the
last reference.

https://bugzilla.gnome.org/show_bug.cgi?id=780861
2017-09-08 09:29:18 -07:00
Chris Lamb
e5eaca5492 gio-querymodules: Make the output reproducible
Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.

Patch attached.

 [0] https://reproducible-builds.org/

Signed-off-by: Chris Lamb <lamby@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786983
2017-09-08 15:20:27 +01:00
Daniel Boles
b1b00517cf GApplication: Fix required # of elements in docs
The reality, as shown by our tests, is that only 2 elements are needed.
2017-09-06 21:44:25 +01:00
Cj Malone
926db3174a gdesktopappinfo.c: Drop disregarded xterm check
https://bugzilla.gnome.org/show_bug.cgi?id=786580
2017-08-23 23:55:43 +01:00
Philip Withnall
73eee8d64e tests: Fix some leaks and double-frees in the GSubprocess tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Will Thompson
65a95a5a2d gio: failing cases for subprocess cancellable bug
https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
8f86d312d8 gio: Fix double-callback on cancellation with GSubprocess
See bug #786456 for a detailed analysis of the situation which can cause
this (in summary, if a g_subprocess_wait_async() call is cancelled on a
GSubprocess which is already known to be dead).

The problem was that the GCancellable callback handler was
unconditionally returning a result for the GTask for
g_subprocess_wait_async(), even if that GTask had already returned a
result and the callback was being invoked after the GTask had been
removed from the pending_waits list.

Fix that by checking whether the GTask is still in the pending_waits
list before returning a result for it.

Thanks to Will Thompson for some very useful unit tests which reproduce
this (which will be pushed in the following commit).

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

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
a60359aee2 tests: Add temporary working directory for monitor test
Similarly to the previous commit, move the temporary directory for the
monitor test from $(cwd) to the system temporary directory.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
0f5b523fac tests: Add temporary working directory for appmonitor test
Rather than creating a temporary directory in the current directory
(typically the builddir), then never deleting it; create one in the
system /tmp directory, and clean it up properly afterwards.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
3ce00b29ec tests: Fix leak in appmonitor test
Spotted by Daniel Macks.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Ondrej Holy
087525b62b gio-tool: Use print_file_error correctly
Use print_file_error where an error relates to that file and vice versa.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
78fa67e70c gio-tool-save: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
1cce5dda18 gfile: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
c7f2a7e431 gio-tool-save: Prevent overwriting error
The following warning is shown, when both g_output_stream_write and
g_output_stream_close fail:
"GError set over the top of a previous GError or uninitialized memory."

Let's clear the error after use.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
37cddec0ee gio-tool: Unify buffer sizes
Recently, buffer size for copying has been increased in order to improve
performance:
https://bugzilla.gnome.org/show_bug.cgi?id=773823

Let's do the same for gio-tool-save and gio-tool-cat.

https://bugzilla.gnome.org/show_bug.cgi?id=786460
2017-08-18 14:46:23 +02:00
Chun-wei Fan
54aee1f627 Meson: Set _WIN32_WINNT to 0x0601 (Windows 7)
We want to set _WIN32_WINNT so that functions will be properly found in
the headers, to target the NT6.1+ (Windows 7+) APIs.

Also improve the checks for if_nametoindex() and if_indextoname() on
Windows as they are supported in Windows Vista+, but they have
to be checked by linking against iphlpapi.lib (or -liphlpapi).  On other
platforms, they are still checked as they were before.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 23:40:35 +08:00
Chun-wei Fan
32d6a76b98 build: Use Meson's find_library() for MSVC builds as needed
Some of the dependencies' build systems for Visual Studio do not provide a
pkg-config file upon build, so we use find_library() for them when the
corresponding pkg-config files are not found during Visual Studio builds,
so that one will not need to make up pkg-config files for them, which
could be error-prone.  These .lib names match the names that are built
with the officially supported build system that is used by their
respective Visual Studio support.

For ZLib, this will make gio-2.0.pc reflect on the zlib .lib based on
what is found, or whether we use the fallback/bundled ZLib, when we
don't have a pkg-config file for ZLib on MSVC.  We still need to depend
on Meson to be updated to put the correct link argument for linking ZLib
in the pkg-config case.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:17:59 +08:00
Simon McVittie
7c97e3d784 gdbus: Check signature of NameAcquired, NameLost
Calling g_variant_get (parameters, "(&s)") when parameters has a
signature other than (s) is considered to be a programming error.
In practice the message bus (dbus-daemon or a reimplementation) should
always send the expected type, but be defensive.

(Modified by Philip Withnall to improve type check.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:31:31 +01:00