Commit Graph

18119 Commits

Author SHA1 Message Date
Christoph Reiter
97c28f7fe1 ci: fix warnings and enable --werror for the mingw build
Fix various warnings regarding unused variables, duplicated
branches etc by adjusting the ifdeffery and some missing casts.

gnulib triggers -Wduplicated-branches in one of the copied files,
disable as that just makes updating the code harder.

The warning indicating missing features are made none fatal through
pragmas. They still show but don't abort the build.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:50 +02:00
Christoph Reiter
995f75cdd7 gitlab-ci: Add 32bit MinGW jobs using MSYS2
This builds glib using meson/ninja/ccache with mingw-w64 on a Windows
machine.

The CI scripts expect a gitlab runner to exist with the "win32" tag
which uses the default "cmd" shell by default.

Before running the tests pacman is invoked to update the system
(potentially including bash etc, thus the extra step)
Then a login shell is started with CHERE_INVOKING to not change the
cwd and finally the test script is executed.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:49 +02:00
Christoph Reiter
06d61434c9 meson: pass -fno-builtin when testing whether stpcpy is a builtin
In https://bugzilla.gnome.org/show_bug.cgi?id=794555 the tests for
posix_memalign and stpcpy were extended to catch the case where
the compiler provides an incomplete builtin.

Under MSYS2 the example code still compiles and links while the real usage
of stpcpy fails to build. To prevent the MSYS2 gcc from using the builtin
versions pass -fno-builtin.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:49 +02:00
Christoph Reiter
d137cebf8f meson: Disable -Wformat-nonliteral for the embedded gnulib
glib enables -Werror=format-nonliteral by default which is triggered
by the embedded gnulib (in vasnprintf.c). Disable that warning
for gnulib alone. The gnulib code is there to handle user provided
format strings, so the warning doesn't add anything anyway.

This fixes the build under MinGW.

https://bugzilla.gnome.org/show_bug.cgi?id=793729
2018-04-25 17:23:49 +02:00
Philip Withnall
384a166ed3 gdbus: Clarify types of g-properties-changed signal arguments
Make it a bit more obvious that the changed properties are provided as
an a{sv}.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-25 15:30:46 +01:00
Руслан Ижбулатов
85a32c7137 Force W32-specific POLL* constant values in meson
The winsock2-using test does work perfectly, however this is a new
thing that didn't exist in autotools-based builds of glib in the past.
Autotools builds used the generic case where values were just defined
to some agreed-upon numbers, and this is what all autotools-glib
binaries and binaries built against autotools-glib (since these
values go into public glibconfig.h header) use. At least one value,
G_POLLIN, is different, thus breaking ABI if some binaries are
built with autotools and the others are built with meson.

Force meson buildscript to use the same G_POLL* constant values
for Windows builds that autotools builds use.

https://bugzilla.gnome.org/show_bug.cgi?id=794687
2018-04-25 12:40:06 +00:00
Daniel Mustieles
9dc2da8f07 Updated Spanish translation 2018-04-25 13:09:57 +02:00
Xavier Claessens
7efd76dd67 struct ip_mreq_source definition is broken on Android NDK <= r16
This fix the build on Android r16 and older, see:
https://issuetracker.google.com/issues/36987220

https://bugzilla.gnome.org/show_bug.cgi?id=740791
2018-04-24 15:00:17 -04:00
Florian Müllner
6343555605 tests: Fix desktop-app-info test
g_desktop_app_info_load_from_keyfile() refuses to load .desktop files
where the executable doesn't exist. Therefore whether or not the .desktop
file added in commit 148995544 is actually considered during tests depends
on /usr/bin/flatpak being installed. This isn't a safe assumption to make,
so use /bin/sh to test filtering of "prefix" commands.

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 18:36:05 +02:00
Florian Müllner
1e2579da2c gdesktopappinfo: Filter out some binary names in search
The executable name can be a useful bit of information to match on in
searches where it differs from the name (for example because the latter
is localised), but will produce surprising results where the real appli-
cation is executed by a shared binary (for example interpretors like
gjs or python, or sandboxes like flatpak).

Address this by adding a blacklist of binary names that are ignored
in search.

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 13:11:00 +02:00
Florian Müllner
1489955444 tests: Use gnome-clocks from flatpak
It's the future (and provides us with a new test case) ...

https://bugzilla.gnome.org/show_bug.cgi?id=795488
2018-04-24 13:11:00 +02:00
Matej Urbančič
804b44f9ca Updated Slovenian translation 2018-04-23 21:57:51 +02:00
Martin Pieuchot
ab179184b8 Reorder operations in _kqsub_cancel() to prevent races.
Removing the event and closing the related file descriptor must be
done first to make sure the kqueue subsystem delete pending events.

