Commit Graph

19858 Commits

Author SHA1 Message Date
António Fernandes
3da40e9036 gutils: Use no-break space in g_format_size()
It's undesirable for quantity and unit to be separated by line breaks.

Fixes https://gitlab.gnome.org/GNOME/glib/issues/1625
2018-12-19 16:27:14 +00:00
Emmanuele Bassi
c33a98f42f Merge branch 'fix-gsubprocess-tests' into 'master'
Revert "tests: Fix GOptionContext leak in GSubprocess tests"

See merge request GNOME/glib!551
2018-12-19 15:14:29 +00:00
Philip Withnall
ccb3486543 Revert "tests: Fix GOptionContext leak in GSubprocess tests"
This reverts commit 52bab0254a.

It silently conflicted with another commit,
90ca3b4dd0, which was merged later than
it. I’ve kept commit 90ca3b because it also frees the GError; 52bab
doesn’t.

This is my failure to rebase and test old branches before merging them,
instead of assuming that the lack of automatically detected merge
conflicts actually means there are no merge conflicts.
2018-12-19 14:54:27 +00:00
Emmanuele Bassi
b709c6bde4 Merge branch 'rw-lock-docs' into 'master'
gthread: Clarify priority handling in GRWLock

See merge request GNOME/glib!376
2018-12-19 13:27:49 +00:00
Emmanuele Bassi
48c2d94d7b Merge branch 'gmarkup-docs' into 'master'
gmarkup: Make the documentation even more explicit about untrusted input

See merge request GNOME/glib!332
2018-12-19 13:27:05 +00:00
Philip Withnall
499e08a462 Merge branch 'gtask-set-name' into 'master'
gtask: Add a g_task_set_name() method

See merge request GNOME/glib!384
2018-12-19 13:16:07 +00:00
Philip Withnall
0b80445b0c Merge branch 'gsubprocess-communicate-utf8-tests' into 'master'
Add UTF-8 communication tests for GSubprocess

See merge request GNOME/glib!381
2018-12-19 13:15:04 +00:00
Philip Withnall
a81aa3cb96 Merge branch 'rc-align' into 'master'
Align the reference counted allocations

Closes #1581

See merge request GNOME/glib!473
2018-12-19 12:30:57 +00:00
Philip Withnall
ed007bb4cf docs: Mention handling of filenames containing colons in gio docs
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1623
2018-12-19 12:24:17 +00:00
Philip Withnall
88ceff934c docs: Use Unicode apostrophes in gio documentation
Let’s move into the 21st century.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:20:01 +00:00
Philip Withnall
3026efbc0f docs: Fix some minor wording problems in the gio documentation
And some missing apostrophes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:49 +00:00
Philip Withnall
30ed95216a docs: Fix capitalisation of ‘ETag’
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:17:32 +00:00
Philip Withnall
7bac53d41f docs: Improve formatting of literals in gio documentation
There was no distinction between literals which need to be typed, and
normal words in the prose.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-19 12:16:48 +00:00
Philip Withnall
04af8f12f0 Merge branch 'master' into 'master'
GTlsConnection: add ALPN support

See merge request GNOME/glib!520
2018-12-19 12:01:50 +00:00
Philip Withnall
0953338704 Merge branch 'tpm-keys-in-pem-files' into 'master'
gtlscertificate: Add support for TPM keys in PEM files

See merge request GNOME/glib!522
2018-12-19 11:53:17 +00:00
Thomas Jost
5731f06541
gdbus-codegen: honor "Property.EmitsChangedSignal" annotations
Co-Authored-by: Andy Holmes <andrew.g.r.holmes@gmail.com>
2018-12-19 11:06:31 +01:00
Philip Withnall
46900e55e7 Merge branch 'mcatanzaro/g-assert-error-doc' into 'master'
Improve documentation of g_assert_error()

See merge request GNOME/glib!549
2018-12-19 09:29:26 +00:00
Michael Gratton
1d62b3b452 Merge branch 'wip/1615-gdbus-codgen-nullable' into 'master'
gdbus-codegen: Add missing nullable and optional g-i annotations to generated code

Closes #1615

