platform/upstream/glib.git
9 years agoGNetworkMonitorNetlink: Fix check for non-kernel messages
Alexander Larsson [Mon, 1 Jun 2015 08:02:47 +0000 (10:02 +0200)]
GNetworkMonitorNetlink: Fix check for non-kernel messages

This code used to look at the SCM_CREDENTIALS and ignore every message
not from uid 0. However, when user namespaces are in use this does not
work, as if uid 0 is not mapped you get overflowuid instead. Right now
this means we ignore all messages in such user namespaces and glib
apps hang on startup.

We can't look at pids either, as pid 0 is returned for processes
outside your pid namespace.

Instead the correct approach is to look at the sending sockaddr and
if the port id (nl_pid) is zero, then its from the kernel.

Source:
http://lists.linuxfoundation.org/pipermail/containers/2015-May/036032.html

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

9 years agoAdd GNativeSocketAddress for handling "other" addresses
Alexander Larsson [Mon, 1 Jun 2015 08:01:26 +0000 (10:01 +0200)]
Add GNativeSocketAddress for handling "other" addresses

Instead of just dropping address types that we're not specifically
handling we return a GNativeSocketAddress which is just a dummy
container for the stuct sockaddr.

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

9 years agothread: Check sysconf value before using it
Mattias Ellert [Fri, 24 Oct 2014 12:29:00 +0000 (12:29 +0000)]
thread: Check sysconf value before using it

sysconf() is documented as returning -1 if it can't determine
a minimum thread stack size. Check for this case before using
the return value.

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

9 years agoAdd a global signal handler table
Matthias Clasen [Sat, 20 Sep 2014 05:08:32 +0000 (01:08 -0400)]
Add a global signal handler table

Add a global lookup table for signal handlers. We already give
them a unique ID, so there is no good reason to pay for
non-constant lookups when disconnecting handlers.

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

9 years agoAdd a performance test for signal connection
Matthias Clasen [Sat, 20 Sep 2014 04:34:24 +0000 (00:34 -0400)]
Add a performance test for signal connection

This test checks the performance of connecting, disconnecting and
blocking many handlers. Various cases are checked: disconnect in
the same order, in the inverse order, at random. Connect to one
signal on a single object, to two signals on the same object, or
to the same signal on two different objects.

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

9 years agoUpdated Spanish translation
Daniel Mustieles [Tue, 26 May 2015 17:25:56 +0000 (19:25 +0200)]
Updated Spanish translation

9 years ago2.45.2 2.45.2
Matthias Clasen [Tue, 26 May 2015 03:29:41 +0000 (23:29 -0400)]
2.45.2

9 years agoGOptionContext: Improve help in simple cases
Matthias Clasen [Mon, 25 May 2015 17:26:48 +0000 (13:26 -0400)]
GOptionContext: Improve help in simple cases

Only add [OPTION...] to the usage line if the context
has options. And shorten "Application Options" to just
"Options" if we don't have to differentiate from other
kinds of options.

9 years agoDo not use a string literal when a format string is expected
Emmanuele Bassi [Mon, 25 May 2015 13:04:06 +0000 (14:04 +0100)]
Do not use a string literal when a format string is expected

Otherwise we'll get compiler errors.

Based on a patch by: Vincent Le Garrec <legarrec.vincent@gmail.com>

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

9 years agodocs: Add an example of G_DEFINE_BOXED_TYPE
Emmanuele Bassi [Mon, 20 Apr 2015 13:11:12 +0000 (14:11 +0100)]
docs: Add an example of G_DEFINE_BOXED_TYPE

Mention that the GType of the boxed type is stored inside the
g_define_type_id variable.

See bug: https://bugzilla.gnome.org/show_bug.cgi?id=723394

9 years agoUpdated Thai translation
Akom Chotiphantawanon [Sun, 24 May 2015 10:42:33 +0000 (17:42 +0700)]
Updated Thai translation

9 years agoUpdated Slovak translation
Dušan Kazik [Sat, 23 May 2015 20:36:38 +0000 (20:36 +0000)]
Updated Slovak translation

9 years agoAdd introspection annotations to GListStore
David Shea [Wed, 8 Apr 2015 17:14:22 +0000 (13:14 -0400)]
Add introspection annotations to GListStore

GListStore requires that item-type be derived from GObject, so specify
that the type of the item parameters is GObject so the functions can be
used via gobject-introspection.

Add a scope parameter for the callback used during insert_sorted.

9 years agoglib-compile-schemas: Improve an error message
Matthias Clasen [Sat, 16 May 2015 02:53:41 +0000 (22:53 -0400)]
glib-compile-schemas: Improve an error message

Mention the expected type when failing to parse a GVariant.

9 years agoglib-compile-schemas: Show error positions
Matthias Clasen [Sat, 16 May 2015 02:41:29 +0000 (22:41 -0400)]
glib-compile-schemas: Show error positions

GMarkup provides this information, pass it on.

9 years agoFixes to Catalan translation
Jordi Mas [Fri, 15 May 2015 20:14:44 +0000 (22:14 +0200)]
Fixes to Catalan translation

