Commit Graph

5820 Commits

Author SHA1 Message Date
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
Philip Withnall
df2f13f89b gcontenttype: Improve formatting of gcontenttype section documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
b6f7f37427 xdgmime: Add xdg_mime_set_dirs() method to override XDG envvars
In order to make xdgmime properly relocatable so that unit tests can use
it without it reading and modifying the user’s actual xdgmime files, and
without the need to call setenv() (and get tied up with thread safety
problems), add a xdg_mime_set_dirs() method to allow the dirs to be
overridden. They will still default to the values of $XDG_DATA_HOME and
$XDG_DATA_DIRS.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
528d537da8 tests: Port desktop-app-info to use g_assert_*()
g_assert() is for runtime code, and can be compiled out. g_assert_*()
cannot be compiled out, and give more helpful failure messages for
specific types.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
592365239a tests: Drop extraneous newlines from g_test_message() calls in mimeapps
g_test_message() adds a newline already.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
d4f804576a tests: Use g_assert_*() in mimeapps test rather than g_assert()
g_assert() can be compiled out with G_DISABLE_ASSERT, which renders the
test useless. The g_assert_*() functions provide more helpful feedback
on failure too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 17:16:03 +00:00
Philip Withnall
8ddfbb308b tests: Fix indentation of a block in the appinfo test
No functional changes.

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

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
46f47641c5 tests: Avoid chdir() call at the start of appinfo tests
By encoding the path to the appinfo-test binary in the .desktop files,
we can avoid a chdir() call in the tests, which was a bit ugly.

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

https://gitlab.gnome.org/GNOME/glib/issues/538
2018-12-17 17:16:03 +00:00
Philip Withnall
b4479d97d5 Revert "Meson: appinfo tests are racy if run in parallel"
This partially reverts commit 27b5fb5892.

The infrastructure for disabling a test is kept, but the appinfo and
desktop-app-info tests no longer need to be run serially.

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

https://gitlab.gnome.org/GNOME/glib/issues/1601
2018-12-17 17:16:03 +00:00
Philip Withnall
c3fbfbd2bd gio: Add missing documentation for G{Proxy,Socket}AddressEnumerator
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 13:53:34 +00:00
Philip Withnall
778132d54c gmountoperation: Add missing documentation
gtk-doc is unhappy that skeleton documentation comments had been written
for these functions (for the introspection annotations) but that the
documentation content was actually missing.

Add that content. I like a happy gtk-doc.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-17 13:53:34 +00:00
Philip Withnall
903ce7dc02 Merge branch '1191-g_assert_cmpvariant' into 'master'
gtestutils: Add g_assert_cmpvariant()

Closes #1191

See merge request GNOME/glib!529
2018-12-17 13:03:00 +00:00
Ignacio Casal Quinteiro
290c9ee655 Merge branch 'wip/silviol/gsocket_flags' 2018-12-17 10:24:45 +01:00
Michael Catanzaro
c46565d56a Merge branch 'fix-tlscertificate-parse-bug' into 'master'
gtlscertificate: Fix bug in PEM private key parser

See merge request GNOME/glib!534

Also see discussion in GNOME/glib!520
2018-12-14 21:23:04 +00:00
Fredrik Ternerot
feff178c3f gtlscertificate: Fix bug in PEM private key parser
Make sure to not go outside of PEM data buffer when looking for private
key.

Also adding test case that triggers this bug.
2018-12-14 20:18:55 +01:00
Silvio Lazzeretti
e1e5fa0600 added more g_pollable_input_stream_is_readable checks 2018-12-14 17:07:22 +01:00
Silvio Lazzeretti
9e89749e52 Partially revert "GSocket: Fix race conditions on Win32 if multiple threads are waiting on conditions for the same socket"
This partially reverts commit 799f8dcd46.
This patch seems to break the writability status of the server socket: once
somebody writes to it with success, then it reports it is not writable
anymore. Also, when the client socket has the flag FD_CONNECT set once,
it is never cleared and then it reports it is always writable, also when
it is not.
2018-12-14 16:26:59 +01:00
Philip Withnall
d289ef449b tests: Port various tests to use g_assert_cmpvariant()
This should improve test error reporting a little.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-12-14 15:04:11 +00:00
Silvio Lazzeretti
ac0706aad0 added stream writability checks in pollable unit test
This checks if the stream is writable before writing
to it. If the write succeeded with no error, then the
stream has to be also writable after the write
2018-12-13 11:10:06 +01:00
Ondrej Holy
0f508c7b89 Merge branch '1599-follow-up-from-gunixmounts-stop-considering-cifs-nfs-as-system-file-systems'
Merging this manually because the CI is still broken.

https://gitlab.gnome.org/GNOME/glib/merge_requests/494
2018-12-13 09:36:11 +01:00
Patrick Griffis
4c472f8e3f gsocketaddressenumerator: Make it an error to call next_async before finish
It logically doesn't make sense to repeatedly call next_async()
before the previous one has finished.
2018-12-11 16:12:51 -05:00
Patrick Griffis
8b9e88937b tests: Add gsocketclient test for slow connections 2018-12-11 16:12:48 -05:00
Patrick Griffis
4b29e55097 gnetworkaddress: Interleave ipv4 and ipv6 addresses 2018-12-11 16:12:34 -05:00
Patrick Griffis
c1e32b9057 gsocketclient: Improve handling of slow initial connections
Currently a new connection will not be attempted until the previous
one has timed out and as the current API only exposes a single
timeout value in practice it often means that it will wait 30 seconds
(or forever with 0 (the default)) on each connection.

This is unacceptable so we are now trying to follow the behavior
RFC 8305 recommends by making multiple connection attempts if
the connection takes longer than 250ms. The first connection
to make it to completion then wins.
2018-12-11 16:09:29 -05:00
Patrick Griffis
35e41862c2 gnetworkaddress: Implement parallel ipv4 and ipv6 dns lookups
As RFC 8305 recommends we can start multiple DNS queries in parallel
to more quickly make an initial response, especially when one is
particularly slow/broken.
2018-12-11 16:09:29 -05:00
Patrick Griffis
d6afa6c988 gresolver: Add g_resolver_lookup_by_name_with_flags{_async,_finish,}
This allows higher levels to have more control over resolving
(ipv4 or ipv6 for now) which allows for optimizations such
as requesting both in parallel as RFC 8305 recommends.
2018-12-11 16:09:29 -05:00
Philip Withnall
af39a37312 Merge branch 'fix-gdbus-codegen--interface-info' into 'master'
fix gdbus-codegen --interface-info-{header,body}

See merge request GNOME/glib!514
2018-12-11 12:25:31 +00:00
Will Thompson
335a01ebe4
gdbus-codegen: test --interface-info-{header,body}
This test is rudimentary but better than nothing.
2018-12-11 09:49:22 +00:00
Will Thompson
d946bff480
gdbus-codegen: sort input files
This means the output (including lists of filenames) does not depend on
the order of the input files, which may matter if this tool is invoked
with a glob or some other mechanism that doesn't guarantee an order.
2018-12-11 09:49:22 +00:00
Xavier Claessens
bdc9328bdf Merge branch 'meson-dep' into 'master'
Meson: Fix declare_dependency() calls

