Commit Graph

20282 Commits

Author SHA1 Message Date
Philip Withnall
973406ab58 Merge branch 'dboles/atomit' into 'master'
garcbox.c: Fix typo atomit => atomic

See merge request GNOME/glib!884
2019-06-04 19:50:41 +00:00
Philip Withnall
032d275e21 Merge branch 'wip/desrt/happier-eyeballs' into 'master'
gnetworkaddress: fix "happy eyeballs" logic

See merge request GNOME/glib!865
2019-06-04 19:45:48 +00:00
Philip Withnall
2ac3cf8222 Merge branch 'issue-737' into 'master'
Allow calling get_property() with an uninitialized GValue

Closes #737

See merge request GNOME/glib!892
2019-06-04 19:35:53 +00:00
Philip Withnall
fc59d3ee3d Merge branch 'fix-glib-win32-test' into 'master'
glib/tests/win32.c: Fix test variable types

Closes #1797

See merge request GNOME/glib!891
2019-06-04 19:26:45 +00:00
Allison Karlitskaya
efeaf8f747 network-address test: add ipv6-fail ipv4-slow case
Add a case for when the IPv6 result comes back negative and the IPv4
result is significantly delayed.  This is exactly the case that causes
the bug addressed by GNOME/glib!865
2019-06-04 20:09:26 +01:00
Allison Karlitskaya
97f8d3e1d8 gnetworkaddress: fix "happy eyeballs" logic
The "happy eyeballs" RFC states that on receiving a negative response
for an IPv6 address lookup, we should wait for the IPv4 lookup to
complete and use any results we get from there.

The current code was not doing that: it was rather setting a timeout for
failing the resolution entirely.  In scenarios where the IPv4 response
comes more than 50ms after the IPv6 response (which is easily attainable
under valgrind in certain configurations) this means that the IPv4
response will never come.

Remove the timeout and just wait.

See merge request GNOME/glib!865
2019-06-04 20:09:26 +01:00
Daniel Boles
c9b255f6c6 garcbox.c: Fix typo atomit => atomic 2019-06-04 20:08:46 +01:00
Chun-wei Fan
5e0f384f88 glib/tests/win32.c: Fix test variable types
The variable types for the PID (bp) and event (be) are accidentally
reversed in the test program.  Correct their types so that tests do not
fail on Visual Studio x64 builds.

Fixes issue #1797
2019-06-04 20:08:20 +01:00
Emmanuele Bassi
56a56f1ee5 Allow calling get_property() with an uninitialized GValue
We already have the GType with which the GValue should be initialized,
so requiring an initialized GValue is not really necessary, and it
actually complicates code that wraps GObject, by requiring the retrieval
of the GParamSpec in order to get the property type. Additionally, it
introduces a mostly unnecessary g_value_reset().

We already changed g_object_getv() to allow passing uninitialized
GValues, but this fell through the cracks.

Closes: #737
2019-06-04 20:05:24 +01:00
Philip Withnall
0bb8ada1f5 Merge branch 'freebsd-gunichar-wchart-fixes' into 'master'
gunicollate: work around FreeBSD wchar_t not matching our gunichar type

Closes #1798

See merge request GNOME/glib!893
2019-06-04 18:56:09 +00:00
Christoph Reiter
b49e767e2e gunicollate: work around FreeBSD wchar_t not matching our gunichar type
In !863 I assumed that a 4 byte wchar_t would be equal to gunichar on all platforms,
but this is not the case for FreeBSD. It previously was using the non wchar_t based API
because it doesn't define __STDC_ISO_10646__.

Add back the __STDC_ISO_10646__ check again and introduce a more meaningful macro for guarding
the code paths that are mixing gunichar and wchar_t.

Fixes #1798
2019-06-04 18:20:18 +02:00
Sebastian Dröge
41f68f8b19 Merge branch '590-rwlock-docs' into 'master'
gthread: Fix g_rw_lock_reader_lock() documentation

Closes #590

