Commit Graph

23453 Commits

Author SHA1 Message Date
Sebastian Dröge
47a949d74f Merge branch 'fix.unix.nonlinux.ci' into 'master'
gio/tests/pollable.c: Fix build on non-Linux UNIX

See merge request GNOME/glib!1971
2021-02-27 08:13:25 +00:00
Chun-wei Fan
cf02c280ff gio/tests/pollable.c: Fix build on non-Linux UNIX
For non-Linux UNIX systems, the label 'close_libutil:' in
'test_pollable_unix_pty()' will have no statement that goes with that
label.  Just do a 'return' on non-Linux UNIX systems.
2021-02-27 10:53:53 +08:00
Philip Withnall
b3b829e309 Merge branch 'type-traits-glib-min-version' into 'master'
glib/gmacros.h: Move `<type_traits>` include to consumers

Closes #2331

See merge request GNOME/glib!1963
2021-02-26 18:13:52 +00:00
Kukuh Syafaat
2cf8dbe7f0 Update Indonesian translation 2021-02-26 12:02:46 +00:00
Sebastian Dröge
81c4f4de4d Merge branch 'gio/gfileinfo/g_file_info_get_size/documentation' into 'master'
Improving documentation for g_file_info_get_size, fixing #2333

Closes #2333

See merge request GNOME/glib!1964
2021-02-26 08:29:19 +00:00
Uwe Scholz
429ccbd6d3 Improved the description of g_file_info_get_content_type function 2021-02-25 21:46:59 +01:00
Simon McVittie
f443144091 Merge branch 'pollable-test-dlopen-leak' into 'master'
tests: Fix leak of dlopened module in pollable test

