21589 Commits

Author SHA1 Message Date
Philip Withnall
aae98ce774 tree: Fix various ableist language
In almost all cases, rewording the documentation/comments made things
more specific and a little clearer.

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

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1544#note_846645
2020-06-24 11:40:21 +01:00
Matej Urbančič
4abdd10e48 Updated Slovenian translation 2020-06-22 21:00:31 +02:00
Nirbheek Chauhan
175b7e2727 Merge branch 'backport-1522-meson-printf-checks-glib-2-64' into 'glib-2-64'
Backport !1522 “meson: Fix gnulib printf checks” to glib-2-64

See merge request GNOME/glib!1523
2020-06-09 04:00:23 +00:00
Nirbheek Chauhan
d8d5664ba9 meson: Fix gnulib printf checks
Some typos, and accidental usage of the strings `'true'` / `'false'`
instead of the booleans `true` / `false`.
2020-06-08 15:20:00 +01:00
Sebastian Dröge
2068a6c484 Merge branch 'backport-1504-win32-poll-glib-2-64' into 'glib-2-64'
Backport !1504 “win32 gpoll: Fix wait for at least one thread to return” to glib-2-64

See merge request GNOME/glib!1507
2020-05-22 10:32:16 +00:00
majordaw
66b56ee9d8 win32 gpoll: Fix wait for at least one thread to return
When timeout grater than 0 in g_poll function, the WaitForMultipleObjects
call will wait for all the threads to return, but when only one thread
got an event the others will sleep until the timeout elapses, and causes
a stall. Triggering the stop event in g_poll in this case is useless as
it is triggered when all the threads where already signaled or timed-out.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/2107
2020-05-22 09:15:47 +01:00
Philip Withnall
af1edc1c33 2.64.3
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.64.3
2020-05-20 11:45:25 +01:00
Philip Withnall
f39b885c0b Merge branch 'backport-1493-meson-typo-glib-2-64' into 'glib-2-64'
Backport !1493 “meson: Remove stray ], in O_DIRECTORY check” to glib-2-64

See merge request GNOME/glib!1495
2020-05-19 16:48:33 +00:00
Chris Packham
15e73829aa meson: Remove stray ], in O_DIRECTORY check
A stray ], was leftover from the autotools -> meson conversion. Remove
it.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
2020-05-19 16:35:06 +01:00
Sebastian Dröge
50ccd7b714 Merge branch 'backport-1439-stpcpy-fix-glib-2-64' into 'glib-2-64'
Backport !1439 “Fix stpcpy() detection“ to glib-2-64

See merge request GNOME/glib!1501
2020-05-19 15:29:12 +00:00
Martin Storsjö
3c5512222c meson: Don't misdetect stpcpy on windows platforms on clang
See https://github.com/mesonbuild/meson/issues/3672 and
https://github.com/mesonbuild/meson/issues/5628 for explanations
of cases where meson misdetects functions due to clang builtins (that
always are available, regardless of whether the platform actually
provides them).

The same also happens on GCC 10, which added support for __has_builtin.
2020-05-19 15:46:45 +01:00
Cheng-Chia Tseng
c49ee9efbd Update Chinese (Taiwan) translation 2020-05-17 17:11:02 +00:00
Cheng-Chia Tseng
d06de90330 Update Chinese (Taiwan) translation 2020-05-17 17:00:33 +00:00
Cheng-Chia Tseng
e55f6a95b5 Update Chinese (Taiwan) translation 2020-05-17 16:54:18 +00:00
Emmanuele Bassi
624e18f0fb Merge branch 'backport-1440-format-nonliteral-glib-2-64' into 'glib-2-64'
Backport !1440 -Wformat-nonliteral fixes to glib-2-64

See merge request GNOME/glib!1470
2020-05-14 14:08:27 +00:00
Emmanuele Bassi
46756977a1 Merge branch 'backport-1448-dbus-tests-glib-2-64' into 'glib-2-64'
Backport !1448 memory monitor test dependency fixes to glib-2-64

See merge request GNOME/glib!1471
2020-05-14 14:06:55 +00:00
Emmanuele Bassi
b53de16538 Merge branch 'backport-1481-ptr-array-corruption-fix' into 'glib-2-64'
Backport !1481 “array: fix corrupt state of GPtrArray after g_ptr_array_extend_and_steal()” to glib-2-64

