Commit Graph

19518 Commits

Author SHA1 Message Date
Anders Jonsson
cfd2e83709 Update Swedish translation 2018-12-29 22:45:17 +00:00
Philip Withnall
db0bce02cb Merge branch 'win32-spawn-escaping' into 'master'
gspawn, win32: qouted args - escape end backslash

See merge request GNOME/glib!419
2018-12-27 12:52:04 +00:00
Vasily Galkin
22e875f710 gspawn, win32: quoted args - escape end backslash
According to msdn documentation last backslash(es) of quoted argument
in a win32 cmdline need to be escaped, since they are
directly preceding quote in the resulting string:
https://docs.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments

Glib <=2.58.0 passed children arguments like C:\Program Files\
without escaping last backslash(es).
So it had been passed as "C:\Program Files\"
windows command line parsing treated this as escaped quote,
and later text was treated as argument continuation instead of separate
arguments.

Existing implementation wasn't easily adoptable to fix this problem,
so escaping logic was rewritten.
Since the resulting length need to be increased due to extra escaping
it was rewritten too. Now the calculated length assumes that all
escapable chars would be escaped in a resulting string,
so the length may be a bit bigger than actually needed,
since backslashes not preceding quotes are not escaped.

This fixes the glib/tests/spawn-singlethread.c test
(which introduced testing for special chars to make this problem
testable).
The problem itself was found during investigations about fixing
related https://gitlab.gnome.org/GNOME/glib/issues/1566

The logic is duplicated in protect_argv_string() and protect_wargv() funcs.
However there is no single obvious way to get rid of duplication -
https://gitlab.gnome.org/GNOME/glib/merge_requests/419#note_371483

So by now adding a note referencing protect_wargv from protect_argv_string,
the other direction is already referenced.
2018-12-27 00:06:58 +03:00
Vasily Galkin
f7f597c841 gspawn, win32: fix child stderr when coverage enabled
This fixes test that were added in previous commit:
checking for empty stderr failed with coverage enabled, since
coverage warnings printed from gspawn-win32-helper process were treated
as child output. This is fixed by removing redirection after child
finishes execution.

The dup_noninherited renamed to reopen_noninherited,
since it actually always closes passed file descriptor.
2018-12-27 00:00:50 +03:00
Vasily Galkin
cafb61a179 gspawn, win32: fix redirecting only stderr
Problem was just a typo - wrong variable was checked before enabling
stderr redirection.
This fixes error-only redirection spawn-test added in previous commit.

Behavior while redirecting only stdout should be unaffected,
since old code tried to redirect stderr to -1 in such case,
which silently failed I think.
2018-12-26 23:55:28 +03:00
Vasily Galkin
50cb4f221c gspawn, tests: extend spawn_test, run it on win32
The spawn_test is enabled on win32 meson build, both msys and msvc.

Some modifications to make it useful for auto-testing on win32:
- use own argv0 to find helper win32-specific subprogram
- helper subprogram and conditions changed, so testing is fully
automated instead of manually checking contents of some MessageBoxes

Redirection test checks "sort" output for locale-independent string
instead of relying on "netstat" locale-dependent string.
Also with "sort" it become usable on unix, so enabled there too.
Currently this fails on win32 with coverage since
some coverage-realted error output from gpawn-win32-helper
is unexpectedly treated as executed subprocess output.


Added test checking "sort" with error-only redirection. This also fails
on win32 by now, due to a typo in gspawn-win32.c (checks for stdout
redirection instead of stderr)
2018-12-26 23:45:47 +03:00
Vasily Galkin
387739b018 gspawn, tests: check passing special chars in args
The existing singlethread g_spawn_sync test is modified and now tests
that special characters in arguments are correctly passed to child.
The test is added before spawn escaping fixing on win32
and covers the case currently broken on win32:
'trailing \ in argument containing space'.
2018-12-26 23:30:57 +03:00
Philip Withnall
940537bec7 Merge branch '1623-gio-open-docs' into 'master'
docs: Mention handling of filenames containing colons in gio docs

Closes #1623

See merge request GNOME/glib!550
2018-12-23 22:09:22 +00:00
Matthias Clasen
07f1bcfecc Merge branch 'docs-gsettings-backend-dconf' into 'master'
docs: Fix dconf GSETTINGS_BACKEND name in gio overview

See merge request GNOME/glib!560
2018-12-23 21:48:46 +00:00
Philip Withnall
37f41eb44a 2.59.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-23 13:06:57 +00:00
Mart Raudsepp
2ab231f52a docs: Fix dconf GSETTINGS_BACKEND name in gio overview 2018-12-21 17:38:06 +02:00
Philip Withnall
ea0da960ab Merge branch 'issues/1620' into 'master'
Issues/1620

