Commit Graph

3395 Commits

Author SHA1 Message Date
Matthias Clasen
59372663f2 Don't try to find nfs mounts on Windows
This should fix the build there.
https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-02-02 00:19:15 -05:00
Stef Walter
3202978060 gdbus: Don't output invalid nested <para> docbook tags
Fix gdbus-codegen so it no longer outputs tags like
<para><para>Text</para></para>

https://bugzilla.gnome.org/show_bug.cgi?id=692865
2013-01-31 10:00:55 +01:00
Stef Walter
11e208f9d6 gdbus: Don't output invalid empty <variablelist> tags
Docbook doesn't allow an empty <variablelist> and so the docbook
output from gdbus-codegen is invalid when a method/signal has
no arguments.

https://bugzilla.gnome.org/show_bug.cgi?id=692865
2013-01-31 10:00:55 +01:00
Dan Winship
a60014f1b6 GInetSocketAddress: fix the byte order of flowinfo and scope_id
The flowinfo and scope_id fields of struct sockaddr_in6 are in host
byte order, but the code previously assumed they were in network byte
order. Fix that.

This is an ABI-breaking change (since before you would have had to use
g_ntohl() and g_htonl() with them to get the correct values, and now
that would give the wrong values), but the previous behavior was
clearly wrong, and no one ever reported it, so it is likely that no
one was actually using it.

https://bugzilla.gnome.org/show_bug.cgi?id=684404
2013-01-30 16:46:02 -05:00
Colin Walters
f398bec5bc Add g_close(), use it
There are two benefits to this:

1) We can centralize any operating system specific knowledge of
   close-vs-EINTR handling.  For example, while on Linux we should never
   retry, if someone cared enough later about HP-UX, they could come by
   and change this one spot.
2) For places that do care about the return value and want to provide
   the caller with a GError, this function makes it convenient to do so.

Note that gspawn.c had an incorrect EINTR loop-retry around close().

https://bugzilla.gnome.org/show_bug.cgi?id=682819
2013-01-29 09:46:04 -05:00
Colin Walters
166766a89f GFile: Clean up file_copy_fallback to fix SEGV with btrfs
Ok, this function was just an awful mess before.  Now the problem
domain is not trivial, and I won't claim this new code is *beautiful*,
but it should fix the bug at hand, and be somewhat less prone to
failure for the next person who tries to modify it.  There's only one
unref call for each object now.

https://bugzilla.gnome.org/show_bug.cgi?id=692408
2013-01-27 11:04:48 -05:00
Dan Winship
82f2ee90fe .gitignore updates 2013-01-26 10:09:33 -05:00
Matthias Clasen
1eb5c7cedd Plug a small memleak in gdbus-export test 2013-01-25 20:09:26 -05:00
Colin Walters
48fd507012 gfile: Ensure we create internal pipe with FD_CLOEXEC
That way the descriptors aren't leaked to child processes.

https://bugzilla.gnome.org/show_bug.cgi?id=692544
2013-01-25 13:45:07 -05:00
Akira TAGOH
7261294ec1 gcontenttype: Duplicate the string inside Mutex lock for thread-safety
https://bugzilla.gnome.org/show_bug.cgi?id=692360
2013-01-25 13:39:53 +09:00
Alexander Larsson
b0d5ce1678 Ignore fstab entries that are bind mounts
We don't show the bind mounts anyway, so it only leads to
problems when we show the fstab entries, like being unable
to mount them.

https://bugzilla.gnome.org/show_bug.cgi?id=625552
2013-01-24 10:07:03 +01:00
Dan Winship
455afd3545 build: fix a srcdir != builddir problem with gnetworking.h
gio's glib-mkenums call needs to get gnetworking.h out of $(builddir),
not $(srcdir). Fix/simplify it by using $(filter) on $^ and letting
make find everything.

Also add -Wno-portability to AM_INIT_AUTOMAKE in configure.ac, so that
it doesn't warn about this (or about the gmake-specific features we
were already using in gio/tests/)

https://bugzilla.gnome.org/show_bug.cgi?id=691866
2013-01-23 12:49:29 -05:00
Dan Winship
5932e16acd GNetworkMonitorNetlink: make the netlink socket cloexec
Use the same code GSocket does, to try SOCK_CLOEXEC first, and then
fall back to FD_CLOEXEC if it fails. (And fix that code to not call
fcntl if SOCK_CLOEXEC worked.)

