Commit Graph

21104 Commits

Author SHA1 Message Date
Philip Withnall
efa7fa0375 ci: Run the style-check pipeline stage first
Don’t waste CI resources on compiling things which don’t comply with the
style rules.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-27 12:00:20 +00:00
Emmanuele Bassi
cc3716a943 Merge branch 'thread-safe-getpwnam' into 'master'
glocalvfs: Use thread-safe getpwnam_r() rather than getpwnam()

Closes #1687

See merge request GNOME/glib!681
2019-11-27 11:58:51 +00:00
Emmanuele Bassi
9b14cdc258 Merge branch 'ci-versioning' into 'master'
ci: Update all Debian CI runners to use v5 of the Dockerfile

See merge request GNOME/glib!1248
2019-11-27 11:56:39 +00:00
Philip Withnall
34cb297a86 Merge branch 'wip/nielsdg/g-list-store-find' into 'master'
gliststore: Add item lookup functions

Closes #1011

See merge request GNOME/glib!1096
2019-11-27 11:22:56 +00:00
Nirbheek Chauhan
902fc6d261 Merge branch 'suppressions' into 'master'
Add additional valgrind suppressions

See merge request GNOME/glib!1223
2019-11-27 10:26:03 +00:00
Philip Withnall
7a4740c7b1 Merge branch 'zero-null' into 'master'
gthread: Fix "zero as null pointer" warning

See merge request GNOME/glib!1253
2019-11-27 09:04:48 +00:00
Jason Crain
be15a60bda gthread: Fix "zero as null pointer" warning
When compiling a program using glib with -Wzero-as-null-pointer-constant
warnings enabled, the compiler warns about this type check in the
g_once_init_enter macro. Fix by replacing "0" with "NULL".
2019-11-26 22:33:41 -07:00
Philip Withnall
bdf2583fbd glocalvfs: Use thread-safe getpwnam_r() rather than getpwnam()
It’s possible that one VFS operation will happen from a worker thread at
the same time as another is happening from the main thread, in which
case the static buffer which getpwnam() uses will be overwritten.
There’s a chance this will corrupt the results that one of the threads
receives.

Fix that by using the thread-safe getpwnam_r() version, via the new
g_unix_get_passwd_entry() function.

Fix the indentation of the surrounding block while we’re there.

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

Fixes: #1687
2019-11-26 12:17:04 +00:00
Philip Withnall
94a800fb9d glib-unix: Add g_unix_get_passwd_entry() function
This is a convenience wrapper around getpwnam_r() which handles all the
memory allocation faff.

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

Helps: #1687
2019-11-26 12:17:04 +00:00
Philip Withnall
d8c5bcbb7d Merge branch 'wip/hadess/socket-test-not-parallel' into 'master'
tests: Run "timeout tests" sequentially

See merge request GNOME/glib!1239
2019-11-26 10:51:20 +00:00
Philip Withnall
6c41e91f03 Merge branch 'wip/ernestask/g_clear_list' into 'master'
Add g_clear_list()

Closes #1943

See merge request GNOME/glib!1244
2019-11-26 10:36:52 +00:00
Benjamin Otte
276e927fd4 Revert last 4 commits
This reverts commits:
  5899c61ed2
  e994d45352
  eb20dec144
  ebec0dd359
which wer accidentally pushed to master instead of a branch
2019-11-26 00:54:15 +01:00
Benjamin Otte
5899c61ed2 value: Allow automatic transforms to/from interfaces
Use the new g_type_interface_instantiable_prerequisite() to check
compatibility for transform functions.