9 years agoUpdated French translation
Alexandre Franke [Fri, 15 May 2015 08:46:51 +0000 (08:46 +0000)]
Updated French translation

9 years agoregex test: do not assert that system PCRE still has an 8.31 bug
Simon McVittie [Tue, 28 Apr 2015 09:10:58 +0000 (10:10 +0100)]
regex test: do not assert that system PCRE still has an 8.31 bug

This was fixed in 8.32, so if we have that version, assert that it is
fixed; if we don't (e.g. the current internal pcre), still don't
assert that it *isn't* fixed.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
Reviewed-by: Christian Persch <chpe@gnome.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agogdbus tests: wait up to 60s for gdbus-testserver to take its bus name
Iain Lane [Mon, 31 Mar 2014 10:06:05 +0000 (11:06 +0100)]
gdbus tests: wait up to 60s for gdbus-testserver to take its bus name

Previously, we waited up to 0.5s, but that can fail on slow
architectures like ARM; now we wait up to 60s in 0.1s increments.

Patch originally by Simon McVittie <simon.mcvittie@collabora.co.uk>,
modified by Iain Lane to be called earlier, to catch all testcases in a
particular test.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724113
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Acked-by: Matthias Clasen <mclasen@redhat.com>
9 years agogdbus-connection: wait up to 10s to actually send a message
Simon McVittie [Tue, 11 Feb 2014 14:23:15 +0000 (14:23 +0000)]
gdbus-connection: wait up to 10s to actually send a message

We previously waited 0.25s, which should be enough even on slow machines,
but you never know; but we also now wait in 0.1s increments, so this test
should actually be faster now.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=724113
Acked-by: Matthias Clasen <mclasen@redhat.com>
9 years agoConnect to the detailed notify signal in GBinding
Garrett Regier [Thu, 14 May 2015 06:12:49 +0000 (23:12 -0700)]
Connect to the detailed notify signal in GBinding

This avoids the notify handler being called for each
and every emitted notify.

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

9 years agoFix g_binding_unbind() when the source and target are the same
Garrett Regier [Thu, 14 May 2015 05:15:27 +0000 (22:15 -0700)]
Fix g_binding_unbind() when the source and target are the same

It tried to remove a weak ref, but it is only taken if the
source and target object are different.

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

9 years agogresource: Document generated C file function naming
Philip Withnall [Thu, 14 May 2015 07:31:22 +0000 (08:31 +0100)]
gresource: Document generated C file function naming

Mention the relationship to the --c-name argument, plus the need to call
some_prefix_get_resource() to get the GResource object.

9 years agogresource: Minor capitalisation fixes in documentation
Philip Withnall [Thu, 14 May 2015 07:15:46 +0000 (08:15 +0100)]
gresource: Minor capitalisation fixes in documentation

9 years agogmessages: Tweak docs for G_LOG_DOMAIN to use AM_CPPFLAGS
Philip Withnall [Wed, 13 May 2015 14:22:57 +0000 (15:22 +0100)]
gmessages: Tweak docs for G_LOG_DOMAIN to use AM_CPPFLAGS

Instead of INCLUDES, which is deprecated in automake. Using AM_CPPFLAGS
also gives the hint that the -D argument should be a CPPFLAGS variable,
rather than CFLAGS.

9 years agogtype: Bump allowed number of children
Garrett Regier [Wed, 15 Apr 2015 03:44:38 +0000 (20:44 -0700)]
gtype: Bump allowed number of children

Restricting the number of children to be less than 4095 can
be an issue when generating types. This is also an issue for
the Lua bindings as each Lua state will create a new GType each
time the Lua code is executed.

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

9 years agotests: replace most g_print() with g_printerr()
Simon McVittie [Mon, 11 May 2015 16:03:00 +0000 (17:03 +0100)]
tests: replace most g_print() with g_printerr()

I searched all files that mention g_test_run, and replaced most
g_print() calls. This avoids interfering with TAP. Exceptions:

* gio/tests/network-monitor: a manual mode that is run by
  "./network-monitor --watch" is unaffected
* glib/gtester.c: not a test
* glib/gtestutils.c: not a test
* glib/tests/logging.c: specifically exercising g_print()
* glib/tests/markup-parse.c: a manual mode that is run by
  "./markup-parse --cdata-as-text" is unaffected
* glib/tests/testing.c: specifically exercising capture of stdout
  in subprocesses
* glib/tests/utils.c: captures a subprocess's stdout
* glib/tests/testglib.c: exercises an assertion failure in g_print()

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoGFileMonitor test: use g_test_skip() instead of g_print()
Simon McVittie [Mon, 11 May 2015 15:50:00 +0000 (16:50 +0100)]
GFileMonitor test: use g_test_skip() instead of g_print()

This stops it from interfering with structured stdout such as TAP.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agotestglib: my_hash_callback_remove_test: actually fail the test
Simon McVittie [Mon, 11 May 2015 15:38:57 +0000 (16:38 +0100)]
testglib: my_hash_callback_remove_test: actually fail the test