https://bugzilla.gnome.org/show_bug.cgi?id=692332
2013-01-23 08:48:32 -05:00
Cosimo Cecchi
e908b50371 gfile: don't report completion twice on g_file_load_contents error
When an error occurs while reading the file input stream in
g_file_load_contents (e.g. because the operation was cancelled), the
code is correctly calling g_task_return_error(), but in the callback
from the close operation, g_task_return_boolean() will be called again.

Code that cleans up its state in the async callback will then be called
twice, leading to invalid memory access.

https://bugzilla.gnome.org/show_bug.cgi?id=692202
2013-01-21 10:36:42 -05:00
Cosimo Cecchi
40f8e15c1b inotify: fix a memleak
https://bugzilla.gnome.org/show_bug.cgi?id=692201
2013-01-21 09:51:09 -05:00
Ryan Lortie
6af8894003 fam: implement gio-nfs-{file,directory}-monitor
Declare explicit support for monitor NFS from the fam file monitoring
backend.  This will cause it to be preferred for monitoring on NFS, if
it is installed.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
6be54e9f56 localfile: add support for monitoring on NFS
Add a pair of new extension points: 'gio-nfs-file-monitor' and
'gio-nfs-directory-monitor'.

Add a check to GLocalFile when creating a file monitor.  If the
requested file is in the user's home directory and the user has an NFS
home directory then attempt to use an implementation of one of the new
extension points.  If we don't have any implementations then fall back
to the normal "local" monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
c83600e8ae file monitors: use new giomodule function
Get rid of the complicated default module detection code in
GLocalFileMonitor and GLocalDirectoryMonitor and use the new
_gio_module_get_default_type() function instead.

This change also adds the ability to override the default file monitor
via the GIO_USE_FILE_MONITOR environment variable in the same way as can
be done for GIO_USE_VFS.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
3a7b44c007 giomodule: add a new "get default" function
_gio_module_get_default() is a very convenient function for modules
implementing a singleton -- it finds the default module by priority
subject to override by a given environment variable name, instantiates
it, and caches the instance for future calls.  It also has the ability
to query instances for being 'active' using a callback.

It doesn't work very well for non-singletons (like file monitors).

Add a new function _gio_module_get_default_type() that skips the
instantiation, returning the GType instead.  As a replacement for the
'active' callback, a vtable offset can be given for a virtual function
to use to query if a particular backend is supported.

https://bugzilla.gnome.org/show_bug.cgi?id=592211
2013-01-19 14:04:49 -05:00
Ryan Lortie
52a81a7d86 Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
Ryan Lortie
346aa683de Fix visibility for glib/ and gio/ submodules
We have various sub directories in glib/ and gio/ (eg: inotify, gnulib,
pcre, xdgmime, etc.) that build convenience libraries that are then
included into libglib and libgio.  The files in these directories need
to be built with the same visibility policy as the files in the first
level directories, so add CFLAGS for them all.

This wasn't a problem when the visibility flags were set directly in
CFLAGS but then we had to deal with some modules that we built that we
explicitly wanted to export symbols from.

For now, we can keep things the way they are because it's less hacky and
although it's a theoretical hazard to forget these CFLAGS, we rarely add
new subdirectories to the build.
2013-01-18 13:23:40 -05:00
Colin Walters
6f8f1f7097 Remove most use of G_GNUC_INTERNAL
Now that we use an explicit list of symbols to export, the
G_GNUC_INTERNAL is redundant.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-18 13:03:28 -05:00
Ryan Lortie
dbf447292d Remove ABI checking scripts
Before this commit, the only difference between the expected and actual
ABI were the addition of _init and _fini symbols in each module (now
that regexp-based export control is not catching those).
2013-01-17 10:50:18 -05:00
Ryan Lortie
304950a7ac Remove regexp-based export control 2013-01-17 10:49:37 -05:00
Dan Winship
578b657f95 gio/tests: add some more async stream tests
Add read_async() and skip_async() tests to buffered-input-stream.

Fix and re-enable filter-streams's existing close_async() tests, and
add read_async(), skip_async(), and write_async() tests as well. Also,
redo the tests to use dummy GFilterInputStream and GFilterOutputStream
subclasses rather than GBufferedInput/OutputStream, so that we're
testing the base filter stream implementations of everything (since
the buffered stream overrides are already getting tested in the
buffered-input-stream and buffered-output-stream tests anyway).

