Commit Graph

30515 Commits

Author SHA1 Message Date
Benjamin Otte
e8254f14fd gfile: Rewrite load_contents() to use realloc()
GByteArray is limited to 4GB in size and the current code silently
overflows when that happens.

Replace both load_contents() and load_contents_async() implementations
with a version that uses realloc() and gsize to maintain the array.
2024-06-17 13:03:05 +01:00
Benjamin Otte
a57f0b190a array: Abort on overflow
This is a precautionary assert that will probably only trigger on 32bit
OSes. But g_nearest_pow() can overflow.
2024-06-17 11:51:00 +01:00
Michael Catanzaro
bce073dca1 Merge branch 'notification-test-asserts' into 'main'
tests: Use g_assert_*() rather than g_assert() in notification tests

See merge request GNOME/glib!4115
2024-06-14 22:29:09 +00:00
Philip Withnall
577ad8d07d
tests: Use g_assert_*() rather than g_assert() in notification tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-06-14 23:05:25 +01:00
Martin
9fa69b3a72 Update Slovenian translation 2024-06-14 20:10:04 +00:00
Philip Withnall
e89e0a342c Merge branch '3254-construct-property-deprecation' into 'main'
gobject: Don’t warn when setting deprecated construct property defaults

Closes #3254

See merge request GNOME/glib!3942
2024-06-14 19:16:42 +00:00
Philip Withnall
a78c80e9ab Merge branch 'win32-localfileinfo-fixes' into 'main'
glocalfileinfo: A few fixes on win32

See merge request GNOME/glib!4114
2024-06-14 17:25:13 +00:00
Philip Withnall
df5aa217e4
gobject: Don’t warn when setting deprecated construct property defaults
The default values for construct properties always have to be set, even
if those properties are deprecated. The code to do that is in GLib, and
not under the control of the user (unless they completely override the
`constructor` vfunc, which is not recommended). So don’t emit a warning
for that if `G_ENABLE_DIAGNOSTICS` is enabled.

In particular, this fixes deprecation warnings being emitted for
properties of a parent class when chaining up with a custom constructor,
even when none of the child class code mentions the deprecated property.

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

Fixes: #3254
2024-06-14 17:53:37 +01:00
Luca Bacci
2cf0ce39aa glocalfileinfo: Use stat results only if stat succeeded 2024-06-14 17:42:39 +01:00
Luca Bacci
3ae88886ac glocalfileinfo: Do not set G_FILE_ATTRIBUTE_ID_STANDARD_IS_BACKUP twice 2024-06-14 17:42:39 +01:00
Philip Withnall
15202c970a Merge branch 'bootstrap-tests' into 'main'
tests: skip tests that will fail due to missing dependencies

Closes #3317

See merge request GNOME/glib!3997
2024-06-14 15:56:38 +00:00
Natanael Copa
2c042cd466 tests: find update-desktop-database
Disable tests that require update-desktop-database when it is missing.

It requires glib to build so it will be missing when bootstrapping glib.

Refactor the ifdef for Windows and MacOS while at it and reduce number
of ifdefs.

Ref: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3658
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2024-06-14 16:35:44 +01:00
Natanael Copa
7322a925e2 tests: skip tests that requires dbus-daemon when its missing
dbus may not be built yet during bootstrap, because it needs glib to
build.

Ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2024-06-14 16:35:44 +01:00
Natanael Copa
6a262b0c03 tests: skip test that requires shared-mime-info when its missing
shared-mime-info required glib to build and will not be there during
bootstrap. Skip the test if it is missing.

ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2024-06-14 16:35:44 +01:00
Philip Withnall
5fdd6507b4 Merge branch 'ebassi/c11-toolchain-req-docs' into 'main'
docs: Update toolchain requirement to C11

See merge request GNOME/glib!4082
2024-06-14 12:35:06 +00:00
Marco Trevisan (Treviño)
5b0ae99e9a build: Add -Wno-typedef-redefinition to CFLAGS
Without the -Wno-typedef-redefinition option, clang complains if a typedef
gets redefined in gnu99 mode (since this is officially a C11 feature). This
also happened with old versions of GCC.