See merge request GNOME/glib!518
2018-12-10 22:39:32 +00:00
Xavier Claessens
475f0a9b67 Meson: Fix deprecation warning with 0.49.0 release
http://mesonbuild.com/Release-notes-for-0-49-0.html#deprecation-warning-in-pkgconfig-generator
2018-12-10 09:08:28 -05:00
Xavier Claessens
afd3f3beda Meson: Fix declare_dependency() calls
Turns out the fix in commit 93555577c wasn't enough, when using glib as
subproject and the parent project uses only libgio_dep, and include
<gi18n.h>, it won't find libintl.h because it's in the
include_directories of libglib_dep. Fix that by declaring dependencies
explicitly, which is the right thing to do since glib and gobject are
public dependencies of gio. That reflects what we do for the pkg-config
file as well.
2018-12-10 09:06:17 -05:00
Will Thompson
deafd7256e
gdbus-codegen: don't sort args in --interface-info-body
Previously, method and signal arguments were sorted by name, which
(assuming you don't happen to give your arguments
lexicographically-ordered names) means the generated signatures were
incorrect when there is more than 1 argument.

While sorting the methods and signals themselves (and properties, and
annotations on all these) is fine, it's easiest to not sort anything.
2018-12-06 21:39:27 +00:00
Will Thompson
faa3c319ba
gdbus-codegen: make --interface-info-{header,body} not crash
Since 1217b1bc4f, LICENSE_STR has taken two
parameters, not one. Without this change, running either mode fails
with a traceback like:

    Traceback (most recent call last):
      File "../gdbus-codegen", line 55, in <module>
        sys.exit(codegen_main.codegen_main())
      File ".../codegen_main.py", line 294, in codegen_main
        gen.generate()
      File ".../codegen.py", line 896, in generate
        self.generate_body_preamble()
      File ".../codegen.py", line 682, in generate_body_preamble
        self.outfile.write(LICENSE_STR.format(config.VERSION))
    IndexError: tuple index out of range

8916874ee6, which introduced these flags,
was actually merged after that commit, but I assume it was written
beforehand.
2018-12-06 21:39:17 +00:00
Chun-wei Fan
cd30faae1f gresources: Add a test with resources > 64kb
This is to ensure that the generated code is still compilable by the
running compiler, and see whether we can read the things in there
properly.

See issue #1580.
2018-12-05 18:27:16 +08:00
Chun-wei Fan
4501807d73 glib-compile-resources: Fix code generation for MSVC builds
glib-compile-resources was updated to generate octal byte
representation in a string, but unfortunately this breaks the build
on Visual Studio when the generated string sequence exceeds 65535
characters, which is the imposed limit on Visual Studio compilers.

To make things work on Visual Studio builds and to not slow down things
on other compilers, generate a code path for Visual Studio an array of
octal byte representations, as well as a code path for other compilers
that use the new string representation of octal values, and let the
compiler take the appropriate code path when compiling the
generated code.

Fixes issue #1580.
2018-12-05 16:17:24 +08:00
Matthias Clasen
136f83eefd Add tests for --gapplication-replace
Test the GApplication replacement functionality.
2018-11-26 11:45:30 -05:00
Matthias Clasen
3a4b18f903 GApplication: Add a way to replace a unique instance
While uniqueness is great, sometimes you want to restart
a newer version of the same app. These two flags make that
possible.

We also add a ::name-lost signal, that is emitted when it
happens. The default handler for this signal just calls
g_application_quit(), but applications may want to connect
and do cleanup or state-saving here.
2018-11-26 11:45:29 -05:00
António Fernandes
624e99b9d6 gunixmounts: Don't treat ZFS as a system internal fs
ZFS was originally added to the list of system internal filesystems by
commit 4cafadc955.

The rationale from https://bugzilla.gnome.org/show_bug.cgi?id=542156
doesn't seem very solid, and now we have x-gvfs-hide for this.

Also, this may contribute for trash:/// ignoring `{zfs mount path}/.Trash/`

So, remove zfs from the ignore_fs array.

Closes https://gitlab.gnome.org/GNOME/glib/issues/1599
2018-11-26 15:55:52 +00:00
Philip Withnall
051c9ada8e Merge branch 'glib-as-subproject' into 'master'
Meson: Add missing include_directories when using glib as subproject

See merge request GNOME/glib!491
2018-11-26 14:29:24 +00:00
Emmanuele Bassi
4326d5e27d Merge branch '1498-distcheck' into 'master'
Various distcheck and docs fixes

Closes #1498

See merge request GNOME/glib!488
2018-11-26 11:49:36 +00:00
Xavier Claessens
93555577c5 Meson: Add missing include_directories when using glib as subproject
When using glib as subproject we are forced to pass glib_dep,
gobject_dep and gio_dep to any build target. If we pass only gio_dep it
will missing include directory for glib and gobject.
2018-11-24 20:52:01 -05:00
Emmanuele Bassi
c1e44fda69 Merge branch '1514-appinfo-test-failure' into 'master'
tests: Run appinfo tests with a temporary XDG_CONFIG_HOME

Closes #1514

See merge request GNOME/glib!487
2018-11-23 16:52:51 +00:00
Emmanuele Bassi
9c8166806c Merge branch 'ossfuzz-11120-dbus-message-types' into 'master'
gdbusmessage: Gracefully handle message signatures with invalid types

See merge request GNOME/glib!472
2018-11-23 16:37:36 +00:00
Philip Withnall
cf8a9d3ffc docs: Fix URIs in documentation comments
Putting the raw URIs in the documentation comments would not link them,
and the ‘%20’s in the URIs were being parsed by gtk-doc as symbol
references. Fix that by using Markdown to format them correctly as
links.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:31:03 +00:00
Philip Withnall
3f2a5ee1cc docs: Fix ‘Since’ line for new function to reference stable release
We only build API ‘since’ indexes for stable releases, so 2.59 needs to
be rounded up to 2.60.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:30:33 +00:00
Philip Withnall
79aead142f docs: Fix formatting of some literals and properties
Using `%` indicates that you’re linking to a symbol. In these cases we
wanted some nicely formatted literals, or a link to a specific property.
Use backticks for the literals, and link to the property fully.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:29:30 +00:00
Philip Withnall
e88c2d1ab5 docs: Fix a doubly-defined symbol in the GApplication documentation
Due to the line wrapping, gtk-doc was interpreting this second line as
redefining the @dbus_register documentation.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:28:29 +00:00
Philip Withnall
8736789855 docs: Fix some typos in GIO documentation comments
These were highlighted by warnings from gtk-doc about broken links.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:27:58 +00:00
Philip Withnall
a39b847ddf tests: Run appinfo tests with a temporary XDG_CONFIG_HOME
Otherwise they fill your real ~/.config/mimeapps.list with rubbish and
race for access to it. This is arguably not good.

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

https://gitlab.gnome.org/GNOME/glib/issues/1514
2018-11-23 11:27:50 +00:00
Debarshi Ray
326a7fafe2 gio/tests/gdbus-test-codegen: Ensure that G_PARAM_DEPRECATED is present
https://gitlab.gnome.org/GNOME/glib/merge_requests/485
2018-11-23 10:38:28 +01:00
Debarshi Ray
53573d98f5 gdbus-codegen: Tag interfaces so annotated with G_PARAM_DEPRECATED
If a D-Bus interface was annotated with o.fd.DBus.Deprecated, then the
corresponding GObject property, in the common GInterface implemented
by the generated GDBusObjectProxies and GDBusObjectSkeletons, to
access the generated code for the D-Bus interface was not being marked
with G_PARAM_DEPRECATED, even though the gtk-doc snippet had the
'Deprecated: ' tag.

G_PARAM_DEPRECATED is older than gdbus-codegen, 2.26 and 2.30
respectively, hence it can be used unconditionally.

https://gitlab.gnome.org/GNOME/glib/merge_requests/485
2018-11-23 10:38:28 +01:00
Debarshi Ray
52ce05aaa7 gdbus-codegen: Tag properties so annotated with G_PARAM_DEPRECATED
If a D-Bus interface has a property that's annotated with
o.fd.DBus.Deprecated, then the corresponding GObject property was not
being marked with G_PARAM_DEPRECATED, even though the gtk-doc snippet
had the 'Deprecated: ' tag.