Add a skip_async() test to unix-streams. (This one would crash without
the bugfix in the previous commit.)
2013-01-16 10:17:15 -05:00
Alban Browaeys
acfa6e2337 gio: callback_data is the task not the task data.
skip_callback_wrapper expect the user_data (callback_data)
to be the task holding the task_data, not the task_data
itself.
Otherwise the task_data is cast as GTask and then task_data
is extracted from this bogus task.

https://bugzilla.gnome.org/show_bug.cgi?id=691812
2013-01-16 10:12:46 -05:00
Ryan Lortie
5d42fdd068 visibility: Use a separate CFLAGS variable
We only want to control the default visibility for our five main
installable libraries: libglib, libgthread, libgmodule, libgobject,
libgio.  We should therefore only set -fvisibility=hidden when building
those.

Use a separate substitution variable for this purpose.

Using CFLAGS directly leads to some modules built in testcases not
exporting their symbols (and then the tests fail).  It also affects the
fam file monitoring module.

Colin had originally done it this way in his visibility patch series but
I failed to understand why so I didn't copy it.  Now I do.

Also: revert changes made to two testcases in an attempt to work around
this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=691756
2013-01-14 23:31:59 -05:00
Matthias Clasen
d4f0ae2c69 Fix distcheck
With gdbus-testserver now being a compiled program, it no longer
lives in SRCDIR.
2013-01-14 22:22:41 -05:00
Matthias Clasen
ba4a3849c6 Remove an unused function 2013-01-14 16:14:28 -05:00
Ryan Lortie
456d6bb3e1 win32: hide g_win32_app_info_get_type()
This was in a private header file and was never part of the public ABI.
Hide it again.

Caught by Dieter Verfaillie.
2013-01-14 11:17:52 -05:00
Ryan Lortie
b7e749fc68 glocal*monitor: export ABI only on UNIX
Add an #ifdef G_OS_UNIX around the GLIB_AVAILABLE_IN_ALL annotation on
the _get_type() functions for GLocal{File,Directory}Monitor.

These symbols are in private header files and are only exported so that
the in-tree file monitoring modules can subclass.  This is only needed
on UNIX and was therefore never part of the public ABI on Windows.

Caught by Dieter Verfaillie.
2013-01-14 11:17:01 -05:00
Ryan Lortie
2c13657b0f tests: introduce a small hack for visibility
One of our testcases builds a small giomodule for testing the loading of
modules containing resources.  Unfortunately, this module gets built
using the same CFLAGS as the rest of GLib, including the visibility
flags (defaulting to hidden).

Use "config.h" to get a declaration of _GLIB_EXTERN that will export
symbols properly and use it to annotate the necessary APIs.
2013-01-14 00:13:00 -05:00
Ryan Lortie
59e46c4928 kqueue: Reduce G_GNUC_INTERNAL + G_LOCK abuse
The kqueue file monitoring backend was misusing G_GNUC_INTERNAL for want
of 'static' in a couple of places and also using it to declare a lock
that was never used at all.

Fix those up.
2013-01-13 23:48:23 -05:00
Ryan Lortie
64e1a9ca50 gio: remove export tags from two private headers
I got a little bit too excited and added GLIB_AVAILABLE_IN_ALL tags to
some internal API.
2013-01-13 23:32:07 -05:00
Ryan Lortie
068a119f74 win32: build: stop using .def files
With visibility now under the control of __declspec(dllexport) we no
longer need to build .def files or use them for building our various
.dll files.

.def files used to be installed (even though it is only really useful
when creating the .dll or .lib file).  Don't do that anymore either.

The Makefiles still contain rules to create a .lib file for use with
Visual Studio and these rules require .def files.  There are special
requirements to using these rules (like having installed and setup
Microsoft tools for use during the build) and therefore the problem of
creating a .def file for use with them is left open to anyone willing to
make the effort.  Many options are available depending on which
toolchain is in use (dlltool, pexport, gendef, dumpbin.exe, just to name
a few).

If we can find a free tool for creating .lib files in the future, we
should probably revisit this issue and add proper support back to our
build system.
2013-01-13 22:59:40 -05:00
Ryan Lortie
38359d1796 gio: hide another leaked symbol
guint g_menu_model_items_changed_signal leaked out.  Tuck it back in.
2013-01-13 22:59:40 -05:00
Rico Tzschichholz
47c9b1e315 gio: add some missing array annotations with their element-type 2013-01-13 20:49:15 +01:00
Rico Tzschichholz
85997d9eeb gio: add missing element-type annotation 2013-01-13 20:05:17 +01:00
Ryan Lortie
ba1bdd0708 add a missing AVAILABLE_IN_2_36 annotation 2013-01-13 13:13:03 -05:00
Ryan Lortie
0156092a42 various: add GLIB_AVAILABLE_IN_ALL everywhere else
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).

