Commit Graph

24007 Commits

Author SHA1 Message Date
Philip Withnall
b1ebb72522 glocalfileoutputstream: Fix ETag check when replacing through a symlink
Since commit 87e19535fe, the ETag check when writing out a file through
a symlink (following the symlink) has been incorrectly using the ETag
value of the symlink, rather than the target file. This is incorrect
because the ETag should represent the file content, not its metadata or
links to it.

Fix that, and add a unit test.

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

Fixes: #2417
2021-06-07 12:44:52 +01:00
Philip Withnall
b407d46c9a Merge branch '2416-tls-certificate-fix-invalid-read' into 'master'
tests/tls-certificate: Add a unit test

Closes #2416

See merge request GNOME/glib!2136
2021-06-07 08:36:12 +00:00
Peter Bloomfield
f0a1671161 tests/tls-certificate: Add context to the new test
Add a comment to `pem_parser_no_sentinel()` to explain what it is
testing and how it works.
2021-06-05 10:14:24 -04:00
Peter Bloomfield
39f661b070 tlscertificate: Avoid possible invalid read
In various places, do not read past the end of the data.
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-04 20:46:44 -04:00
Peter Bloomfield
b9d07813d8 tests/tls-certificate: Add a unit test
Test whether g_tls_certificate_new_from_pem() can handle a
non-nul-terminated PEM.

Helps https://gitlab.gnome.org/GNOME/glib/-/issues/2416
2021-06-04 20:40:16 -04:00
Philip Withnall
205045e5c7 Merge branch 'wip/issue-1884' into 'master'
gsettings: Resolve child schemas from the parent's schema source

Closes #1884

See merge request GNOME/glib!2132
2021-06-04 12:09:24 +00:00
Christian Persch
2632ed7a69 gsettings: Resolve child schemas from the parent's schema source 2021-06-04 12:09:24 +00:00
Philip Withnall
02b298cf08 Merge branch 'mcatanzaro/tls-info' into 'master'
tls: add functions to get protocol version and ciphersuite name

See merge request GNOME/glib!2077
2021-06-04 11:14:46 +00:00
Philip Withnall
8e6214aa30 Merge branch 'fix-memory-leak' into 'master'
inotify: Fix a memory leak

Closes #2311

See merge request GNOME/glib!2128
2021-06-04 10:53:38 +00:00
Gaël Bonithon
df500c68a4 inotify: Fix a memory leak
Fixes: #2311
2021-06-03 19:04:48 +02:00
Michael Catanzaro
bf37392045 tls: add functions to get protocol version and ciphersuite name
This adds g_tls_connection_get_protocol_version(),
g_tls_connection_get_ciphersuite_name(), and DTLS variants. This will
allow populating TLS connection information in the WebKit web inspector.

This is WIP because we found it's not quite possibly to implement
correctly with GnuTLS. See glib-networking!151.
2021-06-03 10:56:15 -05:00
Philip Withnall
942501bec7 gbitlock: Minor improvement to documentation formatting
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-06-03 15:15:34 +01:00
Philip Withnall
11cd751203 gbitlock: Drop unnecessary volatile qualifiers
This follows on from !1719. It drops volatile qualifiers on internal
functions in `gbitlock.c`, and casts volatile public arguments to
non-volatile versions to avoid the `g_atomic_*()` macros from
propagating the volatile qualifier.

We can’t drop the `volatile` qualifier from the public API in
`gbitlock.h`, as that would unfortunately be an API break.

Update the documentation in `gbitlock` to mention that users of the API
should not use `volatile`. See http://c.isvolatileusefulwiththreads.com/

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

Fixes: #2418
2021-06-03 15:15:21 +01:00
Philip Withnall
91759dbd63 tests: Ignore warning about use of volatile from a test for exactly that
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #2418
2021-06-03 13:44:15 +01:00
Sebastian Dröge
fbcd653bd9 Merge branch '2414-wrap-code-example' into 'master'
docs: Wrap a code example more tightly to reduce minimum page width

Closes #2414

See merge request GNOME/glib!2129
2021-06-03 12:23:06 +00:00
Philip Withnall
e02b905b4b Revert "tests: Deactivate tls-bindings test suite for windows"
This reverts commit 7f2fef5c26.

There have been some changes to the gitlab-ci-win32-runner pre-clone
script which should be more successful at killing the remaining
processes after this test. See
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2008#note_1127126
2021-06-03 13:01:29 +01:00
Philip Withnall
be24b0c622 docs: Wrap a code example more tightly to reduce minimum page width
Otherwise the page has a horizontal scrollbar in Devhelp on some
machines.

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

Fixes: #2414
2021-06-03 12:52:51 +01:00
Philip Withnall
04739eb4fd Merge branch '2227-gdbus-nullability' into 'master'
gdbus: Add various missing (nullable) or (not nullable) annotations