So, don't break the build on such warn, since we want to support
toolchains that supports C11 anyways.
2024-06-14 12:35:21 +01:00
Emmanuele Bassi
5697c11f1f docs: Update toolchain requirement to C11
We have required C99 for a while; in the meantime, most C toolchains
have moved on to C11 or later as the default C standard.

We still allow for C99 toolchains, but in the future we are going to
require a C11 toolchain to build and use GLib.
2024-06-14 12:35:21 +01:00
Philip Withnall
a7f1b63ba4 Merge branch 'wip/pwithnall/dtrace-freebsd' into 'main'
ci: Disable dtrace/systemtap on FreeBSD CI

Closes #3394

See merge request GNOME/glib!4107
2024-06-13 20:33:24 +00:00
Philip Withnall
74c6c4c221 Merge branch 'fix-introspection-windows' into 'main'
Introspection: Fix running g-ir-scanner 1.80.x+ on Windows

See merge request GNOME/glib!3988
2024-06-13 20:12:33 +00:00
Philip Withnall
9e680ff8f4 Merge branch 'wip/pwithnall/gsocket-eaddrnotavail-macos' into 'main'
gioerror: Map EADDRNOTAVAIL to G_IO_ERROR_CONNECTION_REFUSED

Closes #3394

See merge request GNOME/glib!4111
2024-06-13 19:57:24 +00:00
Philip Withnall
c2744488a1
ci: Disable dtrace/systemtap on FreeBSD CI
It seems to have been accidentally enabled by the switch to making
dtrace a Meson feature. This has only just been caught because the
FreeBSD CI runner has been offline for several weeks (see
https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1503).

