Commit Graph

17668 Commits

Author SHA1 Message Date
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
643c2d590c gdatetime: Drop a duplicate #define
It’s exactly the same as the one on the next line.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790416
2017-11-28 14:21:06 +00:00
Philip Withnall
bccc1057e3 gdatetime: Fix handling of unsupported nl_langinfo() items
If nl_langinfo() doesn’t support a particular item, it returns the empty
string. We should check for that and return NULL from
g_date_time_format() accordingly, otherwise the user could unwittingly
end up with a formatted date/time which is missing some or all of its
components.

This arose with %r in de_DE, which is unsupported by nl_langinfo()
because Germans almost never write time in 12-hour format.

Add a unit test.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790416
2017-11-28 14:21:06 +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
ae7895002b gnode: Eliminate implicit signed-to-unsigned integer conversion
When doing a level traverse of a GNode with depth of -1, the depth was
implicitly being converted to an unsigned integer. This worked (making
the depth limit G_MAXUINT), but was a bit mystical.

Change g_node_depth_traverse_level() to explicitly take a signed depth
and handle it appropriately.

Coverity issue: #1159465

https://bugzilla.gnome.org/show_bug.cgi?id=732003
2017-11-28 14:16:25 +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
2cd26714e5 tests: Add tests to ensure g_[s]list_sort() are stable sorts
Given that we guarantee it in the API…

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

https://bugzilla.gnome.org/show_bug.cgi?id=508976
2017-11-28 14:11:30 +00:00
Philip Withnall
74cbd6c34f gslist: Document that g_slist_sort() is stable
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=508976
2017-11-28 14:11:29 +00:00
Philip Withnall
9297a596d6 gmain: Mark some ref_count variables as volatile
To make it more obvious they should exclusively be accessed with atomic
functions.

https://bugzilla.gnome.org/show_bug.cgi?id=737677
2017-11-28 14:08:59 +00:00
Philip Withnall
d73f8eec48 gmain: Make GSourceCallback thread-safe
Otherwise there is a race in finalising the GSourceCallback if one
thread is finishing off a g_main_dispatch() while another thread is
destroying the GSource which owns the GSourceCallback.

A helgrind log:

==21707== Possible data race during write of size 4 at 0x54EACB0 by
thread #12
==21707== Locks held: none
==21707==    at 0x4ECC174: g_source_callback_unref (gmain.c:1528)
==21707==    by 0x4ECD953: g_main_dispatch (gmain.c:3081)
==21707==    by 0x4ECE667: g_main_context_dispatch (gmain.c:3673)
==21707==    by 0x4ECE859: g_main_context_iterate (gmain.c:3744)
==21707==    by 0x4ECEC7F: g_main_loop_run (gmain.c:3938)
==21707==    by 0x41C197: some_thread (some-code.c:224)
==21707==
==21707== This conflicts with a previous write of size 4 by thread #5
==21707== Locks held: 1, at address 0x54CF320
==21707==    at 0x4ECC174: g_source_callback_unref (gmain.c:1528)
==21707==    by 0x4ECB86F: g_source_destroy_internal (gmain.c:1178)
==21707==    by 0x4ECB9D4: g_source_destroy (gmain.c:1227)
==21707==    by 0x41CF09: some_other_thread (some-other-code.c:410)

https://bugzilla.gnome.org/show_bug.cgi?id=737677
2017-11-28 14:08:58 +00:00
Philip Withnall
030efac077 build: Include $host_cpu in tapset directory
SystemTap tapsets are architecture-specific, as they include the full
path to the .so file for each probe they reference. Hence, we should
install them in an architecture-specific path, or multiarch systems will
suffer from collisions between them.

A better long-term solution, using $libdir rather than the
non-architecture-specific $datadir, is under discussion upstream:
https://sourceware.org/bugzilla/show_bug.cgi?id=20264; but this will do
for now.

https://bugzilla.gnome.org/show_bug.cgi?id=662802
2017-11-28 14:00:26 +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
Emmanuele Bassi
7d3e6738c5 Remove outdated/obsolete README
The README for the API reference top-level is completely obsolete, so we
should just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=790896
2017-11-27 12:55:34 +00:00
Philip Withnall
82adf7b5da tests: Work around a gdb bug in assert-msg-test
It seems that when GLib is compiled without CFLAGS=-g, gdb can’t work
out the size of __glib_assert_msg, so assumes it’s 4 bytes — even on
64-bit systems. This causes it to not read the most significant 4 bytes
of the assertion message pointer, and hence it can’t print the stored
assertion message. This causes assert-msg-test to fail.

The upstream gdb bug is
https://sourceware.org/bugzilla/show_bug.cgi?id=22501.

Work around that by referencing and dereferencing __glib_assert_msg so
that gdb treats it as a pointer of sizeof(char*) rather than of the size
it incorrectly calculated from the library’s symbol table (or through
some other mystical process).

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

https://bugzilla.gnome.org/show_bug.cgi?id=782057
2017-11-27 11:44:08 +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
Christian Hergert
d44afbadda macros: make G_GNUC_CHECK_VERSION() portable
This removes the use of defined() in a macro expansion, which may not be
portable to some pre-processors. Instead, we hoist the defined check
outside the macro expansion.

https://bugzilla.gnome.org/show_bug.cgi?id=790877
2017-11-27 02:07:27 -08:00
Ivar Trygve Jarlsby
f5dba7d43c docs: Correct inconsistency in GObject tutorial
The example code defines an interface with three methods. The preceding text
reads 'This interface defines two methods'. This appears to be because the
example code was changed without updating the surrounding text.

