Commit Graph

17404 Commits

Author SHA1 Message Date
Philip Withnall
8f86d312d8 gio: Fix double-callback on cancellation with GSubprocess
See bug #786456 for a detailed analysis of the situation which can cause
this (in summary, if a g_subprocess_wait_async() call is cancelled on a
GSubprocess which is already known to be dead).

The problem was that the GCancellable callback handler was
unconditionally returning a result for the GTask for
g_subprocess_wait_async(), even if that GTask had already returned a
result and the callback was being invoked after the GTask had been
removed from the pending_waits list.

Fix that by checking whether the GTask is still in the pending_waits
list before returning a result for it.

Thanks to Will Thompson for some very useful unit tests which reproduce
this (which will be pushed in the following commit).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786456
2017-08-23 11:37:32 +01:00
Philip Withnall
a60359aee2 tests: Add temporary working directory for monitor test
Similarly to the previous commit, move the temporary directory for the
monitor test from $(cwd) to the system temporary directory.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
0f5b523fac tests: Add temporary working directory for appmonitor test
Rather than creating a temporary directory in the current directory
(typically the builddir), then never deleting it; create one in the
system /tmp directory, and clean it up properly afterwards.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
3ce00b29ec tests: Fix leak in appmonitor test
Spotted by Daniel Macks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785260
2017-08-23 11:26:57 +01:00
Philip Withnall
2586eb9921 docs: Clarify lack of threading guarantees in GArray
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786555
2017-08-22 15:58:18 +01:00
Marek Cernocky
8cac6797d7 Updated Czech translation 2017-08-22 16:47:10 +02:00
Daniel Mustieles
7fda97c326 Update Spanish translation 2017-08-22 11:35:05 +00:00
Patrick Welche
6fcdf90300 gresource: fix documentation typo 2017-08-22 08:58:56 +01:00
Patrick Welche
2237bb451d build: remove unnecessary executions of libtool from configure
https://bugzilla.gnome.org/show_bug.cgi?id=736710
2017-08-22 08:58:52 +01:00
Pawan Chitrakar
cb1db9e23e Update Nepali translation 2017-08-21 06:56:34 +00:00
Baurzhan Muftakhidinov
89a4a37a34 Update Kazakh translation 2017-08-20 16:48:00 +00:00
Matthias Clasen
fd081f38b6 2.53.6 2017-08-19 09:48:14 -04:00
Ondrej Holy
087525b62b gio-tool: Use print_file_error correctly
Use print_file_error where an error relates to that file and vice versa.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
78fa67e70c gio-tool-save: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
1cce5dda18 gfile: Use g_output_stream_write_all instead of while
Simplify the read-write copy code and use g_output_stream_write_all
instead of while and g_output_stream_write.

https://bugzilla.gnome.org/show_bug.cgi?id=786462
2017-08-18 14:46:23 +02:00
Ondrej Holy
c7f2a7e431 gio-tool-save: Prevent overwriting error
The following warning is shown, when both g_output_stream_write and
g_output_stream_close fail:
"GError set over the top of a previous GError or uninitialized memory."

Let's clear the error after use.

https://bugzilla.gnome.org/show_bug.cgi?id=786463
2017-08-18 14:46:23 +02:00
Ondrej Holy
37cddec0ee gio-tool: Unify buffer sizes
Recently, buffer size for copying has been increased in order to improve
performance:
https://bugzilla.gnome.org/show_bug.cgi?id=773823

Let's do the same for gio-tool-save and gio-tool-cat.