See merge request GNOME/glib!1483
2020-05-14 14:06:14 +00:00
Emmanuele Bassi
f66e56bc2b Merge branch 'backport-1472-thread-deprecation-warnings-glib-2-64' into 'glib-2-64'
Backport !1472 “gthread: ignore deprecated declarations in static inline functions” to glib-2-64

See merge request GNOME/glib!1486
2020-05-14 14:05:12 +00:00
Simon Marchi
5ee80104ac gthread: ignore deprecated declarations in static inline functions
With a trivial file that just includes glib.h:

    #include <glib.h>

Compiled with:

    gcc -c test.c \
      -I /tmp/glib/include/glib-2.0/ \
      -I /tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
      -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_28 \
      -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28 \
      -fmax-errors=1 \
      -Werror

We get:

    In file included from /tmp/glib/include/glib-2.0/glib/gasyncqueue.h:32,
                     from /tmp/glib/include/glib-2.0/glib.h:32,
                     from test.c:1:
    /tmp/glib/include/glib-2.0/glib/gthread.h: In function ‘g_rec_mutex_locker_new’:
    /tmp/glib/include/glib-2.0/glib/gthread.h:396:3: error: ‘g_rec_mutex_lock’ is deprecated: Not available before 2.32 [-Werror=deprecated-declarations]
      396 |   g_rec_mutex_lock (rec_mutex);
          |   ^~~~~~~~~~~~~~~~
    /tmp/glib/include/glib-2.0/glib/gthread.h:196:17: note: declared here
      196 | void            g_rec_mutex_lock                (GRecMutex      *rec_mutex);
          |                 ^~~~~~~~~~~~~~~~
    compilation terminated due to -fmax-errors=1.

The problem is that the code in the static inline functions uses
g_rec_mutex_lock, introduced after 2.28.  This code is compiled
regardless of if it's actually used or not.

Suppress the warning by using G_GNUC_BEGIN_IGNORE_DEPRECATIONS /
G_GNUC_END_IGNORE_DEPRECATIONS.  There are precedents for doing that,
for example g_main_context_pusher_new in gmain.h.

Tested by building with all variations of GLIB_VERSION_MIN_REQUIRED /
GLIB_VERSION_MAX_ALLOWED:

    for i in $(seq 26 2 64); do
      gcc -c test.c \
        -I/tmp/glib/include/glib-2.0 \
        -I/tmp/glib/lib/x86_64-linux-gnu/glib-2.0/include \
        -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_$i \
        -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_$i \
        -fmax-errors=1 \
        -Werror
    done

Fixes: #2094
2020-05-07 11:10:21 +01:00
Christoph Reiter
b715f7535a Merge branch 'backport-1480-msys2-ci-fix-glib-2-64' into 'glib-2-64'
Backport !1480 “CI: Make sure we use meson 0.49.2 in MSYS2” to glib-2-64

See merge request GNOME/glib!1484
2020-05-07 09:48:18 +00:00
Christoph Reiter
857a91833c CI: Make sure we use meson 0.49.2 in MSYS2
pip in MSYS2 seems to install scripts into $USERPROFILE instead of $HOME
which means the MSYS2 meson, which is newer, wins. Make sure $USERPROFILE
is in PATH as well.
2020-05-07 09:48:49 +01:00
Thomas Haller
ebc518da45 array: fix corrupt state of GPtrArray after g_ptr_array_extend_and_steal()
g_ptr_array_extend_and_steal() leaves the GPtrArray in an invalid state,
so if you would try to append another pointer, it leads to a crash.

Also adjust the test case so that it would result in the crash (without
the fix).

Fixes: 0675703af08d ('Adding g_ptr_array_extend_and_steal() function to glib/garray.c')
2020-05-07 09:44:40 +01:00
Simon McVittie
d020a73b66 Merge branch 'backport-1477-dbus-keyring-handling-glib-2-64' into 'glib-2-64'
Backport !1477 D-Bus keyring handling fixes to glib-2-64

See merge request GNOME/glib!1478
2020-05-05 18:46:28 +00:00
Philip Withnall
f3b6700256 gdbusauthmechanismsha1: Reduce syscalls from ensure_keyring_directory()
There’s no need to call `access()` and then `stat()` on the keyring
directory to check that it exists, is a directory, and has the right
permissions. Just call `stat()`.

This eliminates one potential TOCTTOU race in this code.

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