G_PARAM_DEPRECATED is older than gdbus-codegen, 2.26 and 2.30
respectively, hence it can be used unconditionally.

https://gitlab.gnome.org/GNOME/glib/merge_requests/485
2018-11-23 10:18:52 +01:00
Philip Withnall
b660a67cb3 Merge branch 'mcatanzaro/tls1.3-handshake' into 'master'
Deprecate TLS rehandshaking

See merge request GNOME/glib!478
2018-11-21 12:09:22 +00:00
Michael Catanzaro
85f7d493d7 Deprecate TLS rehandshake APIs
Allowing unsafe rehandshakes used to be required for web compatibility,
but this is no longer a concern in 2018. So there should no longer be
compatibility benefits to calling this function. All it does is make
your TLS connection insecure.

Also, rehandshaking no longer exists at all in TLS 1.3.

At some point (maybe soon!) glib-networking will begin ignoring the
rehandshake mode, so let's deprecate it now.
2018-11-20 22:07:58 -06:00
Michael Catanzaro
2031e37dfc Update documentation of g_tls_connection_handshake() one last time
Let's entirely deprecate calling this function for rehandshaking. The
current documentation is OK, but guarantees defined behavior (to attempt
a rehandshake) when TLS 1.2 is in use. But there's no way to force TLS
1.2, and also no way to check which version of TLS is in use. I really
should have deprecated use of this function for rehandshaking entirely
last time I updated it.

Fortunately, there should be no compatibility risk for existing code,
because rehandshaking has no visible effects at the API level.
2018-11-20 22:04:50 -06:00
Philip Withnall
5cc6942eab gdbusconnection: Add missing (nullable) annotation to get_unique_name()
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1594
2018-11-15 09:42:33 +00:00
Philip Withnall
0ff5e5cd32 gdbusmessage: Gracefully handle message signatures with invalid types
With the changes to limit GVariant type nesting (commit 7c4e6e9fbe),
it’s now possible to have a valid type signature which is not a valid
GVariant type when enclosed in parentheses (to make it a tuple).

Check for that when parsing the signature field in a D-Bus message.

Includes a unit test.

oss-fuzz#11120

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-15 09:22:38 +00:00
Xavier Claessens
9534447eb0 Merge branch 'fix-gio-test-build' into 'master'
Meson: Fix build error in gdbus-example-objectmanager

See merge request GNOME/glib!461
2018-11-14 15:37:05 +00:00
Philip Withnall
6f84f6823b Merge branch 'mr285-subscription-docs' into 'master'
docs: Clarify return/error behaviour of D-Bus signal subscriptions

See merge request GNOME/glib!470
2018-11-13 13:57:02 +00:00
Philip Withnall
2a52ff1c7c Merge branch 'settings-list-does-not-exist' into 'master'
Clarify docs for g_settings_list_children

Closes #1362

See merge request GNOME/glib!465
2018-11-13 12:54:41 +00:00
Philip Withnall
c63d37fdc2 docs: Clarify return/error behaviour of D-Bus signal subscriptions
Based on a patch by David Sommerseth, from
https://gitlab.gnome.org/GNOME/glib/merge_requests/285/.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-13 12:44:34 +00:00
Philip Withnall
b323635d79 Merge branch 'wjt/g-file-info-filesystem-readonly-fails' into 'master'
Improve tests/g-file-info-filesystem-readonly, and run it in CI.

Closes #1590

See merge request GNOME/glib!466
2018-11-13 12:38:18 +00:00
Will Thompson
a2f32f6a11
tests/g-file-info-filesystem-readonly: remove output stream stuff
This test is intended to verify the fix for
https://bugzilla.gnome.org/show_bug.cgi?id=787731, which was that
g_file_query_filesystem_info() would return stale information for the
mount. After replacing a read-only mount with a read-write mount, this
test used to only fail if G_FILE_ATTRIBUTE_FILESYSTEM_READONLY was TRUE
and yet the file could be opened for writing. In particular, if (due to
a test bug) the file really was still on a read-only filesystem, the
test would pass.

Now that we have fixed that bug in the test, we can make a stronger
assertion.
2018-11-13 10:34:09 +00:00
Will Thompson
5b106cdc56
tests/g-file-info-filesystem-readonly: unmount lazily
fusermount -z behaves like umount --lazy, which is documented thus:

> Detach the filesystem from the file hierarchy now, and clean up all
> references to this filesystem as soon as it is not busy anymore.

Without this, the call to `fusermount -u` often fails with:

  /usr/bin/fusermount: failed to unmount /home/wjt/src/gnome/glib/_build/dir_bindfs_mountpoint: Device or resource busy

which causes the subsequent call to bindfs to fail:

  fuse: mountpoint is not empty
  fuse: if you are sure this is safe, use the 'nonempty' mount option

It's not clear what is causing the mount to be busy. Inserting a
g_usleep (100 * 1000) before the calls to `fusermount -u` also works to
make the problem go away, but for the purposes of this test the
important point is that the mount is detached from the directory, for
which a lazy unmount is fine.

Fixes #1590.
2018-11-13 10:34:09 +00:00
Will Thompson
3821ba06b1
tests/g-file-info-filesystem-readonly: assert subcommands succeed
In practice, fusermount -u often fails:

  /usr/bin/fusermount: failed to unmount /home/wjt/src/gnome/glib/_build/dir_bindfs_mountpoint: Device or resource busy

which causes the subsequent calls to bindfs to fail:

  fuse: mountpoint is not empty
  fuse: if you are sure this is safe, use the 'nonempty' mount option

This may or may not cause the current test run to fail, but it reliably
causes a repeat run of the test to fail. This change causes the current
run to fail instead.
2018-11-13 10:34:09 +00:00
Philip Withnall
bc320d9fca gsettings: Add an example of a <default> with an empty string
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1261
2018-11-13 00:31:54 +00:00
Philip Withnall
f81a2b3de2 Merge branch 'mcatanzaro/tls1.3-handshake' into 'master'
Update documentation of g_tls_connection_handshake() again

See merge request GNOME/glib!467
2018-11-12 23:50:16 +00:00
Michael Catanzaro
68878ab50b Update documentation of g_tls_connection_handshake() again
I made a mistake when last updating the documentation in 94a99ae9. I
wrote that, with TLS 1.3, this would perform a rekey instead of a
rehandshake. In fact, that's only true for client connections. For
server connections, it's a no-op.

I was a bit nervous about how to document the behavior anyway, because
we really don't know what behavior will be reasonable with non-GnuTLS
crypto backends. This behavior is reasonable for the GnuTLS backend, but
might not necessarily make sense for OpenSSL. Ideally, we would
discourage API users from doing things which could have unexpected
effects, so instead of documenting what the GnuTLS backend does, I think
it'd be better to document that this is "undefined but not dangerous,"
since of course we want to make sure that existing code that doesn't
know about TLS 1.3 is not broken.
2018-11-12 14:49:30 -06:00
Matthias Clasen
bb1f765df3 Clarify docs for g_settings_list_children
The docs sound like settings list is a thing, and
a ::children-changed signal exists. That is not the
case, and will never be the case at this point, so
stop pretending.

Closes: #1362
2018-11-12 08:07:52 -05:00
Philip Withnall
4ea56957db Merge branch 'issues/1310' into 'master'
gdbusproxy: make g-name-owner property useful with unique names

See merge request GNOME/glib!454
2018-11-12 12:43:27 +00:00
INSUN PYO
bf1a2d7079 gio, tests: fix leak of dbus connection.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1- Start server
   gio/tests/.libs/gdbus-example-peer --server --address unix:abstract=/tmp/peer/myaddr