The timeout must be disarmed before freeing the directory dependency
list otherwise it might populate it again.

https://bugzilla.gnome.org/show_bug.cgi?id=795193
2018-04-23 20:07:55 +01:00
Philip Withnall
1217b1bc4f codegen: List basenames of input files in generated preamble
This makes it a bit easier for debugging which files were generated from
which introspection XML.

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

https://bugzilla.gnome.org/show_bug.cgi?id=650875
2018-04-23 20:03:53 +01:00
Kentaro Hayashi
807648663d gobject: Fix redundant warning message in glib-genmarshal
glib-genmarshal shows redundant "time" warning message against combination with --header and --body option.

Before:

  WARNING: Using --header and --body at the same time time is deprecated; use --body --prototypes instead

After:

  WARNING: Using --header and --body at the same time is deprecated; use --body --prototypes instead

https://bugzilla.gnome.org/show_bug.cgi?id=795429
Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
2018-04-23 16:16:36 +01:00
Allison Lortie
ad3b2f2387 gmessages: clarify what log levels are for
For a long time we've had it as 'common knowledge' that criticals are
for programmer errors and warnings are for external errors, but we've
never documented that.  Do so.

(Modified by Philip Withnall <withnall@endlessm.com> to apply cleanly to
master; rearranged to fit in with current master documentation.)

https://bugzilla.gnome.org/show_bug.cgi?id=741049
2018-04-23 13:01:17 +01:00
Daniel Boles
042ab215b2 GObject: Clarify 8db5542803 by avoiding double -ve
Make the wording easier to understand by saying what we do, rather than
what we avoid doing if the relevant thing did not happen!
2018-04-22 15:03:03 +01:00
Руслан Ижбулатов
cf58171342 fileutils test - use UIDs only on *nix
As usual, only call getuid() or geteuid() if G_OS_UNIX is defined.
2018-04-21 20:52:57 +00:00
Stas Solovey
5c8b80c1e4 Update Russian translation
(cherry picked from commit 3975d54bca)
2018-04-20 20:48:58 +00:00
Xavier Claessens
51e5324493 Revert "gsocket: Fix build error on Android"
This was the wrong fix, the real cause is a bug in Android NDK r16:
https://issuetracker.google.com/issues/36987220

This reverts commit 994dd17ee5.
2018-04-20 16:37:35 -04:00
Xavier Claessens
994dd17ee5 gsocket: Fix build error on Android
imr_interface.s_addr is not defined in the HAVE_IP_MREQN case.

https://bugzilla.gnome.org/show_bug.cgi?id=740791
2018-04-20 16:09:43 -04:00
Xavier Claessens
30c2ea4c53 Meson: Use cc.has_type() instead of our own snippet
https://bugzilla.gnome.org/show_bug.cgi?id=740791
2018-04-20 15:47:31 -04:00
Xavier Claessens
5ccd9449fb Tests: gsubprocess: Do not use stdin/stdout variables
https://bugzilla.gnome.org/show_bug.cgi?id=795406
2018-04-20 15:33:31 -04:00
Sam Spilsbury
0e1a26dc49 garray: Steal segment during destruction
And warn in other parts of the code if the caller attempts
to change the array bounds during destruction, this is not
a valid operation.

(Tweaked by Philip Withnall <withnall@endlessm.com> to not use inline
for loop declarations, since we can’t support them in GLib at the
moment.)

https://bugzilla.gnome.org/show_bug.cgi?id=769064
2018-04-20 13:56:55 +01:00
Fabrice Fontaine
b93788ac13 gobject: fix compilation with gcc <= 4.7
On gcc 4.7, we got the following error:

i686-nptl-linux-gnu-gcc --version
> i686-nptl-linux-gnu-gcc (crosstool-NG 1.20.0) 4.7.4
> $ echo '#include <glib-object.h>' | i686-nptl-linux-gnu-gcc -x c -I
staging/usr/include/glib-2.0 -I staging/usr/lib/glib-2.0/include -Wall
-Werror -c - -o /tmp/foo.o
> In file included from
staging/usr/include/glib-2.0/gobject/gbinding.h:29:0,
>                  from staging/usr/include/glib-2.0/glib-object.h:23,
>                  from <stdin>:1:
> staging/usr/include/glib-2.0/gobject/gobject.h: In function
'g_set_object':
> staging/usr/include/glib-2.0/gobject/gobject.h:725:5: error: value
computed is not used [-Werror=unused-value]
> cc1: all warnings being treated as errors

