platform/upstream/glib.git
13 years agoBug 626748 – Use async methods for writing and handle EAGAIN
David Zeuthen [Mon, 16 Aug 2010 17:43:35 +0000 (13:43 -0400)]
Bug 626748 – Use async methods for writing and handle EAGAIN

If sending a lot of data and/or the other peer is not reading it, then
socket buffers can overflow. This is communicated from the kernel by
returning EAGAIN. In GIO, it is modelled by g_output_stream_write()
and g_socket_send_message() returning G_IO_ERROR_WOULD_BLOCK.

It is also problematic that that we're using synchronous IO in the
shared GDBus IO thread. It means that one GDBusConnection can lock up
others.

It turns out that by porting from g_output_stream_write() to
g_output_stream_write_async() we fix the EAGAIN issue. For GSocket, we
still need to handle things manually (by creating a GSource) as
g_socket_send_message() is used.

We check the new behavior in Michael's producer/consumer test case (at
/gdbus/overflow in gdbus-peer.c) added in the last commit.

Also add a test case that sends and receives a 20 MiB message.

Also add a new `transport' G_DBUS_DEBUG option so it is easy to
inspect partial writes:

 $ G_DBUS_DEBUG=transport ./gdbus-connection -p /gdbus/connection/large_message
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 0 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 128000 on a GSocketOutputStream
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 128000 bytes of message with serial 4 and
        size 20971669 from offset 256000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   >>>> WROTE 43669 bytes of message with serial 4 and
        size 20971669 from offset 20928000 on a GSocketOutputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16 bytes of message with serial 3 and
        size 20971620 to offset 0 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 15984 bytes of message with serial 3 and
        size 20971620 to offset 16 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 16000 bytes of message with serial 3 and
        size 20971620 to offset 16000 from a GSocketInputStream
 [...]
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 144000 bytes of message with serial 3 and
        size 20971620 to offset 20720000 from a GSocketInputStream
 ========================================================================
 GDBus-debug:Transport:
   <<<< READ 107620 bytes of message with serial 3 and
        size 20971620 to offset 20864000 from a GSocketInputStream
 OK

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGSocket: Properly initialize msg.msg_control
David Zeuthen [Mon, 16 Aug 2010 16:30:25 +0000 (12:30 -0400)]
GSocket: Properly initialize msg.msg_control

This patch fixes this problem

   Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)
      at 0x3D5B00EA60: __sendmsg_nocancel (syscall-template.S:82)
      by 0x53F9790: g_socket_send_message (gsocket.c:2918)
      by 0x540FDD0: g_unix_connection_send_credentials (gunixconnection.c:351)
      by 0x542B93F: _g_dbus_auth_run_client (gdbusauth.c:618)
      by 0x5438001: initable_init (gdbusconnection.c:2191)
      by 0x53E09CC: g_initable_init (ginitable.c:105)
      by 0x543F6E9: g_bus_get_sync (gdbusconnection.c:6091)
      by 0x402C7E: test_connection_life_cycle (gdbus-connection.c:126)
      by 0x4C7CABB: test_case_run (gtestutils.c:1174)
      by 0x4C7CD84: g_test_run_suite_internal (gtestutils.c:1223)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
      by 0x4C7CE49: g_test_run_suite_internal (gtestutils.c:1233)
    Address 0x7fefff9fc is on thread 1's stack

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoDeclare stream base classes as abstract
Matthias Clasen [Mon, 16 Aug 2010 14:21:38 +0000 (10:21 -0400)]
Declare stream base classes as abstract

13 years agoAlways do async vs sync correctly in GSocketConnection streams
Dan Winship [Thu, 24 Jun 2010 17:09:14 +0000 (13:09 -0400)]
Always do async vs sync correctly in GSocketConnection streams

Previously if a GSocketConnection had a blocking GSocket, it would
sometimes block during asynchonous I/O, and if it had a non-blocking
socket, it would sometimes return G_IO_ERROR_WOULD_BLOCK from
synchronous I/O. This fixes the connection to not depend on the socket
state.

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

13 years agoBelatedly add g_socket_client_get/set_timeout to docs and symbols
Dan Winship [Sun, 15 Aug 2010 11:57:37 +0000 (07:57 -0400)]
Belatedly add g_socket_client_get/set_timeout to docs and symbols

13 years agoGSocketClient: plug two leaks
Dan Winship [Sat, 14 Aug 2010 20:15:39 +0000 (16:15 -0400)]
GSocketClient: plug two leaks

g_socket_client_connect_async() was always leaking its GCancellable,
and would also leak any GSocket that eventually failed to connect
after returning G_IO_ERROR_PENDING.

13 years agoGSocketClient: add a timeout property
Dan Winship [Sat, 14 Aug 2010 19:04:24 +0000 (15:04 -0400)]
GSocketClient: add a timeout property

GSocket has a timeout flag now, but when using GSocketClient there was
no way to set the timeout until after connecting (or failing). Fix
that by adding a timeout property to GSocketClient.

13 years agoAdd examples for GAsyncInitiable and GSimpleAsyncResult
Will Thompson [Sat, 14 Aug 2010 03:34:44 +0000 (23:34 -0400)]
Add examples for GAsyncInitiable and GSimpleAsyncResult

Bug 602417

13 years agoDocument that _complete() et al. ref the GSimpleAsyncResult
Will Thompson [Sat, 14 Aug 2010 03:20:06 +0000 (23:20 -0400)]
Document that _complete() et al. ref the GSimpleAsyncResult

13 years ago_simple_async_result_is_valid: allow tag to be NULL
Will Thompson [Sat, 14 Aug 2010 03:15:27 +0000 (23:15 -0400)]
_simple_async_result_is_valid: allow tag to be NULL

Because g_simple_async_report_[g]error_in_idle() don't take a source tag
parameter, code that uses them can't currently use
g_simple_async_result_is_valid() (at least, not for the error case).

Bug 602417

13 years agoGVariant: be more explicit about adopting and returning floating refs
Simon McVittie [Sat, 14 Aug 2010 02:42:24 +0000 (22:42 -0400)]
GVariant: be more explicit about adopting and returning floating refs

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

13 years agoAdd bug references to some tests
Matthias Clasen [Sat, 14 Aug 2010 01:22:45 +0000 (21:22 -0400)]
Add bug references to some tests

13 years agoDocument vendor override files
Matthias Clasen [Sat, 14 Aug 2010 01:21:43 +0000 (21:21 -0400)]
Document vendor override files

Features without documentation, tsk tsk.

13 years agoFix doc format errors
Matthias Clasen [Sat, 14 Aug 2010 01:05:05 +0000 (21:05 -0400)]
Fix doc format errors

13 years agoAdd tests for async file replace and load
Matthias Clasen [Fri, 13 Aug 2010 23:40:48 +0000 (19:40 -0400)]
Add tests for async file replace and load

13 years agoCorrect a comment
Matthias Clasen [Fri, 13 Aug 2010 21:22:28 +0000 (17:22 -0400)]
Correct a comment

13 years agoAdd an async file create/write/read/delete test
Matthias Clasen [Fri, 13 Aug 2010 21:21:22 +0000 (17:21 -0400)]
Add an async file create/write/read/delete test

13 years agoFix a typo, and some doc reformatting
Matthias Clasen [Fri, 13 Aug 2010 21:19:01 +0000 (17:19 -0400)]
Fix a typo, and some doc reformatting

13 years agoAdd some long descriptions for filter streams
Matthias Clasen [Fri, 13 Aug 2010 20:04:04 +0000 (16:04 -0400)]
Add some long descriptions for filter streams

13 years agoRun volumemonitor test with local vfs
Matthias Clasen [Fri, 13 Aug 2010 19:15:21 +0000 (15:15 -0400)]
Run volumemonitor test with local vfs

This is an attempt to stop the test from hanging on some build bots
in build.gnome.org.

13 years agoBug 626841 – Add test-case for non-socket GIOStream
David Zeuthen [Fri, 13 Aug 2010 17:58:27 +0000 (13:58 -0400)]
Bug 626841 – Add test-case for non-socket GIOStream

Also fix a couple of bugs so it actually works.

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

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoAdd test for EAGAIN overflow in gdbusconnection based on David's test.
Michael Meeks [Fri, 13 Aug 2010 16:56:19 +0000 (17:56 +0100)]
Add test for EAGAIN overflow in gdbusconnection based on David's test.

13 years agoAdd some async file tests
Matthias Clasen [Fri, 13 Aug 2010 16:04:21 +0000 (12:04 -0400)]
Add some async file tests

13 years agoCollect NEWS for 2.25.14
Matthias Clasen [Fri, 13 Aug 2010 04:47:02 +0000 (00:47 -0400)]
Collect NEWS for 2.25.14

13 years agoBump version
Matthias Clasen [Fri, 13 Aug 2010 04:30:58 +0000 (00:30 -0400)]
Bump version

13 years agoGAsyncQueue: use g_queue_init() not g_queue_new()
Havoc Pennington [Fri, 13 Aug 2010 03:57:26 +0000 (23:57 -0400)]
GAsyncQueue: use g_queue_init() not g_queue_new()

By using g_queue_init() instead of g_queue_new(), we can avoid
a separate memory allocation.

Bug 626704

13 years agoUpdated Swedish translation
Daniel Nylander [Thu, 12 Aug 2010 11:19:50 +0000 (13:19 +0200)]
Updated Swedish translation

13 years agoFix gio/win32 build after -I flag changes
Tor Lillqvist [Tue, 10 Aug 2010 13:01:39 +0000 (16:01 +0300)]
Fix gio/win32 build after -I flag changes

13 years agoUpdate Simplified Chinese translation.
Aron Xu [Mon, 9 Aug 2010 06:26:38 +0000 (14:26 +0800)]
Update Simplified Chinese translation.

13 years agoReplace the explicit list of character categories by a reference
Matthias Clasen [Mon, 9 Aug 2010 03:53:52 +0000 (23:53 -0400)]
Replace the explicit list of character categories by a reference
to the GUnicodeType docs.

13 years agoRefer to GUnicodeScript docs instead of listing scripts explicitly
Matthias Clasen [Mon, 9 Aug 2010 03:43:29 +0000 (23:43 -0400)]
Refer to GUnicodeScript docs instead of listing scripts explicitly

13 years agoMove GRegex docs inline
Matthias Clasen [Mon, 9 Aug 2010 03:21:54 +0000 (23:21 -0400)]
Move GRegex docs inline

13 years agoWhitespace cleanup
Matthias Clasen [Mon, 9 Aug 2010 02:19:10 +0000 (22:19 -0400)]
Whitespace cleanup

13 years agoRemove two redundant comments
Matthias Clasen [Mon, 9 Aug 2010 02:15:16 +0000 (22:15 -0400)]
Remove two redundant comments

13 years agoFix up a doc typo
Matthias Clasen [Mon, 9 Aug 2010 02:14:56 +0000 (22:14 -0400)]
Fix up a doc typo

13 years agoMinor cleanup
Matthias Clasen [Mon, 9 Aug 2010 02:12:40 +0000 (22:12 -0400)]
Minor cleanup

The definition is now present in pcre.h

13 years agoMove GConvert docs inline
Matthias Clasen [Mon, 9 Aug 2010 02:11:38 +0000 (22:11 -0400)]
Move GConvert docs inline

13 years agoupdate translation for master
A S Alam [Tue, 10 Aug 2010 00:54:02 +0000 (06:24 +0530)]
update translation for master

13 years agoAdd introspection annotations in gregex.c
Matthias Clasen [Mon, 9 Aug 2010 01:29:26 +0000 (21:29 -0400)]
Add introspection annotations in gregex.c

Also, make the new getters follow the style of other GRegex getters,
and take a const GRegex *.

13 years agoDon't compile some unused functions in gio/xdgmime/
Matthias Clasen [Mon, 9 Aug 2010 00:49:59 +0000 (20:49 -0400)]
Don't compile some unused functions in gio/xdgmime/

13 years agoDon't compile an unused function
Matthias Clasen [Sun, 8 Aug 2010 22:35:12 +0000 (18:35 -0400)]
Don't compile an unused function

13 years agoTrivial typo fix
Matthias Clasen [Sun, 8 Aug 2010 22:34:59 +0000 (18:34 -0400)]
Trivial typo fix

13 years agoImprove regex test coverage
Matthias Clasen [Sun, 8 Aug 2010 22:34:38 +0000 (18:34 -0400)]
Improve regex test coverage

13 years agoImprove the async result test coverage
Matthias Clasen [Sun, 8 Aug 2010 15:32:50 +0000 (11:32 -0400)]
Improve the async result test coverage

13 years agoImprove dbus address test coverage
Matthias Clasen [Sun, 8 Aug 2010 15:31:53 +0000 (11:31 -0400)]
Improve dbus address test coverage

13 years agoUpdated galician translations
Fran Diéguez [Sun, 8 Aug 2010 23:11:59 +0000 (01:11 +0200)]
Updated galician translations

13 years agoImprove regex test coverage
Matthias Clasen [Sun, 8 Aug 2010 05:09:18 +0000 (01:09 -0400)]
Improve regex test coverage

13 years agoDrop some unused code
Matthias Clasen [Sun, 8 Aug 2010 05:08:34 +0000 (01:08 -0400)]
Drop some unused code

Some functions in pcre_get.c are not used.

13 years agoSimplify gcov generation
Matthias Clasen [Sun, 8 Aug 2010 05:07:53 +0000 (01:07 -0400)]
Simplify gcov generation

lcov seems to handle .libs just fine on its own.

13 years agoBug 578295 - gtester has a race condition
Ryan Lortie [Sat, 7 Aug 2010 23:58:12 +0000 (19:58 -0400)]
Bug 578295 - gtester has a race condition

Deal with the race in GMainLoop by installing a do-nothing timeout.

13 years agoMake g_dbus_error_unregister_error work
Matthias Clasen [Sat, 7 Aug 2010 22:56:12 +0000 (18:56 -0400)]
Make g_dbus_error_unregister_error work

13 years agoAdd some more test about gdbus_error apis
Matthias Clasen [Sat, 7 Aug 2010 22:55:21 +0000 (18:55 -0400)]
Add some more test about gdbus_error apis

13 years agoMake g_simple_async_result_is_valid work without source
Matthias Clasen [Sat, 7 Aug 2010 21:08:54 +0000 (17:08 -0400)]
Make g_simple_async_result_is_valid work without source

The problem was pointed out by Xavier Claessens in bug 626208.

13 years agoMake the closure variants of name owning and watching actually work
Matthias Clasen [Sat, 7 Aug 2010 20:27:38 +0000 (16:27 -0400)]
Make the closure variants of name owning and watching actually work

The GClosure API is a bit funky (and badly documented), and requires
you to set a marshaller on the closure, and the marshaller has an
implicit 'this' argument, and the caller is reponsible for unsetting
the values after invoking the closure.

I've added some calls of the _with_closures variants to the
gdbus-names test now.

13 years agoUpdated Norwegian bokmål translation
Kjartan Maraas [Sat, 7 Aug 2010 16:43:01 +0000 (18:43 +0200)]
Updated Norwegian bokmål translation

13 years agonotifyqueue: Dedup pspecs when adding 2.25.13
Benjamin Otte [Fri, 6 Aug 2010 21:15:28 +0000 (23:15 +0200)]
notifyqueue: Dedup pspecs when adding

The previous code dedup'd when thawing and threw nasty warnings your way
if you notified too often. This can now easily be avoided.

Performance should be roughly identical, as both are O(n²).

13 years agoPrepare to release glib 2.25.13
Ryan Lortie [Fri, 6 Aug 2010 20:48:03 +0000 (16:48 -0400)]
Prepare to release glib 2.25.13

13 years agogitignore update
Ryan Lortie [Fri, 6 Aug 2010 20:42:36 +0000 (16:42 -0400)]
gitignore update

13 years agogtester: Run tests only once on 'make check'
Ryan Lortie [Fri, 6 Aug 2010 19:28:58 +0000 (15:28 -0400)]
gtester: Run tests only once on 'make check'

The gtester makefile runs 'make test' on 'make check' and also recurses
on 'make test'.  automake recurses on 'make check'.

This means that every level of recursive make that we go through results
in the tests running twice as many times.  If you type 'make check' at
the toplevel, for example, tests in gio/tests/ run 4 times.

Fix that by introducing a 'test-nonrecursive' target and using that one
from 'make check'.  'make test', 'make test-report', etc. are still
recursive.

13 years agoFix volumemonitor test case
Ryan Lortie [Fri, 6 Aug 2010 17:12:20 +0000 (13:12 -0400)]
Fix volumemonitor test case

Don't blindly g_object_unref() that which may be NULL.

13 years agogio.symbols: add g_dbus_message_[gs]et_byte_order
Ryan Lortie [Fri, 6 Aug 2010 17:11:38 +0000 (13:11 -0400)]
gio.symbols: add g_dbus_message_[gs]et_byte_order

13 years agotypo fix: Dist the data for the test cases
Ryan Lortie [Fri, 6 Aug 2010 17:11:20 +0000 (13:11 -0400)]
typo fix: Dist the data for the test cases

change 'dist_hook:' to 'dist-hook:'

13 years agoReplace -I with $(glib_INCLUDES) and friends
Ryan Lortie [Fri, 6 Aug 2010 17:09:26 +0000 (13:09 -0400)]
Replace -I with $(glib_INCLUDES) and friends

Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.

13 years agoconfigure.ac: define glib_INCLUDES and friends
Ryan Lortie [Fri, 6 Aug 2010 17:07:31 +0000 (13:07 -0400)]
configure.ac: define glib_INCLUDES and friends

These macros should be used instead of -I for things in the tree that
depend on various bits of glib.

also gobject_INCLUDES, gthread_INCLUDES, gmodule_INCLUDES, gio_INCLUDES

13 years agoClean up improper #includes
Ryan Lortie [Fri, 6 Aug 2010 17:05:18 +0000 (13:05 -0400)]
Clean up improper #includes

We have a lot of broken #including going on around the tree.  This has
gone unnoticed due to our sloppy use of -I.

13 years agoDon't dist 'glibconfig.h'
Ryan Lortie [Fri, 6 Aug 2010 14:53:07 +0000 (10:53 -0400)]
Don't dist 'glibconfig.h'

This is causing very serious problems when doing out-of-tree builds from
tarballs on architectures that are different from the architecture that
the tarball was created on.

This commit breaks the build in those cases, but I'll fix that in the
next commits.

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

13 years agoerror test case: don't double-free the source
Ryan Lortie [Fri, 6 Aug 2010 14:29:32 +0000 (10:29 -0400)]
error test case: don't double-free the source

g_propagate_prefixed_error() frees the source already, don't
g_error_free() it.

13 years agoavoid warning in gutils.h when using gcc with -Wconversion
Hannes Müller [Thu, 5 Aug 2010 21:11:03 +0000 (23:11 +0200)]
avoid warning in gutils.h when using gcc with -Wconversion

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

13 years agoUpdated Galician translations
Fran Diéguez [Thu, 5 Aug 2010 13:36:39 +0000 (15:36 +0200)]
Updated Galician translations

13 years agoUpdated French translation
Claude Paroz [Thu, 5 Aug 2010 13:17:40 +0000 (15:17 +0200)]
Updated French translation

Contributed by Gérard Baylard and Claude Paroz

13 years agoAdd $(top_builddir)/glib to includes
paul [Thu, 5 Aug 2010 13:08:34 +0000 (09:08 -0400)]
Add $(top_builddir)/glib to includes

This is required to find glibconfig.h during srcdir != builddir builds

13 years agoUpdated Spanish translation
Jorge González [Thu, 5 Aug 2010 10:11:05 +0000 (12:11 +0200)]
Updated Spanish translation

13 years agoExpand documentation about error quark naming
Philip Withnall [Mon, 2 Aug 2010 13:14:11 +0000 (14:14 +0100)]
Expand documentation about error quark naming

Closes: bgo#625827

13 years agoTest an option handling corner-case
Matthias Clasen [Thu, 5 Aug 2010 06:23:42 +0000 (02:23 -0400)]
Test an option handling corner-case

13 years agoAdd a not about arguments beginning with dashes
Matthias Clasen [Thu, 5 Aug 2010 06:01:58 +0000 (02:01 -0400)]
Add a not about arguments beginning with dashes

13 years agoUpdated Hebrew translation.
Yaron Shahrabani [Thu, 5 Aug 2010 06:14:40 +0000 (09:14 +0300)]
Updated Hebrew translation.

13 years agoBeautify configure output
Matthias Clasen [Thu, 5 Aug 2010 05:53:15 +0000 (01:53 -0400)]
Beautify configure output

Checking for cpp before using it avoids somewhat ugly
nested output. Pointed out in bug 593544.

13 years agoModernize pkg-config check
Matthias Clasen [Thu, 5 Aug 2010 05:45:26 +0000 (01:45 -0400)]
Modernize pkg-config check

As pointed out in bug 599590, our hand-rolled check fails to find
cross-complication variants of pkg-config like i686-pc-mingw32-pkg-config.

13 years agoAdd missing files
Matthias Clasen [Thu, 5 Aug 2010 05:39:02 +0000 (01:39 -0400)]
Add missing files

Reported in bug 624739

13 years agoGDBus: Add `return' debug option
David Zeuthen [Wed, 4 Aug 2010 20:59:26 +0000 (16:59 -0400)]
GDBus: Add `return' debug option

This prints all GDBusMethodInvocation API usage and is normally used
with the `incoming' option. Example:

 # G_DBUS_DEBUG=incoming,return ./polkitd --replace
 Entering main event loop
 Connected to the system bus
 Registering null backend at priority -10
 [...]
 Acquired the name org.freedesktop.PolicyKit1
 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.26
       serial 299
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD ERROR org.freedesktop.PolicyKit1.Error.Failed
       message `Cannot determine session the caller is in'
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.26
       reply-serial 299

 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2402
       serial 25
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD RETURN
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.2402
       reply-serial 25

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusMessage: Validate header fields when serializing/deserializing
David Zeuthen [Wed, 4 Aug 2010 18:38:51 +0000 (14:38 -0400)]
GDBusMessage: Validate header fields when serializing/deserializing

The D-Bus spec mentions exactly what header fields are required for
various message types. Add tests for this as well.

Also disallow empty interfaces for signals since the D-Bus spec says
this is Verboten already.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusMessage: Add a way to get/set byte order of a message
David Zeuthen [Wed, 4 Aug 2010 17:32:19 +0000 (13:32 -0400)]
GDBusMessage: Add a way to get/set byte order of a message

Also use this in the test cases to check that serialization to and
from both big and little endian works.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusMessage: Assert various things when serializing to a blob
David Zeuthen [Wed, 4 Aug 2010 16:24:22 +0000 (12:24 -0400)]
GDBusMessage: Assert various things when serializing to a blob

We use g_assert() instead of setting the GError because it is a
programming error if the GVariant contains invalid data - see commit
5e6f762d61db1a5c64bd1d33e5ba112755106581 for where the last hole in
GVariant was closed.

So if we can trust GVariant to only contain valid data (ignoring the
case where unsafe API such as g_variant_new_from_data() is used), why
g_assert() at all with costly g_utf8_validate() checks? Because a) it
is relatively inexpensive; and b) it helps find bugs such as the one
fixed in commit 5e6f762d61db1a5c64bd1d33e5ba112755106581.

If performance is a concern we can play games like introducing
environment variables or other machinery to avoid such "costly"
checks. I doubt it will ever be an issue.

Also replace two "Hmm" TODO item with a static assert - the code that
serializes a gdouble into the D-Bus wire format by treating it as a
guint64 is indeed correct - endianess needs to be taken into account
(see the D-Bus reference implementation for similar code). But we want
to make sure that we're indeed using an architecture/compiler where a
gdouble takes up 8 bytes - hence the assertion.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusMessage: Validate UTF-8 strings when serializing from blob
David Zeuthen [Wed, 4 Aug 2010 15:26:48 +0000 (11:26 -0400)]
GDBusMessage: Validate UTF-8 strings when serializing from blob

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoremove a junk line
Dan Winship [Wed, 4 Aug 2010 11:36:04 +0000 (07:36 -0400)]
remove a junk line

13 years agoUpdated Norwegian bokmål translation
Kjartan Maraas [Wed, 4 Aug 2010 11:23:02 +0000 (13:23 +0200)]
Updated Norwegian bokmål translation

13 years agobinding: Add a default marshaller for the closure API
Emmanuele Bassi [Tue, 3 Aug 2010 23:57:52 +0000 (00:57 +0100)]
binding: Add a default marshaller for the closure API

The g_object_bind_property_with_closures() function should set a
marshaller if the two GClosures don't have one already. This simplifies
the caller code and avoids duplication.

We need to add a new marshaller to the gmarshal.list matching the
signature of the GBindingTransformFunc function.

13 years agoGDBusConnection: Debug messages when receiving signals and method invocations
David Zeuthen [Tue, 3 Aug 2010 19:36:16 +0000 (15:36 -0400)]
GDBusConnection: Debug messages when receiving signals and method invocations

Spell out "RECEIVED SIGNAL" instead of "SIGNAL" to emphasize this is
about receiving a signal, not emitting one (which is "SIGNAL
EMISSION"). Also make the "arrows" point in the "right" direction
("<<<<" vs ">>>>") - like this:

 ========================================================================
 GDBus-debug:Signal:
  <<<< RECEIVED SIGNAL org.freedesktop.DBus.NameOwnerChanged
       on object /org/freedesktop/DBus
       sent by name org.freedesktop.DBus

and

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2176

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoglib-compile-schemas: Pass a C string, not a GString wrapper
David Zeuthen [Tue, 3 Aug 2010 18:32:29 +0000 (14:32 -0400)]
glib-compile-schemas: Pass a C string, not a GString wrapper

Commit 5e6f762d61db1a5c64bd1d33e5ba112755106581 (introducing UTF-8
validity checks for GVariant instances containing strsings) actually
uncovered a bug in glib-compile-schemas - a GString was passed when a
C string was expected.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGVariant: validate that passed string is UTF-8
David Zeuthen [Tue, 3 Aug 2010 17:33:03 +0000 (13:33 -0400)]
GVariant: validate that passed string is UTF-8

As discussed with Ryan on IRC.

This check is crucial because it guarantees that
g_variant_get_string() will _always_ return valid UTF-8. Except in
cases where the programmer used unsafe API such as
g_variant_new_from_data() and setting @trusted to TRUE.

In fact, this check revealed a flaw in my polkit gdbus port

 (lt-polkitd:11632): GLib-CRITICAL **: g_variant_new_string: assertion
 `g_utf8_validate (string, len, NULL)' failed

