Commit Graph

5301 Commits

Author SHA1 Message Date
Mario Sanchez Prada
637a298960 gio/tests/appinfo: New test for launch with "appId-less" applications
New test to make sure we exercise the code paths in gdesktopappinfo.c
that get triggered when g_desktop_app_info_launch_uris_with_spawn()
is used (i.e. unknown app ID, no session bus), both for when either
a single URI or multiple ones are expected by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
d501bd0dbe gdesktopappinfo: Gracefully handle NULL URIs when passed to expand_macro()
If an application calls g_app_info_launch_uris() with a GList that includes
NULL values in some of its data members, and GIO ends up internally calling
g_desktop_app_info_launch_uris_with_spawn() for whatever reason (e.g. no
D-Bus session available), expand_macro() will crash due to the invalid data.

As this is considered a programmer error, use g_return_val_if_fail() in those
situations to prevent the crash from happening, but printing a warning anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Mario Sanchez Prada
fbed9c8b85 gdesktopappinfo: Pass a copy of the URIs list to expand_application_parameters()
This list will be modified in-place when calling expand_macro(), so pass a copy
of it instead the original pointer, that is supposed to be an input parameter
only for g_desktop_app_info_launch_uris_with_spawn().

https://bugzilla.gnome.org/show_bug.cgi?id=791337
2017-12-08 13:47:23 +00:00
Friedrich Beckmann
018b997dd2 MacOS: fix content type check vs. mime check to show folder icons
In MacOS the file selection dialog does not show folder icons.
With this fix the folder icons are shown. The bug is described
in:

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

This bug fix is only partial, because this fix is only the
last resort when no mime information is available.
2017-12-08 11:10:27 +00:00
Philip Withnall
62dece198b gio: Fix querying of thumbnail attributes other than thumbnail::path
The thumbnail attributes would previously only be set if thumbnail::path
was included in the query — so querying for just thumbnail::is-valid
would return no results.

This fixes the behaviour of
    gio info -a thumbnail::is-valid ./some-file.png
vs
    gio info -a thumbnail ./some-file.png

The first command would previously list nothing. The second would
previously list a thumbnail::path and thumbnail::is-valid.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791325
2017-12-07 13:03:18 +00:00
Arnaud Bonatti
2ebc78ae71 gio: Remove stray ‘<’ from gschema.dtd
The mathematical operator was making the DTD unusable.
Also, min and max can be equal with current parser.

https://bugzilla.gnome.org/show_bug.cgi?id=791267
2017-12-06 10:33:52 +00:00
Arnaud Bonatti
0d59878bce Fix gschema.dtd regarding flags
https://bugzilla.gnome.org/show_bug.cgi?id=791235
2017-12-05 12:31:49 +00:00
Christian Hergert
f44472e715 gobject: fix typecasts via g_object_ref
Now that g_object_ref() propagates the parameter type to the
return value, we need to cast to ensure the result is warning
free.

https://bugzilla.gnome.org/show_bug.cgi?id=790697
2017-12-04 11:42:58 +00:00
Philip Withnall
c26aab36db gio: Fix a minor indentation problem
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2017-12-04 10:38:01 +00:00
Michael Catanzaro
18f4583653 gdbusconnection: Fix link in documentation 2017-12-03 19:22:58 -06:00
Philip Withnall
36f7440bb7 goutputstream: Fix pre-condition
Spotted by Izak van Langevelde.

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

https://bugzilla.gnome.org/show_bug.cgi?id=791036
2017-12-01 10:02:21 +00:00
Philip Withnall
06719a86b2 docs: Drop unnecessary <!-- -->s from gtk-doc comments
Putting a <!-- --> in plural<!-- -->s was an old hack used to fix
linking the symbol with gtk-doc when gtk-doc didn’t know about plural
forms. gtk-doc does now know about plural forms, so the hack can be
removed.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-29 17:50:27 +00:00
Philip Withnall
a2a4a10299 tests: Fix some minor memory leaks in gdbus-test-codegen
It’s not entirely leak-free, but it’s better than before.

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Philip Withnall
37d9b0c699 gdbusutils: Fix a memory leak in g_dbus_gvalue_to_gvariant()
g_variant_get_normal_form() doesn’t necessarily return a floating
GVariant, so we have to take, rather than sink, the ref.

This fixes a lot of leaks with gdbus-codegen-generated code.

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

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:50 +00:00
Tim Waugh
d35d9b7911 codegen: fix array out-param annotations
When using gdbus-codegen to produce generated code for a method with
an out parameter with a signature like 'as', make sure to include
an "(array)" annotation for that parameter.

(Reworked by Philip Withnall to improve code formatting.)

https://bugzilla.gnome.org/show_bug.cgi?id=741167
2017-11-28 14:28:49 +00:00
Philip Withnall
2a0db6d868 inotify: Add missing commas
These were accidentally omitted from commit
748bb24985. My fault.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-28 14:25:34 +00:00
Philip Withnall
e644bfa37e gio: Add some casts for printf() formatting statbufs on Solaris
Apparently Solaris defines statbuf fields as long when Linux doesn’t, in
some cases. Cast down to the type expected by the printf() format
placeholder.

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

https://bugzilla.gnome.org/show_bug.cgi?id=749652
2017-11-28 14:17:09 +00:00
Philip Withnall
b16d7fc1a7 gmountoperation: Add missing (array) annotations
Two of the vfuncs in GMountOperation need some annotations for their
element types and array sizes, otherwise g-ir-scanner comes up with
nonsense output.

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