This error has been added by commit 3fae39a5d7
So enable the new g_set_object definition only if gcc >= 4.8

Fixes:
 - http://autobuild.buildroot.net/results/b29a2f868438a2210873ea72f491db63175848be

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795138
2018-04-20 11:28:42 +01:00
Philip Withnall
29f4eacebe gdbusconnection: Fix a typo in the documentation for close_sync()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-19 16:36:16 +01:00
Xavier Claessens
cc7e0f6cc2 Meson: Define G_ENABLE_DEBUG and friends
https://bugzilla.gnome.org/show_bug.cgi?id=794790
2018-04-19 10:00:41 -04:00
Xavier Claessens
b0ae762a33 Meson: Get results from cross file properties if cannot run code
When cross compiling and not exe wrapper has been defined cc.run() raise
an exception. Avoid this by taking the value from [properties] in the
cross file and provide sensible default if the variable is not defined.

https://bugzilla.gnome.org/show_bug.cgi?id=794898
2018-04-18 19:38:09 -04:00
Xavier Claessens
3f741e087f Meson: Use cc.compute_int() instead of running our own code
When cross compiling we cannot run code, and meson has code to compute
int values without executing code.

https://bugzilla.gnome.org/show_bug.cgi?id=794898
2018-04-18 19:38:09 -04:00
Philip Withnall
d57f3e0a9b tests: Fix a minor memory leak in the GFileMonitor tests
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00
Philip Withnall
723ac89b0c tests: Add a GFileMonitor test for G_FILE_MONITOR_WATCH_HARD_LINKS
Add a test for monitoring an existing local file, with the
WATCH_HARD_LINKS flag specified. This would previously cause a crash;
now it doesn’t.

This test contains a FIXME where I suspect we should be getting some
additional file change notifications from changes made through the hard
link; this requires further follow up and probably further fixes to our
inotify backend.

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

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00
Philip Withnall
3e4e005c96 inotify: Further fixes for hard link monitoring support
This gets the G_FILE_MONITOR_WATCH_HARD_LINKS flag to the state where it
doesn’t cause crashes, and essentially acts as a no-op. It will not yet
actually monitor for changes made via hard links.

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

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00
Ryan Lortie
cc5cd5e8ea inotify: fix segfault on watching hard links
The call to _start() fills in the dirname, basename, and filename
arguments according to the following rules:

  dir watches: dirname filled

  file watches: dirname and basename filled

  hardlink: filename filled

This doesn't map to how the current inotify backend works very nicely,
so we need to adjust things a bit when creating our "sub" objects.

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:09:44 +01:00
Philip Withnall
ad50fdbd50 tests: Drop a slightly suspect GResolver test
This test will only work on machines which have IPv6 enabled and have a
local IPv6 interface with ID 1. On machines which don’t (such as AWS
servers, which we run CI tests on), the GResolver tests will fail with
G_RESOLVER_ERROR_INVALID. We can’t differentiate this kind of failure
(where we’d want to skip the test) from an actual failure (where we’d
want to fail the test), so the only other option is to drop this
particular test vector. I don’t think it’s a significant loss.

This is the last fix needed to get our CI tests working reliably on
jenkins.gnome.org.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795234
2018-04-13 17:42:58 +01:00
Philip Withnall
6751424bbe tests: Skip GSocket tests if setting up a server fails
There are various reasons why setting up a server might fail; it
reliably fails on AWS with IPv6 addresses (are we binding to the right
address?). Since we’re trying to test GSocket as a client, skip tests
where that happens.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795234
2018-04-13 16:14:46 +01:00
Philip Withnall
d990f86911 tests: Add more debug output to the network-address test
Trying to diagnose why some of the resolver tests fail on AWS.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795234
2018-04-13 16:14:46 +01:00
Philip Withnall
c8cbfd551c tests: Skip some of the fileutils tests when running as root
The tests which check permissions and errors like EACCES aren’t going to
work as root, since root always has permission to do things. Skip them
if running as root.

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

https://bugzilla.gnome.org/show_bug.cgi?id=766390
2018-04-13 15:33:33 +01:00
Philip Withnall
33749d837c gdate: Comment that g_date_valid_dmy() does all necessary bounds checks
Make it more obvious that an explicit check isn’t needed for the upper
bound on years, since it’s limited by the type width.

Add a unit test to demonstrate this.

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