See merge request GNOME/glib!554
2018-12-21 12:46:38 +00:00
Philip Withnall
87ea4ce1ff Merge branch 'gdbus-codegen-propemitschanged' into 'master'
honor "Property.EmitsChangedSignal" annotations

Closes #542

See merge request GNOME/glib!532
2018-12-21 12:34:55 +00:00
Philip Withnall
ac974a721f Merge branch 'suppress-int-in-bool-context-warning-with-g++' into 'master'
Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++

See merge request GNOME/glib!555
2018-12-21 12:16:30 +00:00
Kouhei Sutou
b8ac6e146a Suppress -Wint-in-bool-context warning with G_DEFINE_INTERFACE and g++
Note that it's not reported with gcc. It's only reported with g++.

C++ code to reproduce this warning:

    #include <glib-object.h>

    G_BEGIN_DECLS

    #define GARROW_TYPE_FILE (garrow_file_get_type())
    G_DECLARE_INTERFACE(GArrowFile,
                        garrow_file,
                        GARROW,
                        FILE,
                        GObject)

    struct _GArrowFileInterface {
      GTypeInterface g_iface;
    };

    G_DEFINE_INTERFACE(GArrowFile,
                       garrow_file,
                       G_TYPE_OBJECT)

    static void
    garrow_file_default_init(GArrowFileInterface *iface)
    {
    }

    G_END_DECLS

Build command line:

    % g++ -Wall -shared -o liba.so a.cpp $(pkg-config --cflags --libs gobject-2.0)

Message:

    In file included from /tmp/local.glib/include/glib-2.0/gobject/gobject.h:24,
                     from /tmp/local.glib/include/glib-2.0/gobject/gbinding.h:29,
                     from /tmp/local.glib/include/glib-2.0/glib-object.h:23,
                     from a.cpp:1:
    a.cpp: In function 'GType garrow_file_get_type()':
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:219:50: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
                                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:2026:11: note: in definition of macro '_G_DEFINE_INTERFACE_EXTENDED_BEGIN'
           if (TYPE_PREREQ) \
               ^~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:1758:47: note: in expansion of macro 'G_DEFINE_INTERFACE_WITH_CODE'
     #define G_DEFINE_INTERFACE(TN, t_n, T_P)      G_DEFINE_INTERFACE_WITH_CODE(TN, t_n, T_P, ;)
                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:16:1: note: in expansion of macro 'G_DEFINE_INTERFACE'
     G_DEFINE_INTERFACE(GArrowFile,
     ^~~~~~~~~~~~~~~~~~
    /tmp/local.glib/include/glib-2.0/gobject/gtype.h:178:25: note: in expansion of macro 'G_TYPE_MAKE_FUNDAMENTAL'
     #define G_TYPE_OBJECT   G_TYPE_MAKE_FUNDAMENTAL (20)
                             ^~~~~~~~~~~~~~~~~~~~~~~
    a.cpp:18:20: note: in expansion of macro 'G_TYPE_OBJECT'
                        G_TYPE_OBJECT)
                        ^~~~~~~~~~~~~
2018-12-20 11:24:53 +09:00
Cosimo Cecchi
dec0a6874e gdbusproxy: only connect to NameOwnerChanged for message buses
Names are a message bus feature, so it does not make sense to connect
to NameOwnerChanged when the underlying connection is not a message
bus.

Moreover, g_dbus_connection_signal_subscribe() will also enforce that
condition. Adding this extra check here is helpful to avoid a critical
warning when using GDBusProxy with peer-to-peer connections.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:19 +00:00
Cosimo Cecchi
7d02e32644 gdbusconnection: add a getter for the flags property
Right now this can only be set at construction but not read back.
That seems unnecessarily restrictive, and we'll need to read these
flags from outside of gdbusconnection.c in the next commit, so let's
just make it public.

https://gitlab.gnome.org/GNOME/glib/issues/1620
2018-12-20 00:41:13 +00:00
Philip Withnall
3924ef6ac1 Merge branch 'glib-gresource-ld-binary' into 'master'
glib-compile-resources: Add external data option

Closes #1489

See merge request GNOME/glib!553
2018-12-19 17:10:00 +00:00
Ninja-Koala
d04b9c371d glib-compile-resources: Add external data option
Add option to not encode resource data into the C source file
in order to embed the data using `ld -b binary`. This improves compilation
times, but can only be done on Linux or other platforms with a
supporting linker.

(Rebased by Philip Withnall, fixing minor rebase conflicts.)

Fixes #1489
2018-12-19 16:43:21 +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