https://bugzilla.gnome.org/show_bug.cgi?id=773980
2017-11-28 14:14:19 +00:00
Philip Withnall
181eb900d5 gdesktopappinfo: Downgrade a warning to a debug message
Bug #786580 triggered this warning to show up in the appinfo tests if
run on a machine where no terminal except xterm is installed (for
example, a build machine). Since we didn’t warn before if xterm but no
other terminals were installed, it seems reasonable to downgrade the
warning to a debug message.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790914
2017-11-28 14:12:40 +00:00
Philip Withnall
748bb24985 inotify: Don’t propagate unrecognised events to GLocalFileMonitor
If we can’t convert the inotify event mask into a GFileMonitorEvent enum
value, don’t propagate it to GLocalFileMonitor, since it hits an
assertion failure in that case.

This should no longer be possible since the previous commit to ignore
IN_Q_OVERFLOW events, but we might as well change this just in case
other bugs crop up in event mask handling.

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

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Philip Withnall
9853842c53 inotify: Ignore IN_Q_OVERFLOW events
There’s not much we can do about them, and if they go unhandled, they
can propagate through to g_file_monitor_source_handle_event() and cause
assertion failures due to not mapping to a GFileMonitorEvent.

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

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Philip Withnall
76072a2dde kqueue: Fix invalid emission of G_FILE_MONITOR_EVENT_MOVED event
That event is deprecated, and the kqueue backend can’t provide enough
information to go alongside the event (i.e. the name of the new file).
Use G_FILE_MONITOR_EVENT_DELETED instead.

Quite disappointed in the kqueue documentation for this: I cannot find a
single piece of documentation or example about how NOTE_RENAME is
supposed to communicate the new name of the file.

If it turns out that this is possible, the code can be amended again in
future. At least now it doesn’t abort.

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