The test is to remove all the odd values with my_hash_callback_remove(),
then iterate over all values and verify that they are even. However,
failing this check would just print "bad!" instead of failing the test.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoGTestDBus: use g_printerr() for status message
Simon McVittie [Mon, 11 May 2015 15:34:35 +0000 (16:34 +0100)]
GTestDBus: use g_printerr() for status message

This avoids any possibility of interfering with test syntax (such as
TAP) on stdout. TAP specifically does not parse stderr.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Colin Walters <walters@verbum.org>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agogdatetime test: don't assume that time stands still
Simon McVittie [Fri, 8 May 2015 15:38:33 +0000 (16:38 +0100)]
gdatetime test: don't assume that time stands still

If we call time(NULL), then do something (however trivial), then call
g_date_time_new_now_utc(), they do not necessarily share a seconds
value. Let's say the gmtime call takes 2ms. time(NULL) could
return xx:xx:23 when the time is actually xx:xx:23.999999, resulting
in the g_date_time_new_now_utc() happening at xx:xx:24.000001. This is
unlikely, but did happen to me in a parallel build:

GLib:ERROR:.../glib/tests/gdatetime.c:674:test_GDateTime_now_utc: assertion failed (tm.tm_sec == g_date_time_get_second (dt)): (23 == 24)

A similar argument applies to the rollover from xx:23:59.999999 to
xx:24:00, so comparing seconds with a 1s "fuzz" or a >= comparison
is not sufficient; and so on into higher-order fields.

I haven't seen the other tests that use _now() fail in the same way,
but they could.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=749080
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agognetworkaddress: add return type annotation to parse methods
Evan Nemerson [Sun, 10 May 2015 06:45:03 +0000 (23:45 -0700)]
gnetworkaddress: add return type annotation to parse methods

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

9 years agoGDBus tests: change progress noise from "if not quiet" to "if verbose"
Simon McVittie [Thu, 7 May 2015 16:36:01 +0000 (17:36 +0100)]
GDBus tests: change progress noise from "if not quiet" to "if verbose"

It seems that even after Bug #711796, these can still interfere
with TAP testing:

PASS: gdbus-proxy-threads 1 /gdbus/proxy/vs-threads
tap-driver.sh: internal error getting exit status
tap-driver.sh: fatal: I/O or internal error

Let's shut them up unless --verbose is used (which would be appropriate
when running them interactively).

Similar symptoms have been seen in Debian:
https://buildd.debian.org/status/fetch.php?pkg=glib2.0&arch=mipsel&ver=2.39.91-1&stamp=1394394568
and in Guix:
https://lists.gnu.org/archive/html/bug-guix/2014-12/msg00002.html

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=725981
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agogdbus-peer test: let GDBusServer start before notifying main thread
Simon McVittie [Thu, 7 May 2015 15:45:48 +0000 (16:45 +0100)]
gdbus-peer test: let GDBusServer start before notifying main thread

When running the nonce-tcp and tcp-anonymous tests in one run
of gdbus-peer, or running one of them twice via command-line options
"-p /gdbus/tcp-anonymous -p /gdbus/tcp-anonymous", the one run second
would sometimes fail to connect with ECONNRESET.

Adding more debug messages revealed that in the successful case,
g_main_loop_run() was executed in the server thread first:

 # tcp-anonymous: server thread: listening on tcp:host=localhost,port=53517
 # tcp-anonymous: server thread: starting server...
 # tcp-anonymous: server thread: creating main loop...
 # tcp-anonymous: server thread: running main loop...
 # tcp-anonymous: main thread: trying tcp:host=localhost,port=53517...
 # tcp-anonymous: main thread: waiting for server thread...

but in the failing case, the main thread attempted to connect
before the call to g_main_loop_run() in the server thread:

 # tcp-anonymous: server thread: listening on tcp:host=localhost,port=40659
 # tcp-anonymous: server thread: starting server...
 # tcp-anonymous: server thread: creating main loop...
 # tcp-anonymous: main thread: trying tcp:host=localhost,port=40659...
 # tcp-anonymous: server thread: running main loop...

(The log message "creating main loop" was immediately before
create_service_loop(), and "running main loop" was immediately
before g_main_loop_run().)

To ensure that the GDBusServer has a chance to start accepting
connections before the main thread tries to connect to it, do not
tell the main thread about the service_loop immediately, but instead
defer it to an idle.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=749079
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
9 years agoFix a minor typo in a comment
Piotr Drąg [Sun, 10 May 2015 18:09:48 +0000 (20:09 +0200)]
Fix a minor typo in a comment

9 years agogtestutils: better diagnostics if a captured subprocess fails
Simon McVittie [Wed, 29 Apr 2015 11:28:27 +0000 (12:28 +0100)]
gtestutils: better diagnostics if a captured subprocess fails

