Commit Graph

24069 Commits

Author SHA1 Message Date
Philip Withnall
5a9e3df11d Merge branch 'wip/who-tests-the-tests-themselves' into 'main'
tests: Fix error handling when testing gtestutils

See merge request GNOME/glib!2216
2021-08-05 14:13:20 +00:00
Philip Withnall
7451140688 Merge branch 'mcatanzaro/issuer-docs' into 'main'
Improve documentation of various TLS stuff

See merge request GNOME/glib!2211
2021-08-05 12:14:57 +00:00
Simon McVittie
b006403c4e tests: Fix error handling when testing gtestutils
We had two compensating bugs here. We didn't correctly clear the
error indicator after testing a test-case that calls g_test_fail(),
which meant we were leaving the error set to exit status 1 when
falling through to the next test; and then we didn't check the exit
status of the next test, but instead assumed that g_spawn_sync()
would fail (it does not).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-05 12:09:53 +01:00
Michael Catanzaro
b11d3fc2f4 gtlscertificate: improve documentation
Let's explain the advantages of relying on GTlsConnection to perform
certificate verification.

Also, document that the issuer property is a little tricky, because the
issuer certificate might not be the certificate that actually gets used
in final certification path building. This is very unexpected to anybody
who is not an expert.
2021-08-04 14:39:11 -05:00
Michael Catanzaro
235401b056 gtlsdatabase: improve documentation
Because TLS certificate verification is extremely complex, the lookup
issuer function may be tempting to misuse even by experienced
developers. There is a notion that the issuer certificate will always be
used in the final certification path, but it's just not always true.
Trying to make security decisions based on the results of this function is
a trap, so let's document that.

It turns out that old versions of glib-networking actually reordered the
certificate chain to match the final verification path. This no longer
happens since a long time ago, because it was a buggy mess. Instead, we
rely on the TLS library to build the final verification path. Their path
building is not very good, but at least it's consistent. The point of
these doc updates is to clarify that only the TLS library can make
security decisions.

Document that HTTP requests may be performed to look up missing
certificates.

Finally, let's document that certificate verification using GTlsDatabase
cannot be as smart as certificate verification performed directly by
GTlsConnection.
2021-08-04 14:39:11 -05:00
Jonathan Boeing
032eceb9a1 gwin32packageparser: Fix read past end of buffer
g_win32_package_parser_enum_packages() reads beyond the end of a buffer
when doing a memcpy.  With app verifier enabled on Windows, it causes
the application to crash on startup.

This change limits the memcpy to the size of the source string.

Fixes: #2454
2021-08-04 09:19:30 -07:00
Philip Withnall
be4b8cbe96 2.69.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-08-04 16:32:18 +01:00
Philip Withnall
0f9c7ed021 Revert "gdbus: Use DBUS_SESSION_BUS_ADDRESS if AT_SECURE but not setuid"
This reverts commit 7aa0580cc5.

As stated in #2316, that commit was a workaround to allow gnome-keyring
and msmtp to continue to get their session bus address from
`DBUS_SESSION_BUS_ADDRESS`, even though they’re `AT_SECURE`. The timeout
on that workaround has expired so that commit is now being reverted.

Fixes: #2316
2021-08-04 16:16:16 +01:00
Philip Withnall
709df8eeb4 Merge branch 'docgen-fixes' into 'main'
Adapt documentation to gi-docgen

See merge request GNOME/glib!2206
2021-08-03 13:53:38 +00:00
Philip Withnall
30b9aacff1 Merge branch 'notify-hint' into 'main'
GNotification: Allow to set a category

Closes #2446

See merge request GNOME/glib!2207
2021-08-03 13:44:16 +00:00
Guido Günther
8704c521fd gfdonotificationbackend: Pass on category 2021-08-02 19:26:38 +02:00
Guido Günther
791218a5f5 GNotification: Allow to set a category
Some backends like the FDO one allow to set a category. This helps the
notification daemon to select a proper feedback type.
2021-08-02 19:26:38 +02:00
Emmanuele Bassi
d6f7f8e961 docs: Use the proper Markdown syntax for lists
You need to separate the first entry in the list from the preceding
paragraph, and you should add a space before the enumerating symbol.

