Commit Graph

24386 Commits

Author SHA1 Message Date
Aleksandr Melman
62a88d9f38 Update Russian translation 2021-12-25 13:01:35 +00:00
Emmanuele Bassi
036340b25f Merge branch 'g_get_user_cache_dir' into 'main'
utils: Add XDG_STATE_HOME support

See merge request GNOME/glib!2395
2021-12-24 20:11:40 +00:00
Sophie Herold
68eab1d999 utils: Add XDG_STATE_HOME support 2021-12-24 20:11:39 +00:00
Sebastian Dröge
8ca2a7d7c8 Merge branch 'wip/pwithnall/fix-environment-tests' into 'main'
tests: Fix environment test on FreeBSD

See merge request GNOME/glib!2407
2021-12-24 10:08:50 +00:00
Philip Withnall
8225637596 Merge branch '2560-s-isreg' into 'main'
xdgmime: Add missing S_ISREG definitions for VS2022

Closes #2560

See merge request GNOME/glib!2406
2021-12-23 17:37:44 +00:00
Philip Withnall
2f53c8ed64 Merge branch 'barch/windows_no_popups' into 'main'
Prevent gtest tests from popping up dialog boxes

See merge request GNOME/glib!2400
2021-12-23 13:14:00 +00:00
Philip Withnall
1a1f05234e Merge branch 'improve_gasyncqueue_tests' into 'main'
Improve test coverage of glib/tests/asyncqueue.c

See merge request GNOME/glib!2403
2021-12-23 13:11:45 +00:00
Philip Withnall
f3ad0f678f Merge branch 'improve_environment_tests' into 'main'
Improving glib/tests/environment.c

See merge request GNOME/glib!2402
2021-12-23 13:09:11 +00:00
Philip Withnall
4bb9e20fff tests: Fix environment test on FreeBSD
Fix for commit 20c8ea1bc651bc4b79d39b80d42b468f6e7a2dc8; while Linux
seems happy to return the value for the invalid key we set above, BSD
returns NULL (which is probably a more valid thing to do).

Accept both.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-23 13:04:49 +00:00
Philip Withnall
ca6cf3c64a Merge branch 'fix_warnings' into 'main'
Fix several cosmetic warnings

Closes #2559

See merge request GNOME/glib!2401
2021-12-23 12:51:19 +00:00
Philip Withnall
954a8724c2 xdgmime: Add missing S_ISREG definitions for VS2022
Otherwise building with VS2022 fails with:
```
Creating library D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.lib and object D:/temp/29/.sw/out/323969/gnome.glib.gio-2.71.0.exp
xdgmime.c.4b279509.obj : error LNK2019: unresolved external symbol S_ISREG referenced in function _gio_xdg_get_mime_type_for_file
xdgmimecache.c.79af418f.obj : error LNK2001: unresolved external symbol S_ISREG
D:\temp\29\.sw\out\323969\gnome.glib.gio-2.71.0.dll : fatal error LNK1120: 1 unresolved externals
```

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

Fixes: #2560
2021-12-23 12:35:48 +00:00
Kukuh Syafaat
eaa52ddfc5 Update Indonesian translation 2021-12-22 09:15:20 +00:00
Charles Barto
5c82bf65d6 include crtdbg first, so includes are alphabatical 2021-12-17 16:49:42 -08:00
Charles Barto
77df44371e Only call _set_abort_behavior with the ucrt. 2021-12-17 16:05:14 -08:00
Emmanuel Fleury
aa99af54aa Improve test coverage of glib/tests/asyncqueue.c 2021-12-17 21:21:49 +01:00
Emmanuel Fleury
c6ced6abe0 Improving glib/tests/environment.c 2021-12-17 20:18:40 +01:00
Emmanuel Fleury
3887de12a9 Fix old_mem_chunk_new() does not match original declaration warning in tests/slice-test.c
tests/slice-test.c:30:17: warning: type of ‘old_mem_chunk_new’ does not match original declaration
2021-12-17 16:35:45 +01:00
Emmanuel Fleury
c8274a51cd Fix defined but not used warning in gobject/gobject.c
gobject/gobject.c:1189:1: warning: ‘floating_check’ defined but not used
2021-12-17 15:30:18 +01:00
Philip Withnall
49ec7f18e3 Merge branch 'meson-win32-static' into 'main'
meson: Fix linking with static library in Windows

