21627 Commits

Author SHA1 Message Date
Sebastian Dröge
1bb51ad023 Merge branch 'backport-1664-resolver-sign-glib-2-64' into 'glib-2-64'
Backport !1664 “gthreadedresolver: Fix logic in parse_res_text()” to glib-2-64

See merge request GNOME/glib!1668
2020-10-01 06:02:17 +00:00
Peter Bloomfield
9ded33cf59 gthreadedresolver: Fix logic in parse_res_text()
and avoid a sign-compare warning.

Fixes #2209
2020-09-30 16:45:57 +01:00
Sebastian Dröge
629bf398a2 Merge branch 'backport-1187-msvc-arm32-glib-2-64' into 'glib-2-64'
Backport !1187 “Define G_MSVC_SYMBOL_PREFIX correctly for ARM32” to glib-2-64

See merge request GNOME/glib!1656
2020-09-23 10:45:32 +00:00
Sebastian Dröge
923b32ee08 Merge branch 'backport-1652-trash-portal-fix-glib-2-64' into 'glib-2-64'
Backport !1652 “trash portal: Handle portal failures” to glib-2-64

See merge request GNOME/glib!1659
2020-09-23 10:45:23 +00:00
Ryan Gonzalez
9cc200baa2 trash portal: Handle portal failures
Previously, only whether or not the D-Bus call itself succeeded was
checked, regardless of the result code from the actual trash operation.
2020-09-23 10:38:05 +01:00
Wolfgang Stöggl
c444a1aec7 Define G_MSVC_SYMBOL_PREFIX correctly for ARM32
Symbols on x86 are prefixed with an underscore
but symbols on x64/ARM/ARM64 are not.

Relevant information concerning the prefixes for the architectures
can be found in the vcpkg project [1,2], where arm and arm64 builds
are part of the CI.

Specifically, _WIN64 is defined on Windows ARM64, so this issue is
only visible when building on ARM32.

[1] 08e74979df/ports/glib/fix-arm-builds.patch
[2] https://github.com/microsoft/vcpkg/pull/6116
2020-09-22 12:51:19 +01:00
Juliano de Souza Camargo
82ed2f22de Update Portuguese translation 2020-09-21 14:05:44 +00:00
Goran Vidović
814372482b Update Croatian translation 2020-09-05 22:05:47 +00:00
Sebastian Dröge
fba920af8f Merge branch 'backport-1632-fileutils-large-write-glib-2-64' into 'glib-2-64'
Backport !1632 Fix large writes in gfileutils to glib-2-64

See merge request GNOME/glib!1633
2020-09-03 09:33:46 +00:00
Sebastian Dröge
1659dd7a4d Merge branch 'backport-1631-splice-cancellation-glib-2-64' into 'glib-2-64'
Backport !1631 “Fix splice behavior on cancellation” to glib-2-64

See merge request GNOME/glib!1634
2020-09-03 09:33:40 +00:00
Carlos Garnacho
1b03204e67 tests: Add splice cancellation test
This doesn't trigger the cancellation assertion issue when run locally
(the task didn't return yet, so the error is simply overwritten), but
perhaps it ever does in CI. Anyhow, it's good to have a cancellation
test.
2020-09-01 11:56:24 +01:00
Carlos Garnacho
40865e0ba7 goutputstream: Check individual close operations after splice
After a splice operation is finished, it attempts to 1) close input/output
streams, as per the given flags, and 2) return the operation result (maybe
an error, too).

However, if the operation gets cancelled early and the streams indirectly
closed, the splice operation will try to close both descriptors and return
on the task when both are already closed. The catch here is that getting the
streams closed under its feet is possible, so the completion callback would
find both streams closed after returning on the first close operation and
return the error, but then the second operation could be able to trigger
a second error which would be returned as well.

What happens here is up to further race conditions, if the task didn't
return yet, the returned error will be simply replaced (but the old one not
freed...), if it did already return, it'll result in:

GLib-GIO-FATAL-CRITICAL: g_task_return_error: assertion '!task->ever_returned' failed

Fix this by flagging the close_async() callbacks, and checking that both
close operations did return, instead of checking that both streams are
closed by who knows.

This error triggers a semi-frequent CI failure in tracker, see the summary at
https://gitlab.gnome.org/GNOME/tracker/-/issues/240
2020-09-01 11:56:24 +01:00
Sebastian Dröge
259903ca53 Don't pass more than G_MAXSSIZE bytes at once to write() in glib/gfileutils.c
Behaviour in that case is implementation-defined and how many bytes were
actually written can't be expressed by the return value anymore.