GTK-Doc accepts a very lax Markdown syntax, but any other tool parsing
our documentation will likely fail.
2021-08-02 16:29:16 +01:00
Emmanuele Bassi
24a0c3a940 docs: Break GFileAttribute descriptions into paragraph
Keep the first paragraph short, to act as a summary.
2021-08-02 16:21:37 +01:00
Emmanuele Bassi
bed2da6cc2 docs: Break gtk-doc stanzas into paragraphs
Keep the first paragraph short, to act as a summary.
2021-08-02 16:00:12 +01:00
Emmanuele Bassi
4bbe7912a1 docs: Use the correct sigils for pre-processor symbols
And reduce the excessive whitespace in argument and return value blocks.
2021-08-02 15:59:43 +01:00
Emmanuele Bassi
97a6111c83 docs: Enable syntax highlighting on code examples 2021-08-02 15:56:42 +01:00
Emmanuele Bassi
3b5d3ed2e3 docs: Fix KeyFile annotations
Use the right gtk-doc sigil for pre-processor symbols.

Reduce the indentation in argument annotations, to avoid them being
parsed as code blocks.
2021-08-02 15:55:08 +01:00
Simon McVittie
37e5dfd3a2 Merge branch 'close-range-cloexec' into 'main'
gspawn: Use CLOSE_RANGE_CLOEXEC if available

See merge request GNOME/glib!2184
2021-08-02 14:49:27 +00:00
Philip Withnall
921e1f2b8b Merge branch 'appinfo-pointer-init' into 'main'
GWin32AppInfo: Fix missing initialization

See merge request GNOME/glib!2210
2021-08-02 14:36:40 +00:00
Руслан Ижбулатов
ae5e016edc GWin32AppInfo: Fix missing initialization
The value should be initialized to NULL before calling
g_win32_registry_key_get_value_w(), to ensure that cleanup
can be done unconditionally afterward.
2021-08-02 14:19:35 +00:00
Emmanuele Bassi
1b666b7f12 docs: Clean up the GDate types description
Split the first paragraph.

Use the correct gtk-doc sigil for enumeration value.

Use the appropriate term for negative years in the Western calendar.
2021-08-02 14:54:34 +01:00
Emmanuele Bassi
2aedaf293b docs: Annotate glib_check_version()
Add introspection annotations.

Reduce the indentation for the return value documentation string.

Use the appropriate gtk-doc syntax for symbols.
2021-08-02 14:52:06 +01:00
Philip Withnall
92bdc92d6d Merge branch 'unicode-typo-fix' into 'main'
Fix a Unicode typo

See merge request GNOME/glib!2201
2021-08-02 13:44:20 +00:00
Philip Withnall
d6576e9781 Merge branch 'nfc-nfd-test' into 'main'
tests: Add a test for Unicode normalization

See merge request GNOME/glib!2204
2021-08-02 13:17:23 +00:00
Philip Withnall
fad0a6af87 Merge branch 'wip/smcv/2452-g-string-0-length-replace' into 'main'
g_string_replace: Don't replace empty string more than once per location

Closes #2452

See merge request GNOME/glib!2208
2021-08-02 12:47:03 +00:00
Emmanuele Bassi
6081e92daf docs: Match GZlib(De)Compressor section with the type name
Otherwise the introspection scanner won't be able to match the
documentation stanza to the corresponding type.
2021-08-02 13:27:55 +01:00
Emmanuele Bassi
f62622fc7b docs: Start stanzas with a single paragraph
When rendering the contents of the GLib documentation stored inside the
introspection data, a common behaviour is to take the first paragraph as
a summary of the symbol being documented.

The documentation is assumed to be in Markdown format, which means:

 - paragraphs must be separated by newlines
 - lines that have an indentation of four or more spaces are considered
   code blocks
 - lines that start with a `#` are considered titles

This means we need to slightly tweak the documentation in our sources to
ensure that it can be rendered appropriately by tools that are not
gtk-doc.

See issue: #2365
2021-08-02 13:22:23 +01:00
Simon McVittie
b13777841f g_string_replace: Document behaviour of zero-length match pattern
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:36:26 +01:00
Philip Withnall
069308ab54 Merge branch 'issue-2429' into 'main'
gspawn: safe_fdwalk/safe_closefrom for Solaris 11.3/11.4

Closes #2429

See merge request GNOME/glib!2203
2021-08-02 11:35:55 +00:00
Simon McVittie
bf70d58d55 test_string_replace: Exercise zero-length replacements
Previously, these would have done 2**32 replacements, and the first one
would have consumed 6GB of memory in the process. They now match what
Python `str.replace()` does.

Reproduces: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
0a8c7e57ab g_string_replace: Don't replace empty string more than once per location
This matches the behaviour of Python `str.replace()`, and avoids carrying
out 2**32 replacements before n wraps around, which is almost certainly
not what we want.