2- Check the open fds for server process
   lsof -a -p 8253
   ..................
   gdbus-exa 8253 imran    0u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    1u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    2u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    3u  0000        0,9        0     6602 anon_inode
   gdbus-exa 8253 imran    4u  unix 0xf1005680      0t0   966830 @/tmp/peer/myaddr

3- Run the client
   gio/tests/.libs/gdbus-example-peer --address unix:abstract=/tmp/peer/myaddr

4- Check the open fds for server process again
   lsof -a -p 8253
   ..................
   gdbus-exa 8253 imran    0u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    1u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    2u   CHR      136,1      0t0        4 /dev/pts/1
   gdbus-exa 8253 imran    3u  0000        0,9        0     6602 anon_inode
   gdbus-exa 8253 imran    4u  unix 0xf1005680      0t0   966830 @/tmp/peer/myaddr
   gdbus-exa 8253 imran    5u  unix 0xf1004280      0t0   965811 @/tmp/peer/myaddr
   gdbus-exa 8253 imran    6u  0000        0,9        0     6602 anon_inode

5- Please note the fd '5u' which is created when client makes connection but even when the client goes down, the descriptor is still there..
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

https://bugzilla.gnome.org/show_bug.cgi?id=734281
2018-11-12 15:45:20 +09:00
Cosimo Cecchi
47be0f7a23 gdbusproxy: make g-name-owner property useful with unique names
Currently, GDBusProxy:g-name-owner only notifies changes to the unique
name owner of the remote object in case the proxy was constructed for a
well-known name.
That sounds like an artificial restriction, and it's convenient to
connect to notify::g-name-owner if a proxy instance has already been
created for an unique name, instead of additionally using
g_bus_watch_name() to track the owner.

To fix this, always connect to NameOwnerChanged after the proxy is
initialized, instead of only doing so when the proxy was constructed for
a well-known name.

https://bugzilla.gnome.org/show_bug.cgi?id=791316
https://gitlab.gnome.org/GNOME/glib/issues/1310
2018-11-10 03:53:32 +00:00
Xavier Claessens
b3c899d295 Meson: Fix build error in gdbus-example-objectmanager
test_c_args is defined in the root meson.build with unfiltered list of
compiler flags, then redefined in gio/tests/meson.build after the
subdir() call. Move it before.
2018-11-09 13:23:43 -05:00
Philip Withnall
0c6346c98f Merge branch 'atomic-ref-count-cnd' into 'master'
Atomic reference count in GVariant, ContainerInfo and GDBus introspection

See merge request GNOME/glib!452
2018-11-08 14:22:03 +00:00
vmlobanov78
0985e70488 glib-compile-resources: Fix size allocation for compressed streams
The length of the stolen data from a memory output stream is given by
get_data_size() — get_size() can be larger, and hence cause unnecessary
overallocation.
2018-11-06 15:03:03 +00:00
Tomasz Miąsko
b599a0f414 gdbusintrospection: Use atomic operations to read ref_count 2018-11-06 14:44:40 +01:00
Simon McVittie
13e206aaeb meson: Centralize test timeout values
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-11-01 19:13:21 +00:00
Tomasz Miąsko
b7571d5f0f tests: Fix GVariantType leak in GAction tests 2018-11-01 12:15:09 +01:00
Tomasz Miąsko
52bab0254a tests: Fix GOptionContext leak in GSubprocess tests 2018-11-01 12:14:52 +01:00
Tomasz Miąsko
9347c7630f tests: Fix GRand leak in GMenuModel tests 2018-11-01 12:14:09 +01:00
Philip Withnall
e89128a935 gtask: Add a g_task_set_name() method
Similarly to g_source_set_name(), this sets a name on a GTask for
debugging and profiling. Importantly, this name is propagated to the
GSource for idle callbacks for the GTask, ending the glorious reign of
`[gio] complete_in_idle_cb`.

The name can be queried using g_task_get_name(). Locking is avoided by
only allowing the name to be set before the GTask is used from another
thread.

Includes tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-30 11:51:50 +00:00
Will Thompson
745422afac gdbus-codegen: add autocleanup for FooObject
This is only enabled with `--c-generate-autocleanup all` for the
reasons discussed on https://bugzilla.gnome.org/show_bug.cgi?id=763379.
2018-10-29 22:48:26 +00:00
Will Thompson
5b78c3fdff gdbus-codegen: test generating autocleanups
This is the most degenerate possible test but it does exercise this code
path.

(Tweaked by Philip Withnall <withnall@endlessm.com> to also add the flag
to the autotools build.)
2018-10-29 22:48:26 +00:00
Xavier Claessens
7c70bef8b6 gdbus-peer: Make sure to not include objectmanager-gen.c source
The executable depends only on the generated header file at compile
time, and on the library at link time. So meson can decide to compile
gdbus-peer.c before compiling the library and thus won't have generated
the header yet, causing the build error.

So declare_dependency() should only have the header file in its sources,
to force generating files before compiling gdbus-peer.c without
including objectmanager-gen.c into gdbus-peer's sources.
2018-10-25 07:34:23 -04:00
Will Thompson
cd524d065b
gseekable: fix 'attmepting' typo 2018-10-25 09:33:19 +01:00
Philip Withnall
5263b54a06 Merge branch 'objectmanager-src-dep' into 'master'
gio, tests: ensure objectmanager sources are generated

See merge request GNOME/glib!414
2018-10-25 04:28:09 +00:00
Marco Trevisan (Treviño)
11e4fcca5e gio, tests: ensure objectmanager sources are generated
We use libgdbus_example_objectmanager_dep as dependency for various
tests, but this implies only a link dependency while it doesn't ensure
that the sources are generated.

Make this explicit
2018-10-23 20:58:09 -05:00
Philip Withnall
1564ef5589 Merge branch 'wip/oholy/fix-trash-symlink' into 'master'
glocalfile: Fix access::can-trash if parent is symlink

Closes #1522

See merge request GNOME/glib!326
2018-10-24 00:03:55 +00:00
Philip Withnall
25b7716e0d Merge branch 'nirbheek/macos-library-versions' into 'master'
meson: Add macOS libtool versioning for ABI compatibility

See merge request GNOME/glib!282
2018-10-24 00:00:35 +00:00
Xavier Claessens
372e81b56c Merge branch 'ci-test-installed' into 'master'
CI: Test static build on installed glib

See merge request GNOME/glib!360
2018-10-23 13:56:46 +00:00
Xavier Claessens
7fa6e9e837 CI: Test static build on installed glib 2018-10-23 09:45:12 -04:00
Philip Withnall
7db63898c1 Merge branch 'shorten-gdbus-test-filename' into 'master'
build: work around meson issue with too long filenames on Windows. Fixes #1556

Closes #1556

See merge request GNOME/glib!370
2018-10-23 09:16:58 +00:00
Ondrej Holy
39afe07e27 Merge branch 'wip/oholy/bind-mounts' into 'master'
gunixmounts: Mark mounts as system internal instead of filtering out

See merge request GNOME/glib!366
2018-10-23 07:32:32 +00:00
Ondrej Holy
983a95c9dc gunixmounts: Mark mounts as system internal instead of filtering out
mntent-based implementation filter out mounts with device path that was
repeated. Consequently, it is not possible to show such mounts in UI even
with x-gvfs-show, because they are not returned from g_unix_mounts_get.
libmount-based implementation currently doesn't filter out any mounts
which causes issues to our volume monitors. Let's rather mark mounts
which don't point into fs root as system_internal. This approach won't be
affected by mount order as is mntent-based implementation. It will mark
more mounts as system_internal than it is filtered out with mntend-based
implementation, but there will be always possibility to show them in UI
over x-gvfs-show, which was not possible with mntend-based. We can
probably introduce some improvements later to not mark unique mounts as
system internal even if they don't point into fs root...

