Commit Graph

4032 Commits

Author SHA1 Message Date
Wim Taymans
20feb23569 networkaddress: fix parsing of uri with @ after authority
Make sure that the @ sign is inside the authority part before attempting
to parse the userinfo. We do this by checking if the @ sign comes before
any of the possible authority delimiters.
Add unit test to verify parsing of ftp://ftp.gnome.org/start?foo=bar@baz

https://bugzilla.gnome.org/show_bug.cgi?id=726040
2014-04-02 11:23:29 -04:00
Olivier Crête
638993f5ac networkmonitornetlink: IN6_IS_ADDR_MC_LINKLOCAL is only guaranteed to work on struct in6_addr*
https://bugzilla.gnome.org/show_bug.cgi?id=727119
2014-03-31 12:48:04 -04:00
Dan Winship
3da5d59078 gio: move Winsock error mapping to g_io_error_from_win32_error()
Rather than having special code in gsocket.c, handle Winsock errors
along with other Win32 errors in gioerror.c

Also, reference g_win32_error_message() from the
g_io_error_from_win32_error() docs, and update the
g_win32_error_message() docs to clarify that it works with Winsock
error codes too.
2014-03-30 11:55:47 -04:00
Dan Winship
befc111c43 gio/tests/socket: Update to check the error code
Only treat IPv6 as unsupported if the attempt to create a socket
returns G_IO_ERROR_NOT_SUPPORTED: any other error is a bug.
2014-03-30 11:06:35 -04:00
Dan Winship
9fc35dbfb6 gioerror: map some more values to G_IO_ERROR_NOT_SUPPORTED
Map EPROTONOSUPPORT, ESOCKTNOSUPPORT, EPFNOSUPPORT and EAFNOSUPPORT to
G_IO_ERROR_NOT_SUPPORTED in g_io_error_from_errno(). (GSocket's
socket_io_error_from_errno() already did this with the corresponding
Winsock errors.)

Also map EOPNOTSUPP, which on Linux is the same as ENOTSUP, but may
not be on other platforms.

Also, rewrite the EAGAIN/EWOULDBLOCK section to use the simpler idiom
used by EEXIST/ENOTEMPTY and (now) ENOTSUP/EOPNOTSUPP.
2014-03-30 11:06:35 -04:00
Volker Sobek
a0b932ac8b docs: Remove escaping '\' from literals
commit 35066ed6c6 replaced entities, but
escaped the replacement text also inside literals, which resulted in the
escaping '\' to also appear in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=727320
2014-03-30 08:37:23 -04:00
Bastien Nocera
8792609e15 gio: Add names to idles and timeouts
This isn't too useful for some of the "return result in idle"
functions, but it's better than nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=726872
2014-03-27 12:53:00 +01:00
Volker Sobek
e1dee398bf GNotification: Some small documentation fixes
Use #GVariant instead of GVariant.

g_notification_add_button_with_target,
g_notification_set_default_action_and_target:
Replace 'format_string' with 'target_format'.

g_notification_set_default_action_and_target_value:
Remove paragraph that apparently had been accidentally copied from
g_notification_set_default_action_and_target.

https://bugzilla.gnome.org/show_bug.cgi?id=727123
2014-03-27 01:04:12 +01:00
Olivier Crête
0c65f7e45a GSocket: ignore timed out state when not relevant
Do this by separating the timeout check from the other socket checks.

https://bugzilla.gnome.org/show_bug.cgi?id=726375
2014-03-23 16:17:09 -04:00
Dan Winship
1e8c4d2a6e gio: fix two more g_task_return_error_if_cancelled() leaks
https://bugzilla.gnome.org/show_bug.cgi?id=726611
2014-03-23 15:00:03 -04:00
Olivier Crête
14872d2929 socketclient: Fix leak
https://bugzilla.gnome.org/show_bug.cgi?id=726611
2014-03-23 15:00:03 -04:00
Dan Winship
98aa80b262 gio/tests/socket: skip IPv6 tests on IPv6-less machines
https://bugzilla.gnome.org/show_bug.cgi?id=667468
2014-03-21 09:36:52 -04:00
Dan Winship
c67d23aa2f Clarify expectations with error codes like G_IO_ERROR_FAILED
If an error code enumeration is expected to be extended in the future,
people shouldn't compare explicitly against its generic "FAILED" value.

https://bugzilla.gnome.org/show_bug.cgi?id=726775
2014-03-20 09:31:56 -04:00
Ryan Lortie
3f119b2fd4 GSettingsBackend: fix a nasty race condition
In the event that a GSettings object is being destroyed just as a change
signal is being delivered, the destroying thread will race with the
dconf worker thread for acquiring the lock on the GSettingsBackend.