See merge request GNOME/glib!2123
2021-06-03 09:17:28 +00:00
Philip Withnall
ac8f4a0db5 gdbus: Add various missing (nullable) or (not nullable) annotations
This is the result of checking each `Returns:` line in these files. I’ve
only considered nullability and not other (potentially missing or
incorrect) annotations.

Including suggestions by Simon McVittie.

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

Helps: #2227
2021-06-03 10:02:37 +01:00
Philip Withnall
89fe74fdc0 Merge branch 'master' into 'master'
gutils: ensure g_find_program_in_path() return an absolute path

See merge request GNOME/glib!2127
2021-06-02 12:57:46 +00:00
Luke Yue
3321fb561e tests: Add a test case for g_find_program_in_path()
Signed-off-by: Luke Yue <lukedyue@gmail.com>
2021-06-02 20:10:38 +08:00
Luke Yue
dba1fce993 gutils: ensure g_find_program_in_path() return an absolute path
Fix a possibility of returning a relative path, according to the
doc, the function should return an absolute path.

Signed-off-by: Luke Yue <lukedyue@gmail.com>
2021-06-02 20:10:38 +08:00
Philip Withnall
11c0b2e597 Merge branch 'pgriffis/pkcs11-password' into 'master'
gtlspassword: Add flags signifying PIN type for PKCS#11

See merge request GNOME/glib!2126
2021-06-02 10:06:06 +00:00
Michael Catanzaro
7a51163cf9 Merge branch 'feature/cert-info' into 'master'
tls: expose cert details on GTlsCertificate

See merge request GNOME/glib!2113
2021-06-01 20:25:21 +00:00
Patrick Griffis
e750f7a145 gtlspassword: Add flags signifying PIN type for PKCS#11
In a PKCS#11 operation there are multiple types of PINs possibly
needed and these flags add a way to expose them to the user.

This design exactly matches gnutls' gnutls_pin_flag_t API.
2021-06-01 14:56:56 -05:00
Philip Withnall
bc0d9376b7 Merge branch 'add_g_prefix_error_literal' into 'master'
Add g_prefix_error_literal()

Closes #663

See merge request GNOME/glib!2121
2021-06-01 19:08:16 +00:00
Emmanuel Fleury
1e90d9cd74 Add test case for g_prefix_error_literal() function 2021-06-01 19:00:37 +02:00
Ross A. Wollman
a17c28790a tls: expose cert details on GTlsCertificate
This changeset exposes

* `not-valid-before`
* `not-valid-after`
* `subject-name`
* `issuer-name`

on GTlsCertificate provided by the underlying TLS Backend.

In order to make use of these changes,
see the related [glib-networking MR][glib-networking].

This change aims to help populate more of the [`Certificate`][wk-cert]
info in the WebKit Inspector Protocol on Linux.

This changeset stems from work in Microsoft Playwright to [add more info
into its HAR capture][pw] generated from the Inspector Protocol events
and will bring feature parity across WebKit platforms.

[wk-cert]: 8afe31a018/Source/JavaScriptCore/inspector/protocol/Security.json
[pw]: https://github.com/microsoft/playwright/pull/6631
[glib-networking]: https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/156
2021-06-01 16:24:33 +00:00
Philip Withnall
94e90422b9 Merge branch 'new_patch' into 'master'
gobject: Allow passing %NULL for @data in g_object_remove_toggle_ref

Closes #817

See merge request GNOME/glib!2117
2021-06-01 14:31:13 +00:00
Yaron Shahrabani
9bb69aff63 Update Hebrew translation 2021-05-28 19:58:35 +00:00
Dan Williams
9cb1bb0fb2 Add g_prefix_error_literal()
Because sometimes you don't want a lone "%s", and you don't
want the compiler yelling at you about format strings that
don't have any format in them.

Closes #663
2021-05-28 17:15:46 +02:00
Sebastian Dröge
0d7f3e74e0 Merge branch '399-dlerror-thread-safety' into 'master'
gmodule: Add locking around dlerror() for some libc implementations

Closes #399

See merge request GNOME/glib!2122
2021-05-28 10:02:59 +00:00
Philip Withnall
483843c282 gmodule: Add locking around dlerror() for some libc implementations
Specifically, for uclibc at the moment. Other implementations may need
locking, but I haven’t checked any aside from uclibc-ng and glibc.

POSIX.1-2001 specifies that `dlerror()` is not thread-safe, but the
glibc (and likely other libc) implementation is.

Issue #399 was originally reported about eglibc, but that project has
since died and been merged back into glibc. So that’s one less thing to
worry about.

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

Fixes: #399
2021-05-28 09:58:21 +01:00
Jasper St. Pierre
edb40c7171 gobject: Allow passing %NULL for @data in g_object_remove_toggle_ref
gjs has some situations where it's not always aware of the @data that
was passed into g_object_add_toggle_ref, so allow passing %NULL to
just match on @notify.

Rebased and updated by Nitin Wartkar