It's unhelpful to get an error saying that stderr didn't match a
desired pattern, or matched an undesired pattern, without also
telling you what *was* on stderr. Similarly, if a test subprocess
exits 1, there's probably something useful on its stderr that
could have told you why.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=748534
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Dan Winship <danw@gnome.org>
9 years agogdbus-serialization: use check_serialization() instead of dbus-daemon
Simon McVittie [Tue, 21 Apr 2015 19:46:47 +0000 (20:46 +0100)]
gdbus-serialization: use check_serialization() instead of dbus-daemon

This test originally did not connect to the bus, which meant it was
omitted from commits like 415a8d81 that made sure none of GLib tests
rely on the presence of an existing session bus. (In particular,
Debian autobuilders don't have a session bus.)

When test_double_array() was added, environments like the Debian
autobuilders didn't catch the fact that this test relied on having a
session bus, because it is often skipped in minimal environments
due to its libdbus-1 dependency.

We don't actually need to connect to a dbus-daemon here: it's enough
to convert the message from GVariant to D-Bus serialization, and
back into an in-memory representation through libdbus. That's what
check_serialization() does, and I've verified that when I re-introduce
bug #732754 by reverting commits 627b49b and 2268628 locally, this
test still fails.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=744895
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
9 years agoglocalfilemonitor: Emit notification on rate limit change
Philip Withnall [Sun, 3 May 2015 11:17:10 +0000 (12:17 +0100)]
glocalfilemonitor: Emit notification on rate limit change

The changed variable was previously uninitialised in the path where the
rate limit was actually changed. This could result in the
GObject::notify signal not getting emitted.

Spotted by Coverity.

CID: #1296516

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

9 years agogsocketlistener: Don't double unref address
Ting-Wei Lan [Wed, 29 Apr 2015 07:17:00 +0000 (15:17 +0800)]
gsocketlistener: Don't double unref address

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

9 years agotests: Use de_DE.UTF-8 instead of de_DE
Ting-Wei Lan [Wed, 29 Apr 2015 06:55:00 +0000 (14:55 +0800)]
tests: Use de_DE.UTF-8 instead of de_DE

de_DE.UTF-8 is supported by more operating systems, including FreeBSD,
NetBSD and OpenBSD.

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

9 years ago2.45.1 2.45.1
Matthias Clasen [Thu, 30 Apr 2015 17:40:42 +0000 (13:40 -0400)]
2.45.1

9 years agoUpdates
Matthias Clasen [Thu, 30 Apr 2015 16:46:20 +0000 (12:46 -0400)]
Updates

9 years agoUpdated Hebrew translation
Yosef Or Boczko [Wed, 29 Apr 2015 11:23:50 +0000 (14:23 +0300)]
Updated Hebrew translation

9 years agogmarkup: Make append_escaped_text() slightly more robust.
Hans Petter Jansson [Tue, 28 Apr 2015 14:50:42 +0000 (16:50 +0200)]
gmarkup: Make append_escaped_text() slightly more robust.

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

9 years agoregex test: do not assert that system PCRE allows "(?P<1>)"
Simon McVittie [Sun, 20 Jul 2014 18:34:54 +0000 (19:34 +0100)]
regex test: do not assert that system PCRE allows "(?P<1>)"

Perl >= 5.18, and PCRE >= 8.34, disallow this.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
Reviewed-by: Christian Persch <chpe@gnome.org>
9 years agoregex test: improve diagnostics for some failures
Simon McVittie [Sun, 20 Jul 2014 18:33:17 +0000 (19:33 +0100)]
regex test: improve diagnostics for some failures

These fail with system PCRE 8.35, but the improved diagnostics are
generic.

Reviewed-by: Christian Persch <chpe@gnome.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325

9 years agogsignal: Mark the return value of g_signal_emitv() as (inout) (optional)
Philip Withnall [Mon, 30 Jun 2014 14:57:28 +0000 (15:57 +0100)]
gsignal: Mark the return value of g_signal_emitv() as (inout) (optional)

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

9 years agoUpdated Czech translation
Marek Černocký [Sat, 25 Apr 2015 10:41:09 +0000 (12:41 +0200)]
Updated Czech translation

9 years agoUpdated Icelandic translation
Sveinn í Felli [Fri, 24 Apr 2015 14:36:02 +0000 (14:36 +0000)]
Updated Icelandic translation

9 years agoFix the thumbnail-verification Test
Chun-wei Fan [Wed, 14 May 2014 08:02:35 +0000 (16:02 +0800)]
Fix the thumbnail-verification Test

The third parameter of the thumnail_verify() function had been updated to
const GLocalFileStat, so update the thumbnail-verification test likewise
so that the test works properly on all supported platforms.

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

9 years agoapp info: tweak default application algorithm
Ryan Lortie [Thu, 2 Apr 2015 21:17:35 +0000 (17:17 -0400)]
app info: tweak default application algorithm

Always run the full algorithm for a given mime type before considering
fallback types.

This includes considering installed applications capable of handling a
particular mimetype, even if such an app is not explicitly marked as
default, and there is a default app for a less-specific type.

Specifically, this often helps with cases of installing apps that can
handle a particular subtype of text/plain.  We want to take those apps
in preference to a generic text editor, even if that editor is listed as
the default for text/plain and there is no default listed for the more
specific type.

Because of the more holistic approach taken by the algorithm, it is now
more complicated, but it also means that we can do more work while
holding the lock.  In turn, that lets us avoid duplicating some strings,
which is nice.

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

9 years agobuild/Makefile-newvs.am: Fix %.vcxproj Rule
Chun-wei Fan [Wed, 22 Apr 2015 08:36:13 +0000 (16:36 +0800)]
build/Makefile-newvs.am: Fix %.vcxproj Rule

The if-else statement added in commit 9bc3ae9 was missing a '\' after the
'else', causing 'make dist/distcheck' to break with "unexpected
end-of-file" errors.

Fix this-didn't notice this when reviewing that patch.  My fault. :|

9 years agogdbusmessage: Fix a minor memory leak on an error path
Philip Withnall [Tue, 21 Apr 2015 22:57:17 +0000 (23:57 +0100)]
gdbusmessage: Fix a minor memory leak on an error path

If g_dbus_message_to_blob() fails at all, it will leak its mbuf. Spotted
by running the gdbus-serialization test under Valgrind — so there is a
justification for leak-free tests after all!

9 years agogvariant-parser: Clarify g_variant_parse() returns a non-floating ref
Philip Withnall [Tue, 21 Apr 2015 22:56:10 +0000 (23:56 +0100)]
gvariant-parser: Clarify g_variant_parse() returns a non-floating ref

Unlike, say, g_variant_new(), which returns a floating reference.
g_variant_parse() returns a non-floating one, so must always have
g_variant_unref() called on the result.

9 years agotests: Fix various minor memory leaks in gdbus-serialization
Philip Withnall [Tue, 21 Apr 2015 22:55:49 +0000 (23:55 +0100)]
tests: Fix various minor memory leaks in gdbus-serialization

9 years agogdbus: fix out-of-bound array access
Marc-André Lureau [Fri, 6 Mar 2015 14:22:33 +0000 (15:22 +0100)]
gdbus: fix out-of-bound array access

In path_rule_matches(), the given paths may be of 0-length. Do not
access memory before the array in those case. This is for example
triggered by:

test_match_rule (con, G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH, "/", "", FALSE);

in test_connection_signal_match_rules().

This bug was found thanks to GCC AddressSanitizer.

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

9 years agoMakefile-newvs: some .vcxproj.filters files are in builddir, some in srcdir
Simon McVittie [Mon, 20 Apr 2015 13:54:28 +0000 (14:54 +0100)]
Makefile-newvs: some .vcxproj.filters files are in builddir, some in srcdir

Without this change, out-of-tree distcheck doesn't get very far.

Similarly, allow *.vcxproj, *.props to be in either the builddir or
the srcdir.

Finally, since I'm touching these lines anyway, eliminate some
useless uses of cat: "cat x | sed 's/foo/bar/' > y" is
equivalent to "sed 's/foo/bar/' < x > y".

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=748176
Reviewed-by: Chun-wei Fan <fanchunwei@src.gnome.org>
9 years agogsocketconnection: Fix copy-pasto in documentation
Arun Raghavan [Fri, 17 Apr 2015 04:30:50 +0000 (10:00 +0530)]
gsocketconnection: Fix copy-pasto in documentation

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

9 years agoDistribute summary-xmllang-and-attrs.gschema.xml in tarballs
Simon McVittie [Mon, 20 Apr 2015 11:15:42 +0000 (12:15 +0100)]
Distribute summary-xmllang-and-attrs.gschema.xml in tarballs

This is needed for "make distcheck".

Reviewed-by: Matthias Clasen <mclasen@redhat.com>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=748177

9 years agobuild/Makfile-newvs.am: Use Pattern Rules
Chun-wei Fan [Fri, 17 Apr 2015 05:59:28 +0000 (13:59 +0800)]
build/Makfile-newvs.am: Use Pattern Rules

Make use of pattern rules when generating the Visual Studio 2012/2013
Projects from the Visual Studio 2010 projects, which will help to clean up
the file and also avoid problems when running items like 'make -jN dist'.

9 years agoW32: use 64-bit stat for localfile size calculation
Руслан Ижбулатов [Mon, 4 Aug 2014 12:39:08 +0000 (12:39 +0000)]
W32: use 64-bit stat for localfile size calculation

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

9 years agoRemove UTF-8 quotation marks
Behdad Esfahbod [Mon, 13 Apr 2015 19:30:16 +0000 (12:30 -0700)]
Remove UTF-8 quotation marks

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

9 years agogdbus: Validate the --dest argument
Matthias Clasen [Thu, 9 Apr 2015 02:07:26 +0000 (22:07 -0400)]
gdbus: Validate the --dest argument

Passing an nonsense string for the --dest argument can lead
to a segfault of gdbus. Thats not nice, so use our existing
validation function for bus names here.

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

9 years agogsettings: add test for repeated <summary> errors
Ryan Lortie [Thu, 9 Apr 2015 02:11:27 +0000 (22:11 -0400)]
gsettings: add test for repeated <summary> errors

Make sure error handling on repeated <summary> and <description> is
being done properly, not resulting in glib-compile-schemas throwing a
critical.

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

9 years agogsettings: fix schema compiler error handling
Ryan Lortie [Thu, 9 Apr 2015 02:08:13 +0000 (22:08 -0400)]
gsettings: fix schema compiler error handling

Fix a couple of issues in error handling in glib-compile-schemas.

The first problem is that, in case of repeated <summary> or
<description> tags we were still allocating a GString which was never
being freed (due to the throwing of the error resulting in immediate
termination of the parse).

The second problem is that if the repeated <summary> tag also had
attributes, we would attempt to set the GError twice.

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

9 years agogsettings: stay compatible with installed schemas
Ryan Lortie [Thu, 9 Apr 2015 01:55:58 +0000 (21:55 -0400)]
gsettings: stay compatible with installed schemas

Bug 747209 introduced an error when multiple <summary> or <description>
tags are found for a single key in a GSettings schema.  This check
should have been present from the start, but it was left out because the
schema compiler doesn't include these items in the cache file.  Even
still -- part of the schema compiler's job is validation, and it should
be enforcing proper syntax here.

Repeated <summary> and <description> tags are a semi-common problem when
intltool has been misconfigured in the build system of a package, but
it's possible to imagine mistakes being made by hand as well.

The idea is that these problems would be caught during the build of a
package and maintainers would be forced to fix their build systems.

An unintended side-effect of this change, however, is that the schema
compiler started ignoring already-installed schemas that contained these
problems, when rebuilding the cache.  This means that the installation
of _any_ application would cause the regeneration of the entire cache,
with these already-installed applications being excluded.  Without the
schema in the cache, the application would crash on next startup.

The validation check in the gsettings m4 macro passes --strict to the
compiler, which is not used when rebuilding the cache after
installation.  Pass this flag down into the parser and only throw the
error in case --strict was given.  This will result in the (desired)
build failure without also causing already-installed apps to stop
functioning.

This means that we will not get even a warning about the invalid schema
file in the already-installed case, but that's fine.  There is no sense
spamming the user with these messages when they are already quite fatal
for the developer at build time.

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

9 years agodocs: Document the --strict option of glib-compile-schemas
Matthias Clasen [Wed, 8 Apr 2015 10:38:16 +0000 (06:38 -0400)]
docs: Document the --strict option of glib-compile-schemas

Curiously, this option has managed to remain undocumented for
5 years.

9 years agoMention the glib-compile-schemas change in NEWS
Matthias Clasen [Tue, 7 Apr 2015 20:20:00 +0000 (16:20 -0400)]
Mention the glib-compile-schemas change in NEWS

9 years agodocs: Fix documentation for 95d300eac58e
Ross Lagerwall [Tue, 7 Apr 2015 17:22:58 +0000 (18:22 +0100)]
docs: Fix documentation for 95d300eac58e

9 years agogatomic: Add missing new line in API doc comment
Christophe Fergeau [Sat, 21 Feb 2015 12:34:36 +0000 (13:34 +0100)]
gatomic: Add missing new line in API doc comment

This causes an overlong line, and a spurious '*' in the generated
documentation.

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

9 years agogio/gdbusproxy.c: Include gasyncresult.h
Chun-wei Fan [Tue, 7 Apr 2015 07:02:22 +0000 (15:02 +0800)]
gio/gdbusproxy.c: Include gasyncresult.h

Commit f10b655 removed the inclusion of gasyncresult.h from gdbusproxy.c,
but gdbusproxy.c uses g_async_result_get_source_object(), which caused a
build warning/error.  Fix that.

9 years agogdbus: fix deadlock on message cancel/timeout
Dan Winship [Mon, 6 Apr 2015 14:09:04 +0000 (10:09 -0400)]
gdbus: fix deadlock on message cancel/timeout

The gdbus GTask port introduced a deadlock because some code had been
using g_simple_async_result_complete_in_idle() to ensure that the
callback didn't run until after a mutex was unlocked, but in the gtask
version, the callback was being run immediately. Fix it to drop the
mutex before calling g_task_return*(). Also, tweak
tests/gdbus-connection to test this.

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

9 years agotls: Add support for copying session data
Ross Lagerwall [Thu, 26 Feb 2015 22:24:36 +0000 (22:24 +0000)]
tls: Add support for copying session data

Add support for copying session data between client connections.
This is needed for implementing FTP over SSL. Most servers use a separate
session for each control connection and enforce sharing of each control
connection's session between the related data connection.

Copying session data between two connections is needed for two reasons:
1) The data connection runs on a separate port and so has a different
server_identity which means it would not normally share the session with
the control connection using the session caching currently implemented.
2) It is typical to have multiple control connections, each of which
uses a different session with the same server_identity, so only one of
these sessions gets stored in the cache. If a data connection is opened,
(ignoring the port issue) it may try and reuse the wrong control
connection's session, and fail.