With dtrace enabled, the FreeBSD CI build fails with:
```
[8/1601] Generating 'gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o'
FAILED: gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o
/usr/sbin/dtrace -G -s ../gobject/gobject_probes.d -o gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o
dtrace: failed to link script ../gobject/gobject_probes.d: No probe sites found for declared provider
[9/1601] Generating 'glib/libglib-2.0.so.0.8100.0.p/glib_probes.h' (wrapped by meson because command contains newlines)
[10/1601] Generating 'glib/libglib-2.0.so.0.8100.0.p/glib_probes.o'
FAILED: glib/libglib-2.0.so.0.8100.0.p/glib_probes.o
/usr/sbin/dtrace -G -s ../glib/glib_probes.d -o glib/libglib-2.0.so.0.8100.0.p/glib_probes.o
dtrace: failed to link script ../glib/glib_probes.d: No probe sites found for declared provider
```
(see https://gitlab.gnome.org/GNOME/glib/-/jobs/3961782)

I have no idea how to fix that, and it’s presumably not been working for
a long time.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-06-13 20:43:28 +01:00
Philip Withnall
f09a8e2be4
gioerror: Map EADDRNOTAVAIL to G_IO_ERROR_CONNECTION_REFUSED
Previously it was mapped (as a default) to `G_IO_ERROR_FAILED`.

It’s the error that macOS returns when trying to connect to a socket which
is bound but not listened to. Linux returns `ECONNREFUSED` in this case.
It’s helpful if they both map to the same `GIOError` value.

This should fix the `/socket-client/connection-fail` test on macOS,
which is currently
[failing](https://gitlab.gnome.org/GNOME/glib/-/jobs/3970547) with:
```
 # GLib-GIO-DEBUG: GSocketClient: Starting TCP connection attempt
 # GLib-GIO-DEBUG: GSocketClient: Connection attempt failed: Can't assign requested address
 # GLib-GIO-DEBUG: GSocketClient: Starting new address enumeration
 # GLib-GIO-DEBUG: GSocketClient: Address enumeration completed (out of addresses)
 # GLib-GIO-DEBUG: GSocketClient: Address enumeration failed: (null)
 # GLib-GIO-DEBUG: GSocketClient: Connection failed: Could not connect to localhost: Can't assign requested address
not ok /socket-client/connection-fail - GLib-GIO:ERROR:../gio/tests/gsocketclient-slow.c:231:test_connection_failed: assertion failed (local_error == (g-io-error-quark, 39)): Could not connect to localhost: Can't assign requested address (g-io-error-quark, 0)
Bail out!
```

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

See: #3184
Fixes: #3394
2024-06-13 20:00:12 +01:00
Philip Withnall
9b5f41c71b Merge branch 'wip/djz/factor-out-untranslatable-err-msgs' into 'main'
gdbus: factor out untranslatable parts of error messages

Closes #3363

See merge request GNOME/glib!4103
2024-06-13 18:30:58 +00:00
José Guilherme
efe2c24757 gdbus: factor out untranslatable parts of error messages 2024-06-13 18:30:58 +00:00
Philip Withnall
9261c03c59 Merge branch 'options' into 'main'
build: Rename meson_options.txt to meson.options

See merge request GNOME/glib!4108
2024-06-13 13:37:38 +00:00
Benjamin Gilbert
3e00a88e19 build: Rename meson_options.txt to meson.options
The new name is a bit cleaner and is supported by all versions of Meson
that we support.
2024-06-13 04:50:04 -05:00
Philip Withnall
ea58dcb538
Revert "ci: Disable dtrace/systemtap on FreeBSD CI"
This reverts commit b7a93a7ddb.

Accidentally pushed to `origin/main` without review because I typoed the
switch branch command and didn’t notice.
2024-06-10 11:03:34 +01:00
Philip Withnall
b7a93a7ddb
ci: Disable dtrace/systemtap on FreeBSD CI
It seems to have been accidentally enabled by the switch to making
dtrace a Meson feature. This has only just been caught because the
FreeBSD CI runner has been offline for several weeks (see
https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1503).

With dtrace enabled, the FreeBSD CI build fails with:
```
[8/1601] Generating 'gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o'
FAILED: gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o
/usr/sbin/dtrace -G -s ../gobject/gobject_probes.d -o gobject/libgobject-2.0.so.0.8100.0.p/gobject_probes.o
dtrace: failed to link script ../gobject/gobject_probes.d: No probe sites found for declared provider
[9/1601] Generating 'glib/libglib-2.0.so.0.8100.0.p/glib_probes.h' (wrapped by meson because command contains newlines)
[10/1601] Generating 'glib/libglib-2.0.so.0.8100.0.p/glib_probes.o'
FAILED: glib/libglib-2.0.so.0.8100.0.p/glib_probes.o
/usr/sbin/dtrace -G -s ../glib/glib_probes.d -o glib/libglib-2.0.so.0.8100.0.p/glib_probes.o
dtrace: failed to link script ../glib/glib_probes.d: No probe sites found for declared provider
```
(see https://gitlab.gnome.org/GNOME/glib/-/jobs/3961782)

I have no idea how to fix that, and it’s presumably not been working for
a long time.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-06-10 11:00:31 +01:00
Philip Withnall
d5de81e440 Merge branch 'gcontenttype-win32-add-intro' into 'main'
gcontenttype-win32: Copy documetation comment from gcontenttype

Closes gobject-introspection#509

See merge request GNOME/glib!4106
2024-06-10 09:21:06 +00:00
Biswapriyo Nath
7e69f88480 gcontenttype-win32: Copy documetation comment from gcontenttype
Fixes https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/509
2024-06-09 14:30:03 +00:00
Philip Withnall
601b8b45fb Merge branch '3184-socket-client-leak-with-unit-test' into 'main'
gsocketclient: Unit test for "Fix a leak of the task data on an error path"

Closes #3184

See merge request GNOME/glib!4104
2024-06-05 12:08:33 +00:00
Johan Sternerup
61e006e16c gsocketclient: Add unit test for leak of task data in error path
The unit test cover the error path that causes the leak described in
https://gitlab.gnome.org/GNOME/glib/-/issues/3184.
2024-06-05 12:54:15 +01:00
Philip Withnall
234871f1f9
gsocketclient: Fix a leak of the task data on an error path
Once the task is completed (and `g_task_return_*()` has been called),
the task is no longer needed. It would make more sense to unref it in
`complete_connection_with_error()`, where `g_task_return_*()` is called,
but that complicates other call sites significantly, so I didn’t do it.

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

Fixes: #3184
2024-06-05 12:54:05 +01:00
Philip Withnall
2ab34d97f7 Merge branch 'wip/smcv/type-signedness-followup' into 'main'
Improve handling of standard types' signedness

See merge request GNOME/glib!4095
2024-06-04 16:45:35 +00:00
Philip Withnall
c2e7b2f3b0
girepository: Fix type of precondition return values
This fixes a compiler warning (`-Wnon-literal-null-conversion`) on
clang 13 on macOS.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-06-04 17:27:28 +01:00
Simon McVittie
7efb96d29b glib-init: Statically assert that types have appropriate signedness
Some of these are properties of a Standard C or POSIX platform that
are true by definition and checked for completeness (for example intptr_t
is defined to be signed, and uintptr_t unsigned), while others are
checking that GLib's type detection has been done correctly.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-06-04 16:57:18 +01:00
Simon McVittie
a0ed94a11d Provide private G_SIGNEDNESS_OF macro in glib-private.h
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-06-04 16:57:18 +01:00
Simon McVittie
7c41a6529b girparser: Use INTEGER_ALIAS to reduce repetition
As a special case, keep the historical behaviour of treating gchar
as being signed, both on platforms where it is genuinely signed (for
example x86 Linux) and where it is unsigned (for example ARM, s390x
and PowerPC Linux). Changing gchar to use INTEGER_ALIAS would have a
regression risk, so if we want to do that, it should be as a separate
change.

No functional change intended.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-06-04 16:57:18 +01:00
Philip Withnall
d02f5816bf Merge branch 'wip/pwithnall/gdump-tests' into 'main'
tests: Add basic tests for gdump.c in libgirepository

See merge request GNOME/glib!4102
2024-06-04 15:17:03 +00:00
Philip Withnall
5b26ef2e46
tests: Add basic tests for gdump.c in libgirepository
It’s currently completely untested. Let’s add a few basic tests so that
adding more tests in future is easier.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-06-04 15:52:05 +01:00
Philip Withnall
b1e09794f4 Merge branch 'gi_relocation' into 'main'
girepository: add support for relocations

See merge request GNOME/glib!4088
2024-06-04 14:43:02 +00:00
Philip Withnall
04697b4a95 Merge branch 'bilelmoussaoui/g-i' into 'main'
gio/g-i: Mark Application:action-group property as deprecated

See merge request GNOME/glib!4101
2024-06-04 14:38:03 +00:00
Bilal Elmoussaoui
b845d04918 gio/g-i: Mark Application:action-group property as deprecated
To avoid bindings making use of it
2024-06-04 14:38:02 +00:00
Andoni Morales Alastruey
c93c4d41e8 girepository: add default search paths tests for relocations 2024-06-04 13:00:45 +02:00
Andoni Morales Alastruey
9d0988ca62 girepository: fix find_by_type tests in macOS 2024-06-04 13:00:45 +02:00
Andoni Morales Alastruey
99382cfb4b girepository: fix autoptr tests build
In macOS compilation fails with the following error:
```
In file included from ../girepository/tests/autoptr.c:23:
../girepository/girffi.h:30:10: fatal error: 'ffi.h' file not found
```
2024-06-04 13:00:45 +02:00
Andoni Morales Alastruey
62fb5eb6d4 girepository: add support for relocations
Relocation is a common scenario in macOS applications and frameworks.
This commit provides a mechanism to support relocations by inferring
the typelib dir from the path of the loaded image libgirepository-1.0.dylib.
2024-06-04 13:00:42 +02:00
Philip Withnall
2b7678b41b Merge branch 'ebassi/pointer-types' into 'main'
Dump pointer types in the introspection blob

See merge request GNOME/glib!4098
2024-06-03 10:58:41 +00:00
Philip Withnall
5bcc6ad458 Merge branch 'glib-compile-schemas-docs-1' into 'main'
docs: Mention XDG_DATA_HOME in glib-compile-schemas manual

See merge request GNOME/glib!4100
2024-06-03 10:56:41 +00:00
Philip Withnall
24dd331c2c Merge branch 'ebassi/issue-2896' into 'main'
Build HTML versions of the man pages

Closes #2896

See merge request GNOME/glib!4090
2024-06-02 15:15:31 +00:00