Commit Graph

30690 Commits

Author SHA1 Message Date
Philip Withnall
27c02a0be4
tests: Test against a sample mtab file in unix-mounts for getmntent()
The test in `unix-mounts` to see whether `g_unix_mounts_get_from_file()`
can parse an example file was working fine when GLib is built with
libmount, but not when built without it (and hence typically using
`getmntent()`).

This is because libmount supports mountinfo files (like
`/proc/self/mountinfo`), but `getmntent()` only supports mount files
(like `/proc/mounts`). The test was written only with the former.

So, change the test to use mount files when GLib is built without
libmount support.

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

Fixes: #3456
2024-08-27 12:13:35 +01:00
Philip Withnall
c242972043 Merge branch 'ewlsh/gi-async-function-annotations' into 'main'
girepository: Add APIs for sync, async, and finish function annotations

See merge request GNOME/glib!3746
2024-08-26 16:40:54 +00:00
Philip Withnall
bfd1d73841 Merge branch 'version-bump' into 'main'
build: Post-release version bump

See merge request GNOME/glib!4216
2024-08-26 11:22:30 +00:00
Philip Withnall
e6c26caf44
ci: Also build gobject-introspection in test-msys2.sh
The build instructions for msys2 builds are stored outwith
`.gitlab-ci.yml`.

We need to build a specific (recent) version of gobject-introspection so
we can get support for async annotations in `g-ir-scanner`. See !3746.

Fixes commit 93271385f9.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:44 +01:00
Philip Withnall
39671c196d
girepository: Fix hole in GIFunctionInfoFlags
It’s unclear why there was a hole in this. Let’s keep things less
confusing by eliminating it.

Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:28 +01:00
Philip Withnall
0a60b57fd4
girepository: Fix API version ‘since’ numbers
Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:08:13 +01:00
Philip Withnall
10177cf3ea
girepository: Coding style fixes
Fixes commit 453dd4be9e.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 12:07:49 +01:00
Evan Welsh
453dd4be9e girepository: Add APIs for sync, async, and finish function annotations 2024-08-26 12:07:25 +01:00
Evan Welsh
93271385f9 ci: Set gobject-introspection version and build gobject-introspection in tests
The minimum version is now 1.80.0
2024-08-26 12:07:25 +01:00
Philip Withnall
b0ac7acb8e Merge branch 'wip/pwithnall/3415-freebsd-gmodule' into 'main'
Revert "gmodule-dl: Use RTLD_DEFAULT on FreeBSD too"

Closes #3415

See merge request GNOME/glib!4199
2024-08-26 10:36:20 +00:00
Philip Withnall
ea44c0e4e0
build: Post-release version bump
This opens up the development cycle for 2.84.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-26 10:42:32 +01:00
Philip Withnall
593b88bf1f Merge branch '3417-mutex-speedup' into 'main'
gthread: Move thread _impl functions to static inlines for speed

Closes #3417

