Commit Graph

25802 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
b61cd872f1 build: Threat unused-result warnings as errors
We don't have any in code now, so we should definitely ensure that we
won't introduce anymore unguarded calls.
2022-07-06 18:41:10 +02:00
Marco Trevisan (Treviño)
7a382438aa glib/tests: Ensure that calls to write, system, symlink and pipe are checked
Assert that calls to such system calls are returning the expected values
2022-07-06 18:41:10 +02:00
Marco Trevisan (Treviño)
a5390002fc gio-tool-mount: Exit with error in case we can't read from stdin
It's a fatal situation so we can just exit without caring much.
2022-07-06 16:05:33 +02:00
Marco Trevisan (Treviño)
0e4d8c2478 gbacktrace: Ensure return values of write, dup and fgets are used
Make sure that we did not error when doing write or read operations, and
in such case, just exit reporting the error.
2022-07-06 16:02:13 +02:00
Philip Withnall
8385f52db7 Merge branch 'inline-macros' into 'main'
gmacros: Provide platform-independent G_ALWAYS_INLINE and G_NO_INLINE

See merge request GNOME/glib!2781
2022-07-06 13:40:10 +00:00
Marco Trevisan
45028d7d3e Merge branch 'gmodule-invalid-la-file' into 'main'
gmodule: Improve error handling for invalid .la files

See merge request GNOME/glib!2796
2022-07-06 13:00:09 +00:00
Marco Trevisan (Treviño)
e59ac0bc2d gthread-posix: Use G_NO_INLINE instead of actual attribute
Even if this is gcc/clang-only code, it's just better to use the generic
macros we now have.
2022-07-06 14:57:06 +02:00
Marco Trevisan (Treviño)
a6f8fe071e cleanup: Replace G_GNUC_NO_INLINE with G_NO_INLINE
As per this we can also now mark G_GNUC_NO_INLINE as
GLIB_AVAILABLE_MACRO_IN_2_58, given that we don't have anymore headers
using it.
2022-07-06 14:57:06 +02:00
Marco Trevisan (Treviño)
15cd0f0461 gmacros: Provide platform-independent G_ALWAYS_INLINE and G_NO_INLINE
We had gcc-only implementations for them while both can be used in all
the supported platforms we have.

So let's just provide generic definitions, while we keep the old ones
for both consistency and retro-compatibility.
2022-07-06 14:57:06 +02:00
Philip Withnall
06be6ac8fc gmodule: Use Unicode quotation marks in error messages
This makes them a little nicer to read.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-06 13:33:46 +01:00
Philip Withnall
9b02e58e88 gmodule: Improve error handling for invalid .la files
If a `.la` file is empty, `lt_libdir` and/or `lt_dlname` won’t be set,
but will then still be used in `g_strconcat()`, leading to invalid
output.

Detect that and return an error.

Adds a unit test.

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

Coverity CID: #1474756
2022-07-06 13:33:10 +01:00
Marco Trevisan
5764e3944d Merge branch 'key-file-dead-code' into 'main'
gkeyfile: Remove some unreachable code

See merge request GNOME/glib!2795
2022-07-06 11:06:46 +00:00
Marco Trevisan
d74c773fa4 Merge branch 'more-spdx2' into 'main'
gio: Add some missing license and copyright headers

See merge request GNOME/glib!2797
2022-07-06 11:05:56 +00:00
Philip Withnall
59fc26cbaa gio: Add some missing license and copyright headers
These headers have all been written manually, by looking through the git
log for each file and noting the copyright of each significant
contribution.

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

Helps: #1415
2022-07-05 12:30:46 +01:00
Philip Withnall
1b7f76f1ec docs: Mark .wrap files as uncopyrightable
They’re too trivial to be copyrightable.

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

Helps: #1415
2022-07-05 12:15:15 +01:00
Philip Withnall
41691cc4c8 Merge branch 'more-spdx' into 'main'
Add more SPDX license headers

See merge request GNOME/glib!2706
2022-07-05 11:06:49 +00:00
Philip Withnall
3c69cd369f gkeyfile: Remove some unreachable code
There’s a precondition assertion on the function which checks that
`group_name != NULL`.

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