This operation is conceptually the same as OpenSSL's SSL_copy_session_id
operation.

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

9 years agoMake sure GStatBuf is typedefed correctly
Руслан Ижбулатов [Mon, 21 Apr 2014 14:52:35 +0000 (14:52 +0000)]
Make sure GStatBuf is typedefed correctly

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

9 years agoAdd an event signal to GSocketListener
Paolo Borelli [Thu, 9 Oct 2014 13:54:43 +0000 (15:54 +0200)]
Add an event signal to GSocketListener

This allows the caller to know when a socket has been bound so that
it can for instance set the SO_SENDBUF and SO_RECVBUF socket options
before listen is called

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

9 years agogio: deprecate GSimpleAsyncResult
Dan Winship [Tue, 17 Apr 2012 14:38:37 +0000 (10:38 -0400)]
gio: deprecate GSimpleAsyncResult

GTask has been around for a long time now, everything in GLib is using
it, and the run-in-thread deadlock problems should be fixed now.

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

9 years agogio: (belatedly) port gdbus from GSimpleAsyncResult to GTask
Dan Winship [Thu, 2 Aug 2012 19:46:32 +0000 (15:46 -0400)]
gio: (belatedly) port gdbus from GSimpleAsyncResult to GTask

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

9 years agotests: clean up / ignore some more generated files
Dan Winship [Sat, 4 Apr 2015 14:00:39 +0000 (10:00 -0400)]
tests: clean up / ignore some more generated files