See merge request GNOME/glib!882
2019-06-03 10:44:32 +00:00
Sebastian Dröge
a4d01fcd4b Merge branch '1796-gio-pkg-bin-variables' into 'master'
build: Add various installed utilities to gio-2.0.pc

Closes #1796

See merge request GNOME/glib!881
2019-06-03 10:43:44 +00:00
Emmanuele Bassi
17880eb8e0 Merge branch 'option-docs' into 'master'
goption: Clarify G_OPTION_ARG_FILENAME documentation

See merge request GNOME/glib!885
2019-06-03 10:41:13 +00:00
Sebastian Dröge
645dcc232c Merge branch 'gsubprocess-test-fix' into 'master'
tests: Fix small race in GSubprocess tests

See merge request GNOME/glib!883
2019-06-03 10:39:26 +00:00
Philip Withnall
e1992a0e0e goption: Clarify G_OPTION_ARG_FILENAME documentation
It’s already documented elsewhere, but not particularly obviously.
Clarify argument encodings in the GOptionArg documentation.

As reported on StackOverflow:
https://stackoverflow.com/q/56416098/2931197.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-06-03 10:57:18 +01:00
Balázs Úr
2d16ec8545 Update Hungarian translation 2019-06-01 15:41:51 +00:00
Philip Withnall
799caf772b gsubprocess: Add missing (nullable) annotation to get_identifier()
The bottom of the documentation comment for this symbol seems to have
been missing.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 23:38:58 +01:00
Philip Withnall
7f256e63d0 tests: Fix small race in GSubprocess tests
This was introduced in commit 7846d6154a: g_subprocess_get_identifier()
will return NULL after the subprocess has exited, and the subprocess in
the `noop` test will exit as soon as it has started spawning. So if the
scheduler scheduled the testprog subprocess quickly, descheduled the
parent test process until the testprog exited, then the return value
from g_subprocess_get_identifier() would be NULL.

Move the g_subprocess_get_identifier() test to one which calls testprog
in `sleep-forever` mode, since that is guaranteed not to exit until
killed (which we do later in the test).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 23:35:27 +01:00
Philip Withnall
231661e46c gthread: Fix g_rw_lock_reader_lock() documentation
The documentation erroneously said that a thread calling
g_rw_lock_reader_lock() would always block if another thread was waiting
for the write lock. That’s not true: if no thread holds the lock, it is
implementation defined which of a waiting reader and writer gets the
lock.

See
http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_rwlock_rdlock.html.

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

Fixes: #590
2019-05-31 21:36:34 +01:00
Philip Withnall
3a9f9e3509 build: Add various installed utilities to gio-2.0.pc
The most useful ones were already listed in the pkg-config file, but
some others (notably, `gio-querymodules`) were not. List them in the
pkg-config file with their installed paths so that the right binary is
used if GIO is installed in a non-default path.

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

Fixes: #1796
2019-05-31 21:23:05 +01:00
Michael Catanzaro
e6a55def7d Merge branch '1788-network-more-reachable' into 'master'
gnetworkmonitornm: Consider NM_STATE_CONNECTED_SITE to be available

Closes #1788

See merge request GNOME/glib!880
2019-05-31 14:44:44 +00:00
Philip Withnall
e37f0cbd89 gnetworkmonitornm: Consider NM_STATE_CONNECTED_SITE to be available
`NM_STATE_CONNECTED_SITE` is documented to mean that a default route is
available, but that the internet connectivity check failed. A default
route being available is compatible with the documentation for
GNetworkMonitor:network-available, which should be true if the system
has a default route for at least one of IPv4 and IPv6.

https://developer.gnome.org/NetworkManager/stable/nm-dbus-types.html

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

Fixes: #1788
2019-05-31 11:19:07 +01:00
Sebastian Dröge
8b3f186d8f Merge branch '1790-file-attribute-as-string-annotation' into 'master'
gfileinfo: Add missing (nullable) annotation to get_attribute_as_string()

