Commit Graph

24690 Commits

Author SHA1 Message Date
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
Philip Withnall
3ea4ba31a1 tools: Fix handling of empty argv in various minor GLib tools
This won’t really affect anything, but we might as well fix them to not
crash if called with an empty `argv` by someone (ab)using `execve()`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:42 +00:00
Philip Withnall
0d743e7ffb gapplicationcommandline: Handle the possibility empty args in an example
While it’s not usual, it is possible for applications to be called with
an empty `argv` by a process (ab)using `execve()`. Modify the
`GApplication` code example to handle that possibility, so that anyone
copying the example isn’t introducing a bug into their program
immediately.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:42 +00:00
Philip Withnall
fc6d0ba3a8 gapplicationcommandline: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-02-11 14:45:42 +00:00
Emmanuele Bassi
36449ef5f9 Explain the errno use in g_aligned_alloc() 2022-02-11 14:44:09 +00:00
Emmanuele Bassi
b37c99c44e Add tests for g_aligned_alloc()
We want to test the API contract, by checking the return value for
zero-sized allocations, invalid alignments, and overflows.
2022-02-11 14:44:09 +00:00
Emmanuele Bassi
475d574440 Add aligned memory allocators
When working with storage (especially GInputStream or GOutputStream) it
is preferred to use page-aligned buffers so that the operating system
can do page-mapping tricks as the operation passes through the kernel.

Another use case is allocating memory used for vectorised operations,
which must be aligned to specific boundaries.

POSIX and Windows, as well as the C11 specification, provide this kind
of allocator functions, and GLib already makes use of it inside GSlice.
It would be convenient to have a public, portable wrapper that other
projects can use.

Fixes: #2574
2022-02-11 14:44:09 +00:00
Philip Withnall
1094bfc7d7 Merge branch 'wip/smcv/defer-test-cleanup' into 'main'
testutils: Defer global cleanup until we really exit

Closes #2563

See merge request GNOME/glib!2420
2022-02-11 14:21:43 +00:00
Philip Withnall
f2d67f3605 gtestutils: Mark a variable as const
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

See: !2420
2022-02-11 13:04:06 +00:00
Simon McVittie
00b17c92bf Add a test-case for calling g_test_build_filename after g_test_run
This will not reproduce the bug when run as a unit test, because in that
scenario, G_TEST_BUILDDIR and G_TEST_SRCDIR are set. It *can* reproduce
the bug (at least probabilistically) when run as an installed-test,
or manually in a build tree:

    ./_build/glib/tests/testing

Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2563
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-11 13:04:06 +00:00
Philip Withnall
6fd53df562 Merge branch 'wip/hadess/timer-docs' into 'main'
gtestutils: Mention the unit used for the test timer

See merge request GNOME/glib!2378
2022-02-11 12:46:15 +00:00
Philip Withnall
a71ed21116 Merge branch 'unicode-script-math' into 'main'
Add G_UNICODE_SCRIPT_MATH to GUnicodeScript

See merge request GNOME/glib!2476
2022-02-11 12:42:55 +00:00
Alexis King
e85a085ca4 Add G_UNICODE_SCRIPT_MATH to GUnicodeScript 2022-02-11 12:42:55 +00:00
Philip Withnall
95c6f3dc38 Merge branch '2329-application-cli-parsing' into 'main'
gapplication: Expose zero-valued numbers in handle-local-options

Closes #2329

See merge request GNOME/glib!1953
2022-02-11 12:40:37 +00:00
Matheus Barbosa
14e0eab02a Update Brazilian Portuguese translation 2022-02-10 20:20:19 +00:00
Philip Withnall
6d5953ee48 gdebugcontroller: Add some more documentation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1190
2022-02-10 19:24:17 +00:00
Philip Withnall
35f6c65b35 giomodule: Ensure GDebugControllerDBus is registered
Or it’ll never work as a `GIOModule`, as the implementation won’t be
found.

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

Helps: #1190
2022-02-10 19:23:49 +00:00
Philip Withnall
a03920152f gdebugcontrollerdbus: Fix a typo in a D-Bus interface name
This was preventing `PropertiesChanged` signals from working.

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

Helps: #1190
2022-02-10 19:23:21 +00:00
Philip Withnall
29edfc1169 gdebugcontroller: Drop dup_default() method as it’s broken
If `GDebugControllerDBus` remains as the only, or default,
implementation of `GDebugController`, `dup_default()` cannot work.
`GDebugControllerDBus` requires a `GDBusConnection` at construction
time, which the `GIOModule` construction code can’t provide it.

Either we use a default D-Bus connection (but which one? and how would
it be changed by the user later if it was the wrong one?), or delegate
singleton handling of the `GDebugController` to the user.

The latter approach seems more flexible.

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

Helps: #1190
2022-02-10 19:21:24 +00:00
Sebastian Dröge
cfd245bc78 Merge branch 'test-skip-fix-win32' into 'main'
tests: Use g_test_skip() to skip a test on Windows

See merge request GNOME/glib!2484
2022-02-10 13:40:28 +00:00
Philip Withnall
0c27ac8287 tests: Use g_test_skip() to skip a test on Windows 2022-02-10 13:40:28 +00:00
Hugo Carvalho
484c884469 Update Portuguese translation 2022-02-10 13:35:57 +00:00
Nirbheek Chauhan
a93a8db5d3 Merge branch 'w32-tests-datetime' into 'main'
Fix glib/tests/gdatetime on win32

See merge request GNOME/glib!2483
2022-02-10 09:43:26 +00:00
Marc-André Lureau
32f514b0fa glib/tests: skip more tests that depend on installed translations
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
6d21ff6305 glib/tests: skip test that aborts with plain Windows UCRT
setlocale() asserts on LC_MESSAGES:
minkernel\crts\ucrt\src\appcrt\locale\wsetlocale.cpp(448) : Assertion failed: LC_MIN <= _category && _category <= LC_MAX

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale
https://developercommunity.visualstudio.com/t/setlocale-assert-on-invalid-category/1646244

(apparently, MinGW wraps or reimplements the call)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00
Marc-André Lureau
9e9e323a2d glib/tests: set DE ThreadLocale to fix a test
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-02-10 12:44:59 +04:00