In particular, this allows interfaces (in my case GDK_TYPE_PAINTABLE) to
be transformed to/from any GObject type (in my case G_TYPE_OBJECT) using
the transform function registered to tranform between any 2 objects
(g_value_object_transform_value() does a type check and uses NULL if the
types don't match).

And this in turn allows be to g_object_bind_property() a gobject-typed
generic property (GtkListItem::item) to a GtkImage::paintable.
2019-11-25 20:06:49 +01:00
Benjamin Otte
e994d45352 closure: Support generic marshals for interface returns
Use the newly added g_type_interface_instantiable_prerequisite() to
allow closure return values being interfaces by looking up the
instantiable type for the interface and usings its GValue accessors.
2019-11-25 20:06:39 +01:00
Benjamin Otte
eb20dec144 gtype: Add g_type_interface_instantiable_prerequisite()
There is (at most) a single GType that is instantiable and a
prerequisite for an interface. This function returns that type.

This type is necessary in particular when dealing with GValues because a
GValue contains an instance of a type.
2019-11-25 20:06:39 +01:00
Benjamin Otte
ebec0dd359 gtype: Fix typo in API comment 2019-11-25 20:06:39 +01:00
Emmanuele Bassi
eb439076a6 Merge branch '1947-uuid-docs' into 'master'
guuid: Document that g_uuid_string_random() is not secure

Closes #1947

See merge request GNOME/glib!1246
2019-11-25 18:50:12 +00:00
Ernestas Kulik
58ba7d78fb list, slist: Add g_clear_{s,}list()
Although not quite as often-occurring, this should help with constructs
like this:

  if (list)
    {
      g_list_free_full (list, foo);
      list = NULL;
    }

Closes https://gitlab.gnome.org/GNOME/glib/issues/1943
2019-11-25 13:09:25 +01:00
Bastien Nocera
3894335dc6 tests: Don't "timeout tests" by default
Those tests seem to regularly fail because a timeout (which we're
measuring outside the function that times out) is too long, which can
happen when the system is busy.

Don't run those tests unless "thorough" tests are requested. This
disables those tests by default.

Bail out! GLib-GIO:ERROR:../gio/tests/socket.c:1167:test_timed_wait: assertion failed (poll_duration < 112000): (114254 < 112000)
Bail out! GLib-GIO:ERROR:../gio/tests/cancellable.c:167:on_mock_operation_ready: assertion failed (error == (g-io-error-quark, 19)): error is NULL
2019-11-25 12:55:18 +01:00
Philip Withnall
ae49ff0903 2.63.2
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-25 11:11:33 +00:00
Philip Withnall
b7fe4b84ee ci: Update all Debian CI runners to use v5 of the Dockerfile
This shouldn’t affect them (since it just adds the `clang-format-7`
package), but it’s good to keep everything on the same version.

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

See: #1552
2019-11-25 10:51:14 +00:00
Philip Withnall
8555aeec8d Merge branch 'wip/ci-style-check' into 'master'
CI: Code check formating in CI

Closes #1552

See merge request GNOME/glib!1237
2019-11-25 10:23:50 +00:00
Philip Withnall
812253a95f guuid: Document that g_uuid_string_random() is not secure
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1947
2019-11-25 10:10:36 +00:00
Pavlo Solntsev
e95f47c395
CI: Code check formating in CI 2019-11-21 14:03:01 -06:00
Philip Withnall
7b77439841 Merge branch 'wip/hadess/occurred' into 'master'
docs: Fix "occurred" typos in API documentation

See merge request GNOME/glib!1243
2019-11-21 12:45:45 +00:00
Philip Withnall
7c77cdf9ba Merge branch 'objcpy-version' into 'master'
Enable test about objcopy if it supports the --add-symbol parameter

Closes #1895

See merge request GNOME/glib!1236
2019-11-21 12:34:15 +00:00
Philip Withnall
6f3de72ad4 Merge branch 'th/gstrv-use-gsize' into 'master'
gstrfuncs: use gsize type internally for strv functions

See merge request GNOME/glib!1238
2019-11-21 12:33:34 +00:00
Iain Lane
50c215b14e Merge branch 'unix-mode-docs' into 'master'
gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE

See merge request GNOME/glib!1242
2019-11-21 12:24:32 +00:00
Bastien Nocera
6fd2ea1dc6 docs: Fix "occurred" typos in API documentation 2019-11-21 13:07:08 +01:00
Philip Withnall
94e8f027bd Merge branch '1004-lldb' into 'master'
Make gbacktrace use lldb on macOS

Closes #1004

See merge request GNOME/glib!167
2019-11-21 11:54:46 +00:00
Philip Withnall
0a469dafe4 Merge branch 'wip/iainl/fix-1934' into 'master'
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"

Closes #1934

See merge request GNOME/glib!1241
2019-11-21 11:27:20 +00:00
Philip Withnall
f793319b17 gfileinfo: Clarify the documentation for G_FILE_ATTRIBUTE_UNIX_MODE
It’s not just the mode, it’s also the file type.

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

Helps: #1934
2019-11-21 11:24:08 +00:00
Ignacio Casal Quinteiro
5fe61e8c46 Enable test about objcopy if it supports the --add-symbol parameter
This fixes building in old systems like centos 6.

(With tweaks by Philip Withnall.)

Fixes: https://gitlab.gnome.org/GNOME/glib/issues/1895
2019-11-21 11:16:24 +00:00
Kristian Rietveld
1fbd185430 gbacktrace: on macOS support and default to LLDB
Tweaked by Philip Withnall <withnall@endlessm.com> to fix review issues.

Closes: #1004
2019-11-21 11:02:14 +00:00
Philip Withnall
9dc006cfc8 Merge branch '1940-atomic-types' into 'master'
tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()

Closes #1940

See merge request GNOME/glib!1234
2019-11-21 10:57:27 +00:00
Iain Lane
0c88825a75
test_copy_preserve_mode: Adjust for the previous revert
Now we're returning the file type again, we need to mask it out to
compare with the mode. We can also check that the statbuf said the file
is a regular file.

Related: #1934
2019-11-21 10:49:31 +00:00
Iain Lane
e330a99f7a
Revert "glocalfileinfo: Only return file mode, not type, as UNIX_MODE attribute"
This reverts commit bfdc5fc4fc.

This changes the semantics of G_FILE_ATTRIBUTE_ID_UNIX_MODE, and we've
already found one user of the previous semantics (ostree).

Closes #1934
2019-11-21 10:31:43 +00:00
Philip Withnall
a0d5b49ef7 Merge branch 'wip/hadess/gdatetime-leap-seconds' into 'master'
gdatetime: Add hack for leap seconds

Closes #1938

See merge request GNOME/glib!1233
2019-11-21 09:55:52 +00:00
Thomas Haller
c8194ee3ec gstrfuncs: use gsize type internally for strv functions
In C, the proper type for a heap allocate structure is size_t/gsize.
That means, no valid (heap allocated) pointer will ever contain more
bytes than size_t can represent.

Hence, this integer type should also be used when operating on
data like a strv array. Adjust some internal uses to use gsize
instead of gint/guint.

Note that g_strv_length() returns a value of type guint. So this
API cannot be used on string arrays longer of arbitrary size. But
that is not fixable.
2019-11-21 10:44:48 +01:00
Bastien Nocera
b4eaac5817 gdatetime: Handle leap seconds in ISO8601 dates
GDateTime doesn't handle leap seconds, so just round these down to
the previous second.

https://gitlab.gnome.org/GNOME/glib/issues/1938
2019-11-21 09:14:39 +01:00
Xavier Claessens
653d3e2c5d Merge branch 'mgl-fix-build' into 'master'
Fix build on old libc that does not define _SC_HOST_NAME_MAX

See merge request GNOME/glib!1231
2019-11-20 14:12:29 +00:00
Xavier Claessens
de79958295 Fix build on old libc that does not define _SC_HOST_NAME_MAX
Bionic (Android's libc) only added that symbol in Nov 2014, can't find
in which NDK release it got released.
2019-11-20 08:34:25 -05:00
Philip Withnall
21fce30e9a Revert "gatomic: Temporarily disable C11-style atomics on FreeBSD"
This reverts commit fd3ed5e31b.

C11-style atomics have been fixed (on FreeBSD and other platforms) in
the previous commit, “gatomic: Check argument width in
g_atomic_pointer_compare_and_exchange()”.

See !1229 and #1940.
2019-11-20 12:12:04 +00:00
Philip Withnall
75cd86f00e gatomic: Check argument width in g_atomic_pointer_compare_and_exchange()
Check that the new value is actually pointer-width, rather than (for
example) `sizeof (int)` which could happen if someone used `0` rather
than `NULL`.

Changes suggested by Simon McVittie.

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

Helps: #1940
2019-11-20 12:10:43 +00:00
Philip Withnall
844332ef31 tests: Use pointers in calls to g_atomic_pointer_compare_and_exchange()
Don’t pass integers; it’s not type-safe. The macro version of
`g_atomic_pointer_compare_and_exchange()` used to erroneously accept
integers, but they would have the wrong width on some platforms.

Changes originally investigated and suggested by Ting-Wei Lan.

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

Fixes: #1940
2019-11-20 12:10:23 +00:00
Philip Withnall
eadc17f894 Merge branch 'wip/ernestask/bz-693576-annotations' into 'master'
Make GTask more binding-friendly

See merge request GNOME/glib!1216
2019-11-20 11:17:35 +00:00
Michael Catanzaro
d3768c89ae Merge branch 'mcatanzaro/copy-session-state' into 'master'
Improve documentation for footgun function g_tls_client_connection_copy_session_state()

See merge request GNOME/glib!1039
2019-11-18 21:14:37 +00:00
Michael Catanzaro
88e7529101 Merge branch 'mcatanzaro/gtlsconnection-changes' into 'master'
Deprecate old GTlsConnection functionality even harder!

See merge request GNOME/glib!1227
2019-11-18 21:10:54 +00:00
Michael Catanzaro
fb54646899 Improve documentation of g_tls_client_connection_copy_session_state()
This function has numerous undocumented limitations. In particular, it
is not possible to ensure this function actually does anything. Document
these problems.
2019-11-18 13:55:34 -06:00
Michael Catanzaro
9d2c949b54 gtlsclientconnection: use-ssl3 is now ignored
For many years after SSL 3.0 support was removed, we used this function
to indicate that we should perform protocol version fallback to the
lowest-supported protocol version, to workaround protocol version
intolerance. Nowadays this is no longer needed, and support has been
removed from glib-networking, so update the documentation.
2019-11-18 13:52:39 -06:00