https://gitlab.gnome.org/GNOME/glib/issues/1271
2018-10-23 09:01:04 +02:00
Ondrej Holy
e1fa5ffb91 gio: Add g_unix_mount_get_root_path
Currently, there isn't API to determine root path for mounts created
over bind operation (or btrfs subvolumes). This causes issues to our
volume monitors if there is multiple mounts for one device, which can
happen with libmount-based implementation currently. Let's propagate
root path from libmount over g_unix_mount_get_root_path, so we can
handle this somehow in our volume monitors.

https://gitlab.gnome.org/GNOME/glib/issues/1271
2018-10-23 09:01:04 +02:00
Ondrej Holy
a56b9cc6b2 glocalfile: Use MAXSYMLINKS when following symlinks
Currently, readlink() is used only 12 times when expanding symlinks.
However, kernel uses 40 for this purpose and it is defined as MAXSYMLINKS.
Use that constant if available, or 40. See:
https://github.com/torvalds/linux/include/linux/namei.h.
2018-10-23 08:53:55 +02:00
Ondrej Holy
b6191059b8 glocalfile: Return NULL if symlink expansion fails
find_mountpoint_for() uses current file in case of error, because
get_parent() returns NULL for error, but also if parent doesn't exist.
Return "." from get_parent() if parent doesn't exist in order to
differentiate the error state.
2018-10-23 08:53:55 +02:00
Ondrej Holy
57cfbc9341 glocalfile: Add test case for symlink expansion
Test symlink expansion in find_mountpoint_for() function over
 _g_local_file_find_topdir_for(). find_mount_for() is crucial for many
of glocalfile.c functionality (e.g. to determine correct trash location)
and symlink expansion has to work properly.

https://gitlab.gnome.org/GNOME/glib/issues/1522
2018-10-23 08:53:54 +02:00
Philip Withnall
1c421b0158 glib: Port various callers to use g_utf8_validate_len()
These were callers which explicitly specified the string length to
g_utf8_validate(), when it couldn’t be negative, and hence should be
able to unconditionally benefit from the increased string handling
length.

At least one call site would have previously silently changed behaviour
if called with strings longer than G_MAXSSIZE in length.

Another call site was passing strlen(string) to g_utf8_validate(), which
seems pointless: just pass -1 instead, and let g_utf8_validate()
calculate the string length. Its behaviour on embedded nul bytes
wouldn’t change, as strlen() stops at the first one.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
8e60b3dde0 tests: Use g_assert_null() in gdbus-serialization test
This introduces no real functional changes (except when compiling with
G_DISABLE_ASSERT, in which case it fixes the test). Mostly just a code
cleanup.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
c2c9c7fa3b tests: Tidy up GError handling in gdbus-serialization test
This introduces no functional changes; just a bit of code tidying.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
e03d5a335b gdbusmessage: Check for valid GVariantType when parsing a variant blob
The code was checking whether the signature provided by the blob was a
valid D-Bus signature — but that’s a superset of a valid GVariant type
string, since a D-Bus signature is zero or more complete types. A
GVariant type string is exactly one complete type.

This meant that a D-Bus message with a header field containing a variant
with an empty type signature (for example) could cause a critical
warning in the code parsing it.

Fix that by checking whether the string is a valid type string too.

Unit test included.

oss-fuzz#9810

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
968f1c6cad gdbusmessage: Fix a typo in a documentation comment
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
50b544e2c0 gdbusmessage: Clarify error returns for g_dbus_message_new_from_blob()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
94a9ab3c03 gdbusmessage: Improve documentation for g_dbus_message_get_header()
The caller is responsible for checking the type of the returned
GVariant.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
af712bbce1 gdbusmessage: Validate type of message header signature field
Parsing a D-Bus message with the signature field in the message header
of type other than ‘g’ (GVariant type signature) would cause a critical
warning. Instead, we should return a runtime error.

Includes a test.

oss-fuzz#9825

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-23 17:01:51 +13:00
Philip Withnall
da512adc34 Merge branch 'stap-pass-cflags' into 'master'
build-sys: Pass CFLAGS to $(DTRACE)

See merge request GNOME/glib!403
2018-10-22 22:39:59 +00:00
Nirbheek Chauhan
8b3590c231 meson: Add macOS libtool versioning for ABI compatibility
With this, the compatibility version and current version values in macOS
and iOS dylibs will match the values set by Autotools.

See: https://github.com/mesonbuild/meson/issues/1451
2018-10-22 06:51:32 +05:30
Xavier Claessens
a46f88ba1b Meson: Fix linking of gdbus-peer test 2018-10-19 10:08:00 -04:00
Michael Catanzaro
4e94164a72 Fix a couple typos in doc comments 2018-10-17 13:23:36 -05:00
Ondrej Holy
ce9fa7a172 glocalfile: Fix bug uri in trash test
Fix typo in g_test_bug_base and move g_test_bug in the concrete test.
2018-10-17 12:42:04 +02:00
Ondrej Holy
0f5017fb70 glocalfile: Fix access::can-trash if parent is symlink
G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH can be set to a wrong value if
its parent dir is a symlink. This is because the find_mountpoint_for()
function tries to find mountpoint for a filepath and expands symlinks
only in parent dirs. But in this case the path is already parent dir
and needs to be expanded first...

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1522
2018-10-17 12:42:04 +02:00
Colin Walters
d7233ef81e build-sys: Pass CFLAGS to $(DTRACE)
Fedora is using https://fedoraproject.org/wiki/Changes/Annobin
to try to ensure that all objects are built with hardening flags.
Pass down `CFLAGS` to ensure the SystemTap objects use them.
2018-10-15 21:50:31 +00:00
Philip Withnall
efda2be302 Merge branch 'ghash-hpj-2018' into 'master'
GHashTable improvements

See merge request GNOME/glib!208
2018-10-10 23:01:51 +00:00
Philip Withnall
19c7a7bb23 gsubprocess: Add a missing test for invalid UTF-8 output
There were tests for invalid UTF-8 output when asynchronously
communicating with a subprocess, but nothing for synchronous
communication. Add such a test, and refine the code as a result.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-11 11:31:27 +13:00
Philip Withnall
4795dadde4 gsubprocess: Clear std buf outputs to NULL on failure
Instead of sometimes returning a non-NULL buffer, always return NULL.
However, keep the documentation as explicitly returning undefined values
on failure, so that we can change the behaviour in future if needed.

The return values weren’t defined for failure before, so were
implicitly returning undefined values.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-11 11:31:27 +13:00
Philip Withnall
90ca3b4dd0 tests: Fix some minor memory leaks in gsubprocess-testprog
This just makes the valgrind logs a bit cleaner so we can find real
problems in future.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-11 11:28:36 +13:00
Philip Withnall
2eaeefdf5d gdbusproxy: Document blocking guarantees of constructors
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/734
2018-10-09 09:15:43 +13:00
Christoph Reiter
180e59539c build: work around meson issue with too long filenames on Windows. Fixes #1556
When using glib as a meson subproject on Windows the build currently fails
due to too long paths during the build process. See
https://github.com/mesonbuild/meson/issues/4226 for the upstream bug.

To work around the issue shorten the filenames of the generated gdbus files.
2018-10-04 10:45:45 +02:00
Hans Petter Jansson
0600dd3220 tests: Fix bad node ordering assumption
The tests were making assumptions about the order of the returned D-Bus
introspection nodes. However, these are semantically unordered and
changes to e.g. GHashTable would break the tests.

