Commit Graph

19346 Commits

Author SHA1 Message Date
Will Thompson
4544dcb788
gmain: test far-future ready_time 2018-11-27 10:40:35 +00:00
Will Thompson
cdc2dd8eb1
gmain: clamp over-large timeouts
g_main_context_prepare() needs to calculate the timeout to pass to
poll(), expressed in milliseconds as a gint.  But since the ready time
for a GSource is represented by gint64 microseconds, it's possible that
it could be more than G_MAXINT * 1000 microseconds in the future, and so
can't be represented as a gint. This conversion to a narrower signed
type is implementation-defined, but there are two possible outcomes:

* the result is >= 0, in which case poll() will time out earlier than we
  might hope (with no adverse consequences besides an unwanted wakeup)
* the result is < 0, in which case, if there are no other sources,
  poll() will block forever

This is extremely unlikely to happen in practice, but can be avoided by
clamping the gint64 value, which we know to be positive, to G_MAXINT.

Thanks to Tomasz Miąsko for pointing this out on !496.
2018-11-27 10:36:20 +00:00
Will Thompson
6490fe7fe8
g_timeout_*_seconds: test an interval that overflowed
This is essentially a C version of the reproducer on #1600. It is based
on the existing test_seconds(), which relates to a similar but distinct
overflow.

I've only actually run this on a system with 32-bit ints, it should work
regardless of the width of an int, since the remainder after wrapping
will by construction be less than 1 second.
2018-11-27 10:36:20 +00:00
Will Thompson
4ff3734ff5
g_timeout_*_seconds: don't overflow for large intervals
Previously, the `guint interval` parameter, measured in seconds, was
multiplied by 1000 and stored in another `guint` field. For intervals
greater than (G_MAXUINT / 1000) seconds, this would overflow; the
timeout would fire much sooner than intended.

Since GTimeoutSource already keeps track of whether it was created at
millisecond or second resolution, always store the passed interval
directly. We later convert the interval to microseconds, stored in a
gint64, so can move the `* 1000` to there.

The eagle-eyed reader might notice that there is no obvious guarantee
that the source's expiration time in microseconds won't overflow the
gint64, but I don't think this is a new problem. Previously, the
monotonic time would have to reach (2 ** 63 - 2 ** 32) microseconds for
this overflow to occur; now it would have to reach approximately (2 **
63 - 2 ** 42) microseconds. Both of these are 292.47 millennia to 5
significant figures.

Fixes #1600.
2018-11-26 16:04:10 +00:00
Will Thompson
6debbbfd73
gio-test: use g_debug rather than #define VERBOSE 2018-11-26 15:47:14 +00:00
Will Thompson
b45d911cc6
gio-test: fix leak & maybe-uninitialized warning
GCC 8 on F29 complains:

../tests/gio-test.c: In function ‘main’:
../tests/gio-test.c:375:7: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       g_free (id);
       ^~~~~~~~~~~

In the normal case, when run without arguments, 'id' will be assigned
exactly once, so all is fine. If run with argument '0', 'id' will never
be assigned, so the warning is legit; but in that case the test program
will never exit. If run with any argument greater than 1, 'id' will be
assigned more than once but only the last incarnation will be freed.

Tweak the scope of the variable to match its use, and arrange for it to
be freed when its watch is destroyed.
2018-11-26 15:46:54 +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
Philip Withnall
95844424ba Merge branch 'value-get-variant-annotation' into 'master'
g_value_get_variant: return value is transfer-none not transfer-full

See merge request GNOME/glib!492
2018-11-26 10:54:32 +00:00
Philip Withnall
8c9c9d92cc Merge branch '1014-gspawn-linux-threadsafety' into 'master'
gspawn: Fix g_spawn deadlock in a multi-threaded program on Linux

Closes #1014 and #945

See merge request GNOME/glib!490
2018-11-26 10:48:52 +00:00
Christoph Reiter
f73b9e29e1 g_value_get_variant: return value is transfer-none not transfer-full
It defaulted to transfer-full.
2018-11-25 13:05:54 +01:00
Emmanuele Bassi
8316ae2241 Merge branch 'non-atomic-init' into 'master'
gatomicrefcount: Make g_atomic_ref_count_init non-atomic

