Commit Graph

26031 Commits

Author SHA1 Message Date
Ray Strode
1c1c452ff2 glib-unix: Add test to make sure g_unix_open_pipe will intrude standard range
Now that we know it's a bad idea to avoid the standard io fd range
when getting pipe fds for g_unix_open_pipe, we should test to make sure
we don't inadvertently try to do it again.

This commit adds that test.
2022-11-02 09:26:47 -04:00
Ray Strode
2a36bb4b7e Revert "Handling collision between standard i/o file descriptors and newly created ones"
g_unix_open_pipe tries to avoid the standard io fd range
when getting pipe fds. This turns out to be a bad idea because
certain buggy programs rely on it using that range.

This reverts commit d9ba615090

Closes: #2795
Reopens: #16
2022-11-02 09:26:45 -04:00
Simon McVittie
05fdb2d049 Merge branch 'backport-3035-portal-header-guard-glib-2-74' into 'glib-2-74'
Backport !3035 “portal: Fix broken header guard” to glib-2-74

See merge request GNOME/glib!3038
2022-11-02 02:01:03 +00:00
Robert Ancell
1304f9ed92 portal: Fix broken header guard
This wouldn't have caused an issue with the current header contents, but could have triggered a future bug.
2022-10-31 12:32:22 +00:00
Nart Tlisha
681980d382 Update Abkhazian translation 2022-10-31 10:03:40 +00:00
Marco Trevisan
a1151bc166 Merge branch 'backport-3008-wrapped-argv-leak-glib-2-74' into 'glib-2-74'
Backport !3008 “gio/gdesktopappinfo: Free the wrapped argv array on launch failure” to glib-2-74

See merge request GNOME/glib!3017
2022-10-26 11:47:08 +00:00
Marco Trevisan (Treviño)
efb43ef813 gio/gdesktopappinfo: Free the wrapped argv array on launch failure
We create an array that we never free, ensure this is the case.
The previous commit gives CI a chance to check this with valgrind job.

Found as part of another review:
 - https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2839#note_1524922
2022-10-26 10:30:09 +01:00
Philip Withnall
058491cb6f 2.74.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-25 13:53:22 +01:00
Philip Withnall
8fa92cf69b Merge branch 'backport-3009-timezone-relative-link-target-glib-2-74' into 'glib-2-74'
Backport !3009 “gtimezone: Fix symlink checks on relative link targets” to glib-2-74

See merge request GNOME/glib!3010
2022-10-25 12:23:15 +00:00
Fabio Tomat
142f1712d2 Update Friulian translation 2022-10-25 11:43:10 +00:00
Philip Withnall
14d5f25dd0 gfileutils: Mention possibility of relative paths in g_file_read_link()
It’s entirely possible that `g_file_read_link()` will return a relative
path. Mention that in the documentation, and include a short example of
how to make the path absolute for further computation.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 13:12:57 +01:00
Philip Withnall
0768067155 gtimezone: Fix symlink checks on relative link targets
The changes in 6265b2e6f7 to reject weird
`/etc/localtime` configurations where `/etc/localtime` links to another
symlink did not consider the case where the target of `/etc/localtime`
is a *relative* path. They only considered the case where the target is
absolute.

Relative paths are permissible in all symlinks. On my Fedora 36 system,
`/etc/localtime`’s target is `../usr/share/zoneinfo/Europe/London`.

Fix the check for toolbx by resolving relative paths before calling
`g_lstat()` on them.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-10-24 13:12:57 +01:00
Marco Trevisan
abac659264 Merge branch 'backport-2952-win32-test-fixes-glib-2-74' into 'glib-2-74'
Backport !2952 “Various win32 test fixes” to glib-2-74

See merge request GNOME/glib!2958
2022-10-21 16:02:36 +00:00
Marco Trevisan
957679f024 Merge branch 'backport-2947-gspawn-eintr-glib-2-74' into 'glib-2-74'
Backport !2947 “gspawn: avoid race due to retry with EINTR on close()” to glib-2-74

See merge request GNOME/glib!2988
2022-10-21 15:59:59 +00:00
Emmanuele Bassi
0e12b7d662 Merge branch 'backport-2934-floating-variants-grr-glib-2-74' into 'glib-2-74'
Backport !2934 “gobject: Always ref-sink variants in g_object_set” to glib-2-74

See merge request GNOME/glib!2998
2022-10-21 15:20:56 +00:00
Thomas Haller
7720c598f4 gspawn: use g_close()
g_close() now is async-signal-safe, as long as we don't request a GError
and pass a valid file descriptor.

Update "gspawn.c" to drop its safe_close() function and use
g_close() instead.
2022-10-21 15:38:27 +01:00
Thomas Haller
0cfc5b054a gstdio: make g_close() async-signal-safe under certain conditions
g_close() does something useful. It is not trivial to get EINTR handling of
close() right, in a portable manner. g_close() abstracts this.