Fix this by applying a sort prior to validation.
2018-10-03 22:14:38 +02:00
Philip Withnall
5002d87dec Merge branch '1525-task-result' into 'master'
gtask: Check an error hasn’t been returned when calling g_task_return*()

Closes #1525

See merge request GNOME/glib!368
2018-10-02 10:07:49 +00:00
Philip Withnall
290bb0dd1b gtask: Compress GTask struct using a bitfield
There are a lot of gbooleans in the private GTask struct, which seems a
bit wasteful. Use a bitfield to compress the struct a bit.

This reduces the size of the struct from 216 bytes to 168 bytes on my
64-bit machine.

One of the fields needs to remain separate, since it’s used from a
TRACE() macro which calls typeof() on it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-02 09:59:13 +01:00
Philip Withnall
f0cecba199 tests: Add return ordering tests for GTask
These are based on an example test program provided by Will Thompson in
issue #1525.

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

https://gitlab.gnome.org/GNOME/glib/issues/1525
2018-10-02 09:59:13 +01:00
Philip Withnall
bea3770935 gtask: Check an error hasn’t been returned when calling g_task_return*()
These functions already check to see if a successful result has already
been returned; expand them to also check to see if an error has been
returned.

We can’t just check GTask.result_set, as that’s actually an indicator
for whether the GTask.result member is filled — when
g_task_propagate_*() is called, it’s cleared again. We need a new state
bit.

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

https://gitlab.gnome.org/GNOME/glib/issues/1525
2018-10-01 21:45:48 +01:00
Philip Withnall
03232bd6a6 tests: Fix location of an unref in the GTask tests
This method drops the last reference *it* owns to the GTask, but then
continues to call methods on the GTask. This wasn’t resulting in
failures because a ref in another thread kept the GTask alive, but
that’s quite dodgy.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-10-01 21:45:48 +01:00
Philip Withnall
846a61457a Merge branch 'wjt/g_desktop_app_info_get_string_list' into 'master'
Add g_desktop_app_info_get_string_list(); fix g_key_file_free()

See merge request GNOME/glib!339
2018-10-01 19:21:05 +00:00
Will Thompson
5ca9eca632 gdesktopappinfo: add get_string_list() function
The X-Flatpak-RenamedFrom key is used in .desktop files to identify past
names for the desktop file. It is defined to be a list of strings.
However, there was previously no correct way to retrieve a list of
strings from the GKeyFile wrapped by GDesktopAppInfo, short of
re-parsing the file with GKeyFile.

Note that doing something like:

    g_strsplit (g_desktop_app_info_get_string (...), ";", -1)

is not correct: the raw value "a\;b;" represents the one-element list
["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so
g_desktop_app_info_get_string() returns NULL in this case. (Of course, a
.desktop file with a semicolon in its name is a pathological case.)

Add g_desktop_app_info_get_string_list(), a trivial wrapper around
g_key_file_get_string_list(), similar to g_desktop_app_info_get_string()
and co.

The change from g_key_file_free() to g_key_file_unref() in the test is
needed because g_key_file_free() clears the contents of the keyfile.
This is fine for all the fields which are eagerly loaded and copied into
GDesktopAppInfo, but not when we want to access arbitrary stuff from the
keyfile.
2018-10-01 20:03:55 +01:00
Xavier Claessens
6e0a03ee07 Merge branch '1536-link-whole' into 'master'
Meson: Fix static linking of convenience libraries

Closes #1536

See merge request GNOME/glib!357
2018-09-28 14:54:40 +00:00
Simon McVittie
62af03bda8 Meson: Extract objects from convenience libraries to link them
This avoids the convenience library being treated as though it was
an installed static library (objects not included in the dependent
static library, and convenience library being listed in the pkg-config
metadata), both of which would make static linking impossible.
This is a workaround for meson not having
https://github.com/mesonbuild/meson/pull/3939 merged yet.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1536
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-28 15:15:48 +01:00
Xavier Claessens
24d7a73b93 Meson: Bump dependency to 0.48.0 2018-09-27 16:01:41 -04:00
Xavier Claessens
27b5fb5892 Meson: appinfo tests are racy if run in parallel 2018-09-25 15:14:53 -04:00
Xavier Claessens
88a1188fc1 Merge branch 'speling' into 'master'
Fix spelling mistakes detected by Debian's Lintian tool

See merge request GNOME/glib!354
2018-09-25 18:16:52 +00:00
Simon McVittie
03cf374848 Spelling: Fix spelling of "unknown"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:35:13 +01:00
Simon McVittie
e0a8df12ef Spelling: Fix spelling of "similarly"
Detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-25 14:35:13 +01:00
Simon McVittie
cbc7fbbf7d meson: Run build-time tests with --tap where supported
This makes it easier to debug test failures, by ensuring that g_debug()
and g_test_message() are printed as TAP diagnostics.

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1528
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-24 23:37:12 +01:00
Xavier Claessens
b512135fc6 Merge branch '1535-tap' into 'master'
Meson: Run in TAP mode installed tests that support it

Closes #1535

See merge request GNOME/glib!343
2018-09-24 14:49:40 +00:00
Xavier Claessens
8391219e4c Meson: Run in TAP mode installed tests that support it 2018-09-23 13:44:15 -04:00
Simon McVittie
fa32ee6481 Remove unnecessary +x permissions
None of these files starts with a #! line, and they are not native
binary executables, so if a user attempts to execute them as a program,
Unix shells will run them as /bin/sh scripts. This is not going to end
well, since none of them are shell scripts (the gio bash completion
is for bash, which is not a lowest-common-denominator POSIX shell, and
in any case is designed to be sourced rather than executed).

Fixes: #1539
Signed-off-by: Simon McVittie <smcv@collabora.com>
2018-09-23 17:01:04 +01:00
Emmanuele Bassi
032f1a9782 Merge branch 'gio-fix-build' into 'master'
gio: automake: Add libgmodule dependency

See merge request GNOME/glib!334
2018-09-22 15:49:07 +00:00
Xavier Claessens
96fafcfe92 Meson: Fix missing files when installing tests
Closes #1527
2018-09-21 08:45:02 -04:00
Philip Withnall
18456b74a6 tests: Mark two more tests as slow
These keep on taking just longer than 30s on my local machine when run
in parallel with the rest of the tests (i.e. with `ninja test`). Testing
them individually, they do terminate correctly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-09-20 17:51:18 +01:00
Bernhard Walle
0d97c4d20c gio: automake: Add libgmodule dependency
Otherwise I get following compile error:

 libtool: link: /home/builduser/toolchains/linux/tc/2017-12/x86-ncp-linux-gnu/bin/i686-ncp-linux-gnu-gcc -Wall -Wstrict-prototypes -Wmisleading-indentation -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=pointer-arith -Werror=init-self -Werror=format=2 -O2 -Wall -pipe -Wformat -g -fstack-protector-strong -fPIC -fno-strict-aliasing -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-rpath-link=/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/zlib/lib -Wl,-rpath-link=/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/libffi/lib -o .libs/gio gio-tool.o gio-tool-cat.o gio-tool-copy.o gio-tool-info.o gio-tool-list.o gio-tool-mime.o gio-tool-mkdir.o gio-tool-monitor.o gio-tool-mount.o gio-tool-move.o gio-tool-open.o gio-tool-rename.o gio-tool-remove.o gio-tool-save.o gio-tool-set.o gio-tool-trash.o gio-tool-tree.o  -L/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/zlib/lib -L/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/libffi/lib ./.libs/libgio-2.0.so ../gobject/.libs/libgobject-2.0.so ../glib/.libs/libglib-2.0.so -Wl,-rpath -Wl,/home/builduser/workspaces/rws_trunk_linux_x86_build_shared-fips/build/3p/linux/x86/install/glib/lib
 /home/builduser/toolchains/linux/tc/2017-12/x86-ncp-linux-gnu/bin/../lib/gcc/i686-ncp-linux-gnu/6.3.0/../../../../i686-ncp-linux-gnu/bin/ld: warning: libgmodule-2.0.so.0, needed by ./.libs/libgio-2.0.so, not found (try using -rpath or -rpath-link)
 ./.libs/libgio-2.0.so: undefined reference to `g_module_error'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_close'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_open'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_supported'
 ./.libs/libgio-2.0.so: undefined reference to `g_module_symbol'
 collect2: error: ld returned 1 exit status
 Makefile:2300: recipe for target 'gio' failed

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
2018-09-18 10:27:19 +02:00
Philip Withnall
f928dfdf57 Merge branch 'master' into 'master'
Issue #1513: fix g_icon_to_string() regression (doc inconsistency).

Closes #1513

See merge request GNOME/glib!305
2018-09-17 10:32:32 +00:00
Iain Lane
d2a1a4bf55 Merge branch '1523-network-monitor-init-failure' into 'master'
gnetworkmonitornm: Set a GError properly on an error handling path

See merge request GNOME/glib!322
2018-09-13 14:27:56 +00:00
Jehan
8519368c0e Fix g_icon_to_string() regression (doc inconsistency).
g_icon_new_for_string() docs states that it should return a single name
when created with a single name. I add a second condition to this case:
the themed icon must not include default fallbacks (i.e. it must not
have been created with `g_themed_icon_new_with_default_fallbacks()`).
Otherwise the return value of `g_icon_new_for_string()` would not
recreate the same icon list when passed to `g_icon_new_for_string()`
(which would be another documentation inconsistency).

g_icon_new_for_string() is now back to old behavior for this specific
case.

I also revert the unit test for this case, and add a new unit test when
using g_themed_icon_new_with_default_fallbacks() with a single name as
well.

Closes #1513.
2018-09-13 13:16:40 +02:00
Iain Lane
6eb5bd8192
network-monitor-race test: Have the subprocess inherit stdout and stderr
If initialising the monitors produces any debug output, it is good to be
able to see it when running this test.
2018-09-13 11:44:16 +01:00
Iain Lane
36c79adb2f
gnetworkmonitornetlink: Pass a GError into read_netlink_messages()
Currently this function calls `g_warning()` explicitly. It would be
nicer to properly propagate these failure up to the caller that tried to
initialise us.
2018-09-13 11:44:16 +01:00
Iain Lane
6629423e7a
gnetworkmonitornetlink: Close the socket after disconnecting its GSources
`read_netlink_messages()` is the callback attached to the netlink socket
(G_IO_IN). It calls `g_socket_receive_message()`. There is a race
condition that if the socket is closed while there is a pending call, we
will try to receive on a closed socket, which fails.

To avoid this, we switch the order of the operations around: first
destroy the source and then close the socket.
2018-09-13 11:14:34 +01:00
Iain Lane
7fe8aa68a2
gnetworkmonitornetlink: Don't check if a passed-in GError ** is NULL
This is not a correct way to check if `g_socket_new_from_fd()` failed.
Instead just see if it returned `NULL` itself.

This was preventing the netlink monitor from being initialised.

Closes #1518
2018-09-13 11:14:34 +01:00
Philip Withnall
c5761146bc gnetworkmonitornm: Set a GError properly on an error handling path
All the other initialisation failure paths set a GError, but this one
didn’t. Set a GError to avoid breaking the invariant that returning
FALSE should always have a GError set.

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

https://gitlab.gnome.org/GNOME/glib/issues/1523
2018-09-13 10:25:05 +01:00
Michael Catanzaro
5bc35a7245 Merge branch 'mcatanzaro/auto-start-portals' into 'master'
Autostart xdg-desktop-portal if needed

See merge request GNOME/glib!317
2018-09-13 04:43:59 +00:00
Philip Withnall
dbe0572d57 Merge branch 'w32-gio-tests-enable' into 'master'
Enable GIO tests on Windows

See merge request GNOME/glib!312
2018-09-12 22:42:16 +00:00
Philip Withnall
3f10c8b059 Merge branch 'gdbus-codegen-type-punned-pointer-warnings' into 'master'
codegen: Change pointer casting to remove type-punning warnings

See merge request GNOME/glib!309
2018-09-12 22:31:54 +00:00
Michael Catanzaro
04989cfafb Autostart xdg-desktop-portal if needed
This is a speculative fix for epiphany#533, which we think might be
caused by xdg-desktop-portal not ever being started. This service is
started on-demand, not automatically.
2018-09-12 15:38:44 -05:00
Michael Catanzaro
0e0b94d635 gdbus: Improve error when well-known name is unowned
We should indicate the name, so that we have some chance of debugging
this problem.
2018-09-12 11:32:55 -05:00
Руслан Ижбулатов
ad3694b82a Enable GIO tests on Windows
1) Remove the non-Windows-only condition for subdir('tests').
2) Add libiphlpapi, libws2_32 and libsecur32 deps, needed for W32 tests.
3) Remove the -no-undefined argument (gcc doesn't understand it,
   it *does* understand -Wl,-no-undefined; either way, the test
   compiles without this argument just fine; maybe meson adds it
   by itself - you can hardly build shared modules without it).
