Commit Graph

16805 Commits

Author SHA1 Message Date
Bastien Nocera
5c566e435e httpproxy: Fix invalid request on invalid hostnames
When an invalid hostname is passed for connection, the
g_hostname_to_ascii() might fail when creating the request in
create_request(). Make sure that error is caught and reported rather
than passing "(null)" as the hostname of the site we want to connect to.

https://bugzilla.gnome.org/show_bug.cgi?id=772989
2017-01-03 14:35:52 +01:00
Shawn Walker
9b3cb4470d Remove stray semicolon after g_variant_print() function in gvariant.c
https://bugzilla.gnome.org/show_bug.cgi?id=776198

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-12-27 20:49:42 +01:00
Sjoerd Simons
e097619327 Assert threads are created in test 642026
We kept seeing the glib testsuite hanging on our CI system in the
testcase for 642026. After some digging it turned out the jenkins slave
was misconfigured and its task limit was too low.

Add an assertion that the test thread has been created to more easily
spot this error condition as opposed to the test simply hanging.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=769672
2016-12-27 20:43:17 +01:00
Ingo Brückl
731e7fea17 tests: Don't run tests requiring DBUS unconditionally
The tests defaultvalue, gdbus-peer and gdbus-unix-addresses will fail
without DBUS, so only run them in case we HAVE_DBUS_DAEMON.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>

https://bugzilla.gnome.org/show_bug.cgi?id=767609
2016-12-27 20:13:46 +01:00
Fran Dieguez
7ff42a4003 Updated Galician translations 2016-12-27 00:35:18 +01:00
Chun-wei Fan
c5754bdc43 build/Makefile.msvcproj: Fix cleanup
When we make Visual Studio 2013 the baseline Visual Studio version, we need to
the *.vs12.sourcefiles that are generated along the way so that 'make distcheck'
won't complain about the leftover files.  This was not caught in GLib as we do
not yet require Visual Studio 2013, but we update this here as this module is
intended to be used in projects that support Visual Studio project builds.
2016-12-20 14:36:02 +08:00
Marek Černocký
073f4dfb88 Updated Czech translation 2016-12-18 23:59:07 +01:00
Yosef Or Boczko
6c293d0af4 Updated Hebrew translation 2016-12-11 07:14:58 +02:00
Chun-wei Fan
7518067cec gmessages.c: Windows: Improve g_log_writer_supports_colors()
... when tty terminal emulators (such as mintty) are used.  This support
is however for Vista and later, so use of such terminals should have
support for ANSI color codes in their outputs, even on Windows 7/8/8.1/

https://bugzilla.gnome.org/show_bug.cgi?id=775468
2016-12-08 22:15:47 +08:00
Baurzhan Muftakhidinov
1ef807445c Update Kazakh translation 2016-12-08 10:06:39 +00:00
donadigo
ab70359bbf Fixed notify id in FDO notification backend
https://bugzilla.gnome.org/show_bug.cgi?id=775765
2016-12-07 12:39:25 -08:00
Ignacio Casal Quinteiro
4b98a79997 gioerror: make WSAESHUTDOWN an alias of G_IO_ERROR_CONNECTION_CLOSED
This fixes one of the assertions of the socket unit tests where
G_IO_ERROR_FAILED was returned instead of G_IO_ERROR_CONNECTION_CLOSED.
2016-12-07 08:47:00 +01:00
Sebastian Dröge
799f8dcd46 GSocket: Fix race conditions on Win32 if multiple threads are waiting on conditions for the same socket
WSAWaitForMultipleEvents() only returns for one of the waiting threads, and
that one might not even be the one waiting for the condition that changed. As
such, only let a single thread wait on the event and use a GCond for all other
threads.

With this it is possible to e.g. have an UDP socket that is written to from
one thread and read from in another thread on Win32 too. On POSIX systems this
was working before already.

https://bugzilla.gnome.org/show_bug.cgi?id=762283
2016-12-05 18:17:17 +02:00
Sebastian Dröge
620b3c1e56 gmessages: Fix compilation on Android
There is no systemd on Android.