and with this I could easily find the problem by using gdb(1) and
G_DBUS=fatal-warnings.

Without this check we'd pass the non-UTF8 string all the way to the
message bus and the bus would then disconnect us. So instead I was
seeing

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

and then SIGTERM as raised by g_dbus_connection_real_closed() and my
polkitd process would exit. This behavior is much harder to debug than
failing early (as this patch implements).

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoFix gdbus-exit-on-close test case
David Zeuthen [Tue, 3 Aug 2010 16:47:07 +0000 (12:47 -0400)]
Fix gdbus-exit-on-close test case

Forgot to update the test case after last commit.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBus: If exiting b/c remote peer disconnected and error is set, print it
David Zeuthen [Tue, 3 Aug 2010 16:24:48 +0000 (12:24 -0400)]
GDBus: If exiting b/c remote peer disconnected and error is set, print it

This should make things easier to debug:

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoGDBusProxy: Don't leak a GSimpleAsyncResult when doing async calls
David Zeuthen [Tue, 3 Aug 2010 15:14:21 +0000 (11:14 -0400)]
GDBusProxy: Don't leak a GSimpleAsyncResult when doing async calls

Signed-off-by: David Zeuthen <davidz@redhat.com>
13 years agoFix a possible deadlock
Matthias Clasen [Tue, 3 Aug 2010 14:41:21 +0000 (10:41 -0400)]
Fix a possible deadlock

