Commit Graph

23202 Commits

Author SHA1 Message Date
Tim Sabsch
3cf65c4989 Update German translation 2021-03-10 19:57:52 +00:00
Guillaume Bernard
f041188bbd Update French translation 2021-03-10 19:41:52 +00:00
Philip Withnall
519bdf665b Merge branch 'work-out-libutil-soname-at-build-time' into 'master'
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time

See merge request GNOME/glib!1977
2021-03-10 19:35:18 +00:00
Asier Sarasua Garmendia
e72c235734 Update Basque translation 2021-03-10 19:10:57 +00:00
Philip Withnall
c80528f17b Merge branch '2325-symlink-replace-file' into 'master'
Resolve "file-roller symlink attack"

Closes #2325

See merge request GNOME/glib!1981
2021-03-10 18:42:33 +00:00
Iain Lane
373e46c2b2
gio/tests/{meson.build,pollable.c}: Determine libutil SONAME at build time
Calling `dlopen()` with `libutil.so` makes the installed tests depend on
having glibc's development files installed. To avoid this, we can work
out the runtime library name at build time and `dlopen` that instead.

This approach is [taken from libfprint][1], thanks to Marco Trevisan.

[1]: f401f399a8
2021-03-10 18:04:17 +00:00
Philip Withnall
8f57a5b9ad ci: Set localstatedir to the system directory on FreeBSD CI machines
These changes were missing from commit 62cc3158e9 and broke CI on
FreeBSD.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
57a53ec964 gioerror: Add conversion from ENXIO to G_IO_ERROR_NOT_REGULAR_FILE
`ENXIO` can be returned from `open(2)` for special files (FIFOs, device
files and domain sockets) which are not backed by anything.

This fixes the error returned by `g_file_replace()` when trying to
replace such a file, so that it now matches the documentation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
730015a8ed tests: Add comprehensive tests for static behaviour of g_file_replace()
These test all the functionality and combinations of flags I can think
of. They do not cover dynamic behaviour (for example, what would happen
if the source file is deleted by another process part-way through a call
to `g_file_replace()`).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
ac505e88c4 glocalfileoutputstream: Add a missing O_CLOEXEC flag to replace()
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 17:55:51 +00:00
Philip Withnall
87e19535fe glocalfileoutputstream: Fix CREATE_REPLACE_DESTINATION with symlinks
The `G_FILE_CREATE_REPLACE_DESTINATION` flag is equivalent to unlinking
the destination file and re-creating it from scratch. That did
previously work, but in the process the code would call `open(O_CREAT)`
on the file. If the file was a dangling symlink, this would create the
destination file (empty). That’s not an intended side-effect, and has
security implications if the symlink is controlled by a lower-privileged
process.

Fix that by not opening the destination file if it’s a symlink, and
adjusting the rest of the code to cope with
 - the fact that `fd == -1` is not an error iff `is_symlink` is true,
 - and that `original_stat` will contain the `lstat()` results for the
   symlink now, rather than the `stat()` results for its target (again,
   iff `is_symlink` is true).

This means that the target of the dangling symlink is no longer created,
which was the bug. The symlink itself continues to be replaced (as
before) with the new file — this is the intended behaviour of
`g_file_replace()`.

The behaviour for non-symlink cases, or cases where the symlink was not
dangling, should be unchanged.

Includes a unit test.

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

Fixes: #2325
2021-03-10 17:55:51 +00:00
Philip Withnall
a5f1f1e47c glocalfileoutputstream: Factor out a flag check
This clarifies the code a little. It introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:05:55 +00:00
Philip Withnall
5f2eae1156 tests: Stop using g_test_bug_base() in file tests
Since a following commit is going to add a new test which references
Gitlab, so it’s best to move the URI bases inside the test cases.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:02:35 +00:00
Philip Withnall
d523ed4543 glocalfileoutputstream: Fix a typo in a comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-10 16:02:35 +00:00
Daniel Mustieles
098bd29fe7 Updated Spanish translation 2021-03-10 12:47:52 +01:00
Kukuh Syafaat
b3c00135b1 Update Indonesian translation 2021-03-10 10:12:46 +00:00
Balázs Úr
64473e7b80 Update Hungarian translation 2021-03-10 01:06:53 +00:00
Anders Jonsson
7ae5db749b Update Swedish translation 2021-03-09 21:27:18 +00:00
Jordi Mas
a882fd4fb0 Update Catalan translation 2021-03-09 20:16:30 +01:00
Yuri Chornoivan
bba0b7c7bd Update Ukrainian translation 2021-03-09 16:51:14 +00:00
Rafael Fontenelle
d811e7df73 Update Brazilian Portuguese translation 2021-03-09 15:13:34 +00:00
Sebastian Dröge
f5bb3c353d Merge branch 'suppressions' into 'master'
glib.supp: Add another system thread suppression

See merge request GNOME/glib!1980
2021-03-09 13:00:11 +00:00
Sebastian Dröge
0dc86cded2 Merge branch 'machine-id-test' into 'master'
Validate D-Bus machine ID after loading

See merge request GNOME/glib!1962
2021-03-09 12:49:51 +00:00
Sebastian Dröge
40573a8b8b Merge branch 'fix-glib-genmarshal-empty-output' into 'master'
glib-genmarshal: close output file

Closes #2341

See merge request GNOME/glib!1978
2021-03-09 12:47:22 +00:00
Sebastian Dröge
5968425fe4 Merge branch 'fix-access-rights-for-directory-monitoring-on-win32' into 'master'
Use the right permissions for directory watching on Win32

Closes gimp#4594

See merge request GNOME/glib!1976
2021-03-09 12:46:37 +00:00
Sebastian Dröge
e401825d77 Merge branch 'fix-gbitlock-asm' into 'master'
gbitlock.c: replace remaining 'asm' with '__asm__'

Closes #2344

See merge request GNOME/glib!1979
2021-03-09 12:44:29 +00:00
Philip Withnall
60de03b86a glib.supp: Add another system thread suppression
This mirrors the existing `calloc()` suppression for that code path.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-03-09 12:34:39 +00:00
Marek Černocký
c9adc4921a Updated Czech translation 2021-03-08 15:20:57 +01:00
Rūdolfs Mazurs
6065b53e3b Update Latvian translation 2021-03-07 17:59:56 +00:00
Changwoo Ryu
1a4f903880 Update Korean translation 2021-03-06 18:12:59 +00:00
Aleksandr Mezin
d18bdef42d gbitlock.c: replace remaining 'asm' with '__asm__'
Commit 2330f7e65e changed 'asm' to '__asm__' in
g_bit_lock and g_bit_trylock.

Replace 'asm' with '__asm__' in the remaining functions.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2344
2021-03-04 04:39:27 +06:00
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
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