https://bugzilla.gnome.org/show_bug.cgi?id=775621
2016-12-05 12:12:50 +02:00
Chun-wei Fan
7a61a94b95 gmessages.c/Windows: Improve g_log_writer_supports_color()
Windows 10 begins to support color output on the console using ANSI
codes, but a few extra steps are required for this support, so we cannot
just use isatty() and expect colors to work in the outputs.
Instead, we use still use isatty() from the Windows CRT, and then enable
ENABLE_VIRTUAL_TERMINAL_PROCESSING if it returns true.

Also make the invalid parameter handler shared between gmessages.c and
gspawn-win32-helper.c, since it is basically intended to be a no-op stub.

https://bugzilla.gnome.org/show_bug.cgi?id=775468
2016-12-05 16:47:09 +08:00
Simon McVittie
0d28ee458f type-test: do not rely on signed integer overflow wrapping around
Signed integer overflow is undefined behaviour: if a compiler
detects signed integer overflow, it is free to compile it to absolutely
anything.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:47 +00:00
Simon McVittie
4496ef91b5 g_hostname_is_ip_address: detect integer overflow
Signed integer overflow is undefined behaviour, which the undefined
behaviour sanitizer detects.

Previously, if the compiler had implemented this in the obvious way
(overflowing signed multiplication wraps around mod 2**32), we would
have incorrectly classified addresses where one octet was, for example,
(2**32 + 42) as valid IP addresses, by treating that octet as though
it was 42.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:45 +00:00
Simon McVittie
1d697a5f30 g_unichar_iswide_cjk: add a special case for U+0000
bsearch() is defined to search for a non-null key, so we can't
search for NULL. The undefined behaviour sanitizer picks this up.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:44 +00:00
Simon McVittie
663e12feca gdbus-serialization test: don't left-shift a negative number
-2LL<<34 is undefined, because left-shifting a negative number is
undefined (it was implementation-defined behaviour in C99, but
is formally undefined in C11). The undefined behaviour sanitizer
picks this up.

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:41 +00:00
Simon McVittie
e5ed410c8c Avoid calling Standard C string/array functions with NULL arguments
glibc string.h declares memcpy() with attribute(nonnull(1,2)), causing
calls with NULL arguments to be treated as undefined behaviour.
This is consistent with ISO C99 and C11, which state that passing 0
to string functions as an array length does not remove the requirement
that the pointer to the array is a valid pointer.
gcc -fsanitize=undefined catches this while running OSTree's test suite.