4) Add or fix a number of includes
5) Disable gdbus-objectmanager tests when building with MSVC
   (right now these tests don't work on Windows anyway, so the fact
    that MSVC can't even build them properly is irrelevant;
    most likely gdbus-codegen needs changes to put _GLIB_EXTERN
    before each function)
2018-09-12 15:42:11 +00:00
Руслан Ижбулатов
157dfc8aae test_internal_enhanced_stdio: don't use g_assert()
g_assert() can be disabled, use more specific assertion macros.
2018-09-12 14:35:20 +00:00
Руслан Ижбулатов
c24d3b0fc3 W32: extend the g-file-info test with new DOS attributes 2018-09-12 14:35:18 +00:00
Руслан Ижбулатов
c6b4eff09e W32: new GFileInfo attributes
G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT allows mountpoints
(NTFS reparse points with IO_REPARSE_TAG_MOUNT_POINT tag) to
be told apart from symlinks (NTFS reparse points with
IO_REPARSE_TAG_SYMLINK tag), even though both are reported
by glib as "symlinks".

G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG allows the exact
reparse tag value to be obtained by the user. This way
even more exotic reparse points can be identified and
handled by the user (glib itself currently has no code
to work with any reparse points that are not symlinks
or mountpoints).
2018-09-12 14:35:16 +00:00
Philip Withnall
83cd2f6204 gvolumemonitor: Document the need to run a main loop
Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/1119
2018-09-07 12:18:44 +01:00
Robert Ancell
64b76c7ca5 codegen: Change pointer casting to remove type-punning warnings
The existing code was generating code with undefined results that modern compilers warn about:

accounts-generated.c:204:23: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     (GDBusArgInfo **) &_accounts_accounts_method_info_list_cached_users_OUT_ARG_pointers,
2018-09-07 10:19:05 +12:00
Emmanuele Bassi
86ab6ffa8d Merge branch '303-list-store-tests' into 'master'
Add more GListStore/GListModel tests

See merge request GNOME/glib!304
2018-09-05 11:11:58 +00:00
Philip Withnall
574e2c8a99 Merge branch 'wip/otte/simplify-liststore-splice' into 'master'
liststore: Simplify code

See merge request GNOME/glib!303
2018-09-05 10:38:59 +00:00
Philip Withnall
53a6689ebf tests: Test g_list_model_get_object()
It wasn’t being tested. It should behave the same as
g_list_model_get_item(), so write a wrapper for the two.