If the signalling thread gets there first then the destroying thread
will block on the lock.  The signalling thread adds a reference to the
GSettings object that is being destroyed and releases the lock.  The
idea is that this should prevent the GSettings object from being
destroyed and thus maintain its entry in the list.  Unfortunately, the
weak reference notify function is already running and as soon as we
release the lock, the list entry is removed.

The signalling thread crashes.

This bug is indicative of a serious problem encountered in many
situations where GObject instances are touched from multiple threads.
Ideally, we will move to a place where g_object_ref() is not called at
all on the GSettings object from the dconf worker thread and instead, a
dispatch will be done without holding a reference (similar to how
GAppInfoMonitor presently works).  This would also prevent the
unfortunate case of someone dropping what they assume to be the last
reference on a GSettings object, only to have an already-pending signal
delivered once they return to the mainloop, crashing their program.

Making this change for GSettings (with multiple instances per thread,
the possibility of multiple backends and each instance being interested
in different events) is going to be extremely non-trivial, so it's not a
change that makes sense at this point in the cycle.

For now, we can do a relatively small and isolated tweak so that we
never access the list except under a lock.  We still perform the bad
pattern of acquiring a ref in a foreign thread which means that we still
risk delivering a signal to a GSettings object that the user has assumed
is dead (unless they explicitly disconnect their signal handler).  This
is a problem that we already had, however.

https://bugzilla.gnome.org/show_bug.cgi?id=710367
2014-03-14 09:46:39 -04:00
Ryan Lortie
698970f1f7 gsettingsbackend: a minor simplification
Change the order of the arguments on the (internal) keys_changed callback in
GSettingsListenerVTable.

This means that all functions in the table now fit the following signature:

  void (* f) (GObject             *target,
              GSettingsBackend    *backend,
              const gchar         *name_or_path,
              gpointer             origin_tag,
              const gchar * const *names);

allowing the possibility of arguments ignored at the end.

This allows us to simplify our dispatch-to-thread code in GSettingsBackend,
making it a bit less generic.

So far, this should be a straight refactor.

https://bugzilla.gnome.org/show_bug.cgi?id=710367
2014-03-14 09:46:39 -04:00
Ryan Lortie
ffe4e94e3a GUnixVolume: implement _finish functions
The _finish functions for GUnixVolume _mount and _eject functions were
never implemented, having been simply stubbed out as 'return TRUE;'.

Implement them.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-11 21:28:58 -04:00
Ryan Lortie
62fa9c578f GUnixVolume: port to GSubprocess
Do the same as we just did for GUnixMount, for GUnixVolume too.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-11 21:28:58 -04:00
Ryan Lortie
64ec757d05 GUnixMount: port unmount to GSubprocess
The existing code is buggy and now that we have GSubprocess, we should just use
it instead, allowing for some substantial reduction in complexity.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-11 21:28:58 -04:00
Lars Uebernickel
8c78fb827b glocalfileinfo: don't special-case directory icons
As of e6af432, g_content_type_get_symbolic_icon() returns non-symbolic
fallbacks. Thus, we can't append another symbolic icon to the fallbacks.

The special case was a bit of a hack anyway. It was only applied to
themed icons and there was no generic fallback for mime types that are
not folders.

https://bugzilla.gnome.org/show_bug.cgi?id=726046
2014-03-11 11:47:57 +01:00
Ryan Lortie
66e2ffe978 gio tests: add codegen to BUILT_SOURCES
We need to have these in BUILT_SOURCES so that 'make' knows to generate them
before attempting to compile other .c files in the same directory (since some
of these files include the header).

Should fix up remaining issues about partial versions of this file being
included under parallel builds.

https://bugzilla.gnome.org/show_bug.cgi?id=725891
2014-03-07 07:47:14 -05:00
Matthias Clasen
fd8c1a3067 Work around gtk-doc problems
Returns shall never be at the beginning of a line.
2014-03-04 20:20:52 -05:00
Ryan Lortie
2b11af4f1f gsubprocess: test environment a bit more
Add a test for GSubprocess to test setting, unsetting and inheritance of
environment variables.  Use communicate() to give it a bit more of a
workout as well.

https://bugzilla.gnome.org/show_bug.cgi?id=725651
2014-03-04 09:08:24 -05:00
Ryan Lortie
e767204e0e GSubprocessLauncher: don't get empty environment
Use g_get_environ() to get the environment variables with their values
instead of g_listenv() which only lists off the keys.