https://bugzilla.gnome.org/show_bug.cgi?id=540013
2018-04-13 15:31:47 +01:00
Philip Withnall
f9ff79704c gdate: Make integer comparisons explicit
GDate.dmy is a 1-bit bitfield which is treated as a boolean. However,
it’s still an integer, and we can’t really treat it like a gboolean
because it’s a bitfield. Make the comparisons with it explicitly compare
integers, rather than implicitly, to make it more obvious that it is
actually an integer.

This introduces no functional changes.

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

https://bugzilla.gnome.org/show_bug.cgi?id=335731
2018-04-13 15:28:06 +01:00
Philip Withnall
38080bad05 gdate: Add overflow precondition checks for g_date_[add|subtract]_*()
These turn undefined or hard-to-detect misbehaviour into a well-defined
critical warning and early return.

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

https://bugzilla.gnome.org/show_bug.cgi?id=335731
2018-04-13 15:26:51 +01:00
Philip Withnall
cf24867b93 gtimezone: Add g_time_zone_new_offset() convenience constructor
This includes tests.

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

https://bugzilla.gnome.org/show_bug.cgi?id=676923
2018-04-13 15:25:26 +01:00
Philip Withnall
a80117c371 gdatetime: Fix a spurious gcc warning
It’s possible to get a -Wmaybe-uninitialized warning out of this code
with some GCC versions. Rework the code to avoid needing the conditional
free.

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

https://bugzilla.gnome.org/show_bug.cgi?id=728108
2018-04-13 15:22:46 +01:00
Philip Withnall
68f6d39895 gdatetime: Fix a leak in g_date_time_new_week()
This was a small leak of a GDateTime instance from an internal helper
function, which was using it to calculate week numbers, and then forgot
to free it.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-04-12 13:25:16 +01:00
Philip Withnall
8945227743 gtimezone: Add g_time_zone_get_identifier() accessor
This is a non-trivial accessor which gets the identifier string used to
create the GTimeZone — unless the string passed to g_time_zone_new() was
invalid, in which case the identifier will be `UTC`.

Implementing this required reworking how timezone information was loaded
so that the tz->name is always set at the same time as tz->t_info, so
they are in sync. Previously, the tz->name was unconditionally set to
whatever was passed to g_time_zone_new(), and then not updated if the
tz->t_info was eventually set to the default UTC information.

This includes tests for the new g_time_zone_get_identifier() API, and
for the g_date_time_get_timezone() API added in the previous commit.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-04-12 13:25:16 +01:00
Philip Withnall
9ddd17d304 gdatetime: Add g_date_time_get_timezone() accessor
This is a trivial method to get the GTimeZone for the GDateTime.

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

https://bugzilla.gnome.org/show_bug.cgi?id=795165
2018-04-12 13:25:16 +01:00
Stas Solovey
4e6dc6f2a7 Update Russian translation
(cherry picked from commit 78aa070a24)
2018-04-12 11:46:03 +00:00
Stas Solovey
ff1b0cadb0 Update Russian translation
(cherry picked from commit f403e16797)
2018-04-12 11:41:55 +00:00
Philip Withnall
a90c578952 tests: Lower number of iterations in network-monitor-race
While 333 runs is very likely to reproduce the bug, Milan has previously
reproduced it with as few as 9 runs. Since this test will be run by the
CI machinery quite often, a lower number of runs each CI run will still
probably catch any regressions over time.

This reduces the total test runtime from 33s to 2s.

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

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
2018-04-11 15:45:10 +01:00
Fabrice Fontaine
0beb62f564 gio: fix compilation without F_{S,G}ETPIPE_SZ
Commit a5778ef7c5 broke compilation on
architectures without F_SETPIPE_SZ and F_GETPIPE_SZ such as or1k.
If those variables are undefined, put back previous behavior, buffer
size set to 1024 * 64

Fixes:
 - http://autobuild.buildroot.net/results/398490e07343a931b25ca6ab5c90a75d7a073e9f

(Modified by Philip Withnall <withnall@endlessm.com> to add an
explanatory comment.)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=795133
2018-04-11 15:20:23 +01:00
Milan Crha
ca0add4b8a gnetworkmonitor: Fix use-after-free when using from another thread
When using g_network_monitor_get_default() from another thread, it’s
possible for network-changed events to be processed after an instance of
GNetworkMonitor has been disposed, causing use-after-free problems.

Fix that by moving some of the initialisation into the GInitable.init()
chain, rather than in a main context idle callback.

This includes a unit test which probabilistically reproduces the bug
(but can’t do so deterministically due to it being a race condition).

Commit amended by Philip Withnall <withnall@endlessm.com> before
pushing.

https://bugzilla.gnome.org/show_bug.cgi?id=793727
2018-04-11 15:03:43 +01:00