Resolves: https://gitlab.gnome.org/GNOME/glib/-/issues/2452
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
7d35e49c42 test_string_replace: Expand test coverage
These are taken from another project (steam-runtime-tools) where I
implemented a similar replace method before realising that more recent
GLib versions had g_string_replace().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
c64e6cfc79 test_string_replace: Make the test table-driven
This makes it straightforward to add more test-cases.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 12:31:19 +01:00
Simon McVittie
24b652d3ca test_string_replace: Make types agree
g_string_replace() returns guint, not gint.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-08-02 11:53:56 +01:00
Philip Withnall
ce5a2cfed5 Merge branch 'regwatch-appinfo-fixes' into 'main'
GWin32RegistryKey / GWin32AppInfo registry watch fixes

See merge request GNOME/glib!2205
2021-08-02 10:51:28 +00:00
Casper Dik
a75ffc5112 gspawn: safe_fdwalk for Solaris 11.4
Use F_NEXTFD/F_PREVFD for fdwalk when they are available.

Closes #2429
2021-08-01 12:52:34 -07:00
Casper Dik
790571a2cd gspawn: safe_closefrom for Solaris 11.3/11.4
When F_CLOSEFROM is defined, we know that closefrom() is signal safe.
2021-08-01 12:43:19 -07:00
Руслан Ижбулатов
4e9e7bfd34 GWin32AppInfo: re-trigger registry watcher from the callback
To ensure that the watch is properly re-set every time, call
watch_keys() from the watch callback. Previously the watch was only
renewed after a data update was done in a worker thread, which made
no sense, since the update function was implemented in such a way
that it can (and should) be re-triggered on each key change, until
the changes stop coming, and that can only happen if we renew
the registry watcher right away.
2021-07-31 11:01:06 +00:00
Руслан Ижбулатов
6885a29428 GWin32RegistryKey: ensure reqeueing works correctly
If a key watch is renewed from the key watch callback, it results
in the callback being NULL, since we clear it after we call it.

Rearrange the function to make sure that the changes done by the
callback function are preserved properly.
2021-07-31 10:57:44 +00:00
Руслан Ижбулатов
8c25302726 GWin32RegistryKey: Change STATUS_SUCCESS handling
This function can, in fact, return STATUS_SUCCESS. We shouldn't
assert that it doesn't.

For now interpret it just like STATUS_PENDING (i.e. APC will be called),
see how it goes (it isn't documented how the function behaves in this
case, we have to play it by ear).

Note that while we *can* use a better-documented RegNotifyChangeKeyValue() here,
it communicates back to us via event objects, which means that the registry
watcher would have to interact with the main loop directly and insert its
events (plural; one event per key) there. That would make the API more complicated.
Whereas the internal NT function communicates by calling an APC - we're good
as long as something somewhere puts the thread in alertable state.
2021-07-31 10:50:12 +00:00
Matthias Clasen
9599a9451c Add a test for Unicode normalization
This test verifies the examples from the Unicode
Annex that defines normalization.
2021-07-30 16:54:59 +01:00
Matthias Clasen
770059b588 tests: Remove a misplaced comment
This comment had nothing to do with the test below.
2021-07-29 14:19:41 -04:00
Matthias Clasen
6a6da9637a Fix a Unicode typo
The name of one of the Unicode Break types is misspelt.
Add an alias, since it annoys me every time I look at
Pango's break code.
2021-07-29 10:09:27 -04:00
Philip Withnall
02742ef957 Merge branch 'pgriffis/low-power-monitor' into 'main'
Add GPowerProfileMonitor

See merge request GNOME/glib!2194
2021-07-28 14:52:15 +00:00
Patrick Griffis
889bdb994f Add GPowerProfileMonitor 2021-07-28 15:56:02 +02:00
Bastien Nocera
92399e7114 gio: Do not block when low-memory-monitor daemon appears 2021-07-28 15:31:16 +02:00
Bastien Nocera
a7000cd989 gio: g_clear_signal_handler() can handle NULL args 2021-07-28 15:31:01 +02:00
Bastien Nocera
2e500304e3 tests: Remove unused constant in GMemoryMonitor test 2021-07-28 15:04:46 +02:00
Philip Withnall
f56fbb50a4 Merge branch 'fix-annotations' into 'main'
Fix doc stanzas for GDataInputStream properties

See merge request GNOME/glib!2200
2021-07-28 05:41:09 +00:00