https://bugzilla.gnome.org/show_bug.cgi?id=725651
2014-03-04 08:55:00 -05:00
Ryan Lortie
9da88a12c5 gsubprocess: test empty splices
Make sure we handle the case that our splice returns no data properly.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-03 21:26:24 -05:00
Ryan Lortie
9f71965bec gsubprocess: fix communicate() with empty buffers
On the splice for stdout or stderr completing, GSubprocess calls
_slice_finish() to collect the result.

We assume that a zero return value here means failure, but in fact this
function returns a gssize -- the number of bytes transferred, or -1 for
an error.

This causes GSubprocess to mistakenly think that it has an error when it
actually just has an empty buffer (as would be the case when collecting
stderr from a successful command).

Check for -1 instead of FALSE to detect the error.

https://bugzilla.gnome.org/show_bug.cgi?id=724916
2014-03-03 21:26:24 -05:00
Ryan Lortie
5d5ea495b5 desktopappinfo: add Exec to searchable keys
Add the basename from the first component of the Exec line to the list of
strings to search for via g_desktop_app_info_search().

We treat Exec as a fairly strong match -- just below the visible name.

Add a testcase to make sure everything is working OK.

https://bugzilla.gnome.org/show_bug.cgi?id=725023
2014-03-03 16:01:27 -05:00
Matthias Clasen
49cc207e35 docs: Ditch more markup
Some markup was hiding in docs in headers. Drop it there, too.
2014-03-02 18:23:43 -05:00
Matthias Clasen
e7bde4acf4 Test content type icons more thoroughly
Check we actually get the right icon names, and check
that symbolic icons fall back to non-symbolic ones.
2014-02-23 12:11:59 -05:00
John Lindgren
e6af432b39 Add non-symbolic fallback icons in g_content_type_get_symbolic_icon().
This makes the behavior consistent with e.g. g_volume_get_symbolic_icon().

https://bugzilla.gnome.org/show_bug.cgi?id=724994
2014-02-23 12:11:59 -05:00
Chun-wei Fan
4825e819b2 Fix build of gio/gapplication.c on Visual C++
Visual C++ is quite zealous about checking against the types used in the
initializing of array of structures, even up to Visual C++ 2013.  Fix this
by splitting up the initializing steps.

https://bugzilla.gnome.org/show_bug.cgi?id=724609
2014-02-23 11:48:06 +08:00
Ryan Lortie
8da795de4f gsocket: use check/prepare only on win32
There is no longer any code left in the check/prepare functions on UNIX,
so put %NULL in the GSourceFuncs vtable.

This also allows us to simplify some logic.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
e8f26efe0d gsocket: use _add_unix_fd() instead of _add_poll()
Use g_source_add_unix_fd() on UNIX instead of using a GPollFD.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
04aee2d920 gsocket: make use of g_source_set_ready_time()
Drop our own hand-rolled version of the same functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:25:42 -05:00
Ryan Lortie
1f7100506a gsocket: don't abuse GPollFD.revents field
We are reusing the GPollFD.revents field of the source to store a
temporary value.  Use a local variable for that instead.

This is a refactor to make the next commit easier to understand.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
Ryan Lortie
ff96f88e17 gsocket: use cancellable child source
Now that GCancellable's GSource is based on _set_ready_time() instead of
an fd, we should use it as a child source, instead of forcing the
creation of the fd and adding it as a poll.

https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
Ryan Lortie
d8263dd793 gsocket: trivial typo fix
https://bugzilla.gnome.org/show_bug.cgi?id=724707
2014-02-22 10:24:19 -05:00
William Jon McCann
20f4d1820b docs: use "Returns:" consistently
Instead of "Return value:".
2014-02-19 19:41:52 -05:00
Chun-wei Fan
9cb53851be gio/gresolver.c: Fix build on Windows
Windows does not come with inet_aton(), and this check on IPv4 addresses
is actually not needed on Windows as the getaddrinfo() implementation on
Windows already rejects non-standard and non-real IPv4 numbers-and-dots
addresses.

https://bugzilla.gnome.org/show_bug.cgi?id=724609
2014-02-20 08:36:54 +08:00
Ryan Lortie
c37cd19fee Work around test failure in gdbus-names
This is caused by g_test_dbus_down() returning too soon.

Add a sleep for now.

https://bugzilla.gnome.org/show_bug.cgi?id=711807
2014-02-17 18:18:20 -05:00
Ryan Lortie
53d5b17f62 GApplication: disable some more tests
Disable some racy GApplication testcases.  We need some better non-hacky
GApplication tests...

