Commit Graph

27687 Commits

Author SHA1 Message Date
Philip Withnall
d2d1af284d gtestutils: Fix a sign-conversion warning in g_assert_cmpmem()
It was assigning the two provided lengths to internal `int` variables.
Given that memory block lengths are typically a `size_t`, this will
usually result in a warning if `-Wsign-conversion` is enabled.

Given that the internal variables are passed to `memcmp()`, which takes
`size_t`, change them to `size_t` and add an explicit cast to avoid
warnings in future.

The alternative would be to mess around with defining `__l1` and `__l2`
to using `typeof()`, but that would lead to a complete mess with the
printf placeholders and probably cause more problems than it fixes.

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

Helps: #2919
2023-02-16 11:29:26 +00:00
Philip Withnall
39eea23825 Merge branch 'implicit_conversion' into 'main'
g_string_append_len_inline: fix implicit conversion changes signedness

Closes #2919

See merge request GNOME/glib!3274
2023-02-16 11:19:38 +00:00
Aleš Matěj
f6d6800962 g_string_append_len_inline: fix implicit conversion changes signedness
For: https://gitlab.gnome.org/GNOME/glib/-/issues/2919
2023-02-16 10:57:48 +00:00
Philip Withnall
e784bedd40 Merge branch 'gitlab-ci-enable-python-utf8-mode-for-windows' into 'main'
Enable Python UTF-8 mode for Windows CI jobs

Closes #2915

See merge request GNOME/glib!3278
2023-02-16 10:55:47 +00:00
Марко Костић
8376928c6a Update Serbian translation 2023-02-16 09:59:25 +00:00
Kukuh Syafaat
12df145382 Update Indonesian translation 2023-02-16 03:30:05 +00:00
Luca Bacci
c31eeb0b64 Enable Python UTF-8 mode for Windows CI jobs
It will become the default in Python 3.15 and makes things
more consistent across Unix and Windows platforms.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2915
2023-02-15 19:28:46 +01:00
Yuri Chornoivan
ffbcba1f63 Update Ukrainian translation 2023-02-15 17:37:36 +00:00
Philip Withnall
40fc22f81f Merge branch 'no-buffered-reads-during-server-auth' into 'main'
gdbus: Never buffer reads during server authentication

Closes #2916

See merge request GNOME/glib!3272
2023-02-15 16:29:38 +00:00
Marius Vollmer
8f02681f6e gdbus: Never buffer reads during server authentication
Otherwise, the content of the buffer is thrown away when switching
from reading via a GDataInputStream to unbuffered reads when waiting
for the "BEGIN" line.

(The code already tried to protect against over-reading like this by
using unbuffered reads for the last few lines of the auth protocol,
but it might already be too late at that point.  The buffer of the
GDataInputStream might already contain the "BEGIN" line for example.)

This matters when connecting a sd-bus client directly to a GDBus
client.  A sd-bus client optimistically sends the whole auth
conversation in one go without waiting for intermediate replies.  This
is done to improve performance for the many short-lived connections
that are typically made.
2023-02-15 14:33:15 +00:00
Simon McVittie
c83fd0bce7 Merge branch 'revert-revert-revert-i-hate-ci' into 'main'
Revert "Revert "tests: Temporarily disable socket test due to a kernel bug""

See merge request GNOME/glib!3273
2023-02-15 13:59:25 +00:00
Philip Withnall
bde724e5ac Revert "Revert "tests: Temporarily disable socket test due to a kernel bug""
This reverts commit 27bee8fe5d.

Inevitably, despite testing the CI multiple times before merging commit
27bee8fe, the CI is now failing again in the `socket` test due to (what
I continue to assume is) the kernel regression:

https://gitlab.gnome.org/martinpitt/glib/-/jobs/2585332

In order to unblock development on `main` expediently, I guess I’ll just
revert the revert.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Reopens: #2879
2023-02-15 13:23:13 +00:00
Philip Withnall
0816156cfe Merge branch 'wip/smcv/garray-endian' into 'main'
array-test: Don't rely on endianness of multi-byte numbers

Closes #2918

See merge request GNOME/glib!3270
2023-02-15 13:02:48 +00:00
Fran Dieguez
66b1f4e99a Update Galician translation 2023-02-14 20:05:09 +00:00
Philip Withnall
5af1e3d8c2 Merge branch 'wip/pwithnall/revert-disabling-socket-test-maybe' into 'main'
Revert "tests: Temporarily disable socket test due to a kernel bug"

Closes #2879 and Infrastructure/Infrastructure#981