Instead do a short write of G_MAXSSIZE bytes and let the existing loop
for handling short writes takes care of the remaining length.
2020-09-01 11:54:16 +01:00
Emmanuel Fleury
3ff911afaa Fixing signedness warning in glib/gfileutils.c
glib/gfileutils.c: In function ‘write_to_file’:
glib/gfileutils.c:1176:19: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
 1176 |       g_assert (s <= length);
      |                   ^~
glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
  939 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/gfileutils.c:1176:7: note: in expansion of macro ‘g_assert’
 1176 |       g_assert (s <= length);
      |       ^~~~~~~~

Related to issue #1735 (Get back to a -werror build)
2020-09-01 11:54:16 +01:00
Philip Withnall
2560f61370 2.64.5
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.64.5
2020-08-18 12:05:22 +01:00
Sebastian Dröge
b24969cefe Merge branch 'backport-1620-variant-depth-init-glib-2-64' into 'glib-2-64'
Backport !1620 “gvariant: Ensure GVS.depth is initialised” to glib-2-64

See merge request GNOME/glib!1621
2020-08-18 09:42:56 +00:00
Philip Withnall
2b6d4081e2 gvariant: Ensure GVS.depth is initialised
When byteswapping the depth was accidentally left uninitialised.

Coverity CID: #1430636
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 09:50:43 +01:00
Sebastian Dröge
03a53a9531 Merge branch 'backport-1617-subprocess-blocking-glib-2-64' into 'glib-2-64'
Backport !1617 “Ensure g_subprocess_communicate_async() never blocks” to glib-2-64

See merge request GNOME/glib!1618
2020-08-17 11:56:46 +00:00
Alexander Larsson
53c9497268 Ensure g_subprocess_communicate_async() never blocks
It turns out that our async write operation implementation is broken
on non-O_NONBLOCK pipes, because the default async write
implementation calls write() after poll() said there were some
space. However, the semantics of pipes is that unless O_NONBLOCK is set
then the write *will* block if the passed in write count is larger than
the available space.

This caused a deadlock in https://gitlab.gnome.org/GNOME/glib/-/issues/2182
due to the loop-back of the app stdout to the parent, but even without such
a deadlock it is a problem that we may block the mainloop at all.

In the particular case of g_subprocess_communicate() we have full
control of the pipes after starting the app, so it is safe to enable
O_NONBLOCK (i.e. we can ensure all the code using the fd after this can handle
non-blocking mode).

This fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2182
2020-08-17 12:25:45 +01:00
Sebastian Dröge
94ef46477c Merge branch 'backport-1607-ios-frexpl-glib-2-64' into 'glib-2-64'
Backport !1607 “meson: Don't use gnulib for printf on iOS” to glib-2-64

See merge request GNOME/glib!1608
2020-08-06 09:46:08 +00:00
Nirbheek Chauhan
41af1187c3 meson: Don't use gnulib for printf on iOS
iOS and tvOS use the same printf family as macOS, and these all have
been available on macOS for a long time.

Closes https://gitlab.gnome.org/GNOME/glib/-/issues/1868
2020-08-06 10:17:43 +01:00
Emmanuele Bassi
d2a232aee0 Merge branch 'backport-1563-desktop-app-info-leak-glib-2-64' into 'glib-2-64'
Backport !1563 “gdesktopappinfo: Fix unnecessarily copied and leaked URI list” to glib-2-64

See merge request GNOME/glib!1565
2020-07-06 11:44:06 +00:00
Felix Riemann
47cdc8e35a gdesktopappinfo: Fix unnecessarily copied and leaked URI list
When an app is spawned using g_desktop_app_info_launch_uris_with_spawn
it will expand the various token in the app's commandline with the
URIs of the files to open. The expand_macro() function that is used for
this advances the pointer to the URI list to show up to which entries
it used.

To not loose the pointer to the list head a duplicate of the URI list
was actually passed to expand_macro(). However, it's not necessary to
create a copy of the URI list for that as expand_macro() will only
change which element the pointer will point to.

This behaviour actually caused the duplicated list to be leaked as the
the list pointer is NULL once all URIs are used up by expand_macro()
and thus nothing was freed at the end of the function.
2020-07-06 11:58:47 +01:00
Sebastian Dröge
2cbd8717e2 Merge branch 'backport-1517-win32-registry-assertions' into 'glib-2-64'
Backport !1517 “GWin32RegistryKey: Move assertions” to glib-2-64

See merge request GNOME/glib!1520
2020-07-02 14:30:16 +00:00
Sebastian Dröge
f418989128 Merge branch 'backport-1468-compile-resources-win32' into 'glib-2-64'
Backport !1468 “glib-compile-resources: Fix exporting on Visual Studio” to glib-2-64

