Commit Graph

23372 Commits

Author SHA1 Message Date
Aleksandr Mezin
f346b9c8ce glib-genmarshal: close output file
Close output file to ensure all buffered output actually gets written.

Otherwise, glib-genmarshal output is sometimes empty (for example, when trying
to build gdk-pixbuf on Windows, with Meson installed from .msi package).

argparse.FileType doesn't get closed automagically when the script exits:
https://bugs.python.org/issue13824

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2341
2021-03-03 12:24:29 +06:00
Мирослав Николић
14c9fc79ac Update Serbian translation 2021-03-02 21:16:14 +00:00
Aleksandr Mezin
19106af47f data-to-c.py: autodetect line endings
When GLib code is checked out with Windows line endings (happens on Windows),
data-to-c.py embedded that line endings into generated string literal. And
then they translated to double newlines in glib-compile-resources output.

clang-cl failed to compile such files because of empty lines in the middle of
multiline macros:

    #define G_MSVC_CTOR(_func,_sym_prefix) \

      static void _func(void); \

To fix the issue, enable 'universal newlines' mode when reading the input in
data-to-c.py - translate both '\n' and '\r\n' to '\n'.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2340
2021-03-01 23:59:34 +06:00
Philip Withnall
ef41cc28b4 ci: Ensure the machine-id is set on the Fedora CI image
Run `systemd-machine-id-setup` when creating the image, so that
`/etc/machine-id` is created with a valid ID. Since systemd isn’t
started when running the CI image with podman/Docker, it’s not created
otherwise. This causes some tests to fail.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:55:03 +00:00
Philip Withnall
da50de9b30 ci: Include details of machine ID in CI output
Include the size of the `machine-id` file, but not the value itself as
that is sensitive for non-throwaway machines. What’s most useful for
debugging CI problems is knowing whether, and where, the `machine-id` is
set.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:54:09 +00:00
Philip Withnall
62cc3158e9 ci: Set localstatedir to the system directory on CI machines
So the tests can access `/var/lib/dbus/machine-id`. This is not a
behaviour change relative to older behaviour on CI.

In future, it might make more sense to revert this commit and change the
CI scripts so they symlink
`/home/user/glib-installed/var/lib/dbus/machine-id` to the system
machine ID; or ensure that `/etc/machine-id` exists on all the CI
machines. That’s too complicated to do right now though.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
05ff2f877c gdbusprivate: Stop hard-coding path to /var/lib
This will require distributions to ensure they pass
`--localstatedir=/var` correctly to Meson, but they should be doing that
already.

See https://mesonbuild.com/Builtin-options.html#directories for details
about how Meson treats `localstatedir` differently from most other `dir`
variables.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
daa62a35e1 gdbusprivate: Validate machine ID after loading it
It’s unlikely that the machine ID will be invalid (it’s system
configuration), but it would be helpful to not propagate invalid IDs
further, since a lot of things rely on it.

It’s not easy to test this (it requires factoring out the code so it can
be used from a test program, or allowing it to load a machine ID from a
custom path), so I haven’t added unit tests. I’ve tested manually by
overriding the loaded machine ID.

Coverity CID: #1430944

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
ea19358039 gdbusprivate: Simplify some variable initialisations
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:44:20 +00:00
Philip Withnall
4e4b35208a 2.67.5
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-01 13:36:00 +00:00
Philip Withnall
6cc6df230a Merge branch 'glib-typeof-gatomic-h' into 'master'
gatomic.h: Make `glib_typeof` API break opt in.

See merge request GNOME/glib!1975
2021-03-01 13:19:08 +00:00
Philip Withnall
1d0d9b92f6 Merge branch 'fix-clang-cl-strcasecmp' into 'master'
meson: fix str[n]casecmp detection on clang-cl

Closes #2337

See merge request GNOME/glib!1973
2021-03-01 11:45:47 +00:00
Philip Withnall
75ca263ad6 Merge branch 'GRWLock' into 'master'
GRWLock: Tweak doc to make things a bit clearer

Closes #832

See merge request GNOME/glib!1972
2021-03-01 11:43:55 +00:00
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