See merge request GNOME/glib!1936
2021-02-25 18:26:57 +00:00
Iain Lane
552b8fd862
glib/gmacros.h: Move <type_traits> include to consumers
When included inside an `extern "C"` block, this causes build failures
that look something like:

  /usr/include/c++/10/type_traits:2930:3: error: template with C linkage
   2930 |   template<typename _Fn, typename... _Args>
        |   ^~~~~~~~
  ../../disas/arm-a64.cc:20:1: note: ‘extern "C"’ linkage started here
     20 | extern "C" {
        | ^~~~~~~~~~

Commit 4273c43902 made this opt in for
projects which are defining `GLIB_VERSION_MIN_REQUIRED`, but the include
of `<type_traits>` via `gmacros.h` was not included in this. If we move
the include out to the places where `glib_typeof` is called, we can make
it covered by this macro too, and save a few consumers from FTBFSing.

That also means that, if you don't want to fix your use of the headers,
and as long as this version is sufficient for you, a quick workaround is
to define `GLIB_VERSION_MIN_REQUIRED` to `GLIB_VERSION_2_66` or lower.

Suggested by Simon McVittie.

Alternative to: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1935
Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2331
2021-02-25 15:33:59 +00:00
Uwe Scholz
73182528fa Improving documentation for g_file_info_get_size, fixing #2333 2021-02-24 23:13:27 +01:00
Hugo Carvalho
f9069b04ee Update Portuguese translation 2021-02-24 19:04:50 +00:00
Philip Withnall
48322e878b Merge branch 'zlib-forcefallback' into 'master'
meson: Use subproject zlib if "wrap_mode=forcefallback" was specified

See merge request GNOME/glib!1959
2021-02-24 11:23:36 +00:00
Sebastian Dröge
17889df81a Merge branch 'mcatanzaro/kfsb' into 'master'
gkeyfilesettingsbackend: check for errors when creating file monitors

See merge request GNOME/glib!1961
2021-02-24 08:53:35 +00:00
Fran Dieguez
f4e9e125b8 Update Galician translation 2021-02-23 23:51:21 +00:00
Michael Catanzaro
26f6e3db9e gkeyfilesettingsbackend: check for errors when creating file monitors
File monitor creation may fail. We should check for this, rather than
ignoring it and then spewing criticals upon improperly assuming that we
have a valid GFileMonitor rather than NULL.

In practice, creating the GFileMonitors here fail when opening a large
number of tabs in Epiphany. I'm still investigating to see why, but it
doesn't matter for the purposes of this commit.
2021-02-23 16:31:26 -06:00
Asier Sarasua Garmendia
30fcf2ab6a Update Basque translation 2021-02-23 20:48:34 +00:00
Ask Hjorth Larsen
4bfa4dddea Updated Danish translation 2021-02-23 01:13:55 +01:00
Mario Blättermann
6d44238fb4 Update German translation 2021-02-22 18:01:36 +00:00
Seungha Yang
97c7cb0e71 meson: Use subproject zlib if "wrap_mode=forcefallback" was specified
"wrap_mode=forcefallback" would mean that user wants to use dependency
which was built from our source, instead of system installed one.
2021-02-22 19:46:06 +09:00
Aurimas Černius
0da87b090e Updated Lithuanian translation 2021-02-21 21:56:08 +02:00
Sebastian Dröge
7b0ac98afe Merge branch '2332-subprocess-launcher-oops' into 'master'
gsubprocesslauncher: Don’t close target FDs in close() method

Closes #2332

See merge request GNOME/glib!1958
2021-02-20 10:07:03 +00:00
Sebastian Dröge
7da6d79d03 Merge branch 'SkipAsyncData_changed_to_gsize' into 'master'
Change SkipAsyncData fields to be gsize (and not gssize)

See merge request GNOME/glib!1954
2021-02-20 09:45:25 +00:00
Philip Withnall
50cf90dc56 tests: Test g_subprocess_launcher_close() doesn’t close too many FDs
Expand an existing unit test to check that the target FD of a
`g_subprocess_launcher_take_fd()` call doesn’t get closed when
`g_subprocess_launcher_close()` is called. Only the source FD should be
closed by the parent process.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2332
2021-02-19 18:27:00 +00:00
Philip Withnall
55a75590d0 gsubprocesslauncher: Don’t close target FDs in close() method
This is a regression introduced in commit 67a589e505. Previously, the
source/target FD pairs were stored in `needdup_fd_assignments`, in
consecutive entries, so source FDs had even indices and target FDs had
odd indices.

I didn’t notice that the array index was being incremented by 2 when
closing FDs, when porting from the old code. So previously the code was
only closing the source FDs; after the port, it was closing source and
target FDs.

That’s incorrect, as the target FDs are just integers in the parent
process. It’s only in the child process where they are actually FDs —
and `g_subprocess_launcher_close()` is never called in the child
process.

This resulted in some strange misbehaviours in any process which used
`g_subprocess_launcher_take_fd()` with target FDs which could have
possibly aliased with other FDs in the parent process (and which weren’t
equal to their mapped source FDs).

Thanks to Olivier Fourdan for the detailed bug report.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2332
2021-02-19 18:27:00 +00:00
Philip Withnall
1e74c52a63 gsubprocesslauncher: Improve documentation formatting slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-19 18:27:00 +00:00
Emmanuel Fleury
23dad977d8 Change SkipAsyncData fields to be gsize (and not gssize) 2021-02-19 18:10:30 +01:00
Zander Brown
619bb841b0 Update British English translation 2021-02-19 14:33:41 +00:00
Matej Urbančič
0815d44362 Update Slovenian translation 2021-02-18 19:19:03 +00:00
Rafael Fontenelle
ba3b429f6c Update Brazilian Portuguese translation 2021-02-18 01:34:13 +00:00
Philip Withnall
49d5c4f859 Merge branch 'gfile-etag-nullable' into 'master'
The ETag returned by various GFile functions is nullable

See merge request GNOME/glib!1956
2021-02-17 09:21:44 +00:00
Sebastian Dröge
b41147dfc9 The ETag returned by various GFile functions is nullable
This was correctly annotated for proper return values but in case of out
parameters it was only annotated as (optional) and not additionally as
(nullable).
2021-02-17 10:01:36 +02:00
Philip Withnall
4236672170 2.67.4
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 16:24:25 +00:00
Emmanuele Bassi
4402482397 Merge branch 'wip/pwithnall/freebsd-spawn-fix' into 'master'
tests: Add missing NULL terminator to spawn-singlethread test

See merge request GNOME/glib!1955
2021-02-16 15:37:05 +00:00
Philip Withnall
b018730087 tests: Add missing NULL terminator to spawn-singlethread test
This should have been in commit
b31f3f5f80.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 15:08:47 +00:00
Philip Withnall
51e964849b Merge branch '2097-spawn-fd-rewriting' into 'master'
Resolve "GSubprocessLauncher with FD assignment can clash with g_spawn_async internal pipe"

Closes #2097

See merge request GNOME/glib!1690
2021-02-16 14:04:39 +00:00
Philip Withnall
eebb66280d gspawn-win32: Various minor internal const-correctness fixes
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 13:44:00 +00:00
Philip Withnall
ea9fd4c2f2 gspawn-win32: Implement g_spawn_async_with_pipes_and_fds()
The `source_fds`/`target_fds` functionality is not supported on Windows
at the moment.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
a34b674134 gspawn-win32: Refactor internal spawn functions
This should introduce no functional changes, but condenses the variants
of the internal spawn implementation down to be more like `gspawn.c`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
ba403908a2 gspawn-win32: Rename a variable for consistency with the public headers
I realise Windows uses handles rather than PIDs, but given that there
are multiple platform-specific implementations of the public
`g_spawn_*()` API, I think it is less confusing for them all to use the
same naming scheme.

This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 13:44:00 +00:00
Philip Withnall
fd0b20d537 gspawn: Minor improvements to documentation formatting
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 13:44:00 +00:00
Philip Withnall
67a589e505 gsubprocess: Use new source/target FD mapping functionality in g_spawn()
This improves performance by eliminating the use of a
`GSpawnChildSetupFunc` in the common case (since that setup code has now
moved into `g_spawn*()` itself), and enables the use of the fix to avoid
the child error reporting FD being overwritten by target FD mappings,
introduced via `g_spawn_async_with_pipes_and_fds()`.

It reworks how the source/target FD mapping is stored within
`GSubprocessLauncher` to match what `g_spawn*()` uses. The two
approaches are equivalent.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
b31f3f5f80 gspawn: Add new g_spawn_async_with_pipes_and_fds() API
This is a simple wrapper around the new source/target FD mapping
functionality in `fork_exec()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
52dc7cb9dd tests: Add setlocale() call to spawn-singlethread
This allows non-ASCII characters to be used in test messages from it.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-02-16 13:44:00 +00:00
Philip Withnall
c5f3ba7f01 gspawn: Avoid merged FDs being closed on exec()
If `stdout_fd` was set to (say) 6, and `stderr_fd` was set to 1, the
`set_cloexec()` call for setting up `stderr` would set the new `stdout`
for the forked process to be closed in the pending `exec()`.

This would cause the child process to error when writing to `stdout`.

This situation happens when using `G_SUBPROCESS_FLAGS_STDERR_MERGE`.

Add some conditions to prevent setting `CLOEXEC` in such cases.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
f20f0d385e gspawn: Avoid custom FDs conflicting with the child_err_report_fd
It was previously possible to specify the FD number which
`child_err_report_fd` was assigned, as a target FD in the FD mapping set
up using `g_subprocess_launcher_take_fd()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
7be9767cc4 gspawn: Handle arbitrary FD passing and renumbering between fork/exec
This effectively moves some of the functionality of `GSubprocess`
(`g_subprocess_launcher_take_fd()`) into `g_spawn*()`, which should make
implementation a little simpler.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
cddcd24b52 gspawn: Combine fork_exec() implementations
This is an internal change which won’t affect the public API. It should
introduce no functional changes, but simplifies the code a little.

The arguments from `fork_exec_with_pipes()` have been added to
`fork_exec_with_fds()`. `child_close_fds` has been dropped since it’s
now an implementation detail within the function.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2097
2021-02-16 13:44:00 +00:00
Philip Withnall
4946569730 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!1940
2021-02-16 13:11:43 +00:00
Emmanuel Fleury
0dde9f3744 Fix signedness warning in gio/gmemoryoutputstream.c
gio/gmemoryoutputstream.c: In function ‘g_memory_output_stream_seek’:
gio/gmemoryoutputstream.c:792:44: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  792 |   if (priv->realloc_fn == NULL && absolute > priv->len)
      |                                            ^
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
e939550cad Fix signedness warning in gio/gdummyfile.c
gio/gdummyfile.c: In function ‘unescape_string’:
gio/gdummyfile.c:485:32: error: comparison of integer expressions of different signedness: ‘long int’ and ‘size_t’ {aka ‘long unsigned int’}
  485 |   g_warn_if_fail (out - result <= strlen (escaped_string));
      |                                ^~
2021-02-16 13:32:26 +01:00
Emmanuel Fleury
18097c8acb Fix signedness warning in gio/gbufferedinputstream.c:g_buffered_input_stream_seek()
gio/gbufferedinputstream.c: In function ‘g_buffered_input_stream_seek’:
gio/gbufferedinputstream.c:899:18: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                  ^~
gio/gbufferedinputstream.c:899:53: error: comparison of integer expressions of different signedness: ‘goffset’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’}
  899 |       if (offset <= priv->end - priv->pos && offset >= -priv->pos)
      |                                                     ^~
2021-02-16 13:32:26 +01:00