Commit Graph

25415 Commits

Author SHA1 Message Date
Philip Withnall
5b7383c544 tests: Merge iochannel-test into io-channel tests in glib directory
We’re trying to eliminate the legacy `tests/` directory. This commit
moves the code from `tests/iochannel-test.c` into
`glib/tests/io-channel.c` and ports it to the latest GLib test coding
standards:
 * Change `g_assert()` to `g_assert_*()`
 * Print verbose messages with `g_test_message()`
 * Rename some variables to conform to modern conventions
 * Use `GTest`

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

Helps: #1434
2022-02-17 21:42:35 +00:00
Philip Withnall
a09aca68d4 glib-compile-resources: Fix a memory leak of the compiler option
`G_OPTION_ARG_STRING` returns a newly allocated string, not a `const`
one.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-17 21:18:27 +00:00
Marc-André Lureau
9f2660fbae gio: fix OOB string access if filename is empty
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-16 18:54:03 +04:00
Philip Withnall
d286ea0c57 Merge branch 'unix_mount_points' into 'main'
Add cache to g_unix_mount_points_get()

See merge request GNOME/glib!1707
2022-02-16 10:53:40 +00:00
rim
37b39c525f Add cache to g_unix_mount_points_get() 2022-02-16 10:53:40 +00:00
Philip Withnall
c70673d011 Merge branch 'w32-tests-date' into 'main'
Various glib/tests/date fixes on win32

See merge request GNOME/glib!2480
2022-02-16 00:07:53 +00:00
Marc-André Lureau
4549a97a75 glib/tests: ucrt locale date output is a bit different
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
f7c66423a4 glib/tests: set Polish ThreadLocale on win32 to fix a test
Fixes /date/month_substring
Bail out! GLib:ERROR:../glib/tests/date.c:1090:test_month_substring: 'g_date_valid (&date)' should be TRUE

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
051d000acd glib/tests: fix checking two-digit years on Windows
Fixes:
ok 10 /date/parse_locale_change

(when locale th_TH available)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-15 23:21:49 +00:00
Marc-André Lureau
acb46f8b36 glib/tests: add comment about %Z strftime on w32
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-16 03:00:06 +04:00
Yosef Or Boczko
11997a4d25 Update Hebrew translation 2022-02-15 20:57:50 +00:00
Luming Zh
19ff527cda Update Chinese (China) translation 2022-02-15 19:10:16 +00:00
Philip Withnall
40fc53d3aa 2.71.2
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-15 14:25:23 +00:00
Philip Withnall
c39c2a2821 Merge branch 'ebassi/issue-2601' into 'main'
Fix the DocBook codegen

Closes #2601

See merge request GNOME/glib!2489
2022-02-15 14:07:02 +00:00
Emmanuele Bassi
3bf76da56e Merge branch 'coverage-link' into 'main'
ci: Add link to Coverage output at end of coverage job

See merge request GNOME/glib!2467
2022-02-15 13:17:44 +00:00
Philip Withnall
b5873878cd Merge branch '1190-debugging-docs' into 'main'
gdebugcontroller: Add documentation and tests

Closes #1190

See merge request GNOME/glib!2486
2022-02-15 12:47:50 +00:00
Emmanuele Bassi
47ce6432f3 codegen: Verify that we're generating valid XML
We should output valid XML even when getting an iffy annotation.
2022-02-15 12:14:49 +00:00
Philip Withnall
00ba3ceacc Merge branch 'wip/smcv/aligned-alloc-tests' into 'main'
Fix some problems with g_aligned_alloc() tests

See merge request GNOME/glib!2488
2022-02-15 11:52:46 +00:00
Emmanuele Bassi
17f38affa2 codegen: Add missing closing angular bracket
We are matching `<parameter>` as well as `<para>`, and we
end up with broken XML in case the (expanded) description
starts with `<parameter>`.

Fixes: #2601
2022-02-15 11:51:11 +00:00
Emmanuele Bassi
6ddf760507 codegen: Remove flake8 lint rule
Using `flake8: noqa` disables ALL linting on a file. Adding
an error code does not limit the linter to that error.
2022-02-15 11:48:58 +00:00
Emmanuele Bassi
128ae2b5f5 codegen: Fix whitespace
This is Python, not C.
2022-02-15 11:48:28 +00:00
Emmanuele Bassi
fe3f699371 Add .flake8 file
The flake8 validation tool prefers an actual configuration
file to inline comments to disable the lint.
2022-02-15 11:47:30 +00:00
Philip Withnall
27798cda22 Merge branch 'fix_gdate_tests' into 'main'
Fix unit test on date format '%Z' which is too versatile to be trustable