See merge request GNOME/glib!2384
2021-12-17 12:22:31 +00:00
Philip Withnall
9fd3b5ed23 Merge branch 'env-test' into 'main'
Move tests/env-test.c into glib/tests/environment.c

See merge request GNOME/glib!2399
2021-12-17 11:51:51 +00:00
Charles Barto
908ed3498b Prevent gtest tests from popping up dialog boxes
Many UCRT (and msvcrt/msvcxx) functions open dialog boxes
by default for .... some reason. This is a problem because a test runner
waiting on a process to exit won't see it exit unless someone actually
clicks away the box, which won't happen on a CI machine.

Additionally g_abort unconditionally raises a debugging exception,
which, if uncaught, will cause windows error reporting to pop a dialog

Resolve the first problem by calling platform specific (but documented)
functions to change the CRT's behavior in g_test_init

Resolve the second by only throwing a debug exception if we're under
debugging, and just calling abort() otherwise.

This reduces the number of popups triggerd by `meson test` from
over 10 to about three on my machine, mostly in the spawn test code.
2021-12-16 20:20:56 -08:00
Philip Withnall
42a5f1d387 2.71.0
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-16 18:52:24 +00:00
Emmanuel Fleury
20c8ea1bc6 Move tests/env-test.c into glib/tests/environment.c 2021-12-16 16:32:26 +01:00
Patrick Griffis
22965a4d7d Merge branch 'wip/pwithnall/resolver-fuzzing' into 'main'
fuzzing: Add a fuzz test for parsing DNS records

See merge request GNOME/glib!2396
2021-12-16 12:47:43 +00:00
Philip Withnall
06e282e50f fuzzing: Add a fuzz test for parsing DNS records
Based on Patrick’s work to expose the parser for unit testing.

See !2134.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-16 11:26:03 +00:00
Philip Withnall
f2609eaa1a Merge branch 'move_dirname_tests' into 'main'
Moving tests/dirname-test.c to glib/tests/fileutils.c

See merge request GNOME/glib!2397
2021-12-16 11:14:47 +00:00
Emmanuel Fleury
9f760a7cc1 Moving tests/dirname-test.c to glib/tests/fileutils.c
Helps issue #1434
2021-12-16 10:41:13 +00:00
Philip Withnall
dce8d110d6 Merge branch 'move_tests/child-test_to_glib/tests/spawn-multithreaded' into 'main'
Merging tests/child-test.c into glib/tests/spawn-multithreaded.c

See merge request GNOME/glib!2390
2021-12-16 10:38:53 +00:00
Philip Withnall
11767ed96c Merge branch 'barch/glist_position_unspecified_behavior' into 'main'
fix /list/position test

See merge request GNOME/glib!2398
2021-12-16 09:47:03 +00:00
Charles Barto
d60b4010c4 Silence MSVC C4312 in list tests
This warning warns on widening casts from integer to pointer type,
because those casts can be problematic for porting to new pointer
sizes. The code in question didn't do any bad things here so an
intermediate cast to size_t was added to silence the warning
2021-12-15 17:21:20 -08:00
Charles Barto
cdd53b9218 fix /list/position test
This test was exploiting unspecified behavior w.r.t. the address of string
literals, It expected them to be pooled (the same literal has the same
address, at least within a TU), but MSVC does not pool by default,
leading to a failure.
2021-12-15 17:19:50 -08:00
Emmanuel Fleury
45bd6e1d3d Improving the tests moved in spawn-multithreaded 2021-12-16 00:55:42 +01:00
Hugo Carvalho
5aafb1f21f Update Portuguese translation 2021-12-15 23:21:04 +00:00
Emmanuel Fleury
241b9f41b4 Merging tests/child-test.c into glib/tests/spawn-multithreaded.c
Helps issue #1434
2021-12-15 23:12:59 +01:00
Yuri Chornoivan
a7a80d9855 Update Ukrainian translation 2021-12-15 19:04:20 +00:00
Philip Withnall
4d6da4457a gthreadedresolver: Tighten up types and constness of parsing code
Not everything should be an int. This code is quite dated. We now try to
use `guint8*` to represent arbitrary binary data, rather than `guchar*`
(which makes it sound like some form of string).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-12-15 17:04:20 +00:00
Patrick Griffis
49e667d250 gthreadedresolver: Export g_resolver_records_from_res_query()
While it’s not a supported public part of the API, exporting this
symbol from the library means we can easily test the DNS record parser,
which is important to do since it handles untrusted data from the
network.
2021-12-15 16:55:01 +00:00
Philip Withnall
5462612dc3 Merge branch 'mcatanzaro/posix-spawn2' into 'main'
gspawn: Implement fd remapping for posix_spawn codepath, and fix file descriptor conflation issues