Coverity CID: #1474780
2022-07-05 10:41:49 +01:00
Peter Bloomfield
4ef2025d47 gobject/tests/binding: Add a test with run-dispose
Add tests in which `g_object_run_dispose()` is called on the source or target
of a `GBinding`. After commit a4fa456e67,
the target test caused a failed assertion in `g_weak_ref_set()` that was not
found by the existing tests.  Commit 94ba14d542
weakens the assertion to allow the test to succeed.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2676
2022-07-04 13:16:21 -04:00
Peter Bloomfield
94ba14d542 gobject: Weaken an assertion in g_weak_ref_set()
When weak references are being cleaned up, it is possible for the `qdata` for
both `quark_weak_locations` and `quark_weak_refs` to have been deallocated,
so that `g_datalist_id_get_data()` returns `NULL` for both. This happens
when `g_object_run_dispose()` is called for the target of a `GBinding`,
and is not an error.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2676
2022-07-03 14:56:44 -04:00
Мирослав Николић
ccc9bc1400 Update Serbian translation
(cherry picked from commit 776719234a)
2022-07-03 01:58:32 +00:00
Aurimas Černius
21373478db Updated Lithuanian translation 2022-07-02 22:02:44 +03:00
Aleksandr Melman
8c262667b9 Update Russian translation 2022-07-02 18:45:29 +00:00
Hugo Carvalho
b1ffc838ce Update Portuguese translation 2022-06-30 21:16:44 +00:00
Marco Trevisan
777f0975f9 Merge branch 'content-type-locking' into 'main'
gcontenttype: Fix a potential use-after-free of xdgmime data

See merge request GNOME/glib!2786
2022-06-30 15:01:41 +00:00
Marco Trevisan
f86d8e2291 Merge branch 'thread-pool-fix-test' into 'main'
test: Potentially fix a race in thread-pool-slow test