https://bugzilla.gnome.org/show_bug.cgi?id=776147
2017-11-28 13:55:34 +00:00
Carlos Garcia Campos
7dcc09e586 gproxyresolverportal: do not connect to session bus when not under flatpak
While gio module extension is loaded a new GProxyResolverPortal is
created to query whether it's supported. We always return FALSE when not
aunder flatpak, so we don't need to connect to the session bus in that
case. Add a helper ensure_resolver_proxy() that returns TRUE when the
proxy is created and use it in is_supported() instead of creating the
proxy unconditionally in the instance initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=790894
2017-11-27 12:36:03 +01:00
Nirbheek Chauhan
7a9d92702e meson: Create gio-unix and gio-win32 internal deps
These are useful when using glib as a subproject and you want to use
gio-unix-2.0 or gio-win32-2.0.
2017-11-24 12:40:43 +05:30
Nirbheek Chauhan
bd22bb9898 meson: Use files() for gio sources and headers
This allows them to be fetched with subproject().get_variable(). Needed
for generating Gio-2.0.gir in the gobject-introspection meson port.
2017-11-23 23:03:57 +05:30
Daniel Macks
deeacce18a Do not load systemwide giomodules during self-test
$libdir/gio/modules/*.so on the live build machine are supplied by
third parties, so we should not look there while testing ourselves.

https://bugzilla.gnome.org/show_bug.cgi?id=780309
2017-11-20 10:23:23 +00:00
Daniel Macks
0b10c41a04 Git should ignore generated config.py file
gio/gdbus-2.0/codegen/config.py is generated by ./configure from
gio/gdbus-2.0/codegen/config.py.in

https://bugzilla.gnome.org/show_bug.cgi?id=790588
2017-11-20 10:17:01 +00:00
Philip Withnall
9ab0073321 glocalfileinfo: Fix a leak on an error handling path
Spotted by Clang static analysis, thanks to Leslie Zhai.

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

https://bugzilla.gnome.org/show_bug.cgi?id=777075
2017-11-17 14:39:55 +00:00
Philip Withnall
63c07f9b63 codegen: Change (allow-none) annotations to (nullable)
(nullable) has been around for a while now.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-17 11:42:48 +00:00
Daiki Ueno
c71098ddab tests/gmenumodel: Add test cases using peer-to-peer D-Bus connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
f29065c315 GMenuExporter: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
d37af2bd04 GDBusActionGroup: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Daiki Ueno
e8a09b3f85 GDBusMenuModel: Allow NULL bus name for peer-to-peer connection
https://bugzilla.gnome.org/show_bug.cgi?id=720380
2017-11-17 11:28:43 +00:00
Philip Withnall
d4f07f21fb glocalfile: Fix leak of FS type on some platforms
fstype is a const char*, and is passed to
g_file_info_set_attribute_string(), which takes a copy of it. There’s no
need to g_strdup() the FS type from various statfs/statvfs buffers
beforehand, given that the buffers are valid for the duration of this
function.

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

https://bugzilla.gnome.org/show_bug.cgi?id=679347
2017-11-15 13:08:11 +00:00
Christian Hergert
ed78f30c5e file: add tests for g_file_load_bytes()
This adds a test for both g_file_load_bytes() and the
asynchronous form g_file_load_bytes_async().

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 04:10:23 -08:00
Christian Hergert
2227918dfd file: add g_file_load_bytes()
This adds g_file_load_bytes() to make it more convenient to
load the contents of a GFile as GBytes.

It includes a special casing for gresources to increase the
chances that the GBytes directly references the embedded data
instead of copying to the heap.

https://bugzilla.gnome.org/show_bug.cgi?id=790272
2017-11-15 03:52:41 -08:00
Christian Hergert
5464461e4c gresource: avoid allocations in enumerate_children()
In the vast majority of cases, we can avoid temporary
allocations for paths in g_resources_enumerate_children().

In the case we need to add a suffix "/", we can usually just
build the path on the stack. In other cases, we can completely
avoid the strdup, which appears to only have been added for
readability. If the path is really long, we fallback to doing
what we did before, and use g_strconcat().

In the case of Builder, this saved 5.3mb of temporary
allocations in the process of showing the first application
window.

https://bugzilla.gnome.org/show_bug.cgi?id=790275
2017-11-15 03:24:29 -08:00
Christian Hergert
38ffcd298c gresourcefile: simplify path canonicalization
Previously, the path canonicalization for resources had liberal use of
strlen() and memmove() while walking through the path. This patch avoids
any secondary strlen() and removes all use of memmove().

A single allocation is created up front as we should only ever need one
additional byte more than then length of the incoming path string.

To keep the implementation readable, the mechanics are kept in external
functions. memrchr() was not used due to its lack of portability.

This is faster in every test case I've tested. Paths that contain
relative ../ have the most speedup.

https://bugzilla.gnome.org/show_bug.cgi?id=790310
2017-11-14 15:13:44 -08:00
Sebastian Dröge
7b60708204 GResource – Create an internal copy of the GBytes if it is not pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:39:45 +02:00
Sebastian Dröge
3c9c01e3ce GResource – Add note to documentation that the memory must be at least pointer aligned
https://bugzilla.gnome.org/show_bug.cgi?id=790030
2017-11-14 10:19:58 +02:00
Stefan Sauer
c68f66c19e docs: fix 'emphasis' tag
There is no 'em' tag in docbook. Use 'emphasis'. This would also require
to enable --xml-mode in MKDB_OPTIONS, but that requires more cleanups.
2017-11-12 21:04:30 +01:00
Stefan Sauer
2812219adb docs: add missing '*' chars at start of doc-comments 2017-11-12 16:36:16 +01:00
Philip Withnall
1897e66dce build: Drop data-to-c.pl in favour of data-to-c.py
The Python version was added for the Meson build, but we might as well
use it from autotools too, since it does exactly the same thing as the
Perl version (modulo not including a trailing linebreak, but that
doesn’t matter).

Works fine with Python 2.7 or Python 3.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790147
2017-11-10 11:47:57 +00:00
Christian Kellner
b9b7a1d039 gio-tool: fix inverted logic in monitor tool
The tool should refuse to work if none of the locations to watch
are set, not if *any* of them are unset.

https://bugzilla.gnome.org/show_bug.cgi?id=790093
2017-11-09 10:47:14 +01:00
Cosimo Cecchi
44d6052584 gfile: add g_file_new_build_filename()
This is a convenience C API that combines g_build_filename() with
g_file_new_for_path().

https://bugzilla.gnome.org/show_bug.cgi?id=788488
2017-11-07 08:25:28 -08:00
Philip Withnall
8e8f4e6486 docs: Fix various minor syntax errors in gtk-doc comments
This will fix a few broken links in the documentation, and shut up a
load of gtk-doc warnings (but certainly not all of them).

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

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:51:12 +00:00
Philip Withnall
249d74fcf6 docs: Make argument names in GAppInfo consistent
This fixes a mismatch between some of the gtk-doc comments and reality.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790015
2017-11-07 14:50:23 +00:00
Ondrej Holy
796599a705 gio-tool: Do not alter uris before use
Uris may be altered by the following code, which breaks xdg-open:
file = g_file_new_for_commandline_arg (arg[i])
uri = g_file_get_uri (file);

Examples of possible uri changes:
mailto:email -> mailto:///email
magnet:?xt=urn:hash -> magnet:///?xt=urn:hash
ssh://user@host -> sftp://user@host

This patch causes that uris aren't preprocessed for locations with
scheme, however absolute and relative paths are still preprocessed.

https://bugzilla.gnome.org/show_bug.cgi?id=779182
2017-11-07 13:46:56 +01:00
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
Simon McVittie
c53b44edb2 GBusNameOwnerFlags: Add DO_NOT_QUEUE flag
PulseAudio and LibreOffice are among the services that use this flag.
Refusing to queue for a name lets you do this transaction,
but atomically, avoiding the transient state where you briefly join
the queue and then are given the name when its primary owner drops it:

    result = RequestName(name)

    if result == IN_QUEUE:
        ReleaseName(name)
        result = EXISTS

    return result

(Modified by Philip Withnall to add documentation.)

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

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:16:07 +01:00
Simon McVittie
92f1ba200d GBusNameOwnerFlags: Note equivalence with D-Bus Specification
The implementation passes flags through directly to the RequestName()
call, so if any new values break that equivalence, the implementation
will have to be changed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:10:07 +01:00
Philip Withnall
05abc6cfce gio: Fix crash in open URI portal when no callback is provided
If no callback is provided, token is never set, but it’s then passed to
g_variant_new_string(), which requires a non-NULL input.

Fix that by moving all the option handling inside the (callback != NULL)
case.

Spotted by Coverity (CID #1378714).

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

https://bugzilla.gnome.org/show_bug.cgi?id=785817
2017-08-07 17:08:07 +01:00
Philip Withnall
1782219fb8 docs: Fix typo in GDBusInterfaceSkeleton documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-04 13:30:10 +01:00
Philip Withnall
ad9d5a11f2 tests: Fix gschema-compile test for translatable string changes
Little did I know when making commit
c257757cf6 that a lot of the output of
glib-compile-schemas is string matched in some of the unit tests. Fix
them to match the updated strings.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:32:42 +01:00
Philip Withnall
25c01e1c55 glib-compile-schemas: Use double quotes rather than single quotes
It’s what GLib is standardising on. See bug #772221.

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 16:31:37 +01:00
Daniel Macks
f7a14fece4 Use "-module" when compiling loadable modules
Some platforms use different extensions for compile-time linkable
libraries vs runtime-loadable modules. Need to use special libtool
flag in the latter case for consistency with what gmodule expects.

https://bugzilla.gnome.org/show_bug.cgi?id=731703
2017-08-03 12:28:10 +01:00
Philip Withnall
c257757cf6 glib-compile-schemas: Improve some translatable strings
• Fix capitalisation to be consistent
 • Use Unicode quotation marks where appropriate
 • Move trailing \n characters out of the translable strings and append
   them unconditionally

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

https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:41:13 +01:00
Daniel Boles
94816e10d2 glib-compile-schemas: Fix typo in newly translatable string 2017-08-03 11:30:20 +01:00
Jiro Matsuzawa
a7aa8acc48 glib-compile-schemas: Mark missing strings for translation
https://bugzilla.gnome.org/show_bug.cgi?id=695573
2017-08-03 11:19:08 +01:00
Philip Withnall
f2b6c11629 gstrfuncs: Expand documentation for errno functions
Mention that it really is a good idea to save errno before doing
literally anything else after calling a function which could set it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Philip Withnall
5cddde1fb2 Consistently save errno immediately after the operation setting it
Prevent the situation where errno is set by function A, then function B
is called (which is typically _(), but could be anything else) and it
overwrites errno, then errno is checked by the caller.

errno is a horrific API, and we need to be careful to save its value as
soon as a function call (which might set it) returns. i.e. Follow the
pattern:
  int errsv, ret;
  ret = some_call_which_might_set_errno ();
  errsv = errno;

  if (ret < 0)
    puts (strerror (errsv));

This patch implements that pattern throughout GLib. There might be a few
places in the test code which still use errno directly. They should be
ported as necessary. It doesn’t modify all the call sites like this:
  if (some_call_which_might_set_errno () && errno == ESOMETHING)
since the refactoring involved is probably more harmful than beneficial
there. It does, however, refactor other call sites regardless of whether
they were originally buggy.

https://bugzilla.gnome.org/show_bug.cgi?id=785577
2017-08-03 10:21:13 +01:00
Ondrej Holy
41a4a70b43 gunixmounts: Add missing const qualifier for mtab path
get_mtab_read_file and get_mtab_monitor_file returns const path,
but const qualifier is missing. Let's add it.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Ondrej Holy
2db36d0d5c gunixmounts: Prevent "mounts-changed" race if /etc/mtab is used
The /etc/mtab file is still used by some distributions (e.g. Slackware),
so it has to be monitored instead of /proc/self/mountinfo in order to
avoid races between g_unix_mounts_get and "mounts-changed" signal. The
util-linux is built with --enable-libmount-support-mtab in that case and
mnt_has_regular_mtab is used for checks. Let's use mnt_has_regular_mtab
also to determine which file to monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=779607
2017-08-03 10:22:43 +02:00
Debarshi Ray
b51a0e7c63 GApplication: Use a WARNING if dbus_unregister is called by destructor
Unlike g_application_register, there is no public API to unregister the
GApplication from D-Bus. Therefore, if the GApplication is set up
manually without using g_application_run, then neither can the
GApplicationImpl be destroyed nor can dbus_unregister be called before
destruction.

This is fine as long as no sub-class has implemented dbus_unregister.
If they have, their method method will be called after destruction, and
they should be prepared to deal with the consequences.

As long as there is no public API for unregistering, let's demote the
assertion to a WARNING. Bravehearts who don't use g_application_run
can continue to implement dbus_unregister, but they would have been
adequately notified.

This reverts commit c1ae1170fa.

https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00
Debarshi Ray
df06dc6550 GApplication: Don't call dbus_unregister multiple times
https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-24 19:52:48 +02:00
Debarshi Ray
c1ae1170fa GApplication: Assert that dbus_unregister was called before destruction
Invoking the dbus_unregister virtual method during destruction is
problematic. It would happen after a sub-class has dropped its
references to its instance objects, and it is surprising to be asked to
unexport exported D-Bus objects after that.

This problem was masked as a side-effect of commit 21b1c390a3.
Let's ensure that it doesn't regress by asserting that dbus_unregister
has happened before destruction.

Based on a patch by Giovanni Campagna.

https://bugzilla.gnome.org/show_bug.cgi?id=725950
2017-07-20 15:31:41 +02:00
Adrian Perez de Castro
f8a88a768d Map G_NOTIFICATION_PRIORITY_HIGH to NOTIFY_URGENCY_NORMAL
When using the Freedesktop backend for GNotification, it seems like a
better idea to map G_NOTIFICATION_PRIORITY_HIGH to NOTIFY_URGENCY_NORMAL
(instead of NOTIFY_URGENCY_CRITICAL) provided that the difference
between GNotification's NORMAL and HIGH priorities is minor.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784815
2017-07-18 17:31:29 -04:00
Matthias Clasen
9424facde2 2.53.4 2017-07-17 16:20:52 -04:00
Emmanuele Bassi
683809d5f7 Use env for gdbus-codegen's script
This allows us to build with Python 3 without using an absolute path.
2017-07-14 22:05:01 +01:00
Thibault Saunier
be8820128f meson: fix remaining wrong #include's for gdbus_codegen files
This is a follow up on 266bc1e510
to fix building tests and examples when using GLib as a meson
subproject.
2017-07-13 22:22:16 -04:00
Matthias Clasen
653be67d7d Add gopenuriportal.c to the meson build
This was added recently.
2017-07-13 19:34:21 -04:00
Alessandro Decina
4db695bfb7 meson: replace meson.current_source_dir() with files()
As the meson reference doc says, files() is preferred over building
paths with current_source_dir().
2017-07-13 19:03:39 -04:00
Alessandro Decina
266bc1e510 meson: fix wrong #include's for gdbus_codegen files
When building glib as a subproject, #include's for xdp-dbus.h from xdp-dbus.c
and for gdbus-daemon-generated.h from gdbus-daemon-generated.c were generated as
being prefixed with the subproject prefix, eg
 #include "subproject/glib/gio/gdbus-daemon-generated.h".
That failed since the root of the build directory is obviously not part of the
include path when building a subproject.

Passing --output-directory @OUTDIR@ to gdbus-codegen and removing @OUTDIR@ from
--generate-c-code fixes the issue.
2017-07-13 19:03:39 -04:00
Thibault Saunier
eb2196e89d meson: Fix building as a subproject
meson.source_root() returns the toplevel source directory
of the toplevel project, thus the paths were wrong when using
it. Simply using files() gets us the right path

https://bugzilla.gnome.org/show_bug.cgi?id=784133
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
10ae386727 meson: gio tests need to link against gobject as well
With meson from git dependencies of dependencies are no
longer added automatically and recursively to the linker
lines. Meaning dependencies that are used have to be
passed directly and explicitly or we'll get linker errors.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
42705b57f7 meson add missing gio/tests subdirectory/file 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
03eac5fac5 meson: rebase on top of master ~2.53.1
From 2.51.2
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
6af4f1752a meson: gio/tests: remove some leftover rubbish 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
613e00826e meson: gio/tests: add more gio tests
Need to fix up some of the tests a little, because the
test binary will not necessarily be run from the current
build sub-directory, and the build directory structure
might not always be a mirror of the source directory
structure, so pass location of glib-mkenums and
glib-compile-scheme and such directly.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
1acd6de763 meson: Use glib-mkenums directly instead of via build_mkenum.py
This is no longer needed because we use templates and custom targets
can capture output just fine on all platforms.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
dd8ff54736 meson: Use Python port of glib-mkenums
This reduces the build-time dependencies of glib to only Python 3,
Meson, and git. Git is also optional if you provide a tarball in
which the subproject directories already exist.

The Python port was done by Jussi Pakkanen on bugzilla:
https://bugzilla.gnome.org/show_bug.cgi?id=779332

This version contains some fixes from that and also changes all
instances of `@` to `\u0040` because Meson does not yet provide a
configure_file() mode that ignores unknown @MACRO@ values.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
ee94ad776e meson: Use proxy-libintl if gettext is not found
This is a stub-only library that can be used while building against
MSVC and contains no i18n machinery at all.

The dependencies added indirectly use the libintl.h header, and when
built as a subproject, the header won't be in a path known the
pre-processor.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
192cd652d4 tests: gio/tests: add gdbus tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
4e0ef7655d meson: gio/tests: add more gresource tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
2f29ee1735 meson: add -fvisibility=hidden explicitly to selected targets
Don't use it project-wide for building everything. Otherwise
symbols for shared modules won't be exposed, e.g. in the
resourceplugin used by the gio resource unit test.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
34e4e25d53 meson: gio/tests: add more missing tests 2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
f438c04fac gio: tests: rename generated giotypefunc.c to giotypefuncs.inc
This is needed for the Meson port, a file name .c that's included
and shouldn't be compiled into an object is difficult to manage
otherwise.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
33fb1bbb61 meson: gio, gobject: use files() for headers list
Since these variables are referenced from other directories
such as the tests/ subdir as well.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
d29f022b0b meson: add support for dtrace/systemtap
Still at least one FIXME. And untested so far. It builds.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
9fdcb2bf37 meson: Add a comment about the gdbus-peer gio test
So that it's not forgotten later.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
3c62619930 tests: autoptr test can be run on gcc, clang, intel
The only place where it won't work, is MSVC and maybe Sun Studio, but
we'd need someone to test Sun Studio first.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
122f4c051d meson: Add tls-interaction test, and fix giomodule test
giomodule test needed symbol visibility pragmas added. This is needed on
Windows anyway, so it's better to do it this way rather than disabling
-fvisibility=hidden for the test modules.
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
e2da3cb599 meson: Port to latest master (2.51.0)
Also remove headers from some gio sources. Headers do not need to be
added to the list of sources.

+ various smaller self-explanatory fixes.
2017-07-13 19:03:39 -04:00
Patrick Griffis
d10be6102f meson: Minor modernizations 2017-07-13 19:03:39 -04:00
Patrick Griffis
a690e2a375 meson: More build fixes
- Fix installing various data files
- Build translations
2017-07-13 19:03:39 -04:00
Nirbheek Chauhan
fe2a9887a8 meson: Improve MSVC and MinGW support and fix dependencies everywhere
Disable gio tests on Windows, fix .gitignore to not ignore
config.h.meson, and add more things to it.

Rename the library file naming and versioning to match what Autotools
outputs, e.g., libglib-2.0.so.0.5000.2 on Linux, libglib-2.0-0.dll  and
glib-2.0-0.dll on Windows with MSVC.

Several more tiny fixes, more executables built and installed, install
pkg-config and m4 files, fix building of gobject tests.

Changes to gdbus-codegen to support out-of-tree builds without
environment variables set (which you can't in Meson). We now add the
build directory to the Python module search path.
2017-07-13 19:03:39 -04:00
Tim-Philipp Müller
213957970e meson: Fix glib, add gobject, gio, gthread, gmodule, etc
Several small fixes to the build files.

Lots of tests have also been added, and glib tests pass now.
2017-07-13 19:03:39 -04:00
Daniel Boles
5eededccda gsettingsschema: Fix a compiler warning
g_build_filename() returns a gchar*, but it was stored in a const gchar*
and then g_free()d, which is wrong and led to a warning about the const
qualifier being cast away.
2017-07-12 19:23:40 +01:00
Philip Withnall
a131134918 build: Drop nmake/MSC build system for GLib
It hasn’t been seriously maintained for the best part of 10 years and is
very outdated. The recommended way to build GLib on Windows is now
Visual Studio:

https://wiki.gnome.org/Projects/GTK%2B/Win32/MSVCCompilationOfGTKStack#GLib

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

https://bugzilla.gnome.org/show_bug.cgi?id=722047
2017-07-10 11:22:40 +01:00
Matthias Clasen
28cc6aeb19 gsettings: Try harder to describe keys
If a key has no description, show the summary,
rather than "(null)". Since thats not helpful at all.
2017-07-07 19:11:51 -04:00
Matthias Clasen
85e4a25912 Avoid a race with the openuri portal
Same as the previous commit; use the new predictable request
object path to connect to the Response signal early.
2017-07-07 11:54:54 -04:00
Bastien Nocera
a95e2a4c64 docs: Fix cut'n'paste error in g_resources_get_info() doc
https://bugzilla.gnome.org/show_bug.cgi?id=784581
2017-07-05 23:50:04 +02:00
Philip Withnall
5a8b02cae6 gdbusutils: Add an example to g_dbus_gvariant_to_gvalue() docs
Clarify that GVariants of type v are not magically unboxed.

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

https://bugzilla.gnome.org/show_bug.cgi?id=784433
2017-07-04 10:45:50 +01:00
Matthias Clasen
f39024038f Disambiguate source names
This makes debugging more pleasant.
2017-06-28 19:50:57 -04:00
Emanuele Aina
79e4d4c6be gio: Mention the ALL_METADATA flag in g_file_copy()
The g_file_copy() documentation didn't mention if
G_FILE_COPY_ALL_METADATA was applicable or not, and users were led to
call g_file_copy_attributes() to specify it after the g_file_copy()
call, unless they checked the source (been there, done that).

https://bugzilla.gnome.org/show_bug.cgi?id=784037
2017-06-21 15:54:11 +02:00
Philip Withnall
18f8b77c04 gio: Use g_strerror() instead of strerror()
This marginally improves thread safety, and marginally improves
consistency.

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

https://bugzilla.gnome.org/show_bug.cgi?id=733821
2017-06-21 11:20:29 +01:00
Colin Walters
017f78d77f gtype: Add private DEFINE_TYPE with prelude to workaround gtype deadlocks
And use it in GSocket, as it had a real-world case reported.

https://bugzilla.gnome.org/show_bug.cgi?id=674885
2017-06-14 14:45:45 -04:00
Ting-Wei Lan
45d4b59e3f glocalfileoutputstream: Fix symlink writing on FreeBSD and NetBSD
FreeBSD, DragonflyBSD and NetBSD support O_NOFOLLOW, but they use error
numbers that are different from what POSIX standard specifies. They are
not going to change the behavior, and existing programs on these systems
already take advantage of this difference. To support them, we have to
add a check in GIO to use different error numbers on these systems.

https://bugzilla.gnome.org/show_bug.cgi?id=775593
2017-06-10 20:55:12 +08:00
Simon McVittie
34045e66a6 GGtkNotificationBackend: Use correct path for GetNameOwner call
For historical reasons, the reference dbus-daemon responds to most
method calls on all object paths. However, the canonical path
of the object implementing the o.fd.DBus interface is
/org/freedesktop/DBus, and in some environments (notably AppArmor
with the <abstractions/dbus-session-strict> abstraction) only this
path is allowed.

https://bugs.freedesktop.org/show_bug.cgi?id=101256 officially
deprecates all other object paths, and when adding new APIs we will
only make them available on the canonical object path.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Emmanuele Bassi <ebassi@gnome.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=783593
2017-06-09 16:45:09 +01:00
Ondrej Holy
6863080c32 gio-tool: Fix alignment of monitor messages
Name of GMount/GVolume/GDrive is aligned in many cases in output messages,
except few cases. Let's unify the alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=776169
2017-06-06 11:11:58 +02:00
Philip Withnall
085b3470f0 gdbusintrospection: Remove incorrect (out) annotations
The caller passes in a GString instance which is then modified by the
function, rather than the function building its own GString and passing
it out to the caller.

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

https://bugzilla.gnome.org/show_bug.cgi?id=783392
2017-06-05 16:07:52 +01:00
Philip Withnall
f98d998267 gdatainputstream: Annotate (out) length arguments as (optional)
All of them are.

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

https://bugzilla.gnome.org/show_bug.cgi?id=783350
2017-06-05 16:04:18 +01:00
Sébastien Wilmet
eea0681574 LGPLv2+ -> LGPLv2.1+: update remaining files
For the files in gio/ (but not in gio/ sub-directories), only the *.[ch]
files were handled in commit 3bf4a720c3.

For the modified files in glib/tests/markups/, I've tested that
`make check` still succeeds.

After this commit,
$ git grep -in "GNU Library"
and
$ git grep -in "Library General"
return only results in COPYING files and in glib/libcharset/. The latter
was not updated because it's a copy.

$ git grep -in "version 2" | grep -iv "version 2\.1"
now doesn't return any LGPL license header.
- glib-gettextize.in: GPL
- glib/gen-unicode-tables.pl: GPL
- glib/gnulib/: a copy
- glib/libcharset/: a copy
- m4macros/attributes.m4: GPL
- po/po2tbl.sed.in: GPL
- tap-driver.sh: GPL
- tests/*.pl: GPL

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-06-03 10:30:17 +02:00
Matthias Clasen
34b21312f1 appinfo: Fix the build on windows
The previous commit forgot to protect some unix-only
calls by an ifdef.

Pointed out by John Emmas.
2017-06-02 22:04:46 -04:00
Patrick Griffis
7c5cd293d0 Fix g_file_copy_async() annotation
https://bugzilla.gnome.org/show_bug.cgi?id=776333
2017-06-02 13:44:16 -04:00
John Lindgren
d1d60fc846 NtNotifyChangeMultipleKeys is a __stdcall function.
https://bugzilla.gnome.org/show_bug.cgi?id=781301
2017-06-01 11:00:28 +00:00
Philip Withnall
4dd1b17c24 gdbus: Fix race in name watching on connection teardown
If g_dbus_unwatch_name() is called from one thread at the same time as
the GDBusConnection is emitting ::disconnected in another thread, there
will be a race and the handler for ::disconnected may end up using
memory after it’s freed.

Fix this by serialising through the map_id_to_client, so that
on_connection_disconnected() atomically gets a strong reference to the
Client, or NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=777307
2017-06-01 11:39:40 +01:00
Matthias Clasen
97068f363e OpenFile support: Handle open failing
This can happen, report it as an error when it does.
2017-05-31 12:10:58 -04:00
Philip Withnall
e1e73dafa6 gsubprocess: Copy parent process’ environ when clearing subprocess’
Previously, this was done at the time of spawning the subprocess, which
meant the g_subprocess_launcher_*_environ() functions could not be used
to modify the parent process’ environment.

Change the code to copy the parent process’ environment when
g_subprocess_launcher_set_environ(NULL) is called. Document the change
and add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-05-31 12:07:31 +01:00
Philip Withnall
c7d325733c docs: Mention GtkApplication in the GResource documentation
Since GtkApplication auto-loads some well-known resource paths. Add a
cross-reference to its documentation. (The cross-reference won’t be
linked if the GTK+ documentation isn’t available at build time, but this
is probably good enough. It is likely to be available.)

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

https://bugzilla.gnome.org/show_bug.cgi?id=782336
2017-05-31 11:09:51 +01:00
Philip Withnall
678899e87a docs: Mention the alias GResource attribute in the documentation
It was the only part of the XML format which was not documented.

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

https://bugzilla.gnome.org/show_bug.cgi?id=782336
2017-05-31 11:08:05 +01:00
Philip Withnall
29b4e9b05f docs: Improve formatting and fix typos in GResource documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-31 10:55:45 +01:00
Matthias Clasen
4c8ab22b95 Use OpenFile for local files
The OpenURI portal has a separate method to handle local
files now. Use it.

At the same time, split out the openuri helpers into separate
files, and generate code for the OpenURI portal.

https://bugzilla.gnome.org/show_bug.cgi?id=783193
2017-05-30 14:23:10 -04:00
Florian Müllner
99d34f65d3 gdbus-codegen: Apply --output-directory to generated docs as well
In addition to code, gdbus-codegen can also generate docbook
documentation for DBus interfaces. There's no good reason why
the newly added --output-directory option shouldn't apply to
those generated files as well.

https://bugzilla.gnome.org/show_bug.cgi?id=783201
2017-05-30 00:08:38 +02:00
Matthias Clasen
d3b4f7c9f6 Make dbus activation sandbox-aware
When we call org.freedesktop.Application.Open to activate
an application and pass file uris, the application may not
be able to see the files due to a flatpak sandbox.

Flatpak puts the flatpak app-id in the  X-Flatpak key in
desktop files that it exports, so we can easily recognize
applications that may be affected by this.

In this case, call the document portal to export the files
and pass the resulting uri's instead of the original ones.

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Matthias Clasen
60a1cc9fac Add a wrapper for the AddFull document portal api
This is a wrapper which takes a list of uris and rewrites
them by calling AddFull with the file:// uris.

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Matthias Clasen
a76fc7fa76 Update flatpak document portal interface
This api has been changed upstream, recently.

A new AddFull method has been added in this commit:
6ce8521b64

https://bugzilla.gnome.org/show_bug.cgi?id=783130
2017-05-29 17:57:39 -04:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
90afd3b775 gio/xdgmime/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
408381b8ae gio/win32/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
d9a44b66af gio/tests/: LGPLv2+ -> LGPLv2.1+
A lot of tests in gio/tests/ don't have a license header.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
6000f25e4f gio/inotify/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
ae4bac0ada gio/gvdb/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
0fedc90fac gio/gdbus-2.0/codegen/: LGPLv2+ -> LGPLv2.1+
https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Sébastien Wilmet
57cd1b4239 gio/fam/: LGPLv2+ -> LGPLv2.1+
There is only one *.c file in gio/fam/.

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Philip Withnall
fae61260c6 gtlspassword: Fix a typo in a translatable string
Singular/Plural mismatch.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-29 11:24:09 +01:00
Juan R. Garcia Blanco
d865ffa4d5 gtlspassword: Comment for translators added
With tweaks by Philip Withnall <philip@tecnocode.co.uk>.

https://bugzilla.gnome.org/show_bug.cgi?id=658446
2017-05-29 11:22:28 +01:00
Chun-wei Fan
7f41633efd gio/gdbusprivate.c: Include missed headers
This ensures the needed GTYPE_*'s can be found during the build
2017-05-27 00:23:54 +08:00
Matthias Clasen
b5e8e4eea9 GApplication: Remove some unused members
All the menu handling is in GtkApplication, these fields
are entirely unused, and can go away.

https://bugzilla.gnome.org/show_bug.cgi?id=783061
2017-05-25 14:50:34 -04:00
Colin Walters
a0ed9bc8d6 gdbus: Init more types to work around gtype thread issue
See https://bugzilla.gnome.org/show_bug.cgi?id=674885#c85

In this pass I also went through and added more types from GDBusConnection.
2017-05-22 09:20:45 -04:00
Ryan Hendrickson
151d3b01e6 gsettings: check $XDG_DATA_HOME for schemas
Add $XDG_DATA_HOME/glib-2.0/schemas as a schema source, after (higher
priority than) $XDG_DATA_DIRS/glib-2.0/schemas but before
$GSETTINGS_SCHEMA_DIR. This is per the XDG Base Directory Specification,
which states that user specific versions of data in $XDG_DATA_DIRS can
be created in $XDG_DATA_HOME.

https://bugzilla.gnome.org/show_bug.cgi?id=741335
2017-05-22 09:18:25 +01:00
Philip Withnall
3de1fac392 docs: Fix a trivial typo in GMount documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-17 13:40:06 +01:00
Philip Withnall
7f8ae236a7 docs: Fix a trivial typo in GMount documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-05-17 13:37:02 +01:00
Mohammed Sadiq
274f336f6a docs: Trivial typo fixes
The presence of space was resulting in wrongly rendered documentation
in devhelp (and probably in other documentations).

https://bugzilla.gnome.org/show_bug.cgi?id=782068
2017-05-16 11:22:54 +01:00
Alexandru Pandelea
eb7b796bd2 xdgmime: fix special case for mime_type_subclass
Currently, all mime types are considered subclasses of
application/octet-stream, but according to the freedesktop
standard, everything but the inode/* types is a subclass of
application/octet-stream.

Update the special case for application/octet-stream so that all
types but inode/* will match with it and add unit test for it.

https://bugzilla.gnome.org/show_bug.cgi?id=782311
2017-05-16 11:16:41 +01:00
Lars Uebernickel
0751ccd315 gdbus: fix use-after-free
g_dbus_connection_call_internal() accesses the user data it passes to
g_dbus_connection_send_message_with_reply() after the call. That data
might be freed already in the case that the callback is called
immediately.

Fix this by removing the 'serial' field from the user data altogether
and fetch the serial from the message in the callback.

https://bugzilla.gnome.org/show_bug.cgi?id=748263
2017-05-12 14:43:22 -04:00
Krzesimir Nowak
b89fed057c docs: Fix typos
Something I spotted by accident with git log.
2017-05-10 12:44:59 +02:00
Ondrej Holy
83c1b881fb gunixmounts: Prevent unwanted automount requests
mnt_table_is_fs_mounted causes unwanted automount requests due to
canonicalization of source and target. It might be replaced by
mnt_table_find_source as per the documentation in order to prevent
the automounts, but it is redundant. All mtab entries should be already
mounted and thus mnt_table_is_fs_mounted result is always true (it
basically checks that the fs from mtab is in mtab). Let's remove
the check at all.

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-05-09 14:28:48 +02:00
Ondrej Holy
53ed1804e2 gunixmounts: Speed up mtab processing with libmount
libmnt_context is useless. It contains cache which is useful for searching,
but it isn't used in our case. Let's use mnt_context_parse_mtab instead
directly and the mtab processing will be faster.

https://bugzilla.gnome.org/show_bug.cgi?id=781867
2017-05-09 14:28:48 +02:00
Rico Tzschichholz
17395d79eb Revert "ginputstream: Add missing (out) annotations to read() functions"
This reverts commit 8446ee8c20.
2017-05-04 16:27:39 +02:00
Matthias Clasen
6ddfd516e6 Small documentation additions
The GNetworkMonitor docs were talking about one implementation,
omitting the others. While fixing that, add a bit about implementations
to the GProxyResolver docs too.
2017-05-02 07:23:32 -04:00