Closes #2503 and #2506

See merge request GNOME/glib!1968
2021-12-15 08:17:29 +00:00
Michael Catanzaro
376e2915e2 Add test for child_err_report_fd conflation with target fds
This tests for glib#2506.
2021-12-14 13:47:31 -06:00
Michael Catanzaro
d4c486779d Add tests for GSubprocess fd conflation issues
This tests for #2503. It's fragile, but there is no non-fragile way to
test this. If the test breaks in the future, it will pass without
successfully testing the bug, not fail spuriously, so I think this is
OK.
2021-12-14 13:47:31 -06:00
Michael Catanzaro
b251a7cd18 gspawn: add new error message for open() failures
Reporting these as dup2() failures is bogus.
2021-12-14 13:45:39 -06:00
Michael Catanzaro
34de33a9bd gspawn: Check from errors from safe_dup2() and dupfd_cloexec()
Although unlikely, these functions can fail, e.g. if we run out of file
descriptors. Check for errors to improve robustness. This is especially
important now that I changed our use of dupfd_cloexec() to avoid
returning fds smaller than the largest fd in target_fds. An application
that attempts to remap to the highest-allowed fd value deserves at least
some sort of attempt at error reporting, not silent failure.
2021-12-14 13:45:39 -06:00
Michael Catanzaro
2a7547f8a5 gsubprocess: ensure we test fd remapping on the posix_spawn() codepath
We should run test_pass_fd twice, once using gspawn's fork/exec codepath
and once attempting to use its posix_spawn() codepath. There's no
guarantee we'll actually get the posix_spawn() codepath, but it works
for now on Linux.

For good measure, run it a third time with no flags at all.

This causes the test to fail if I separately break the fd remapping
implementation. Without this, we fail to test fd remapping on the
posix_spawn() codepath.
2021-12-14 13:45:39 -06:00
Michael Catanzaro
7d5bdff6d9 gspawn: Implement fd remapping for posix_spawn codepath
This means that GSubprocess will (sometimes) be able to use the
optimized posix_spawn codepath instead of having to fall back to
fork/exec.
2021-12-14 13:45:39 -06:00
Michael Catanzaro
f9780c6bee gspawn: fix fd remapping conflation issue
We currently dup all source fds to avoid possible conflation with the
target fds, but fail to consider that the result of a dup might itself
conflict with one of the target fds. Solve this the easy way by duping
all source_fds to values that are greater than the largest fd in
target_fds.

Fixes #2503
2021-12-14 13:45:39 -06:00
Michael Catanzaro
e2700c7638 gspawn: fix hangs when duping child_err_report_fd
In case child_err_report_fd conflicts with one of the target_fds, the
code here is careful to dup child_err_report_fd in order to avoid
conflating the two. It was a good idea, but evidently was not tested,
because the newly-created fd is not created with CLOEXEC set. This means
it stays open in the child process, causing the parent to hang forever
waiting to read from the other end of the pipe. Oops!

The fix is simple: just set CLOEXEC. This removes our only usage of the
safe_dup() function, so it can be dropped.

Fixes #2506
2021-12-14 13:36:26 -06:00
Michael Catanzaro
33f15d9dd0 gspawn: Improve error message when dup fails
This error message is no longer accurate now that we allow arbitrary fd
remapping.
2021-12-14 13:36:25 -06:00
Michael Catanzaro
ac8d1aa247 gspawn: use close_and_invalidate more 2021-12-14 13:36:24 -06:00
Philip Withnall
2c07c17840 Merge branch 'datetime_tests' into 'main'
Removing unnecessary test on gdatetime.c

See merge request GNOME/glib!2393
2021-12-14 15:25:40 +00:00
Philip Withnall
f493d3fd24 Merge branch 'cxx-test' into 'main'
Removing redundant cxx test tests/cxx-test.cpp

See merge request GNOME/glib!2391
2021-12-14 15:23:16 +00:00