Similarly, running the GLib test suite reports similar issues for
qsort(), memmove(), memcmp().

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:39 +00:00
Simon McVittie
5e7eaaaaee GParam: make G_PARAM_USER_MASK unsigned
UBSan considers left-shifting a negative number to be undefined
behaviour (per
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_081.html> it is
implementation-defined in C89, but according to
<https://llvm.org/bugs/show_bug.cgi?id=17490> it is undefined in C99).

Signed-off-by: Simon McVittie <smcv@debian.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=775510
Reviewed-by: Colin Walters
2016-12-02 19:10:26 +00:00
Ondrej Holy
d1d1aba3b4 Add missing check for termios.h
Check for termios.h is missing and passwords in the new gio tool
are echoed in the terminal consequently, which is really bad!

https://bugzilla.gnome.org/show_bug.cgi?id=775517
2016-12-02 13:25:12 +01:00
Ignacio Casal Quinteiro
463a863605 gdbusauth: fix crash when server data send returns NULL
_g_dbus_auth_mechanism_server_data_send may fail in which case
we would endup getting a NULL data. In this case we should not
try to encode the data and simply let the state machine to continue.
The auth mechanism will change internally to REJECTED so we just
need to continue the iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=775309
2016-11-29 13:12:47 +01:00
Ignacio Casal Quinteiro
93179f10b8 dbusaddress: do not leak error on win32 code 2016-11-29 09:21:04 +01:00
Philip Withnall
3e7b5cbef8 glib: Namespace global tapset variables by soname
global variables in SystemTap are shared between all SystemTap scripts;
so if scripts are loaded for two versions of GLib (for example, a stable
and a development version), those global variables will conflict.

Avoid that by including the soname’s version in the global variable
names.

https://bugzilla.gnome.org/show_bug.cgi?id=770646
2016-11-23 10:50:39 +00:00
Philip Withnall
a24f57b071 glib: Add installed Valgrind suppressions file for GLib and GIO
While we cannot get Valgrind to automatically load this suppression file
for applications which link to GLib
(https://bugs.kde.org/show_bug.cgi?id=160905), we can at least install
it on systems in a shared directory, so that developers can use a
standardised (and up-to-date) suppressions file for GLib, rather than
rolling their own.

The file will typically be installed to:
   /usr/share/glib-2.0/valgrind/glib.supp

Distributors: it is recommended that this suppression file be installed
as part of the development package for GLib in your distribution.

https://bugzilla.gnome.org/show_bug.cgi?id=666114
2016-11-23 10:45:56 +00:00
Chun-wei Fan
673036d609 Visual Studio builds: Update gio-2.0.pc generation
We don't have libmount on Windows, so just make the entry for it blank.
2016-11-23 11:12:00 +08:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Christophe Fergeau
a4012abbdf gdbus: Fix leak in g_dbus_message_print()
This leak only happens when using G_DBUS_DEBUG=message or similar, but
it's nicer to be valgrind-clean even in these cases.

https://bugzilla.gnome.org/show_bug.cgi?id=736810
2016-11-22 15:01:31 -05:00
Lukasz Skalski
59a996db9b GDBusMessage: Fix segfault if DEBUG_SERIALIZER is enabled
https://bugzilla.gnome.org/show_bug.cgi?id=729730
2016-11-22 14:59:49 -05:00
Simon McVittie
be4fd3d0b0 glib-init: statically assert that int is exactly 32 bits long
The GVariant documentation says you can assume that types of no more
than 32 bits may be assumed to be promoted to int by the usual
promotions. If we're going to document that, we should statically
assert that it's true, i.e. sizeof (int) >= sizeof (int32_t).

All reasonable modern platforms are either ILP32 (32-bit platforms),
LP64 (64-bit Linux, *BSD etc.), or LLP64 (64-bit Windows): there have
been ILP64 platforms in the past, but ILP64 has the compelling
disadvantage that {signed char, short, int} can't possibly provide
all of {int8_t, int16_t, int32_t} unless int is 32 bits long.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=730932
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters
2016-11-22 18:50:02 +00:00
Simon McVittie
5227630077 glib-init: statically assert that "small" enums are all int-sized
ISO C allows compilers to make enums smaller than int if their
enumerated values would all fit in the range of a smaller type.

In practice, I suspect that in relevant compilers, all enums whose
values fit in the range INT32_MIN to INT32_MAX (inclusive) are the same
size as int. ISO C allows compiler to break that assumption, but those
that do would break code that works fine in other compilers, making the
compiler look bad, for no significant benefit. I conjecture that such
compilers are not popular.

Let's statically assert that my assumption holds. If all goes well,
GLib will continue to compile on every relevant platform; if it
fails to compile on some platform as a result of this change, then
there are probably a lot of naive uses of enums that need auditing
for this assumption.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=730932
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Allison Lortie
2016-11-22 18:48:17 +00:00
Pavel Grunt
c99fe67817 gtask: Add guards for public functions
https://bugzilla.gnome.org/show_bug.cgi?id=769745
2016-11-22 13:23:25 -05:00
Ondrej Holy
b626a4677a gunixmounts: Fix crash if path doesn't exist
g_unix_mount_for segfaults for nonexistent paths. Return NULL if path
doesn't exist.

https://bugzilla.gnome.org/show_bug.cgi?id=772160
2016-11-22 13:21:36 -05:00
Simon McVittie
1c47f62de7 gatomic: statically assert that our assumptions hold
This code assumes that int is exactly 32 bits, and that pointers
are either 4 or 8 bits, on platforms with __ATOMIC_SEQ_CST.
In practice this is going to be true.

A previous attempt at this assertion placed the G_STATIC_ASSERT
at the top level in gatomic.h, but that broke anjuta, which
redefined __unused__ at the time. These assertions are about the
platform/compiler ABI, so it's sufficient to check them once,
while compiling GLib itself; accordingly, move them to the
implementation.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=730932
2016-11-22 13:11:24 -05:00
Rahul Bedarkar
ecdd3c29fc gio-2.0.pc: include libmount in Libs.private
This helps with static linking. When application statically links with
libgio, it needs to link against libmount explicitly. When it is
mentioned in Libs.private, build system can figure out with which extra
libs to link against with help of pkg-config.

This build failure is detected by Buildroot autobuilder:
http://autobuild.buildroot.net/results/fdf/fdf26abbed0014606a7788ce5d60828a0e871186

Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
2016-11-22 13:06:36 -05:00
Debarshi Ray
00bf553a60 GDBusMethodInvocation: Clarify how the ownership is handled
https://bugzilla.gnome.org/show_bug.cgi?id=767952
2016-11-22 17:06:48 +01:00
Benjamin Otte
578b42a2f2 glib-compile-resources: Add suggested braces
... around empty body in an 'else' statement
2016-11-20 23:50:56 +01:00
Benjamin Otte
611b079e3d gvariant: Add suggested braces
... around empty body in an 'else' statement
2016-11-20 23:50:56 +01:00
Patrick Griffis
3a8ac6e221 glib-compile-resources: Escape file names in dependency file
https://bugzilla.gnome.org/show_bug.cgi?id=774368
2016-11-20 13:33:21 -05:00
Patrick Griffis
7a8cbc60a5 glib-compile-resources: Add --generate-phony-targets flag
This includes phony targets for each dependency in the the generated
dependency file which allows building with `ninja` which doesn't like
the phony targets[1] but also allows silencing `make` errors similar to
gcc's -MP option.

[1] - https://github.com/ninja-build/ninja/issues/1184

https://bugzilla.gnome.org/show_bug.cgi?id=774368
2016-11-20 13:33:21 -05:00
Petr Kulhavy
437474318f GSocket: do not process control messages if not requested by the user
If g_socket_receive_message_with_timeout() is called with messages ==
NULL set the msg_control buffer to empty to not request the control
messages from recvmsg() at all.

This completely disables the control message processing and reduces
overhead, which might be critical at high packet rate.

https://bugzilla.gnome.org/show_bug.cgi?id=774520
2016-11-20 11:09:45 -05:00
Yosef Or Boczko
4ddaa891e0 Updated Hebrew translation 2016-11-17 22:24:26 +02:00
Ross Burton
a8c6e306bd glib-gettextize: respect @datadir@ instead of assuming $prefix/share
https://bugzilla.gnome.org/show_bug.cgi?id=774421
2016-11-14 18:33:32 +00:00
Ross Burton
11a6e19e07 tests/refcount/signals: don't shadow rand()
rand() is in the C library and some C libraries (uclibc, for example) end up
with rand() defined even if stdlib.h isn't included explicitly.

https://bugzilla.gnome.org/show_bug.cgi?id=774421
2016-11-14 18:33:32 +00:00
Philip Withnall
9f4d5e8b91 gsignal: Mention handler ID type in signal connection macro docs
gtk-doc doesn’t make the return type clear, because these are macros
rather than inline functions, so people often have to guess at the
return type (or look it up from g_signal_connect_closure(), but that’s
hard work).

Make it clear that the return type for handler IDs is gulong. While
there, fix the capitalisation of ‘id’ to ‘ID’ in a few places.
2016-11-10 16:12:41 +00:00
Philip Withnall
3f12ca57c4 gtestutils: Clarify that g_assert() should not have side effects
g_assert() gets completely compiled out if G_DISABLE_ASSERT is defined,
so applications should not depend on side effects of the expression in
an assertion.
2016-11-09 16:52:21 +00:00
Mohammed Sadiq
4607bd377f gmain: fix g_main_context_check declaration
g_main_context_check is defined as a function returning gboolean.
It should be declared as such.

https://bugzilla.gnome.org/show_bug.cgi?id=774086
2016-11-09 10:38:20 -05:00
Philip Withnall
d8acf9b956 gmacros: Clarify G_GNUC_[PRINTF|SCANF] macro documentation
Clarify that the arguments parameter can be zero if the function being
annotated just accepts a string format argument, and no varargs for it
(for example, if it takes a va_list of arguments instead).

Add some links to the GCC documentation for the `format` attribute.
2016-11-09 15:11:53 +00:00
Philip Withnall
1f36189aa5 gapplication: Fix a typo in a documentation comment
It’s ‘D-Bus’, not ‘DBus’, ‘DBUS’, ‘D Bus’, ‘Dee Buss’ or ‘the bus’.
2016-11-08 21:13:45 +00:00