If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:11:57 -05:00
Ryan Lortie
0dba77d0f4 gioenumtypes.h.template: use GLIB_AVAILABLE_IN_ALL
glib-mkenums is not currently clever enough to know which version an
enum type was added in, so just mark all the _get_type() functions as
available in all versions.

https://bugzilla.gnome.org/show_bug.cgi?id=688681
2013-01-13 13:05:15 -05:00
Henrique Dante de Almeida
c219181cb2 Add G_GNUC_PRINTF on all functions with format strings
This allows compilation with clang without errors, even when
-Wformat-nonliteral is active (as long as there are no real cases of
non literal formatting).

https://bugzilla.gnome.org/show_bug.cgi?id=691608
2013-01-13 12:32:40 -05:00
Dan Winship
1738d5f1ef GInputStream: fix default g_input_stream_skip_async() logic
g_input_stream_real_skip_async() wants to use read_async() normally,
but will use skip() in a thread instead if it sees that read_async()
will end up using threads. Except that the test for "will read_async()
use threads" never got updated to know about the GPollableInputStream
support in read_async(), so it was doing the wrong thing in that case.
Fix.

Also remove a small bit of pre-GTask cruft noticed nearby.

https://bugzilla.gnome.org/show_bug.cgi?id=691489
2013-01-13 09:55:48 -05:00
Colin Walters
8fe8dcda1e glocalfile: Only check for .hidden files if standard::is-hidden is requested
For OSTree, I use Gio and also really care about performance.  It's
disturbing to see open('.hidden') all over my straces and such.  At
the moment I have an explicit set of things to query, as opposed to
"standard::*", since even before this that also implies an lstat() of
the parent directory.

This matches up with what we do for all the other attributes.

See https://bugzilla.gnome.org/show_bug.cgi?id=587806
https://bugzilla.gnome.org/show_bug.cgi?id=691558
2013-01-11 11:14:12 -05:00
Colin Walters
a1f40adf73 gio-querymodules: Ensure we're linked to GObject
Since we're dynamically loading objects, after the g_type_init()
change, we now need to ensure people building with --as-needed don't
lose the DT_NEEDED on libgobject.

https://bugzilla.gnome.org/show_bug.cgi?id=691077
2013-01-10 22:24:00 -05:00
Will Thompson
f2a5b33270 G_IO_ERROR_INVALID_DATA: fix docstring typo 2013-01-10 11:17:01 +00:00
Antoine Jacoutot
cb1876b4a7 ipv6_v4mapped: force pass even if we don't speak IPv4
Some OS (e.g. OpenBSD) do not implement IP v4-mapped addresses. When
this is the case, then we get a "Connection refused", so force the test
to pass to that further tests can run.

https://bugzilla.gnome.org/show_bug.cgi?id=686058
2013-01-09 16:29:29 +01:00
Dan Winship
615b44c7ca glib-compile-resources: avoid warnings with -Wmissing-field-initializers
Initialize all the fields of the generated GStaticResource, to avoid
warnings in packages that build with -Wmissing-field-initializers.
2013-01-09 10:12:12 -05:00
Dan Winship
1d0687aa81 gio/tests: fix a few more gdbus-testserver.py references
that got missed in Matthias's earlier patch
2013-01-06 17:13:11 -05:00
Nirbheek Chauhan
5eba978497 GFile: Add Btrfs clone ioctl support
The attached patch adds support for the btrfs "clone" ioctl which
makes Copy-on-Write reflinks, resulting in cheap O(1) copies when
source/destination are on the same filesystem. The ioctl itself is
quite straightforward, and GNU coreutils has had support since 7.5
(--reflink=auto --sparse=auto).

The ioctl only operates on regular files and symlinks, and always
follows symlinks; checks have been added accordingly.

This patch would be very useful for everyone who uses btrfs
filesystems (Meego folks for instance). On systems that don't have
btrfs, or if the the source is not on a btrfs filesystem, the ioctl
returns EINVAL, and the fallback code is triggered. Hence this will
cause no problems for non-btrfs users.

https://bugzilla.gnome.org/show_bug.cgi?id=626497
2013-01-05 14:21:25 -05:00