See merge request GNOME/glib!3269
2023-02-14 13:19:58 +00:00
Hugo Carvalho
edb5df31e8 Update Portuguese translation 2023-02-14 11:58:49 +00:00
Simon McVittie
854fd11422 array-test: Don't rely on endianness of multi-byte numbers
The array is an array of bytes in this part of the test, so we need to
append a single byte. Previously we were reusing val (a size_t variable)
from earlier in the test, but because g_array_append_val passes the value
by reference, appending a multi-byte number to an array of bytes will
take the first byte of the number's memory representation, which has the
desired value on little-endian CPUs but is zero on big-endian, leading
to a test failure.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2918
Bug-Debian: https://bugs.debian.org/1031271
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-14 10:42:08 +00:00
Ekaterine Papava
23a839159a Update Georgian translation 2023-02-14 07:33:25 +00:00
Kukuh Syafaat
bda564d68c Update Indonesian translation 2023-02-14 02:35:10 +00:00
Aurimas Černius
25cc5bc6ff Update Lithuanian translation 2023-02-13 20:46:17 +00:00
Emin Tufan Çetin
10c8149c23 Update Turkish translation 2023-02-13 19:38:41 +00:00
Philip Withnall
27bee8fe5d Revert "tests: Temporarily disable socket test due to a kernel bug"
This reverts commit 1507585869.

Maybe it works now? It will work as soon as the CI host kernel is
updated.

Fixes: #2879
2023-02-13 19:35:30 +00:00
Yuri Chornoivan
6fec7720da Update Ukrainian translation 2023-02-13 19:30:44 +00:00
Philip Withnall
b65044c52b
2.75.3
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-13 19:02:58 +00:00
Philip Withnall
b135c1b1c1 Merge branch 'wip/pwithnall/test' into 'main'
po: Add missing header file to POTFILES.in

See merge request GNOME/glib!3268
2023-02-13 18:29:35 +00:00
Philip Withnall
1c60821897 po: Add missing header file to POTFILES.in
Change originally by Piotr in !3257, but the CI has problems with
his name in the author field. Since this change is blocking a release,
I have decided to merge it under my name instead, so that it lands sooner.

In parallel, we are trying to figure out what is broken with the CI so
this does not happen again.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-13 17:40:09 +00:00
Philip Withnall
f5b2aeaf39 Merge branch '2876-api-public-or-internal' into 'main'
gutils: Make g_find_program_for_path() a proper private API

Closes #2876

See merge request GNOME/glib!3267
2023-02-13 17:31:28 +00:00
Philip Withnall
a359e56f58 gutils: Remove public API decorator from g_set_user_dirs()
It’s a private API, and is not meant to be exposed in the public API.
Since it’s only used internally within libglib, we don’t have to expose
it in the public symbol table, so drop the decorator.

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

Helps: #2876
2023-02-13 16:14:10 +00:00
Philip Withnall
438bd5cfa1 gutils: Make g_find_program_for_path() a proper private API
It’s not meant to be exposed publicly yet (we’re not ready to stabilise
it), but it was incorrectly decorated with `GLIB_AVAILABLE_IN_2_76`.

We can’t remove the decorator and use it that way, as it’s called in
libgio, so we have to expose it using `GLIB_PRIVATE_CALL()`.

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

Fixes: #2876
2023-02-13 16:12:07 +00:00
Emmanuele Bassi
585c7d2db6 Merge branch 'wip/smcv/symlink-detection-doc' into 'main'
fileutils: Make some sample code detect symlinks as intended

See merge request GNOME/glib!3265
2023-02-10 20:52:08 +00:00
Alex Richardson
9f8edb1e3f GVariant: ensure GVariantIter alignment for CHERI systems
For CHERI-enabled architectures such as Arm Morello we have to align the
GVariantIter to pointer alignment (16 bytes for Morello) but defining the
opaque struct as 16 gsize elements only aligns to 8 bytes.
This does not change the layout for existing architecutre since there
gsize is the same as guintptr.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
2023-02-10 18:22:20 +00:00
Alex Richardson
147777e342 GHash: Don't use SMALL_ENTRY_SIZE for CHERI
The code for SMALL_ENTRY_SIZE assumes pointers are no larger than 8 bytes,
so instead of trying to make it work disable the optimization for now.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
Co-authored-by: Graeme Jenkinson <graeme@capabilitieslimited.co.uk>
2023-02-10 18:22:20 +00:00
Alex Richardson
5d8ecac1ec Make GVariantBuilder and GVariantDict layout compatible with CHERI
Use guinptr instead if gsize. While this increases the structure size
for Morello, it is still only 256 bytes which should not matter for a
type where we expect few instances to exist at any given time.
This does not increase the size for existing architectures since gsize
is the same as guintptr for all of them.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
2023-02-10 18:22:20 +00:00
Alex Richardson
2aed76fc94 Fix GHashTableIter layout for CHERI targets
Last field needs to be pointer-size to match GHashTableIter. This happened
to work for most architecture due to alignment padding/pointer size, but
for CHERI targets with 128-bit pointers RealIter ends up being smaller
than GHashTableIter.

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/2842
2023-02-10 18:22:20 +00:00
Simon McVittie
702e606f73 Merge branch 'wip/smcv/pathbuf-windows' into 'main'
pathbuf: Treat forward slashes and backslashes as equivalent on Windows

Closes #2914