Helps: #1954
2020-05-05 17:46:31 +01:00
Philip Withnall
b4664e237a gdbusauthmechanismsha1: Fix race in keyring_acquire_lock()
There was a time-of-check-to-time-of-use (TOCTTOU) race in the keyring
lock code, where it would check the existence of the lock file using
`access()`, then proceed to call `open(O_CREAT | O_EXCL)` to try and
create the lock file once `access()` showed that it didn’t exist.

The problem is that, because this is happening in a shared directory
(`~/.dbus-keyrings`), another process could quite legitimately create
the lock file in the meantime.

Instead, unconditionally call `open()` and ignore errors from it (which
will be returned if the lock file already exists) until it succeeds (or
the code times out).

This eliminates the TOCTTOU race, and simplifies the timeout behaviour
so there aren’t two loops (check for existence, try to create)
happening. It brings this code in line with what dbus.git does (see
`_dbus_keyring_lock()`).

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

Fixes: #1954
2020-05-05 17:46:31 +01:00
Philip Withnall
a0689d21e4 gdbusauthmechanismsha1: Fix keyring lock file permissions
Why should it have the sticky bit set? dbus.git sets permissions 0600;
so should GLib.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-05 17:46:31 +01:00
Philip Withnall
d20664c6d4 gdbusauthmechanismsha1: Fix return type in precondition guards
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-05 17:46:31 +01:00
Philip Withnall
1a35d27f1b tests: Isolate directory access for gdbus-server-auth test
When multiple tests were run in parallel, this would race on its access
to `~/.dbus-keyrings` to authenticate with the D-Bus server, since the
keyring directory was not appropriately sandboxed to the unit test.

Use `G_TEST_OPTION_ISOLATE_DIRS` to automatically isolate each unit
test’s directory usage.

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

Fixes: #1954
2020-05-05 17:46:31 +01:00
Philip Withnall
de0fae3d49 tests: Fix a memory leak in gdbus-server-auth
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-05-05 17:46:31 +01:00
Philip Withnall
95f6d3c808 Merge branch 'windows-ci-switch-2-64' into 'glib-2-64'
CI: Switch to new Windows runners (2.64)

See merge request GNOME/glib!1473
2020-05-04 09:23:40 +00:00
Christoph Reiter
c8f6aab8b2 CI: Switch to new Windows runners
gitlab will drop cmd.exe support with GitLab 13 so I took the opportunity to
add new runners with Windows 2016 and powershell as default.

These runners are tagged with win32-ps instead of win32. The old runners
will be switched off in the coming weeks.

The main difference is that all commands and env expansions use powershell
and Windows 2016 instead of 2012r2.
2020-05-02 13:16:48 +02:00
Ross Burton
f11fd52dd2 gio/tests/memory-monitor-*.py.in: skip if 3rd party modules not available
The GIO tests memory-monitor-dbus and memory-monitor-portal use a number
of third party Python modules that may not be present when running the
test case.

Instead of failing due to missing imports, catch the ImportError and
mock a test case that skips.  This can't use the usual unittest.skip
logic because the test case class itself uses a 3rd party module.

Closes #2083.
2020-05-01 18:06:31 +01:00
Ross Burton
5903b75185 gio: use TAPTestRunner in the memory monitor tests
There are two memory monitor tests that use Python's unittest module directly,
but GLib tests should be outputting TAP.  Use the embedded TAPTestRunner to
ensure that TAP is output for these tests too.
2020-05-01 18:06:31 +01:00
Martin Storsjö
693013bba5 Silence clang errors about -Wformat-nonliteral due to missing intermediate attributes
By default, meson builds glib with -Werror=format=2, which
implies -Werror=format-nonliteral. With these flags, clang errors
out on e.g. the g_message_win32_error function, due to "format
string is not a string literal". This function takes a format
string, and passes the va_list of the arguments onwards to
g_strdup_vprintf, which is annotated with printf attributes.

When passing a string+va_list to another function, GCC doesn't warn
with -Wformat-nonliteral. Clang however does warn, unless the
functions themselves (g_message_win32_error and set_error) are decorated
with similar printf attributes (to force the same checks upon the
caller) - see
https://clang.llvm.org/docs/AttributeReference.html#format
for reference.