https://bugzilla.gnome.org/show_bug.cgi?id=790830
2017-11-26 21:21:34 +00:00
Yosef Or Boczko
bb2696e8d9 Updated Hebrew translation 2017-11-26 15:46:05 +02:00
Emmanuele Bassi
bc277bfcef docs: Fix typo in the GObject tutorial
The description of the instance construction does not match the example.
2017-11-25 10:24:07 +00:00
Philip Withnall
b97e5cb21b glib-tap: Add missing mkdir for .test generation rule
We can’t guarantee that the builddir we’re generating in actually exists
— if doing a clean build with builddir ≠ srcdir, and there are no other
rules which generate build products in builddir, the .test generation
rule can fail. This happens for flatpak-builder.git for me.

Try to avoid that by explicitly creating the builddir.

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

https://bugzilla.gnome.org/show_bug.cgi?id=790785
2017-11-24 13:10:11 +00:00
Nirbheek Chauhan
87122cae38 meson: Fix gnulib compilation on MSVC
glibinc is needed for including glibconfig.h, this was not noticed
during testing probably because a system-installed header got picked
up instead.
2017-11-24 12:41:53 +05:30
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
Philip Withnall
1969af3e8c build: Use AM_DISTCHECK_CONFIGURE_FLAGS rather than unprefixed version
Since automake 1.11.2, it’s recommended to use the prefixed version and
leave the unprefixed version for users to override. Since we depend on
automake 1.13.3, we should be doing this.

Based on a patch by Sam Spilsbury <smspillaz@gmail.com>.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-23 16:37:00 +00:00
Nirbheek Chauhan
2e5bb92de6 meson: Use files() for headers and sources
This allows them to be fetched via subproject().get_variable(). Needed
for the gobject-introspection meson port.
2017-11-22 14:11:11 +05:30
Nirbheek Chauhan
c603ba301d meson: Add 'charsetalias-dir' option mirroring the autotools one
This fixes the build again.
2017-11-22 04:43:05 +05:30
Philip Withnall
4e5c6616f0 tests: Add tests for GArray constructors
Noticed these were missing when handling bug #733648. Add a few missing
tests to improve coverage.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-21 12:43:17 +00:00
Philip Withnall
0dc68e5d46 tests: Use g_test_skip() instead of a message in GDateTime tests
There are some GDateTime tests which need to be skipped if changing the
locale fails. Use g_test_skip() to do that, rather than just a
human-readable message.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-11-21 12:42:42 +00:00
Alan Coopersmith
ca32be3bf2 Fix -z nodelete configure check to work on Solaris
Passing -z nodelete without the shared library flags on Solaris results in
ld: fatal: option '-z nodelete' is incompatible with building a dynamic executable
which causes the configure test to falsely report its not supported.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776195
2017-11-21 12:14:27 +00:00
Daniel Macks
6bcc8b4034 Add configuration option for charset.alias directory
Specifically controlling the location of this file, rather than simply
using $libdir, allows one to avoid conflicting with the same default
location as the gnulib localcharset module uses.

https://bugzilla.gnome.org/show_bug.cgi?id=346816
2017-11-20 11:27:21 +00:00
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
f2c093f657 build: Drop --enable-rebuilds configure option
It is outdated and no longer effectively used. It was originally in
place to prevent rebuilding generated files (from a tarball) if the
right build tools (awk, Perl, indent) were not available. However, we no
longer use indent, we have hard-required awk for a while, and the only
places the @REBUILD@ substitution was still used were for
glib-genmarshal, which has recently been rewritten in Python (so no
longer depends on whether Perl is available).

Drop the whole lot.

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

https://bugzilla.gnome.org/show_bug.cgi?id=694723
2017-11-17 15:11:47 +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
Emanuele Aina
e73831d808 tests: Re-wire the testgobject test program to the build system
After the build system rework in commit f9eb9e testgobject fell through
the cracks and was not built since then.

Re-enable it, even if it is currently failing due to commit 31fde56.

(Tweaked by Philip Withnall to add meson.build support.)

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:27:10 +00:00
Emanuele Aina
edcabe1a4e tests: Don't assume that private data follows the instance data
Commit 31fde56 changed the way the private data is laid out in memory by
putting it *before* the instance data to keep the offsets fixed
regardless of the number of many subclasses.

This means that the invariant testgobject was verifying is no longer
true and the failing tests can be safely dropped.

https://bugzilla.gnome.org/show_bug.cgi?id=701156
2017-11-17 12:26:23 +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
Luca Bruno
3b89702bcf glib/tests/mappedfile.c: Use temp dir instead of user runtime dir
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724412
2017-11-16 11:17:19 +00:00
Christophe Fergeau
8d5c30cf90 Fix "on on" typo in tap-driver.sh comment
It should be "and/or on systems" rather than "and/on on systems"

https://bugzilla.gnome.org/show_bug.cgi?id=724794
2017-11-16 11:16:28 +00:00
Dan Winship
42d3ed0013 glib: document restrictions on various foreach() functions
Some foreach() functions allow you to modify the object they are
iterating, and others don't, but the docs were not generally clear
about this.

https://bugzilla.gnome.org/show_bug.cgi?id=724383
2017-11-16 11:12:32 +00:00
David Schleef
3cfac71d09 gdatetime: fix floating-point conversion
Conversion from floating point to integer requires special care.

https://bugzilla.gnome.org/show_bug.cgi?id=697715
2017-11-16 11:07:20 +00:00
Patrick Welche
b5733ecc76 Solaris build fix
On Solaris sigset_t is only defined in /usr/include/sys/signal.h
(included from /usr/include/signal.h) if _XPG4_2 is defined. If
it's not defined, you need to include /usr/include/sys/select.h.

http://bugzilla.gnome.org/show_bug.cgi?id=562334
2017-11-16 10:36:13 +00:00