Commit Graph

23209 Commits

Author SHA1 Message Date
Luca Bacci
00e848fbc3
Use the right permissions for directory watching on Win32
Using FILE_GENERIC_READ | FILE_GENERIC_WRITE access rights for directory monitoring
might cause problems, as noted in https://gitlab.gnome.org/GNOME/gimp/-/issues/4594.

ReadDirectoryChanges only needs FILE_LIST_DIRECTORY, so use that.

Fixes: https://gitlab.gnome.org/GNOME/gimp/-/issues/4594
2021-03-01 11:41:12 +01:00
Iain Lane
5b3e4f94b0
gatomic.h: Make glib_typeof API break opt in.
The changes in 4273c43902 did not guard
macros in `gatomic.h` which use `glib_typeof`. This meant that when
552b8fd862 was committed, moving the
include of `<type_traits>` under such a guard, these macros were still
trying to use it. This broke the build of at least vte.

Fix this by guarding the API break in `gatomic.h` too.
2021-03-01 09:18:03 +00:00
Sebastian Dröge
d799d27808 Merge branch 'msvc.doc' into 'master'
README.win32.md: Mention about Window 8+ SDK requirement

See merge request GNOME/glib!1970
2021-02-28 09:40:03 +00:00
Chun-wei Fan
22291ce82e README.win32.md: Mention about Window 8+ SDK requirement
This release series of GLib began using features that are provided in
the Windows 8 SDK and later for Visual Studio builds.  This also means
that it is no longer possible to build GLib with Visual Studio 2008 nor
2010 since the Windows 8+ SDKs do not work with those compiler versions.

Mention that people that still need to use those Visual Studio versions
should continue sticking on to glib-2.66.x, and so remove the section
about the workarounds that need to be applied for Visual Studio 2008
builds, since they are no longer applicable.
2021-02-28 11:04:29 +02:00
Aleksandr Mezin
1eac0c39f9 meson: fix str[n]casecmp detection on clang-cl
Meson incorrectly detects strcasecmp, strncasecmp on clang-cl if 'prefix:'
is not specified for cc.has_function().

See https://github.com/mesonbuild/meson/issues/5628

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2337

Before this change:
msvc was using _stricmp()
gcc on mingw was using strcasecmp()
gcc on linux was using strcasecmp()
clang-cl was trying to use strcasecmp()

After this change:
msvc is using _stricmp()
gcc on mingw is using strcasecmp()
gcc on linux is using strcasecmp()
clang-cl is using _stricmp()

Tests are still failing to build with clang-cl, but that's a separate issue.
2021-02-28 02:45:14 +06:00
Olivier Brunel
ddb2b5fe54 GRWLock: Tweak doc to make things a bit clearer
The doc used different phrasing for the same thing, e.g. "if any thread"
vs "any other thread."

Also make it clear that trying to take a write lock while already having
a lock, or trying to take a read lock while having a write lock, is
undefined.
2021-02-27 20:34:30 +01:00
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