See merge request GNOME/glib!526
2018-12-19 07:25:19 +00:00
Michael Gratton
613f63f4a1 gdbus-codegen: Add missing nullable and optional g-i annotations to generated code
Fixes #1615
2018-12-19 18:00:25 +11:00
Michael Catanzaro
0618d67411 Improve documentation of g_assert_error()
This macro is intended for use in tests, but recommends as an
alternative to use a macro that is not intended for use in tests.
Fix it.
2018-12-19 02:29:14 +00:00
Scott Hutton
9032e8897d Implement support for ALPN in GTlsConnection, GDtlsConnection 2018-12-18 16:32:55 -08:00
Philip Withnall
26f783576d Merge branch 'docs-fixes' into 'master'
Various minor docs fixes

See merge request GNOME/glib!536
2018-12-18 15:35:07 +00:00
Matthias Clasen
4e776d9167 Merge branch 'no-free-check' into 'master'
Do not check for NULL when calling free()

See merge request GNOME/glib!547
2018-12-18 13:51:50 +00:00
Emmanuele Bassi
84d013ed46 Do not check for NULL when calling free()
The C standard guarantees that `free()` is `NULL`-safe.
2018-12-18 13:27:43 +00:00
Philip Withnall
8aff74e213 Merge branch 'wip/kalev/recursive-mutex-locker' into 'master'
Add GRecMutexLocker

See merge request GNOME/glib!528
2018-12-18 12:18:40 +00:00
Kalev Lember
e7e40ba1cf tests: Update GMutexLocker tests
Spawn a thread and assert that the mutex actually got locked and then
unlocked again, same as we do in GRecMutexLocker tests.
2018-12-18 12:24:17 +01:00
Kalev Lember
8c2e71bba0 Add GRecMutexLocker
This is the same as GMutexLocker, just for recursive mutexes.
2018-12-18 12:24:17 +01:00
Emmanuele Bassi
76d8fb65b2 Document the alignment for refcounted allocations
We use the same definition as malloc().
2018-12-18 11:18:43 +00:00
Emmanuele Bassi
f81723e675 Test the alignment of the refcounted box allocations
Check that the allocations are aligned regardless of the block size.
2018-12-18 11:18:43 +00:00
Emmanuele Bassi
87f0a5a219 Align the reference counted allocations
We need stronger alignment guarantees for the memory allocations done
through g_rc_box_alloc_full(): while the passed block size may be
aligned, we're not aligning the private data size; this means the
overall allocation may become unaligned, and this could raise issues
when we use the private data size as an offset to access the reference
count.

Fixes: #1581
2018-12-18 11:18:43 +00:00
Fredrik Ternerot
a437a50694 gtlscertificate: Allow any type of private key in PEM files
Allow any type of private key in PEM files by treating PEM guards ending
with "PRIVATE KEY-----" as a private key instead of looking for a
pre-defined set of PEM guards. This enables the possibility for custom
GTlsBackend to add support for new key types.

Test cases have been expanded to ensure PEM parsing works for private
key when either header or footer is missing.

Encrypted PKCS#8 is still rejected. Test case has been added for this to
ensure behaviour is the same before and after this change.
2018-12-18 11:43:08 +01:00
Fredrik Ternerot
73ca761a8d tests/tls-certificate: Add PEM files containing CRLF
Add test case to ensure correct parsing of PEM files containing CRLF
(\r\n) line endings.
2018-12-18 11:41:45 +01:00
Fredrik Ternerot
c7ee522172 tests/tls-certificate: Change to g_assert_null/nonnull
Use g_assert_null/g_assert_nonnull instead of g_assert since
g_assert can be compiled out with G_DISABLE_ASSERT.
2018-12-18 11:40:26 +01:00
Philip Withnall
2a64176b83 Merge branch 'g-alignof' into 'master'
gmacros: Add G_ALIGNOF superseding _g_alignof macro

Closes #1055

See merge request GNOME/glib!538
2018-12-18 10:29:22 +00:00
Philip Withnall
79dc99b9f0 Merge branch 'wip/add-shebang-to-test-script' into 'master'
spawn: add shebang line to script