9 years agogtask: remove hardcoded GTask thread-pool size
Dan Winship [Mon, 9 Mar 2015 20:33:16 +0000 (16:33 -0400)]
gtask: remove hardcoded GTask thread-pool size

GTask used a 10-thread thread pool for g_task_run_in_thread() /
g_task_run_in_thread_sync(), but this ran into problems when task
threads blocked waiting for another g_task_run_in_thread_sync()
operation to complete. Previously there was a workaround for this, by
bumping up the thread limit when that case was detected, but deadlocks
could still happen if there were non-GTask threads involved. (Eg, task
A sends a message to thread X and waits for a response, but thread X
needs to complete task B in a thread before returning the response to
task A.)

So, allow GTask's thread pool to be expanded dynamically, by watching
it from the glib worker thread, and growing it (at an
exponentially-decreasing rate) if too much time passes without any
tasks completing. This should solve the deadlocking problems without
causing sudden breakage in apps that assume they can queue huge
numbers of tasks at once without consequences.

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

9 years agoglib-compile-schema: Don't accept duplicate docs
Matthias Clasen [Wed, 1 Apr 2015 22:55:54 +0000 (18:55 -0400)]
glib-compile-schema: Don't accept duplicate docs

This schema compiler was completely ignoring <summary> and
<description> tags. Unfortunately, there are modules out there
who merge translations for these back in, with xml:lang. And
this is giving dconf-editor a hard time. Since this is not
how translations of schemas are meant to be done, just
reject such schema files.