See merge request GNOME/glib!2667
2022-06-30 15:00:28 +00:00
Philip Withnall
c530debb62 tests: Shorten another sleep/retry loop in thread-pool-slow
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-30 14:42:37 +01:00
Philip Withnall
afc0883652 test: Potentially fix a race in thread-pool-slow test
It’s failed on a CI machine
(https://gitlab.gnome.org/GNOME/glib/-/jobs/2006694) with log:
```
[unused] => pushed 100 threads onto the idle pool
[unused] stopping unused threads
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] waiting ONE second for threads to die
[unused] stopped idle threads, 9 remain
Bail out! GLib:ERROR:../glib/tests/thread-pool-slow.c:113:test_thread_stop_unused: assertion failed (g_thread_pool_get_num_unused_threads () == 0): (9 == 0)
```

I can’t reproduce this locally, but it’s possible that it failed because
a one second wait was not enough to enqueue all the jobs (on a heavily
loaded machine), and hence some jobs spawned thread pool threads after
calling `g_thread_pool_stop_unused_threads()`, leading to the assertion
failure.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-30 14:41:36 +01:00
Philip Withnall
ecec522835 gcontenttype: Clarify some ownership transfers
This introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-30 14:21:37 +01:00
Philip Withnall
45d4c52501 gcontenttype: Fix a potential use-after-free of xdgmime data
While `gio_xdgmime` is unlocked, the data which `type` points to in the
xdgmime cache might get invalidated, leaving `type` as a dangling
pointer. That would not bode well for the `g_strdup (type)` call to
insert a new entry into the `type_comment_cache` once `gio_xdgmime` is
re-acquired.

This was spotted using static analysis, and the symptoms have not
knowingly been seen in the wild.

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

Coverity CID: #1474702
2022-06-30 14:21:18 +01:00
Philip Withnall
89b1fe42d7 Merge branch 'testing-docs' into 'main'
docs: Add a testing policy

See merge request GNOME/glib!2748
2022-06-30 10:24:35 +00:00
Marco Trevisan
f7113ae607 Merge branch 'uuid-fuzzing' into 'main'
fuzzing: Add fuzz test for g_uuid_string_is_valid()

See merge request GNOME/glib!2744
2022-06-30 05:49:14 +00:00
Emmanuele Bassi
5cf742d42e Merge branch 'ebassi/c99-macro-varargs' into 'main'
Require C99's __VA_ARGS__

Closes #2681

See merge request GNOME/glib!2791
2022-06-30 01:40:55 +00:00
Emmanuele Bassi
f38908240f Merge branch 'ebassi/enum-type-macros' into 'main'
Add G_DEFINE macros for enum and flags types

See merge request GNOME/glib!2788
2022-06-30 01:24:30 +00:00
Emmanuele Bassi
c4f9b926d8 Add versioning to the new macros
They are available in 2.74.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
c0766caf20 Use varargs for enum types definition macros
Makes the syntax a little bit better.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
fa05ebe27c docs: Mention alternatives for defining enumeration types
We should mention glib-mkenums in the documentation for
G_DEFINE_ENUM_TYPE and G_DEFINE_FLAGS_TYPE.

We should also mention the macros in the documentation for glib-mkenums.

This way, developers can choose the most appropriate tool for their use
case.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
6cbf7a7461 Port enums tests to the appropriate assert functions
Do not use `g_assert()` inside tests, as the symbol can be disabled.
Instead, use `g_assert_null()` and `g_assert_nonnull()`.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
28edd84e77 docs: Add the new G_DEFINE macros for enumeration types 2022-06-30 01:46:54 +01:00
Emmanuele Bassi
2a9ef1e0b4 Test the newly added G_DEFINE macros for enumeration types 2022-06-30 01:46:54 +01:00
Emmanuele Bassi
9a4a10fbc8 Add G_DEFINE macros for enum and flags types
While you might want to use automated tools like glib-mkenums to
generate enumeration types for your library, it's often not entirely
necessary to complicate your build system in order to handle a couple of
enumerations with few values.

Just like we have G_DEFINE macros for object, interface, pointer, and
boxed types, we should provide macros for defining enum and flags types.
2022-06-30 01:46:54 +01:00
Emmanuele Bassi
2a12de5b1d Require C99's __VA_ARGS__
We have fallback in places for GNU's variadic arguments in macros, and
for static inline functions with variadic arguments as an fallback of
last resort, but going forward we are going to depend on `__VA_ARGS__`
for macros that cannot be re-implemented using a static inline function.

Fixes: #2681
2022-06-30 01:46:32 +01:00
Emmanuele Bassi
89b34963e7 Merge branch 'wip/pwithnall/macos-yet-again' into 'main'
ci: Ensure git submodules are updated before running macOS CI

See merge request GNOME/glib!2792
2022-06-30 00:45:53 +00:00
Philip Withnall
dc2c769d5c ci: Ensure git submodules are updated before running macOS CI
Since the macOS CI jobs are run on a machine which isn’t using a
pre-made container image, we can’t ship a cached version of the
subproject, so it has to be pulled as a git submodule.

GitLab doesn’t do that by default unless you set
`GIT_SUBMODULE_STRATEGY` to something other than `none`.

See https://docs.gitlab.com/ee/ci/git_submodules.html

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-30 01:31:02 +01:00
Emmanuele Bassi
d2c715d7a8 Merge branch 'why-are-the-tests-always-breaking' into 'main'
tests: Skip assert-msg-test.py if gdb is non-functional

See merge request GNOME/glib!2790
2022-06-29 14:49:08 +00:00
Philip Withnall
466a080c45 Merge branch 'typos' into 'main'
gdate: Fix a typo in a code comment

See merge request GNOME/glib!2789
2022-06-29 14:28:51 +00:00
Philip Withnall
6e44151bf7 tests: Skip assert-msg-test.py if gdb is non-functional
Some of the CI runners disable ptrace, as they’re running inside a
container and ptrace would allow container escape. On those systems, gdb
can’t work, so skip the gdb test.

Add some additional stderr debug output to make it clear that’s the
case.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-06-29 15:07:20 +01:00
Michael Vetter
162df3a6fa gdate: Fix a typo in a code comment 2022-06-29 16:05:09 +02:00
Marco Trevisan
5e4fa36680 Merge branch 'wip/pwithnall/ci-image-updates' into 'main'
ci: Update CI images to add gdb and pcre2

See merge request GNOME/glib!2782
2022-06-28 18:11:14 +00:00
Yuri Chornoivan
cf3ea1a3f1 Update Ukrainian translation 2022-06-28 16:18:40 +00:00
Philip Withnall
bd56345f23 Merge branch 'move_assert-msg-test' into 'main'
Convert tests/assert-msg-test* to glib/tests/assert-msg-test*

Closes #1434

See merge request GNOME/glib!2767
2022-06-28 10:41:59 +00:00