Adding these attributes revealed one existing mismatched format string
(fixed in the preceding commit).
2020-05-01 17:59:33 +01:00
Martin Storsjö
8d7b170656 gregistrysettings: Fix a mismatched error format string 2020-05-01 17:59:33 +01:00
Martin Storsjö
43c826021a meson: Add -Wno-format-zero-length for gcc/clang builds
Zero length format strings isn't something that needs to be warned
about.
2020-05-01 17:59:33 +01:00
Christian Kirbach
acefe859e6 Update German translation 2020-04-14 13:33:57 +00:00
Philip Withnall
e264e6fcf7 2.64.2
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.64.2
2020-04-09 14:40:24 +01:00
Sebastian Dröge
6bebadace6 Merge branch 'backport-1442-gfile-content-type-glib-2-64' into 'glib-2-64'
Backport !1442 “gfile: Fallback to fast-content-type if content-type is not set” to glib-2-64

See merge request GNOME/glib!1447
2020-04-09 13:16:38 +00:00
Ondrej Holy
35953b5371 gfile: Fallback to fast-content-type if content-type is not set
The G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE attribute doesn't have to be
always set. See https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/68
for more details. In that case, the g_file_query_default_handler function
fails with the "No application is registered as handling this file" error.
Let's fallback to the "standard::fast-content-type" attribute instead to
fix issues when opening such files.

https://gitlab.gnome.org/GNOME/nautilus/-/issues/1425
2020-04-09 13:30:53 +01:00
Sebastian Dröge
204b4dc285 Merge branch 'backport-various-glib-2-64' into 'glib-2-64'
Backport various patches to glib-2-64

See merge request GNOME/glib!1438
2020-04-03 16:42:21 +00:00
Ondrej Holy
39dc7f07d5 docs: Mention new gio tool options
New features were added for gio tool, but they are not mentioned in
man pages as it is not generated from GOptionEntry in contrast to the
help output. Let's update the man pages to reflect the recent changes.
2020-04-03 16:59:24 +01:00
Philip Withnall
72e1d3c964 gdbusmessage: Fix swapped signatures in error messages
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2081
2020-04-03 13:42:00 +01:00
Chris Mayo
4523f75625 docs: Fix configuration with gtk_doc=true and installed_tests=false
Skip the gdbus-object-manager-example which is generated as part of
testing.

Program xsltproc found: YES (/usr/bin/xsltproc)
Run-time dependency gtk-doc found: YES 1.32

docs/reference/gio/gdbus-object-manager-example/meson.build:1:0: ERROR:
Unknown variable "libgdbus_example_objectmanager_dep".
2020-04-03 13:29:55 +01:00
Alexander Kanavin
4d95cb5cb6 glib-unix.c: fix heap corruption in g_unix_get_passwd_entry
malloc() was given too small value (size of pointer,
rather than struct it points to), and subsequent call
getpwnam_r() wrote past the end of allocated block - easily
seen with valgrind.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
2020-04-03 13:24:40 +01:00
Martin Storsjö
d50ea2a34f Fix arch detection ifdefs in glib/valgrind.h
Don't assume that __MINGW32__ implies x86; Windows runs on ARM/ARM64
as well, and there are mingw toolchains that target those architectures.

This mirrors how the MSVC part of the same expressions are written,
as (defined(_WIN32) && defined(_M_IX86)) and
(defined(_WIN64) && defined(_M_X64)) - not relying on _WIN32/_WIN64
or __MINGW32__/__MINGW64__ alone to indicate architecture.
2020-04-03 13:06:18 +01:00
Martin Storsjö
73148e2242 Add missing 'extern' to the dllexport version of GLIB_VAR/GOBJECT_VAR
The __declspec(dllexport) attribute in itself doesn't imply
'extern' - thus any intended variable declaration with
GLIB_VAR/GOBJECT_VAR would actually be a variable definition. With
C compilers defaulting to -fcommon, this isn't an issue, but
upcoming compilers (GCC 10 and Clang 11) will default to -fno-common,
ending up with duplicate definitions of these variables.
2020-04-03 12:48:11 +01:00
Yosef Or Boczko
2443c6bb46 Update Hebrew translation 2020-03-30 17:38:17 +00:00
Daniel Șerbănescu
e62cd323c3 Update Romanian translation 2020-03-19 10:53:37 +00:00
Simon McVittie
9d46d9d457 Merge branch 'backport-1420-gmacros-cpp-glib-2-64' into 'glib-2-64'
Backport !1420 “gmacros.h: avoid using _Static_assert in C++17 mode” to glib-2-64

See merge request GNOME/glib!1421
2020-03-18 10:23:08 +00:00