See merge request GNOME/glib!2482
2022-02-15 11:46:59 +00:00
Simon McVittie
b0f686a00e tests: Don't test invalid aligned allocations if avoiding UB
We can't exercise precondition check failures if GLib was (inadvisably)
compiled with -Dglib_checks=false, and we shouldn't necessarily exercise
precondition check failures when using QA tools like valgrind, so skip
these tests if run with -m no-undefined.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 11:03:00 +00:00
Simon McVittie
38cdfe3c02 tests: Make g_aligned_alloc tests fail if preconditions aren't checked
Previously, these tests would always pass. If the precondition check
failed (as we want it to), the subprocess would exit unsuccessfully;
but if the precondition check wrongly passed, the subprocess would
continue, allocate a nonzero amount of memory, and fail the
g_assert_null(), resulting in the subprocess exiting unsuccessfully
and the test still passing.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 10:52:59 +00:00
Simon McVittie
d04f3491af tests: Don't assume that all platforms are 64-bit
On ILP32 platforms, 4 is a valid alignment for g_aligned_alloc(), so
use 2 as our invalid alignment instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-15 10:49:51 +00:00
Emmanuel Fleury
81764b6508 Fix unit test on date format '%Z' which is too versatile to be trustable 2022-02-15 11:43:25 +01:00
Rafael Fontenelle
66857db98e Update Brazilian Portuguese translation 2022-02-14 22:20:24 +00:00
Matej Urbančič
e613aed96d Update Slovenian translation 2022-02-14 21:40:52 +00:00
Fran Dieguez
ac06c48b31 Update Galician translation 2022-02-14 20:44:29 +00:00
Marek Černocký
b28166cdbc Updated Czech translation 2022-02-14 20:40:54 +01:00
Philip Withnall
b7d3e3f16e tests: Add tests for GDebugController
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #1190
2022-02-14 14:42:17 +00:00
Philip Withnall
1b3e6bab53 gdebugcontrollerdbus: Add stop() method
This allows the controller to explicitly be removed from the bus, in a
way that allows the caller to synchronise with it and know that all
other references to the controller should have been dropped (i.e. after
this method returns, there should be no in-flight D-Bus calls still
holding a reference to the object).

This is needed to be able to guarantee finalisation of the controller in
unit tests (and comparable real-world situations).

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

Helps: #1190
2022-02-14 14:42:17 +00:00
Hugo Carvalho
6338db9c97 Update Portuguese translation 2022-02-14 14:01:37 +00:00
Yuri Chornoivan
010194fbf3 Update Ukrainian translation 2022-02-14 13:56:00 +00:00
Philip Withnall
1f75ca6ebd Merge branch 'ebassi/compile-resource-split' into 'main'
Do not generate C resources for all possible toolchains

Closes #2492

See merge request GNOME/glib!2250
2022-02-14 13:47:42 +00:00
Emmanuele Bassi
6c42c79d6c Use glib-compile-resource's compiler type
Since we call `glib-compile-resources` through a custom_target(), we
need to set the compiler type we're targeting.
2022-02-14 13:09:22 +00:00
Emmanuele Bassi
7bc6ef8734 Do not generate C resources for all possible toolchains
The resources data is generated for both GCC and MSVC toolchains, even
though we know beforehand which toolchain we're going to compile it for.
By dropping the data duplication we make the generated resources file
faster to compile, especially when dealing with large embedded data,
instead of relying on the C pre-processor to walk the whole file and
discard the branch we're not using.
2022-02-14 13:09:22 +00:00
Philip Withnall
40aeefc9ee Merge branch 'gconstructor-h-fix' into 'main'
gconstructor.h: Visual Studio: Only include gslist.h if needed

Closes libadwaita#418

See merge request GNOME/glib!2487
2022-02-14 12:27:19 +00:00
Chun-wei Fan
87db363501 gconstructor.h: Visual Studio: Only include gslist.h if needed
We only want to include gslist.h here if it was not already included via
including glib.h, as:

* gslist.h should normally be included via glib.h if used outside of
  GLib itself.
* This broke Visual Studio builds that use GResources (via
  glib-compile-resources.exe) as that would cause the generated code to
  include gslist.h directly, which is therefore disallowed.
2022-02-14 18:35:58 +08:00
Matej Urbančič
6ee71750a5 Update Slovenian translation 2022-02-13 16:48:01 +00:00
Aleksandr Melman
347ffda327 Update Russian translation 2022-02-13 16:21:22 +00:00
Asier Sarasua Garmendia
058251ad5b Update Basque translation 2022-02-13 09:15:52 +00:00
Fran Dieguez
e062679631 Update Galician translation 2022-02-12 20:49:17 +00:00
Jordi Mas i Hernandez
f53e7be82b Update Catalan translation 2022-02-12 14:48:36 +00:00
Philip Withnall
f9c08308ea Merge branch 'ebassi/aligned-alloc' into 'main'
Add aligned memory allocators

Closes #2574

See merge request GNOME/glib!2421
2022-02-11 15:04:25 +00:00
Philip Withnall
a6311f81ee gtestutils: Handle empty argv array passed to g_test_init()
This can happen if a caller (ab)uses `execve()` to execute a gtest
process with an empty `argv` array. `g_test_init()` has to gracefully
handle such a situation.

Fix a few problem areas in the code, and add a simple test which checks
that `g_test_init()` doesn’t crash when called with an empty `argv`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:47:19 +00:00
Philip Withnall
44f4d55150 gspawn: Clarify that empty argv arrays are not allowed when spawning
While `execve()` might allow (probably malicious) users to execute a
program with an empty `argv` array, gspawn does not. It’s not actually
possible, as the path to the binary to execute is not specified
separately from the argument array.

Explicitly document and encode that in preconditions.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:43 +00:00
Philip Withnall
18fc711355 gshell: Mention handling of empty argv arrays in the documentation
It is not possible for `g_shell_parse_argv()` to return an empty `argv`
array. Make that clear in the documentation and add some assertions to
encode it explicitly in the code.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:43 +00:00
Philip Withnall
11654811ef gdesktopappinfo: Add checks for empty argv
There shouldn’t be any issues here with empty argv arrays since an empty
`Exec=` line is already checked for. Encode that explicitly with an
assertion.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:42 +00:00