Also add tests exercising the new error handling.

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

9 years agoUpdated Russian translation
Stas Solovey [Mon, 30 Mar 2015 21:45:26 +0000 (21:45 +0000)]
Updated Russian translation

9 years agoMake glib-compile-resources a little smarter
alex94puchades [Wed, 25 Mar 2015 14:26:07 +0000 (15:26 +0100)]
Make glib-compile-resources a little smarter

glib-compile-resources was guessing a filename ending
in .c when generating sources, but did not do the same
for headers. Fix it so it generates a .h file when
guessing the filename for headers.

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

9 years agoClarify a confusing string
Matthias Clasen [Sun, 29 Mar 2015 15:41:00 +0000 (11:41 -0400)]
Clarify a confusing string

Relative was repeated twice here, when clearly what was meant is
relative or absolute. Pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=726447

9 years agoinotify: fix move event matching accounting
Ryan Lortie [Thu, 26 Mar 2015 18:49:26 +0000 (14:49 -0400)]
inotify: fix move event matching accounting

The hash table stores the list of unmatched IN_MOVE_FROM events, but we
were removing entries from it when popping IN_MOVE_TO events.

Fix that up to correct a crash in nautilus due to the assertion failure
below.

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

9 years agofile monitors: fix a typo
Ryan Lortie [Thu, 26 Mar 2015 03:08:38 +0000 (23:08 -0400)]
file monitors: fix a typo

Due to a typo, a rename reported via a pair of delete/create events (due
to the watcher not giving the flag for moves to be paired) was
accidentally reported as being created with the old name instead of the
new name.

Fix that.

9 years agoGListModel: roll back use of type redefinition
Ryan Lortie [Wed, 25 Mar 2015 13:29:49 +0000 (09:29 -0400)]
GListModel: roll back use of type redefinition

We declare the typedefs for GListModel and GListStore in giotypes.h, as
a matter of convention.  This is not actually required, since the
typedef is emitted as part of the G_DECLARE_* macros.

The giotypes.h approach is only used to avoid cyclic dependencies
between headers, which is not a problem in this case.

Type redefinition is a C11 feature, and although it was around in some
compilers before then, gcc 4.2.1 (from 2007) is apparently still in wide
use, being the default compiler for OpenBSD.