See merge request GNOME/glib!546
2018-12-18 09:59:26 +00:00
Tapasweni Pathak
58bbdcf6c0 gmacros: Add G_ALIGNOF superseding _g_alignof macro 2018-12-18 13:59:23 +05:30
Ray Strode
3ab7a6544c spawn: add shebang line to script
downstream tools get confused when the script is missing a shebang
line, and having a shebang line doesn't hurt, so add one.
2018-12-17 16:19:31 -05:00
Philip Withnall
70eb076ac3 Merge branch '1601-appinfo-test-again' into 'master'
Support isolating directories for unit tests

Closes #538 and #1601

See merge request GNOME/glib!505
2018-12-17 17:51:37 +00:00
Philip Withnall
7a79984068 gutils: Drop fallback handling for NULL homedirs in XDG getters
It’s not possible for g_build_home_dir() to return NULL. The fallback
code here seems to originate from commit 1607e3f1 in 2005 (bug 169348),
where it was added with the explanation “Guard against g_home_dir being
NULL”.

The XDG Base Directory specification doesn’t have anything to say about
what to do when $HOME is unset:

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

It’s all a bit moot, though, becaause since commit 9cbfb560
(bug 773435), g_{get,build}_home_dir() cannot return NULL. So just drop
the fallback.

See discussion on
https://gitlab.gnome.org/GNOME/glib/merge_requests/505#note_386109.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
1947834b70 tests: Disable debug output from desktop-app-info subprocess
The `apps` subprocess is spawned by desktop-app-info to interpret the
forest of .desktop files, and its output is provided on stdout. If debug
output is mixed up with that output, tests which parse the output fail.

Disable the debug output from the subprocess to prevent this.

The new debug output appeared as a result of recent changes to the
desktop file dir monitoring code in gdesktopappinfo.c.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
f8421059e9 tests: Add some debug output to desktop-app-info test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
1ea4ba8d6e tests: Use static appinfo .desktop file when not launching
The appinfo-test.desktop file is set up with an Exec= path which points
to the compiled and installed appinfo-test utility. When running the
tests uninstalled, however, this might not be present, which causes
loading appinfo-test.desktop to fail.

Split appinfo-test.desktop in two: keep the existing
appinfo-test.desktop for tests which need to launch appinfo-test, and
add a new appinfo-test-static.desktop for tests which don’t launch
anything (and, for example, just inspect GAppInfo properties).
appinfo-test-static.desktop uses an Exec= line which should always be
present (`true`) so it should never fail to load.

Allow the tests using appinfo-test-static.desktop to be run uninstalled
or installed. Allow the tests using appinfo-test.desktop to be skipped
if loading appinfo-test.desktop fails, which is an indicator that the
test is running uninstalled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
60c2533f44 tests: Port appinfo test from g_assert() to g_assert_*()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
707c3f2495 tests: Isolate directories in mimeapps test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
d23c893a0f tests: Isolate directories in appmonitor test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
914e7c6014 tests: Isolate directories in desktop-app-info test
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
797a8b0930 tests: Isolate directories in appinfo test
This is essentially a reversion of commit
a39b847ddf, plus the addition of the new
G_TEST_OPTIONS_ISOLATE_XDG_DIRS option.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1601
2018-12-17 17:16:04 +00:00
Philip Withnall
99bc33b632 gdesktopappinfo: Reload the desktop dirs if the $XDG_CONFIG_HOME changes
This causes the desktop directory cache to be correctly reloaded between
unit tests if G_TEST_OPTION_ISOLATE_DIRS is in use.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
e97bf89dd4 gcontenttype: Improve the formatting of some code in a docs comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00
Philip Withnall
b06fa34bb1 gcontenttype: Add g_content_type_{get,set}_mime_dirs() API
This allows the list of directories which contain MIME data to be set,
separately from the list of directories returned by
g_get_user_data_home() and g_get_system_data_dirs().

While the latter are overridden for a unit test, we don’t have access to
the system MIME registry, which can sometimes be useful for tests which
need to know about standard MIME associations from shared-mime-info.

Allow g_content_type_set_mime_dirs() to be used from unit tests to allow
them to use the system MIME registry again, or to allow them to be
pointed to another custom registry.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:04 +00:00