We should allow glib users to use the function even in async-signal-safe
contexts, at least if the user heeds the caveat about GError and take care
not to fail assertions.

Backport 2.74: Modified to drop documentation changes to g_close() which
document its new async-signal-safe guarantees. They are not public
guarantees until 2.76. Also modified to include moving the code to
ignore `EINTR` from commit d5dc7d266f.
2022-10-21 15:37:33 +01:00
Matthias Clasen
fa8ca6e739 gobject: Always ref-sink variants in g_object_set
When collecting varargs, ignore the NOCOPY_CONTENTS
flag for variants. That is what our docs advice for
refcounted types, and it fixes a regression that
was inadvertendly introduced when we stopped doing
some extra GValue copies.

Includes a test case by Philip Withnall.

Fixes: #2774
2022-10-21 14:27:30 +01:00
Philip Withnall
ccc5dec3c0 Merge branch 'revert-2852-gobject-warnings-glib-2-74' into 'glib-2-74'
Revert "Replace most GObject warnings with criticals" on glib-2-74

See merge request GNOME/glib!2996
2022-10-21 13:09:43 +00:00
Philip Withnall
d38268c086 Merge branch 'wip/smcv/revert-2924' into 'glib-2-74'
Revert !2924 in 2.74.x branch

See merge request GNOME/glib!2995
2022-10-21 12:02:25 +00:00
Philip Withnall
b89e825cc1 Revert "Replace most GObject warnings with criticals"
This reverts commit 0ffe86a1f7.

This was intended to land for the 2.75.x unstable series, and not in the
2.74.x stable series.

Fixes: #2788
2022-10-21 12:51:00 +01:00
Simon McVittie
53178b084c Revert "Optimize g_double_hash implementation"
This reverts commit dd1f4f709e.
which caused a regression on big-endian architectures (all doubles would
hash to zero).

Partially resolves #2787

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:13 +01:00
Simon McVittie
c8e9eaf9a3 Revert "Optional optimization for g_int64_hash"
This reverts commit c1af4b2b88,
which caused a regression on big-endian architectures (all 64-bit
integers would hash to zero).

Partially resolves #2787

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:10 +01:00
Simon McVittie
f889275a28 Revert "Add tests for hash collisions in simple cases"
This reverts commit e02db8ea22.
We can't guarantee a lack of hash collisions if we go back to the 2.74.0
hashing implementation.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-21 10:25:07 +01:00
Marco Trevisan
f147c5eed1 Merge branch 'wip/pwithnall/backport-2978-osx-test-fixes-glib-2-74' into 'glib-2-74'
Backport !2978 “A couple of test fixes on OS X” to glib-2-74

See merge request GNOME/glib!2989
2022-10-20 16:26:10 +00:00
Ray Strode
428f6421fb tests: Check for public.text not text/plain on OSX
The "content type" on OSX is a Uniform Type Identifier not a MIME
type, so make sure to use the right format in the empty file test.
2022-10-20 13:53:09 +01:00
Ray Strode
6c7a242e37 tests: Don't run du on osx
The du command that ships on OS X doesn't understand
--bytes, so don't try to use du on that platform.
2022-10-20 13:53:09 +01:00
Thomas Haller
f0bcb7f79c gspawn: avoid race due to retry with EINTR on close()
Retry on EINTR is wrong on many OS, including Linux. See the comment
in g_close() why that is.

As we cannot use g_close() after fork, we had safe_close(). This had the
wrong retry loop on EINTR. Drop that.