This brings the code coverage of glistmodel.c up to 100%.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-09-05 11:36:13 +01:00
Philip Withnall
7e33c50dd3 tests: Add more GListStore tests to get it too 100% coverage
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-09-05 11:27:06 +01:00
Philip Withnall
35d1ef678a gliststore: Simplify a GType check on construction
When setting the GListStore:item-type property we need to check the
GType is a GObject (or subclass). There was some explicit code for this,
but when actually testing it and looking at the code coverage, it turns
out that the GObject property type check coming from
g_param_spec_gtype() does everything we want, and the custom
g_critical() can never be hit. So turn it into an assertion.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-09-05 11:25:58 +01:00
Philip Withnall
98f326a020 Merge branch 'wip/otte/fallthrough' into 'master'
Add G_GNUC_FALLTHROUGH for __attribute__(fallthrough))

See merge request GNOME/glib!296
2018-09-04 22:06:26 +00:00
Benjamin Otte
e1cec0fb11 liststore: Simplify code
This is also faster, though I doubt anyone's able to measure it.

The previous code was a more complicted way to do the same thing and it
was likely written the more complicated way because it fell out commit
758d7073a9 when fixing
https://bugzilla.gnome.org/show_bug.cgi?id=795307
2018-09-04 20:31:51 +02:00
Benjamin Otte
3aff811d13 Use G_GNUC_FALLTHROUGH where appropriate 2018-09-04 20:24:25 +02:00
Christoph Reiter
912581340e Remove all static ChangeLog files
They only contain old information which is also available in git
2018-09-04 15:56:54 +02:00
Ondrej Holy
6ae061b74d Merge branch 'add-identifier-class-loop' into 'master'
Document new volume class `loop`

See merge request GNOME/glib!293
2018-09-04 08:29:01 +00:00
Philip Withnall
d3656705fa Merge branch 'default-tls-database' into 'master'
gtlsbackend: add support for setting the default TLS database

Closes glib-networking#35

See merge request GNOME/glib!273
2018-09-03 13:22:39 +00:00
Philip Withnall
8f157d0274 Merge branch 'wip/fmuellner/nm-portal-changed-signal' into 'master'
portal network monitor: Always emit changed signal on changed

See merge request GNOME/glib!294
2018-09-03 12:14:18 +00:00
Matthew Waters
27fca3474c gtlsdatabase: document that implementations must be thread-safe 2018-09-03 13:55:57 +10:00
Matthew Waters
b84951eb6f gtlsbackend: add support for setting the default TLS database
There are many cases where a default TLS database is not able to be
defined within the constraints of a system.  For example glib-networking
(or glib-openssl) cannot retrieve the default certificate store on iOS
or Android and need to be initialized from a cert file of certificates
bundled with the application.

Previously GStreamer was relying on a custom patch to glib-networking to
populate the default database from the file pointed to by the
CA_CERTIFICATES environment variable however the mechanism that enabled
this was recently remove from glib-networking.

Adding a more generic g_tls_backend_set_default_database() API allows
application developers to override the default database using their own
certificates as well as allowing equivalent functionality on Android/iOS
(or others) as on the default database handling Linux.

Fixes https://gitlab.gnome.org/GNOME/glib-networking/issues/35
2018-09-03 13:55:57 +10:00
Florian Müllner
423a2936ea portal network monitor: Always emit changed signal on changed
The ::network-changed signal is documented to indicate any change in
network configuration, which doesn't necessarily imply a property
change - additional services becoming available after connecting to
a VPN comes to mind for instance.

In order to match the "native" network monitor's behavior, always
emit the signal when it's in response to the 'changed' D-Bus signal.

Also emit the signal unconditionally when loading the initial property
values, to allow clients to differentiate between "offline" meaning
"offline" and "offline" meaning "uninitialized".
2018-09-01 19:31:45 +02:00
segfault
c341479c23 Document new loop class 2018-08-31 22:02:02 +02:00
Ryan Schmidt
612c450bd4 gio: Don't redefine GKqueueFileMonitor
Fixes build on old compilers that don't allow type redefinitions.

Closes: https://gitlab.gnome.org/GNOME/glib/issues/1506
2018-08-31 09:52:29 -05:00
Philip Withnall
b1cae79f78 glib-compile-resources: Fix generated code compiling with C++ compilers
With 0d685b4946, we now encode resource
data as a string. Strings have trailing nul terminators. A C compiler
will happily ignore the fact that the nul terminator exceeds the stated
array length, and will drop it — but a C++ compiler won’t, and will
raise:

error: initializer-string for array of chars is too long [-fpermissive]

Fix that by increasing the array length by 1, and subtracting it again
in the GStaticResource struct.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-08-31 12:29:39 +01:00
Philip Withnall
7427bb7184 Merge branch 'wip/oholy/nfs-poll-monitor' into 'master'
glocalfilemonitor: Fallback to poll file monitor for NFS

See merge request GNOME/glib!219
2018-08-31 10:51:25 +00:00
Philip Withnall
9be6122e11 Merge branch 'gresource-string-encoding' into 'master'
glib-compile-resources: encode data as string

See merge request GNOME/glib!264
2018-08-31 10:46:24 +00:00
Philip Withnall
f696f512a5 Merge branch 'mcatanzaro/inappropriate-fallback-error' into 'master'
Add a new GTlsError to indicate protocol downgrade attacks

See merge request GNOME/glib!200
2018-08-31 10:44:30 +00:00
Philip Withnall
d9b331f4d4 Revert "Add a gnet utility"
This reverts commit 3c1902fcf9.

This was accidentally re-added from an old version of the branch before
!265 was merged. It should not have been re-added.
2018-08-28 11:59:04 +01:00
Philip Withnall
f65e8eb7e3 Merge branch 'subprocess-cancellable-callback-fix' into 'master'
subprocess: Fix communicate_cancelled signature

See merge request GNOME/glib!266
2018-08-28 10:32:07 +00:00
Matthias Clasen
917dee45b2 Merge branch 'network-monitor-again' into 'master'
Network monitor again

See merge request GNOME/glib!265
2018-08-27 15:32:51 +00:00
Marco Trevisan (Treviño)
72bf795db5 tests, subprocess: units for cancelled communications 2018-08-27 17:08:47 +02:00
Florian Müllner
d047ca341b portal network monitor: Validate connectivity
Only accept connectivity values that are actually
in the range of GNetworkConnectivity.

https://gitlab.gnome.org/GNOME/glib/merge_requests/227
2018-08-27 10:56:02 -04:00
Matthias Clasen
860735f01b portal network monitor: Drop the version property
Rearrange the code so we try version 3 first,
falling back to version 2 and then version 1.

We still do a construct-time check to ensure
that we work with unsupported versions.

Note that this also takes care of setting the
initial property values in the version 1 case.
2018-08-27 10:55:53 -04:00
Matthias Clasen
5c5881b2ed portal network monitor: use GetStatus when available
Version 3 of the portal interface adds a GetStatus
method that gets all data in a single roundtrip.
Use it when available.
2018-08-27 10:55:30 -04:00
Matthias Clasen
a090d8605b portal network monitor: Implement can_reach
Version 3 of the network monitor portal interface adds
a CanReach method. Use it to implement can_reach.

The docs state that can_reach will either return TRUE
or set an error. So, set an error of G_IO_ERROR_HOST_UNREACHABLE
when the portal returns FALSE for CanReach.
2018-08-27 10:55:01 -04:00
Matthias Clasen
3a3a32a2bb portal network monitor: Always emit ::network-changed
The documentation of this signal is not really clear,
but it seems safer to emit it for all changes, even
if available is unchanged.
2018-08-27 10:54:35 -04:00
Matthias Clasen
8f2393b9b6 Whitespace fixup 2018-08-27 10:48:06 -04:00