Closes #817
2021-05-27 21:09:45 +05:30
Philip Withnall
73a78f7470 gmodule: Add some missing consts
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-05-27 13:46:28 +01:00
Philip Withnall
0c8740dc83 Merge branch 'fix_more_warnings' into 'master'
Fix more warnings

See merge request GNOME/glib!2106
2021-05-27 10:00:28 +00:00
Emmanuel Fleury
bf536a5ce2 Fix incompatible pointer to integer conversion warning in glib/tests/atomic.c
lib/tests/atomic.c:115:9: warning: incompatible pointer to integer conversion passing 'void *' to parameter of type 'gsize' (aka 'unsigned long')
  res = g_atomic_pointer_compare_and_exchange (&gs, NULL, NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
glib/gatomic.h:225:34: note: expanded from macro 'g_atomic_pointer_compare_and_exchange'
                                 (newval), FALSE,                            \
                                 ^~~~~~~~
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
2b4bf535f1 Fix discard qualifier warning in glib/tests/atomic.c
glib/tests/atomic.c:132:18: warning: passing 'typeof (*(cspp)) *' (aka 'const int *const *') to parameter of type 'const gint **' (aka 'const int **') discards qualifiers
  g_assert_true (g_atomic_pointer_get (cspp) == csp);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
glib/gatomic.h:117:38: note: expanded from macro 'g_atomic_pointer_get'
    __atomic_load (gapg_temp_atomic, (&(gapg_temp_newval)), __ATOMIC_SEQ_CST); \
                                     ^~~~~~~~~~~~~~~~~~~~~
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
a369efd207 Fix missing initializer warning in tests/slice-threadinit.c
tests/slice-threadinit.c:34:30: warning: missing field 'sample' initializer
} pages[N_PAGES] = { { NULL, }, };
                             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
aace697d7e Fix missing initializer warning in gio/tests/gdbus-exit-on-close.c
gio/tests/gdbus-exit-on-close.c:52:14: warning: missing field 'bug' initializer
      { NULL }
             ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
652a7b7db1 Fix missing initializer warnings in gio/tests/socket.c
gio/tests/socket.c:505:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:630:37: warning: missing field 'vectors' initializer
    GOutputMessage m[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:631:37: warning: missing field 'vectors' initializer
    GInputMessage im[3] = { { NULL, }, };
                                    ^
gio/tests/socket.c:632:36: warning: missing field 'size' initializer
    GOutputVector v[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:633:36: warning: missing field 'size' initializer
    GInputVector iv[7] = { { NULL, }, };
                                   ^
gio/tests/socket.c:871:32: warning: missing field 'vectors' initializer
    GInputMessage im = { NULL, };
                               ^
gio/tests/socket.c:872:31: warning: missing field 'size' initializer
    GInputVector iv = { NULL, };
                              ^
2021-05-27 10:16:52 +02:00
Emmanuel Fleury
bee07cebcd Fix missing initializer warning in gobject/gtype.c
gobject/gtype.c:1103:55: warning: missing field 'value_free' initializer
          static const GTypeValueTable zero_vtable = { NULL, };
                                                             ^
2021-05-27 10:16:52 +02:00
Philip Withnall
4575c70a6b Merge branch 'strv_builder_add_many' into 'master'
gstrvbuilder: add addv and add_many to the API

See merge request GNOME/glib!2112
2021-05-26 12:41:19 +00:00
alex-tee
232b40da7b gstrvbuilder: add addv and add_many to the API 2021-05-26 12:41:18 +00:00
Xavier Claessens
090d65712d glib_typeof: Move definition to its own header
It is cleaner to define glib_typeof() in a header included after
gversionmacros.h so we can use GLIB_VERSION_MIN_REQUIRED directly
instead of doing it everywhere glib_typeof() is used.
2021-05-17 12:07:30 -04:00
Peter Bloomfield
955307208f gapplication: Guard g_application_mark_busy()
The `GApplication` must be registered before calling
`g_application_mark_busy()`. Document that, and add a guard.

The same is true for `g_application_unmark_busy()`, but the existing
documentation and guard for `busy_count > 0` are enough.
2021-05-17 11:50:12 -04:00
Philip Withnall
d64d46dc42 Merge branch 'macos-static-libintl' into 'master'
meson: Fix detection of static libintl on macOS

See merge request GNOME/glib!2109
2021-05-17 14:07:44 +00:00
Philip Withnall
f71faad46b Merge branch 'th/gdbus-doc-unsubscribe-idle' into 'master'
gdbus: document completion after idle action for g_dbus_connection_signal_unsubscribe()

See merge request GNOME/glib!2050
2021-05-17 10:49:38 +00:00
Philip Withnall
62571c71b5 Merge branch 'Docs' into 'master'
docs: Improved documentation of GNotification

Closes #2405

See merge request GNOME/glib!2102
2021-05-17 10:30:55 +00:00
Nitin Wartkar
e727a69a8b docs: Improved documentation of GNotification 2021-05-17 10:30:54 +00:00