See merge request GNOME/glib!4214
2024-08-26 07:35:58 +00:00
Philip Withnall
aec5785e7b
gthread: Move thread _impl functions to static inlines for speed
The changes made in commit bc59e28bf6
(issue #3399) fixed introspection of the GThread API. However, they
introduced a trampoline in every threading function. So with those
changes applied, the disassembly of `g_mutex_lock()` (for example) was:
```
0x7ffff7f038b0 <g_mutex_lock>    jmp 0x7ffff7f2f440 <g_mutex_lock_impl>
0x7ffff7f038b5                   data16 cs nopw 0x0(%rax,%rax,1)
```

i.e. It jumps straight to the `_impl` function, even with an optimised
build. Since `g_mutex_lock()` (and various other GThread functions) are
frequently run hot paths, this additional `jmp` to a function which has
ended up in a different code page is a slowdown which we’d rather avoid.

So, this commit reworks things to define all the `_impl` functions as
`G_ALWAYS_INLINE static inline` (which typically expands to
`__attribute__((__always_inline__)) static inline`), and to move them
into the same compilation unit as `gthread.c` so that they can be
inlined without the need for link-time optimisation to be enabled.

It makes the code a little less readable, but not much worse than what
commit bc59e28bf6 already did. And perhaps
the addition of the `inline` decorations to all the `_impl` functions
will make it a bit clearer what their intended purpose is
(platform-specific implementations).

After applying this commit, the disassembly of `g_mutex_lock()`
successfully contains the inlining for me:
```
=> 0x00007ffff7f03d80 <+0>:	xor    %eax,%eax
   0x00007ffff7f03d82 <+2>:	mov    $0x1,%edx
   0x00007ffff7f03d87 <+7>:	lock cmpxchg %edx,(%rdi)
   0x00007ffff7f03d8b <+11>:	jne    0x7ffff7f03d8e <g_mutex_lock+14>
   0x00007ffff7f03d8d <+13>:	ret
   0x00007ffff7f03d8e <+14>:	jmp    0x7ffff7f03610 <g_mutex_lock_slowpath>
```

I considered making a similar change to the other APIs touched in #3399
(GContentType, GAppInfo, GSpawn), but they are all much less performance
critical, so it’s probably not worth making their code more complex for
that sake.

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

Fixes: #3417
2024-08-25 21:56:14 +01:00
Philip Withnall
f92da0cb49 Merge branch '3421-glib_debug-docs' into 'main'
docs: Set -Dglib_debug=enabled by default and document it for distros

Closes #3421

See merge request GNOME/glib!4212
2024-08-25 18:51:13 +00:00
Philip Withnall
b02e29558f
docs: Set -Dglib_debug=enabled by default and document it for distros
As per https://gitlab.gnome.org/GNOME/glib/-/issues/3421#note_2206315:

It seems like there’s agreement that glib_debug should be enabled for
developers and disabled for distros; and it also seems like there’s no
reliable way to figure this out magically (because not everyone ties
things to `-Dbuildtype=*`). So, we’re left with forcing some group of
people to manually set the value of `glib_debug`. There are more
developers/contributors than there are distros, and distros are more
likely to notice an accidentally-slow GLib package than developers are
likely to notice an accidentally-not-asserting-hard-enough local build,
so let’s say:

The default should be `-Dglib_debug=enabled`, and distros should probably
all override that to `-Dglib_debug=disabled`.

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

Fixes: #3421
2024-08-25 18:34:05 +01:00
Philip Withnall
94078c9f96
meson: Fix reference to docs/macros.md in meson.options
It was renamed from `macros.txt` a while ago.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-25 18:25:51 +01:00
Michael Catanzaro
e5997f1eac Merge branch '3451-ui-example' into 'main'
gmenumodel: Acknowledge in docs that the UI used in the example is old

Closes #3451

See merge request GNOME/glib!4210
2024-08-25 17:21:20 +00:00
Michael Catanzaro
36eed2042d Merge branch '3450-epoll-create' into 'main'
build: Check for epoll_create1 rather than epoll_create in meson.build

Closes #3450

See merge request GNOME/glib!4209
2024-08-25 17:21:06 +00:00
Philip Withnall
282545565a Merge branch 'ci-msys2-mingw32-catch-access-violation' into 'main'
CI/msys2-mingw32: Set the G_DEBUGGER environment variable

See merge request GNOME/glib!4205
2024-08-25 15:36:08 +00:00
Philip Withnall
dfed38ef03
gmenumodel: Acknowledge in docs that the UI used in the example is old
This kind of deeply nested menu is definitely no longer good UI practice
for most apps (deeply nested menus make things hard to find, and require
good mouse control to navigate). However, it does serve as a good
demonstration of the concepts in `GMenuModel`, so keep it, with a
sentence to acknowledge that it’s not a good UI.

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

Fixes: #3451
2024-08-25 15:34:32 +01:00
Philip Withnall
87ebb444a5 Merge branch 'translation' into 'main'
Update Chinese translation

See merge request GNOME/glib!4207
2024-08-25 14:31:03 +00:00
Philip Withnall
fd8ede0b66
build: Check for epoll_create1 rather than epoll_create in meson.build
Because `epoll_create1()` is what the code in `giounix-private.c`
actually uses.

Spotted by Xuntao Chi.

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

Fixes: #3450
2024-08-25 15:28:21 +01:00
Philip Withnall
626ab87d16 Merge branch 'update-sv-translation' into 'main'
Update Swedish translation

See merge request GNOME/glib!4208
2024-08-25 14:27:30 +00:00
Anders Jonsson
052b295ac2 Update Swedish translation 2024-08-25 14:06:59 +02:00
lumingzh
f2007e0cfd update Chinese translation 2024-08-24 13:14:03 +00:00
Luca Bacci
84c2d64436 docs: Don't reference Unix-only method GLib.Source.add_unix_fd
gi-docgen won't find the method on Windows
2024-08-23 15:57:13 +02:00
Luca Bacci
1265b456d1 CI/msys2-mingw32: Set G_DEBUGGER environment variable
This enables us to catch access violation errors in CI and
get meaningful stacktraces with gdb.

Helps #3042

See https://docs.gtk.org/glib/running.html#environment-variables
2024-08-23 15:41:34 +02:00
Philip Withnall
3d53902fc3 Merge branch 'fix_typo_in_comment' into 'main'
issue 3428: fix comment in escape_string

Closes #3428

See merge request GNOME/glib!4200
2024-08-21 10:03:55 +00:00
LI Daobing
0ad7709c22 issue 3428: fix comment in escape_string 2024-08-20 18:24:33 -07:00
Michael Catanzaro
255ffe09d4 Merge branch 'unixmounts-fixes' into 'main'
gunixmounts: Fix use of uninitialised variable

See merge request GNOME/glib!4197
2024-08-20 16:21:24 +00:00
Philip Withnall
82295998ac
Revert "gmodule-dl: Use RTLD_DEFAULT on FreeBSD too"
This reverts commit bb2ab2647d.

It appears to break the use of `G_MODULE_BIND_LOCAL`, as evidenced by
the `test_local_binding()` test in `module-test.c` failing on FreeBSD
ever since that test was added. See #3415.

Looking back at the merge request (!3656), I should have pressed for
detail on why this change was needed.

Fixes: #3415
2024-08-20 14:47:23 +01:00
Philip Withnall
23a7b4bf17 Merge branch 'wip/pwithnall/cancellable-test-fixes' into 'main'
tests: Run expected-to-hang cancellable tests in subprocesses

See merge request GNOME/glib!4198
2024-08-20 13:40:34 +00:00
Philip Withnall
ce71da63ba
Revert "gio/tests/cancellable: Explain failure on GCancellableSource tests on valgrind"
This reverts commit 365411ea32.

Since commit 3a07b2abd4, issue 2309 has
been fixed, so we should no longer have failures from valgrind here.
2024-08-20 13:02:43 +01:00
Philip Withnall
71cd903118
tests: Run expected-to-hang cancellable tests in subprocesses
These tests are expected to cause a thread to deadlock. That seems to be
fine with glibc on Linux, but the glibc version on FreeBSD can detect
the deadlock, and aborts the whole test process with:
```
GLib (gthread-posix.c): Unexpected error from C library during 'pthread_mutex_lock': Resource deadlock avoided.  Aborting.
```

This is fair enough.

To avoid this causing the test suite to fail, run those two tests in
subprocesses. This also means we’re not carrying a deadlocked thread
around for the rest of the test suite.

Improves on commit 62192925b6.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-20 13:02:36 +01:00
Philip Withnall
4235c11757
gunixmounts: Fix use of uninitialised variable
And drop a load of unused variables.

Fixes commit 5040cf1943.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-20 12:39:15 +01:00
Philip Withnall
fe5b9b41b7 Merge branch 'main' into 'main'
Replace hi.po with updated translations.

See merge request GNOME/glib!4195
2024-08-19 11:46:09 +00:00
Karunakar Guntupalli
f67081e118 Replace hi.po with updated translations.
Please refer for veritimus submission -  https://l10n.gnome.org/vertimus/400/390/62/
2024-08-17 18:38:04 +00:00
Philip Withnall
73f5ca5763
2.81.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-16 19:37:20 +01:00
Marco Trevisan
e113052558 Merge branch 'wip/pwithnall/3315-sigaltstack-again' into 'main'
tests: Move alternate stack onto the heap rather than the main stack

Closes #3315

See merge request GNOME/glib!4194
2024-08-16 14:47:13 +00:00
Philip Withnall
84728d4e01
tests: Move alternate stack onto the heap rather than the main stack
And size it to `sysconf (_SC_MINSIGSTKSZ)`, if defined.

This might fix the sigaltstack test on muslc, as suggested by Markus
Wichmann (https://www.openwall.com/lists/musl/2024/05/30/2) and Rich Felker
(https://www.openwall.com/lists/musl/2024/05/29/7) on the musl mailing
list.

The thinking is that the CI machine might have a huge register file
(AVX512 or some other large extension) which doesn’t fit in `MINSIGSTKSZ`.
By sizing the alternate stack to `sysconf (_SC_MINSIGSTKSZ)` we should
be able to avoid that.

Moving it onto the heap should avoid any potential complications or bugs
from having one stack embedded within another.

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

Fixes: #3315
2024-08-16 14:27:25 +01:00
Philip Withnall
f4aceb0e91 Merge branch 'wip/pwithnall/unix-mount-tests' into 'main'
gunixmounts: Add mount point/entry getters from files and add tests based on them

See merge request GNOME/glib!4163
2024-08-15 14:25:52 +00:00
Emmanuele Bassi
b540bdd961 Merge branch 'volume-docs' into 'main'
docs: Clarify distinction between GDrive, GVolume and GMount

See merge request GNOME/glib!4193
2024-08-15 11:06:36 +00:00
Philip Withnall
b4332b0056
docs: Clarify distinction between GDrive, GVolume and GMount
Provide examples of what they all represent, and expand on the
descriptions of them in a few places.

Move references to their equivalents from `GnomeVFS` to lower down in
the documentation, since `GnomeVFS` has been deprecated for many years
now, and is unlikely to be pertinent to most readers.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-15 11:32:37 +01:00
Philip Withnall
67b4a27569 Merge branch 'ghrfunc-doc' into 'main'
ghash: Fix the documentation of GHRFunc

See merge request GNOME/glib!4192
2024-08-15 10:22:07 +00:00
Adrien Plazas
46ec058d2a ghash: Fix the documentation of GHRFunc
This function type isn't only used by g_hash_table_foreach_remove(), and
what happens to the data when we return TRUE depends on the calling
function.

Includes a port to modern gi-docgen syntax by Emmanuele Bassi.

Signed-off-by: Adrien Plazas <adrien.plazas@codethink.co.uk>
2024-08-15 10:22:07 +00:00
Philip Withnall
02ffe6a779 Merge branch 'fix_3429' into 'main'
gsettings-tool: Always use the global_schema_source to lookup schemas in list-recursively

Closes #3429

See merge request GNOME/glib!4183
2024-08-14 16:14:45 +00:00
Lukáš Tyrychtr
018581adb5 gsettings-tool: Always use the global_schema_source to lookup schemas in list-recursively
When listing schemas from a specified directory, explicitly
create the GSettings object from the schema, don't allow g_settings_new
to do the usual lookup. That lookup fails if no other schemas are
installed in the default directories.

Fixes #3429.
2024-08-14 16:14:45 +00:00
Philip Withnall
ab616db01e Merge branch 'wip/3v1n0/ci-really-use-fedora-39' into 'main'
ci: Ignore lcov errors on source missing, handle atomic writes and actually use Fedora 39 image

Closes #3381

See merge request GNOME/glib!4096
2024-08-14 14:58:36 +00:00
Philip Withnall
93fb9951aa
gunixmounts: Drop some Interix and QNX support
This can never have been tested, it was returning `GUnixMountEntry`
structs from functions which are typed to return `GUnixMountPoint`s.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-08-14 15:52:11 +01:00
Philip Withnall
04ee011171
tests: Add tests for handling of fstab and mtab files
While GLib doesn’t parse these files, it does provide API to access the
fields from them, and does implement some logic based on options fields
in them. It would be nice to be able to test that, and get coverage of
the methods for `GUnixMountPoint` and `GUnixMountEntry`.
2024-08-14 15:52:02 +01:00