the FdSource was calling g_cancellable_disconnect while holding the
main context lock, which is bad news if the ::cancelled handler is
trying to get that lock to wake up the mainloop...

Bug 586432

13 years agofix the completion test
Matthias Clasen [Sun, 1 Aug 2010 06:36:27 +0000 (02:36 -0400)]
fix the completion test

13 years agoimprove completion test coverage
Matthias Clasen [Sun, 1 Aug 2010 06:11:15 +0000 (02:11 -0400)]
improve completion test coverage

13 years agoDon't assert too much
Matthias Clasen [Sun, 1 Aug 2010 06:07:50 +0000 (02:07 -0400)]
Don't assert too much

13 years agoMove bookmarkfile tests to the test framework
Matthias Clasen [Sun, 1 Aug 2010 06:07:21 +0000 (02:07 -0400)]
Move bookmarkfile tests to the test framework

13 years agoUpdate the Git ignore files
Emmanuele Bassi [Tue, 3 Aug 2010 13:21:02 +0000 (14:21 +0100)]
Update the Git ignore files

13 years agoDon't add (extra) DESTDIR to tapsetdir for tapset_DATA.
Mark Wielaard [Mon, 2 Aug 2010 21:28:50 +0000 (23:28 +0200)]
Don't add (extra) DESTDIR to tapsetdir for tapset_DATA.

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