Closes #1790

See merge request GNOME/glib!879
2019-05-31 10:16:43 +00:00
Sebastian Dröge
c1a15894e4 Merge branch 'writev-max-num-vectors' into 'master'
Clamp number of vectors to IOV_MAX / UIO_MAXIOV for GOutputStream writev()...

See merge request GNOME/glib!874
2019-05-31 10:04:57 +00:00
Philip Withnall
ebacb64539 gfileinfo: Slightly improve documentation formatting
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-31 10:58:10 +01:00
Philip Withnall
67a0d5237e gfileinfo: Add missing (nullable) annotation to get_attribute_as_string()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1790
2019-05-31 10:58:00 +01:00
Sebastian Dröge
20a2c379c4 Clamp number of vectors to IOV_MAX / UIO_MAXIOV for GOutputStream writev() calls in the implementations
More vectors will give an error and we can simply clamp here and
consider it like a short write instead.

In case of GSocketOutputStream this is done here instead of inside
GSocket before calling sendmsg() because we we can't generically handle
short writes when sending messages on a socket, e.g. for datagram
sockets this causes only part of the datagram to be sent and an error
would be more useful in this case than sending corrupted data.

Also reduce the fallback limit to 16 in gsocket.c as that's the minimum
value required by POSIX and add a static assertion that the limit is
never bigger than G_MAXINT as that's the type recvmmsg/sendmmsg take.
2019-05-31 12:51:59 +03:00
Philip Withnall
947355c101 Merge branch 'wip/oholy/copy-permissions' into 'master'
CVE-2019-12450: gfile: Limit access to files when copying

See merge request GNOME/glib!876
2019-05-31 09:09:30 +00:00
Philip Withnall
57a1d79361 Merge branch 'source-atomic-refcounting-only' into 'master'
Use atomic reference counting for GSource

See merge request GNOME/glib!873
2019-05-30 12:34:17 +00:00
Philip Withnall
c53342c4a1 Merge branch 'ci-msys2-update-lcov' into 'master'
CI/msys2: disable coverage reporting, lcov doesn't support gcc9 yet

See merge request GNOME/glib!875
2019-05-30 09:31:55 +00:00
Christoph Reiter
ab325c24d5 CI/msys2: disable coverage reporting, lcov doesn't support gcc9 yet
https://github.com/linux-test-project/lcov/issues/58
2019-05-29 18:41:23 +02:00
Christoph Reiter
d258bb5be3 CI/msys2: update to lcov 1.14
lconv 1.13 only supports gcc <=7 and lcov 1.14 supports <=8.
msys2 was just updated to gcc9, so this wont help with coverage support, but
it's a start I guess.
2019-05-29 18:18:45 +02:00
Sebastian Dröge
0f056ebea3 Use atomic reference counting for GSource
If attached to a context already it would use a mutex instead but at
least before that the reference counting is not thread-safe currently.
2019-05-28 18:46:18 +03:00
Philip Withnall
713fec9dcb Merge branch 'fix_console_encoding' into 'master'
Add and use g_get_console_charset when printing text

Closes #1270

See merge request GNOME/glib!767
2019-05-27 17:51:40 +00:00
Patrick Storz
56149722ae Add g_get_console_charset
Queries the charset used by the associated console, which does not
necessarily match the charset of the current locale as returned by
g_get_charset.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1270
2019-05-27 17:51:40 +00:00
Philip Withnall
73f8ff82ed Merge branch 'cygwin-gunicollate-check-sizeof-wchar-t' into 'master'
gunicollate/cygwin: Don't use __STDC_ISO_10646__ for wchar_t related checks

See merge request GNOME/glib!863
2019-05-27 10:26:14 +00:00
Philip Withnall
5807da6d92 Merge branch 'deprecated-pragma-docs' into 'master'
docs: Document pitfall of deprecation pragmas