See merge request GNOME/glib!1519
2020-07-02 14:29:54 +00:00
Philip Withnall
551bd5c1d1 2.64.4
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2.64.4
2020-07-02 13:58:20 +01:00
Baurzhan Muftakhidinov
8e7a483a73 Update Kazakh translation 2020-06-25 07:40:07 +00:00
Sebastian Dröge
d0e54ef794 Merge branch 'backport-1544-spawn-async-signal-safety-glib-2-64' into 'glib-2-64'
Backport !1544 “Resolve "calling malloc in fork child is undefined-behaviour"” to glib-2-64

See merge request GNOME/glib!1547
2020-06-24 11:58:49 +00:00
Philip Withnall
f99f0c2fab gspawn: Don’t use malloc() when running a binary under /bin/sh
Allocate a working buffer before calling `fork()` to avoid calling
`malloc()` in the async-signal-safe context between `fork()` and
`exec()`, where it’s not safe to use.

In this case, the buffer is used to assemble a wrapper around `argv` so
it can be run under `/bin/sh`.

See `man 7 signal-safety`.

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

Fixes: #2140
2020-06-24 11:40:22 +01:00
Philip Withnall
cc8715c3b7 gspawn: Don’t use malloc() when searching for a binary
Allocate a working buffer before calling `fork()` to avoid calling
`malloc()` in the async-signal-safe context between `fork()` and
`exec()`, where it’s not safe to use.

In this case, the buffer is used to assemble elements from `PATH` with
the binary from `argv[0]` to try executing them.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:22 +01:00
Philip Withnall
3548996c0e gspawn: Don’t use getenv() in async-signal-safe context
Query the environment before calling `fork()` so that it doesn’t have to
be called in the async-signal-safe context between `fork()` and
`exec()`.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:22 +01:00
Philip Withnall
45b8e60ac4 gspawn: Don’t use getrlimit() or sysconf() in async-signal-safe context
They’re not safe to call in an async-signal-safe context on Linux.
`sysconf()` is safe to call on FreeBSD and OpenBSD (at least), so
continue doing that.

This will reduce performance in the (already low performance) fallback
case where `/proc` is inaccessible to a forked process on Linux, while
spawning a subprocess.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:21 +01:00
Philip Withnall
923315ef82 gspawn: Don’t use g_assert() in async-signal-safe context
Use the error handling infrastructure which already exists for other
failures in the async-signal-safe context.

`g_assert()` is unlikely to have caused problems in practice because it
is only async-signal-unsafe when the assertion condition fails.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:21 +01:00
Philip Withnall
d24acc7ea5 gspawn: Don’t use g_ascii_isdigit() in async-signal-safe context
While `g_ascii_isdigit()` *is* currently async-signal-safe, it’s going
to be hard to remember to keep it that way if the implementation changes
in future.

It seems more robust to just reimplement it here, given that it’s not
much code.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:21 +01:00
Philip Withnall
539d51836a gspawn: Don’t use g_close() in async-signal-safe context
Use normal `close()` instead, which is guaranteed to be
async-signal-safe.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:21 +01:00
Philip Withnall
92eac2f424 gspawn: Audit for async-signal-safety
Functions called between `fork()` and `exec()` have to be
async-signal-safe.

Add a comment to each function which is called in that context, and
`FIXME` comments to the non-async-signal-safe functions which end up
being called as leaves of the call graph.

The following commits will fix those `FIXME`s.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-24 11:40:21 +01:00
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
Руслан Ижбулатов
98570e2d69 GWin32RegistryKey: Move assertions
While these assertions look right at the first glance,
they actually crash the program. That's because GObject
insists on initializing all construct-only properties
to their default values, which results in
g_win32_registry_key_set_property() being called multiple
times with NULL string, once for each unset property.

If "path" is actually set by the caller, a subsequent
call to set "path-utf16" to NULL will fail an assertion,
since absolute_path is already non-NULL.

With assertions moved the set-to-NULL calls bail out before
an assertion is made.
2020-06-05 12:47:26 +01:00
Chun-wei Fan
e56a2865cb glib-compile-resources: Fix exporting on Visual Studio
Have the generated .c code decorate the prototypes with "G_MODULE_EXPORT"
instead of "extern" when --internal is not being used, so that we also
export the symbols from the generated code on Visual Studio-style
compilers.  If --internal is used, we decorate the prototypes with
"G_GNUC_INTERNAL", as we did before.

Note that since the generated .c code does not attempt to include the
generated headers (if one is also generated), the gnerated headers are
still generated as they were before.
2020-06-05 11:58:47 +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