This was especially problematic since commit 6f46294227 ('gspawn: Don’t
use g_close() in async-signal-safe context'). Before, safe_close() was
only called after fork, where there is only one thread and there is no
concern about a race.

This patch only exists for easier backporting of the bugfix. The code
will be reworked further next.

Fixes: 6f46294227 ('gspawn: Don’t use g_close() in async-signal-safe context')
2022-10-20 13:42:23 +01:00
Marco Trevisan
1936516268 Merge branch 'backport-2910-fputs-result-glib-2-74' into 'glib-2-74'
Backport !2910 “gmessages: Handle unused results from fputs and fwrite” to glib-2-74

See merge request GNOME/glib!2983
2022-10-19 15:30:06 +00:00
Marco Trevisan
23fff2024b Merge branch 'backport-2887-content-type-sniffing-glib-2-74' into 'glib-2-74'
Backport !2887 “glocalfileinfo: Ensure we always sniff some data to get the content type” to glib-2-74

See merge request GNOME/glib!2982
2022-10-19 15:25:23 +00:00
Marco Trevisan (Treviño)
07509cace9 gmessages: Handle unused results from fputs and fwrite
Fixes: #2758
2022-10-19 10:29:12 +01:00
Marco Trevisan (Treviño)
3057273816 glocalfileinfo: Ensure we always sniff some data to get the content type
In case the XDG database is not initialized yet we may try to sniff a
0-length data, making our content-type routines to mark non-empty files
as `application/x-zerosize`.

This is wrong, so in case the sniff size is not set, let's just
try to read the default value. To avoid false-application/x-zerosize
results (that are not something we want as per legacy assumptions).

See: https://bugzilla.gnome.org/show_bug.cgi?id=755795

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2742
2022-10-19 10:11:43 +01:00
Marco Trevisan
d0b81a8bfd Merge branch 'backport-2959-leak-fixes-glib-2-74' into 'glib-2-74'
Backport !2959 “Some leaks fixes” to glib-2-74

See merge request GNOME/glib!2960
2022-10-18 15:32:44 +00:00
Marco Trevisan
4ea5bac34a Merge branch 'backport-2955-timezone-toolbox-glib-2-74' into 'glib-2-74'
Backport !2955 “gtimezone: Reject weird /etc/localtime configurations” to glib-2-74

See merge request GNOME/glib!2973
2022-10-18 14:51:13 +00:00
Philip Withnall
d3ecfdf1a1 Merge branch 'backport-2782-gvariant-recursion-typedecl-fix-glib-2-74' into 'glib-2-74'
Backport !2974 “gvariant-parser: Reject deeply-nested typedecls in text form variants” to glib-2-74

See merge request GNOME/glib!2975
2022-10-18 14:33:51 +00:00
Philip Withnall
777606419d gvariant-parser: Reject deeply-nested typedecls in text form variants
Return `G_VARIANT_PARSE_ERROR_RECURSION` from `g_variant_parse()` if a
typedecl is found within a text-form variant which would cause any part
of the variant to exceed the maximum allowed recursion/nesting depth.

This fixes an oversight when `G_VARIANT_MAX_RECURSION_DEPTH` was
implemented, which allowed typedecls to effectively multiply the size of
an array if `g_variant_parse()` was parsing a text-form variant without
a top-level concrete type specified.

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

Fixes: #2782
oss-fuzz#49462
2022-10-18 14:53:02 +01:00
Ray Strode
1143a8a666 gtimezone: Reject weird /etc/localtime configurations
At the moment, glib assumes that if /etc/localtime is a symlink,
that it's a symlink to zoneinfo file.

Toolbx containers add an extra layer of indirection though, making
it a symlink to a symlink to a zoneinfo file.

This commit deals with the problem, by performing additional checks
on /etc/localtime and ignoring it if those check fail, falling back
instead to reading /etc/timezone.
2022-10-18 14:43:21 +01:00
Marc-André Lureau
8c9769605f tests/gmenumodel: fix various leaks
Found thanks to ASAN.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:52:18 +01:00
Marc-André Lureau
fd68558eec tests/gobject-query.py: make it work on msys2/win32
For unclear reasons, universal_newlines=True doesn't seem to set the
text encoding correctly. Even if I set only encoding='utf-8', the test
fails. The combination here works for me, \o/.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
bbe3670224 tests/gobject-query: it is not a script (anymore?)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
64fb6b3b46 tests/contenttype: icon name text/plain doesn't have text-x-generic on win32
The g_content_type_get_icon() function for win32 can lookup the
DefaultIcon associated with .txt and return a different result.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
b440a0f0cb tests/thread-pool-slow: do not pass confusing value to sort function
That value isn't used by the callback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
f16b700cb6 tests/thread-pool-slow: change num-threads limit check
There is no guarantee that the thread pool will reach its limit afaict,
it depends how the system schedule the various threads. This fixes
random test failure on win32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
0d5a885e5a gio/locafileinfo: fix set_mtime_atime on win32
Use a similar behaviour as the utime()/posix implementation and query
the current times to allow modifying only usec/nsecs parts.

Fixes tests/g-file-info on win32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
ab7940e811 tests/assert-msg-test: fix opening temporary file in GDB
On Win32, the file cannot be opened a second time, it must be closed
first.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
2c94b422b2 tests/assert-msg-test: abort() exit code is 3 on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
64e12059e3 tests/assert-msg-test: it is not a script (anymore?)
Fixes running the program on win32.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
06543f6699 tests/assert-msg-test: add exe extension on win32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Marc-André Lureau
0c4e48e547 tests/file-thumbnail: make it work with win32 paths
On Win32, we get paths with mixed \\ and /, use GFile to resolve and
normalize the paths before comparing.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-10-17 11:00:27 +01:00
Philip Withnall
21e89b9bfd Merge branch 'th/ghash-steal-extended-doc' into 'main'
ghash: document g_hash_table_steal_extended() behavior for sets

See merge request GNOME/glib!2948
2022-10-14 08:03:44 +00:00