See merge request GNOME/glib!533
2019-05-27 09:50:47 +00:00
Emmanuele Bassi
50dcccc504 docs: Document pitfall of deprecation pragmas
As we discovered in GNOME/gtk#1280, GCC considers the pragmas to control
the deprecation warnings as statements. This means we cannot just use
the GLib wrappers as markers around the call site, but we must be aware
of their side effects.

Let's document this, to avoid falling into the trap.
2019-05-24 18:17:13 +01:00
Philip Withnall
e10eff122c 2.61.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-05-24 17:38:59 +01:00
Ondrej Holy
d8f8f4d637 gfile: Limit access to files when copying
file_copy_fallback creates new files with default permissions and
set the correct permissions after the operation is finished. This
might cause that the files can be accessible by more users during
the operation than expected. Use G_FILE_CREATE_PRIVATE for the new
files to limit access to those files.
2019-05-24 09:58:18 +02:00
Philip Withnall
ec17786ad1 Merge branch '1450-test-summaries' into 'master'
gtestutils: Add g_test_summary() to add summary metadata to unit tests

Closes #1450

See merge request GNOME/glib!847
2019-05-23 13:47:03 +00:00
Philip Withnall
970599ab7a Merge branch 'osx-psn' into 'master'
gapplication: skip unexpected -psn_ parameter

Closes #1784

See merge request GNOME/glib!864
2019-05-23 10:16:01 +00:00
Christoph Reiter
0030408299 gunicollate/cygwin: Don't use __STDC_ISO_10646__ for wchar_t related checks
The code in gunicollate uses __STDC_ISO_10646__ to check that wchar.h is avilable,
that it includes the wide character related functions and that sizeof(wchar_t) == 4.

cygwin defines __STDC_ISO_10646__ and has sizeof(wchar_t) == 2 and the C standard text isn't
that clear on whether wchar_t should always be 4 bytes in this case, so we better not use if for
assuming the size here.

Instead of relying on __STDC_ISO_10646__ add HAVE_WCHAR_H and SIZEOF_WCHAR_T macros.
With HAVE_WCHAR_H defined we assume wchar_t exists and wchar.h exists. With SIZEOF_WCHAR_T we
guard the parts where the size of wchar_t is assumed to be 4 (currently all of them).

Note that this doesn't make the collate tests pass under cygwin, they fail before and after this patch for me.

See !755 for related discussions.
2019-05-22 19:44:13 +02:00
Christoph Reiter
16e632432e Merge branch 'cygwin-fix-glib-os' into 'master'
build: define G_OS_UNIX, not G_OS_WIN32 under cygwin

See merge request GNOME/glib!862
2019-05-22 08:27:22 +00:00
Ignacio Casal Quinteiro
e367a4f66f gapplication: skip unexpected -psn_ parameter
When an application is launched using Launch Services
osx will add an extra parameter which we were not
handling and then gapplication would abort. Instead we make
an initial parsing and like this we avoid the abort if this
parameter is provided

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1784
2019-05-22 09:11:26 +02:00
Philip Withnall
415e5693f5 Merge branch 'clear-signal-handler-use' into 'master'
gdbusserver: Use g_clear_signal_handler

See merge request GNOME/glib!860
2019-05-21 17:54:24 +00:00
Marco Trevisan (Treviño)
5deaf0bfdf gdbusserver: Use g_clear_signal_handler 2019-05-21 12:10:01 -05:00
Christoph Reiter
767e6a4cac build: define G_OS_UNIX, not G_OS_WIN32 under cygwin
This makes glib build under msys2 for me.
2019-05-21 18:54:34 +02:00
Philip Withnall
4da8b7b35a gtestutils: Add g_test_summary() to add summary metadata to unit tests
This is a new function along the same lines as g_test_bug(): to allow
developers to annotate unit tests with information about the test (what
it tests, how it tests it) for future developers to read and learn from.

It will also output this summary as a comment in the test’s TAP output,
which might clarify test results.

Includes a unit test.

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

Fixes: #1450
2019-05-21 12:33:15 +01:00