See merge request GNOME/glib!460
2018-11-25 00:52:56 +00:00
Peter Wu
f2917459f7 gspawn: Fix g_spawn deadlock in a multi-threaded program on Linux
opendir and closedir are not async-signal-safe, these may call malloc
under the hood and cause a deadlock in a multi-threaded program.
This only affected Linux when /proc is mounted, other systems use a
slower path that iterates through all potential file descriptors.
Fixes a long-standing problem (since GLib 2.14.2).

Closes #945 and #1014
2018-11-24 16:01:28 +01:00
Marek Cernocky
71bbe9f3e0 Updated Czech translation 2018-11-24 10:12:29 +01:00
Philip Withnall
2722e9b31b build: Add a missing file to CLEANFILES
No idea why this didn’t cause problems with distcheck before.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 17:17:39 +00: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
a440152b2a docs: Ignore some generated header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:27:04 +00:00
Philip Withnall
82d28f07ed docs: Fix an invalid DocBook link in the GIO overview
<link> can only be used for links to DocBook IDs. <ulink> is for URI
links. (Why does it have to be this complex?)

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:26:50 +00:00
Philip Withnall
384aea2489 docs: Add some missing new symbols to the GIO documentation
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:25:48 +00:00
Philip Withnall
c20d9d0c84 docs: Ignore various GIO *_get_type() symbols
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:25:20 +00:00
Philip Withnall
2b15b436c7 docs: Ignore some private/uninstalled header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:24:24 +00:00
Philip Withnall
49fe320909 docs: Add indexes for symbols added in 2.60
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 13:23:40 +00:00
Philip Withnall
93f3202a61 docs: Add various missing symbols to glib-sections.txt
As listed in glib-unused.txt.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 12:37:27 +00:00
Philip Withnall
e51ed49ac3 docs: Ignore some private header files
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 12:37:09 +00:00
Philip Withnall
1a46bf88bb docs: Add missing documentation for warnings and assertions
These symbols were listed in glib-undocumented.txt. Thanks gtk-doc.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2018-11-23 12:19:19 +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
Philip Withnall
0c7492750a Merge branch 'wip/rishi/gdbus-codegen-deprecated' into 'master'
gdbus-codegen: Tag interfaces and properties so annotated with G_PARAM_DEPRECATED

See merge request GNOME/glib!485
2018-11-23 10:02:09 +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
Philip Withnall
10be7824a1 Merge branch 'zlib' into 'master'
Check for zlib header

See merge request GNOME/glib!486
2018-11-23 09:28:03 +00: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
Xavier Claessens
c49ed610ed Check for zlib header
It is not enough to check for the library, we also need zlib.h installed
to be able to use it. Autotools were also checking for the header.
2018-11-22 20:14:30 -05: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
Xavier Claessens
f54b48b3e6 Merge branch 'master' into 'master'
meson: Turn selinux into a meson feature and make it auto by default

See merge request GNOME/glib!483
2018-11-20 19:14:52 +00:00
Thibault Saunier
8cc92bcca6 meson: Turn selinux into a meson feature and make it auto by default
Making it more user friendly when building on distro no deploying selinux
2018-11-20 15:58:58 -03:00
Philip Withnall
23f286e040 Merge branch 'libz-fallback' into 'master'
Check for 'z' library before fallbacking to subproject

See merge request GNOME/glib!482
2018-11-19 22:38:57 +00:00
Xavier Claessens
e50f219462 Merge branch '1594-dbus-docs' into 'master'
gdbusconnection: Add missing (nullable) annotation to get_unique_name()

Closes #1594

See merge request GNOME/glib!475
2018-11-19 21:57:19 +00:00
Xavier Claessens
2ded434b40 Check for 'z' library before fallbacking to subproject 2018-11-19 15:22:16 -05:00
Philip Withnall
11847b831e Merge branch 'g-once-data-race' into 'master'
gthread: Remove unsynchronized access to g_once_init_list from assertion

See merge request GNOME/glib!477
2018-11-19 19:11:41 +00:00
Tomasz Miąsko
c2b22bd615 gthread: Synchronize access to g_once_init_list 2018-11-19 19:41:50 +01:00
Emmanuele Bassi
9874006e8f Merge branch 'patch-1' into 'master'
docs: add a missing semicolon

See merge request GNOME/glib!480
2018-11-18 12:29:56 +00:00
eyelash
fccce84d93 docs: add a missing semicolon 2018-11-18 08:05:28 +00:00
Philip Withnall
8a96fca390 Merge branch 'autolist-chainup' into 'master'
Add support for g_auto(s)list to G_DECLARE'd types

See merge request GNOME/glib!413
2018-11-15 10:25:41 +00:00