https://bugzilla.gnome.org/show_bug.cgi?id=786460
2017-08-18 14:46:23 +02:00
Pawan Chitrakar
72a87d8629 Update Nepali translation 2017-08-18 12:17:42 +00:00
Gábor Kelemen
51d2f4fef7 Update Hungarian translation 2017-08-18 08:31:58 +00:00
INSUN PYO
15faf0ef62 glog: fix crash on Linux without stderr stream
0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
1  0xb67c43f0 in __GI_abort () at abort.c:89
2  0xb69ee9d8 in _g_log_abort (breakpoint=2, breakpoint@entry=1) at gmessages.c:548
3  0xb69ef692 in g_logv (log_domain=0xb6a1dfc8 "GLib", log_level=-1254563840, log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0xb6a26a48 "%s: assertion '%s' failed", args=..., args@entry=...) at gmessages.c:1357
4  0xb69ef728 in g_log (log_domain=<optimized out>, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=0xb6a26a48 "%s: assertion '%s' failed") at gmessages.c:1398
5  0xb69efa5a in g_return_if_fail_warning (log_domain=<optimized out>, pretty_function=<optimized out>, expression=<optimized out>) at gmessages.c:2687
6  0xb69efe7c in g_log_writer_is_journald (output_fd=-1) at gmessages.c:2122
7  0xb69f02a2 in g_log_writer_default (log_level=G_LOG_LEVEL_CRITICAL, fields=0xbedc9d00, n_fields=4, user_data=0x0) at gmessages.c:2584
8  0xb69ef21a in g_log_structured_array (log_level=G_LOG_LEVEL_CRITICAL, fields=0xbedc9d00, n_fields=4) at gmessages.c:1933
9  0xb69ef47e in g_log_default_handler (log_domain=0xb6a1dfc8 "GLib", log_level=G_LOG_LEVEL_CRITICAL, message=<optimized out>, unused_data=<optimized out>) at gmessages.c:3036
10 0xb69ef5fc in g_logv (log_domain=0xb6a1dfc8 "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0xb6a26a48 "%s: assertion '%s' failed", args=..., args@entry=...) at gmessages.c:1336
11 0xb69ef728 in g_log (log_domain=<optimized out>, log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=0xb6a26a48 "%s: assertion '%s' failed") at gmessages.c:1398
12 0xb69efa5a in g_return_if_fail_warning (log_domain=<optimized out>, pretty_function=<optimized out>, expression=<optimized out>) at gmessages.c:2687

If stderr is not associated with an output stream, the fileno(stderr) returned is -1.
So, g_return_if_fail_warning is recursively called and the abort occurs on the second call.

Modified by Philip Withnall to include mention this in the
documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=786452
2017-08-18 09:26:12 +01:00
Chun-wei Fan
54aee1f627 Meson: Set _WIN32_WINNT to 0x0601 (Windows 7)
We want to set _WIN32_WINNT so that functions will be properly found in
the headers, to target the NT6.1+ (Windows 7+) APIs.

Also improve the checks for if_nametoindex() and if_indextoname() on
Windows as they are supported in Windows Vista+, but they have
to be checked by linking against iphlpapi.lib (or -liphlpapi).  On other
platforms, they are still checked as they were before.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 23:40:35 +08:00
Chun-wei Fan
ea6ac5f71e meson/Windows: Check whether system PCRE is a static build
Instead of hardcoding -DPCRE_STATIC into the CFLAGS of GLib, do the
following on Windows only (since PCRE_STATIC only matters on Windows):

-If there is no installed PCRE, use the included PCRE copy and
 enable -DPCRE_STATIC, as we did before.
-If there is a installed PCRE, check whether the PCRE build is a static
 or DLL build by checking the linkage against pcre_free() with
 PCRE_STATIC defined works.  If it does, enable -DPCRE_STATIC.
-On non-Windows builds, do not enable -DPCRE_STATIC

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 18:26:02 +08:00
Chun-wei Fan
72528938b7 Meson: Check for HAVE_GOOD_PRINTF
The HAVE_GOOD_PRINTF config variable determines whether we are able to
use the CRT-supplied *printf() functions directly, by determining whether
the CRT-supplied vsnprintf() and snprintf() functions support C99 well
enough.

This means, we need to build the gnulib subdir as a static lib in GLib, and use
the gnulib *printf() functions when:

-We are on Windows
-The CRT's vsnprintf() and snprintf() is not sufficiently C99-compliant.

This will fix the problem when the *printf() functions cause a CRT
abort() call on pre-2015 Visual Studio builds at least, and ensures that
the Visual Studio 2015+ builds will pass the printf tests in GLib, since
the *printf() in Visual Studio 2015/2017's CRT does not support the %n
format specifier, nor the positional parameters (which requires
different _*printf_p*() functions), as indicated by
glib/tests/test-printf.c.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:46:37 +08:00
Chun-wei Fan
79b84ba3fc meson: Install msvc_recommended_pragmas.h on Windows
Copy the msvc_recommended_pragmas.h helper header when we build for
Windows, so that people developing/using GLib on Windows can make use
of them in Visual Studio, so that unwanted compiler noise can be
filtered out and code with potentially-problematic warnings can be
attended to.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:19:43 +08:00
Chun-wei Fan
32d6a76b98 build: Use Meson's find_library() for MSVC builds as needed
Some of the dependencies' build systems for Visual Studio do not provide a
pkg-config file upon build, so we use find_library() for them when the
corresponding pkg-config files are not found during Visual Studio builds,
so that one will not need to make up pkg-config files for them, which
could be error-prone.  These .lib names match the names that are built
with the officially supported build system that is used by their
respective Visual Studio support.

For ZLib, this will make gio-2.0.pc reflect on the zlib .lib based on
what is found, or whether we use the fallback/bundled ZLib, when we
don't have a pkg-config file for ZLib on MSVC.  We still need to depend
on Meson to be updated to put the correct link argument for linking ZLib
in the pkg-config case.

https://bugzilla.gnome.org/show_bug.cgi?id=783270
2017-08-17 17:17:59 +08:00
Jordi Mas
615425d100 Update Catalan translation 2017-08-17 07:35:17 +02:00
Ernestas Kulik
00f5d2ffa2 gobject: add autoptr support for GClosure
This commit defines a g_autoptr() cleanup function for use with
GClosure.

https://bugzilla.gnome.org/show_bug.cgi?id=786360
2017-08-16 16:19:28 +03:00
Мирослав Николић
44b5036714 Updated Serbian translation 2017-08-16 07:24:45 +02:00
Robert Ancell
947fea1d16 GDateTime: Reject days outside of month limits
The previous code allowed February 30th.
2017-08-16 11:47:32 +12:00
Aurimas Černius
f6ee658974 Updated Lithuanian translation 2017-08-15 17:51:59 +03:00
Nirbheek Chauhan
4c46869081 meson: Always define _GNU_SOURCE for pthread checks
Without this, GNU-specific symbols won't be defined and the compiler
check will pass because GCC will assume that you know what you're
doing since it doesn't know what the symbol prototype is and compiler
checks aren't built with -Wall -Werror.

This will then cause a build failure because the wrong prototype will
be used.
2017-08-14 21:49:22 +05:30
Руслан Ижбулатов
788705633e W32: Support XDG_* environment variables
Try to get XDG_* environment variables and, if they are available, use their
contents to initialize various directories the same way this happens on *nix.
When these variables are not available, fall back to the W32-specific APIs for
getting directories.

https://bugzilla.gnome.org/show_bug.cgi?id=766358
2017-08-14 15:45:01 +01:00
Fran Dieguez
f9fe9ea417 Update Galician translation 2017-08-12 10:29:12 +00:00
Philip Withnall
fac7f2be2e gsequence: Add introspection annotations to Return values
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=786060
2017-08-10 16:38:41 +01:00
Emmanuele Bassi
50eeb24415 meson: Update the pthread feature checks
For GNU extensions, we need to define _GNU_SOURCE; but, more
importantly, we need to tell Meson to use the threadlib dependency when
compiling and linking the feature check.

This currently exposes a bug in Meson; see:

https://github.com/mesonbuild/meson/issues/2165

But once that's fixed, the check will work as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Emmanuele Bassi
1a755a63e1 meson: Define _GNU_SOURCE as a project argument
We use it pretty much everywhere in order to get feature detection, and
that's also what the AC_USE_SYSTEM_EXTENSIONS m4 macro defines in the
Autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=785955
2017-08-10 14:36:11 +01:00
Fran Dieguez
4860511d8d Update Galician translation 2017-08-10 09:29:48 +00:00
Kukuh Syafaat
189243b585 Update Indonesian translation 2017-08-08 16:01:29 +00:00
Daniel Boles
f6aa8c3988 GSList: Note that using ->next directly is OK
as for GList
2017-08-07 20:39:06 +01:00
Daniel Boles
a2ec32833e GList: Fix typo of member ->prev in documentation
It said list->previous, which is not a thing that exists.
2017-08-07 20:33:25 +01:00
Matthias Clasen
47e10489c5 2.53.5 2017-08-07 12:35:17 -04:00
Simon McVittie
7c97e3d784 gdbus: Check signature of NameAcquired, NameLost
Calling g_variant_get (parameters, "(&s)") when parameters has a
signature other than (s) is considered to be a programming error.
In practice the message bus (dbus-daemon or a reimplementation) should
always send the expected type, but be defensive.

(Modified by Philip Withnall to improve type check.)

Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:31:31 +01:00
Simon McVittie
c53b44edb2 GBusNameOwnerFlags: Add DO_NOT_QUEUE flag
PulseAudio and LibreOffice are among the services that use this flag.
Refusing to queue for a name lets you do this transaction,
but atomically, avoiding the transient state where you briefly join
the queue and then are given the name when its primary owner drops it:

    result = RequestName(name)

    if result == IN_QUEUE:
        ReleaseName(name)
        result = EXISTS

    return result

(Modified by Philip Withnall to add documentation.)

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:16:07 +01:00
Simon McVittie
92f1ba200d GBusNameOwnerFlags: Note equivalence with D-Bus Specification
The implementation passes flags through directly to the RequestName()
call, so if any new values break that equivalence, the implementation
will have to be changed.

Signed-off-by: Simon McVittie <smcv@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=784392
2017-08-07 17:10:07 +01:00
Philip Withnall
05abc6cfce gio: Fix crash in open URI portal when no callback is provided
If no callback is provided, token is never set, but it’s then passed to
g_variant_new_string(), which requires a non-NULL input.

Fix that by moving all the option handling inside the (callback != NULL)
case.

Spotted by Coverity (CID #1378714).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=785817
2017-08-07 17:08:07 +01:00
Mihai Moldovan
31ae2c5598 glib-genmarshal: wrap prototypes in G_{BEGIN,END}_DECLS.
Since --header --body has been deprecated and replaced with --body
--prototypes, the generated body is not wrapped with G_{BEGIN,END}_DECLS
any longer. Projects using C++ break due to that. Automatically wrap
prototypes individually in G_{BEGIN,END}_DECLS instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785554
2017-08-07 17:07:06 +01:00
Matej Urbančič
c4dc30e2a3 Updated Slovenian translation 2017-08-07 08:44:11 +02:00
Daniel Mustieles
ce46e13fbc Updated Spanish translation 2017-08-05 11:56:28 +02:00
Philip Withnall
1782219fb8 docs: Fix typo in GDBusInterfaceSkeleton documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-04 13:30:10 +01:00
Tim-Philipp Müller
a1fdae8afc meson: don't error out if xmllint is not found
Only needed for glib/tests and entirely optional.
2017-08-03 19:23:25 +01:00