See merge request GNOME/glib!3264
2023-02-10 15:41:31 +00:00
Philip Withnall
9ab080c6ce Merge branch 'wip/smcv/gi-warnings' into 'main'
Avoid some warnings from GObject-Introspection

See merge request GNOME/glib!3266
2023-02-10 13:49:22 +00:00
Simon McVittie
6631e6dc1f Merge branch 'wip/smcv/gsize-is-guintptr-for-now' into 'main'
Add a (temporary) assertion that sizeof(gsize) == sizeof(guintptr)

See merge request GNOME/glib!3262
2023-02-10 13:17:36 +00:00
Simon McVittie
ee223e8ec8 gtimezone: Avoid a nested preprocessor conditional to be nice to g-i
GObject-Introspection seems to become confused by the nested conditional
followed by an `#elif` clause for the outer conditional, and issues
this warning:

.../gtimezone.c:830: mismatched #elif  defined (G_OS_WIN32)

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10 13:16:01 +00:00
Simon McVittie
30352032a6 gstrfuncs: Use separate preprocessor conditionals for g-i and gtk-doc
GObject-Introspection and gtk-doc both parse C headers using regular
expressions, so they can easily be confused by non-trivial conditions.
GObject-Introspection warns about this:

    .../gstrfuncs.h:151: the __GI_SCANNER__ constant should only be used with simple #ifdef or #endif: #if  !defined (__GTK_DOC_IGNORE__) && !defined (__GI_SCANNER__)

In this case it's very easy to convert the compound expression into
nesting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10 13:14:42 +00:00
Simon McVittie
f6e13753aa fileutils: Make some sample code detect symlinks as intended
The sample code here wasn't a race-free version of the race-susceptible
anti-pattern, because it would have dereferenced a symlink automatically.

Fixes: 293b4923 "Clarify g_file_test() docs about TOCTOU bugs"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10 13:06:04 +00:00
Simon McVittie
def7c0ac10 pathbuf: Treat forward slashes and backslashes as equivalent on Windows
The canonical directory separator is a backslash, but some Windows APIs
allow either, interchangeably. Do the same here.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2914
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10 11:13:36 +00:00
Alex Richardson
14ae87f379 Add a (temporary) assertion that sizeof(gsize) == sizeof(guintptr)
Glib does not yet have a well defined ABI/API for architectures
where gsize != guintptr (e.g. CHERI). To enable working on bringup
for new architectures this assertion can be disabled with
`-DG_ENABLE_EXPERIMENTAL_ABI_COMPILATION`.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2842

[smcv: Apply review comments from pwithnall]

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-10 10:54:36 +00:00
Philip Withnall
d5bf03cbcb Merge branch 'wip/smcv/redundant-type-assertions' into 'main'
Revert "glib-init: Add more static assertions for gintptr, guintptr"

See merge request GNOME/glib!3263
2023-02-09 23:03:30 +00:00
Simon McVittie
73c91ef799 Revert "glib-init: Add more static assertions for gintptr, guintptr"
On closer inspection, these are redundant with stricter assertions that I
added in commit bd1e2a98 "glib-init: Statically assert more facts about
standard types", which assert that sizeof (gintptr) == sizeof (void *).

As far as I can tell, a sufficiently pedantic interpretation of Standard
C doesn't actually require (u)intptr_t to be the same size as a pointer:
it only requires that pointers can be losslessly stored in a (u)intptr_t,
which a sufficiently pathological ABI could implement by having (for
example) 32-bit pointers and a 64-bit uintptr_t just to troll us. However,
I'm fairly confident that no practically useful ABI would do this,
and certainly nobody has complained about this assertion since 2020.

Similarly, Standard C might permit an ABI where 64-bit pointers have the
first 32 bits always-zero and therefore storing the remaining bits in a
32-bit uintptr_t is lossless, but again, that would be pathological.

This reverts commit da3fc59544.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-09 19:08:08 +00:00
Emmanuele Bassi
816b35df67 Merge branch 'ebassi/pathbuf' into 'main'
Add GPathBuf

See merge request GNOME/glib!3216
2023-02-09 13:55:26 +00:00
Emmanuele Bassi
fcdbd7f9bd tests: Add GPathBuf to the g_auto suite 2023-02-09 13:36:51 +00:00
Emmanuele Bassi
7e62d01053 tests: Add PathBuf.new_from_path() coverage 2023-02-09 13:36:51 +00:00
Emmanuele Bassi
d0ee88078b doc: Clarify g_path_buf_to_path()
The returned path is built on demand.
2023-02-09 13:36:51 +00:00
Emmanuele Bassi
a05fda9990 Move GPathBuf tests into their own file
Keep the fileutils tests related to the gfileutils.h API.
2023-02-09 13:36:51 +00:00
Emmanuele Bassi
280649fb82 docs: Clarify the path construction functions
Use the same wording for functions that belong in the same family, and
link to the newly introduced GPathBuf API.
2023-02-09 13:36:51 +00:00