https://bugzilla.gnome.org/show_bug.cgi?id=724126
2014-02-17 17:44:58 -05:00
Dan Winship
4139b26f3e gsocket: fix g_socket_condition_timed_wait() recovery after EINTR
After getting an EINTR, g_socket_condition_timed_wait() has to adjust
its timeout, but it was trying to convert from nanoseconds to
microseconds by multiplying by 1000 rather than dividing... Oops.

https://bugzilla.gnome.org/show_bug.cgi?id=724239
2014-02-17 11:38:11 -05:00
Ross Burton
299ca6dc1e gio/tests: fix race when generating code
There is a race condition in the makefile that can result in build failures like this in parallel builds:

| ./gdbus-test-codegen-generated.h:7:0: error: unterminated #ifndef
|  #ifndef __GDBUS_TEST_CODEGEN_GENERATED_H__

This is because a rule like this:

x.c x.h: prerequisites
	@commands

doesn't consider x.c and x.h together. Instead, it expands to two rules, one to
generate x.c and one to generate x.h, which happen to run the same commands.  In
the worst case they execute in parallel, overwriting each other's output.

Signed-off-by: Ross Burton <ross.burton@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723616
2014-02-17 10:21:31 +00:00
Olivier Crête
ed017994c9 subprocess: Init and clear the mutex
Fixes the leak of the GMutexImpl allocated inside the first call to g_mutex_lock()
on an uninitialized GMutex.

https://bugzilla.gnome.org/show_bug.cgi?id=724401
2014-02-16 19:59:44 -05:00
Paolo Borelli
a732f2966d Annotate g_application_add_main_option_entries 2014-02-16 22:06:11 +01:00
Dan Winship
8902276101 g_simple_async_result_is_valid: fix for NULL source tag
If a GSimpleAsyncResult has a NULL source tag, allow it to compare
valid to a non-NULL source tag in g_simple_async_result_is_valid(), to
simplify cases where, eg, g_simple_async_result_new() and
g_simple_async_result_report_error_in_idle() are both used.

https://bugzilla.gnome.org/show_bug.cgi?id=721458
2014-02-16 09:24:04 -05:00
Koop Mast
9c135707cb Fix the build on FreeBSD by replacing EAI_NODATA with EAI_NONAME.
https://bugzilla.gnome.org/show_bug.cgi?id=724434
2014-02-15 18:35:57 -05:00
Ryan Lortie
7cbff954b9 win32: fixup lib.exe invocation
We have a configure.ac check for lib.exe that attempts to enable
creation of .lib files for our 5 public libraries.  That has been broken
for a long time for two reasons:

 1) the Makefiles hardcode 'lib' instead of 'lib.exe'

 2) we dropped generation of .def files quite some time ago (except for
    in gthread where we have the two-symbol file under version control)

Add new rules for creating .def files from dumpbin.exe (which you should
have if you have lib.exe) and fix the .lib rules to use lib.exe.

Add a bit of $(AM_V_GEN) all around, as well.

https://bugzilla.gnome.org/show_bug.cgi?id=722033
2014-02-15 16:55:25 -05:00
Dan Winship
5575a3e9cb gio: don't accept nonstandard IPv4 "numbers-and-dots" addresses
In addition to the standard "192.168.1.1" format, there are numerous
legacy IPv4 address formats (such as "192.168.257",
"0xc0.0xa8.0x01.0x01", "0300.0250.0001.0001", "3232235777", and
"0xc0a80101"). However, none of these forms are ever used any more
except in phishing attempts. GLib wasn't supposed to be accepting
these addresses (neither g_hostname_is_ip_address() nor
g_inet_address_new_from_string() recognizes them), but getaddrinfo()
accepts them, and so the parts of gio that use getaddrinfo()
accidentally did accept those formats.

Fix GNetworkAddress and GResolver to reject these address formats.

https://bugzilla.gnome.org/show_bug.cgi?id=679957
2014-02-15 10:22:24 -05:00
Dan Winship
074df39681 Fix g_socket_get_available() with TCP on Windows
Windows needs a special inefficient hack to implement
g_socket_get_available() correctly for UDP sockets, but that hack
isn't needed for TCP, and in fact, might give the wrong answer in that
case. Fix it to only use the hack with UDP.

Also, fix that case to handle non-blocking sockets as well.

And add a test case for g_socket_get_available() with TCP.

https://bugzilla.gnome.org/show_bug.cgi?id=723422
2014-02-15 10:06:04 -05:00
Matthias Clasen
bc6ee788b4 docs: let go of &ast;
Since we are no longer using sgml mode, using /&ast; &ast;/ to
escape block comments inside examples does not work anymore.
Switch to using line comments with //
2014-02-14 21:33:36 -05:00