Eventually, we will probably hit a case where we actually need to
redefine a type, but since we're not there yet, let's back off a bit.

9 years agoUpdate Czech translation
Petr Kovar [Wed, 25 Mar 2015 12:01:47 +0000 (13:01 +0100)]
Update Czech translation

9 years agoGClosure: add valgrind hints
Ryan Lortie [Sun, 9 Nov 2014 16:22:42 +0000 (11:22 -0500)]
GClosure: add valgrind hints

GClosure has been in the "allocate area before the pointer" game since
before we did this with GTypeInstance.  At the time that this was done
for GClosure, we didn't have valgrind.h in GLib.

Now that we do, we should add similar valgrind hints as the ones we did
for GTypeInstance.  This substantially reduces reports of "possibly
lost" on pretty much any program that makes use of signals.

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

9 years agoFix the build
Matthias Clasen [Sun, 22 Mar 2015 19:05:13 +0000 (15:05 -0400)]
Fix the build

The world would be a better place if gcc had __has_feature(), too.

9 years agoAccount for clangs lack of __alloc_size__
Matthias Clasen [Sun, 22 Mar 2015 18:18:36 +0000 (14:18 -0400)]
Account for clangs lack of __alloc_size__

clang's emulation of gcc 4.3 is not perfect, despite its
pretending that it is.

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

9 years agoUpdated Turkish translation
Muhammet Kara [Sun, 22 Mar 2015 00:17:31 +0000 (00:17 +0000)]
Updated Turkish translation

9 years agogsocket: Document FD ownership with g_socket_new_from_fd()
Philip Withnall [Thu, 15 May 2014 10:44:18 +0000 (11:44 +0100)]
gsocket: Document FD ownership with g_socket_new_from_fd()

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

9 years agoUpdated Danish translation
Ask H. Larsen [Sat, 21 Mar 2015 15:24:42 +0000 (16:24 +0100)]
Updated Danish translation

9 years agoUpdated German translation
Christian Kirbach [Sat, 21 Mar 2015 15:22:09 +0000 (15:22 +0000)]
Updated German translation

9 years agoUpdated Basque language
Inaki Larranaga Murgoitio [Sat, 21 Mar 2015 15:07:05 +0000 (16:07 +0100)]
Updated Basque language

9 years agogversionmacros: add 2.46 version macros
Dan Winship [Fri, 6 Mar 2015 18:43:37 +0000 (13:43 -0500)]
gversionmacros: add 2.46 version macros

9 years agogmain: Save errno when handling unix signals
Ryan Lortie [Fri, 19 Dec 2014 22:05:59 +0000 (17:05 -0500)]
gmain: Save errno when handling unix signals

Our signal handler calls write() on a pipe or an eventfd in order to
deliver the notification.  It's unlikely, but this could fail, setting
errno.  We even check the case that it fails with EINTR.

If it does set errno, then it has potentially blown away the value or
errno that the preempted code cared about (ie: if the signal arrived
shortly after a system call but before errno was checked).

Wrap the handler with code to save errno.

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

9 years agoWin32: Port Directory Monitoring to New GLocalFileMonitor
Chun-wei Fan [Thu, 12 Mar 2015 11:20:30 +0000 (19:20 +0800)]
Win32: Port Directory Monitoring to New GLocalFileMonitor

This WIP patch moves the Windows Directory Monitoring code to the new
GLocalFileMonitor mechanism, and adds file monitoring in the process.

Progress from previous patch:
-File renames are now properly supported, but G_FILE_MONITOR_EVENT_MOVED_IN
 and G_FILE_MONITOR_EVENT_MOVED_OUT needs to be investigated, as
 ReadDirectoryChangesW() seems to send FILE_ACTION_REMOVED when a file is
 moved out of a directory.
-Events are handled for both the long and short (8.3) variants of the
 filenames, and files monitored will report changes when it is changed
 via its short or long filenames.

Things to be done:
-Perhaps find out about attribute changes in files in a monitored
 directory; if a file is monitored, attribute changes are correctly
 handled.
-Investigate on G_FILE_MONITOR_EVENT_MOVED_OUT,
 G_FILE_MONITOR_EVENT_MOVED_IN, G_FILE_MONITOR_EVENT_PRE_UNMOUNT,
 G_FILE_MONITOR_EVENT_UNMOUNTED.
-Investigate on the "boredom" algoritm, and see how we can do it on
 Windows.

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

9 years agofile monitors: rewrite FAM file monitor
Ryan Lortie [Sat, 17 Jan 2015 16:11:22 +0000 (11:11 -0500)]
file monitors: rewrite FAM file monitor

Completely rewrite the FAM file monitor.  Major changes:

 - now runs in the worker thread

 - dispatches events in a threadsafe way via GFileMonitorSource

 - uses unix fd source instead of a GIOChannel

 - is now simple enough to fit into one short file

9 years agofen: remove Solaris file monitor support
Ryan Lortie [Sat, 17 Jan 2015 01:25:38 +0000 (20:25 -0500)]
fen: remove Solaris file monitor support

This code is unmaintained and we have no way to port it to the new file
monitoring API.