Commit Graph

22139 Commits

Author SHA1 Message Date
Sebastian Dröge
24af98e0ee Merge branch 'cancellable-pollfd' into 'master'
gcancellable: Assert that make_pollfd() call succeeds

See merge request GNOME/glib!1623
2020-08-18 10:35:16 +00:00
Sebastian Dröge
009791b614 Merge branch 'dbus-uint-checks' into 'master'
gdbusmessage: Drop redundant uint ≥ 0 checks

See merge request GNOME/glib!1625
2020-08-18 10:25:18 +00:00
Sebastian Dröge
5271b67e37 Merge branch 'dbus-address-null-check' into 'master'
gdbusaddress: Drop an unnecessary NULL check

See merge request GNOME/glib!1624
2020-08-18 10:13:04 +00:00
Philip Withnall
a110ca920a gcancellable: Assert that make_pollfd() call succeeds
The `make_pollfd()` call can’t fail because it only does so if
`cancellable == NULL`, and we’ve already checked that. Assert that’s the
case, to shut Coverity up and to catch behavioural changes in future.

Coverity CID: #1159433
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 11:08:51 +01:00
Philip Withnall
ab700f9c58 Merge branch 'coverity-datetime' into 'master'
gdatetime: Widen a variable before multiplication

See merge request GNOME/glib!1622
2020-08-18 09:49:15 +00:00
Nirbheek Chauhan
0b0b9bfda0 Merge branch 'windows-netreset' into 'master'
gioerror: Map WSAENETRESET on Windows to G_IO_ERROR_CONNECTION_CLOSED

See merge request GNOME/glib!1616
2020-08-18 09:46:36 +00:00
Philip Withnall
7afd4071d6 gdbusmessage: Drop redundant uint ≥ 0 checks
They are always true.

Coverity CID: #1430645, #1430674, #1430884, #1430974
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 10:39:46 +01:00
Philip Withnall
9664ff15ac gdbusaddress: Drop an unnecessary NULL check
`g_strsplit()` never returns `NULL`, although it can return an empty
strv (i.e. with its first element being `NULL`).

Drop a redundant `NULL` check.

Coverity CID: #1430976
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 10:36:26 +01:00
Philip Withnall
b0be67cc3f gdatetime: Widen a variable before multiplication
Otherwise it could possibly overflow on 32-bit machines if `year` is
high enough, although I don’t think that’s possible because of limits
applied on it by callers. This should shut Coverity up though.

The limits applied by callers could be circumvented by calling (say)
`g_date_time_add_years()` multiple times. That’s a bug, but not one I’m
going to fix today.

Coverity CID: #1159479
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 10:23:43 +01:00
Sebastian Dröge
c50fb4f317 Merge branch 'variant-depth-init' into 'master'
gvariant: Ensure GVS.depth is initialised

See merge request GNOME/glib!1620
2020-08-18 09:11:34 +00:00
Sebastian Dröge
27d857bfa1 Merge branch 'minor-coverity-fixes' into 'master'
Minor Coverity fixes

See merge request GNOME/glib!1619
2020-08-18 09:07:39 +00:00
Philip Withnall
a5d34a7c78 gvariant: Ensure GVS.depth is initialised
When byteswapping the depth was accidentally left uninitialised.

Coverity CID: #1430636
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 09:46:12 +01:00
Philip Withnall
0caa00b349 guri: Add an assertion to help static analysis
This might eliminate some false positives being thrown by Coverity to
do with the return value of `uri_decoder()` and whether it’s allocated
anything.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 09:33:42 +01:00
Philip Withnall
b639687b60 gtestutils: Fix a minor memory leak
Coverity CID: #1430603
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 09:33:06 +01:00
Sebastian Dröge
fb6da5677b Merge branch 'wip/pwithnall/coverity' into 'master'
CI support for Coverity Scan

See merge request GNOME/glib!1593
2020-08-17 11:57:24 +00:00
Philip Withnall
a396fa9027 Merge branch 'statx' into 'master'
Add support for Linux statx stx_btime

Closes #1970

See merge request GNOME/glib!1310
2020-08-17 11:49:05 +00:00
Andre Miranda
18aaf33cf1 glocalfileinfo: Support STX_BTIME for G_FILE_ATTRIBUTE_TIME_CREATED
If `statx()` is supported, query it for the file creation time and use
that if returned.

Incorporating some minor code rearrangement by Philip Withnall
<withnall@endlessm.com>.

Fixes: #1970
2020-08-17 12:33:05 +01:00
Andre Miranda
60eefd4de9 glocalfileinfo: Add statx() support
This currently just implements the same functionality as the existing
`stat()`/`fstat()`/`fstatat()`/`lstat()` calls, although where a reduced
field set is requested it may return faster.

Helps: #1970
2020-08-17 12:33:05 +01:00
Sebastian Dröge
30e4dbdb99 Merge branch 'subprocess-communicate-async-pipe' into 'master'
Ensure g_subprocess_communicate_async() never blocks

Closes #2182

See merge request GNOME/glib!1617
2020-08-17 11:20:13 +00:00
Alexander Larsson
4cf95e3904 Ensure g_subprocess_communicate_async() never blocks
It turns out that our async write operation implementation is broken
on non-O_NONBLOCK pipes, because the default async write
implementation calls write() after poll() said there were some
space. However, the semantics of pipes is that unless O_NONBLOCK is set
then the write *will* block if the passed in write count is larger than
the available space.

This caused a deadlock in https://gitlab.gnome.org/GNOME/glib/-/issues/2182
due to the loop-back of the app stdout to the parent, but even without such
a deadlock it is a problem that we may block the mainloop at all.

In the particular case of g_subprocess_communicate() we have full
control of the pipes after starting the app, so it is safe to enable
O_NONBLOCK (i.e. we can ensure all the code using the fd after this can handle
non-blocking mode).

This fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2182
2020-08-17 12:57:24 +02:00
Sebastian Dröge
a8acbba46a gioerror: Map WSAENETRESET on Windows to G_IO_ERROR_CONNECTION_CLOSED
This has almost the same semantics as WSAECONNRESET and for all
practical purposes is handled the same. The main difference is about
*who* reset the connection: the peer or something in the network.

For UDP sockets this happens when receiving packets and previously sent
packets returned an ICMP "Time(-to-live) expired" message. This is
similar to WSAECONNRESET, which on UDP sockets happens when receiving
packets and previously sent packets returned an ICMP "Port Unreachable"
message.
2020-08-17 13:14:46 +03:00
Kukuh Syafaat
7224baffe9 Update Indonesian translation 2020-08-15 03:58:32 +00:00
Andre Miranda
622806d5cf glocalfileinfo: Add support for optional/required fields in stat bufs
This is a step towards supporting `statx()`, which allows the set of
fields it returns to be specified by the caller. Currently, the existing
`stat()` and `fstat()` calls continue to be made, and there are no
behavioural changes — but the new wrapper functions will be extended in
future.

Helps: #1970
2020-08-14 17:30:11 +01:00
Andre Miranda
8edbfe8bb0 glocalfileinfo: Use accessors to access struct stat members
This will allow the actual struct in use to be changed in future without
code changes everywhere.

Helps: #1970
2020-08-14 17:30:11 +01:00
Florentina Mușat
83a59e99ff Update Romanian translation 2020-08-14 12:32:40 +00:00
Philip Withnall
91ccc46fe5 Merge branch 'json-stripblanks-docs' into 'master'
docs: glib-compile-resources: json-stripblanks

See merge request GNOME/glib!1615
2020-08-13 08:07:51 +00:00
James Westman
2ec4e05733 docs: glib-compile-resources: json-stripblanks
Document the `json-stripblanks` preprocessing option for .gresource.xml files.
2020-08-13 08:07:51 +00:00
Fran Dieguez
80887d5044 Update Galician translation 2020-08-12 23:56:12 +00:00
Thibault Martin
b301c92ee9 Update French translation 2020-08-12 14:36:03 +00:00
Philip Withnall
056aaf36f8 Merge branch 'master' into 'master'
gdatetime: Add %f format specifier and microsecond precision to g_date_time_format_iso8601

See merge request GNOME/glib!1605
2020-08-12 13:37:06 +00:00
Philip Withnall
d31c771185 Merge branch 'wip/alloc-memset-inlining' into 'master'
gslice: Allow inlining of memset() in g_slice_new0() macro

Closes #5

See merge request GNOME/glib!1597
2020-08-12 13:29:27 +00:00
Johan Bjäreholt
8e13683f70 gdatetime: Format iso8601 strings with microsecond precision 2020-08-12 15:07:40 +02:00
Johan Bjäreholt
bcb48a18e3 gdatetime: Fix alphabetical order of format specifiers 2020-08-12 15:07:40 +02:00
Johan Bjäreholt
3b0eca5be6 gdatetime: Add %f format specifier for microseconds
Same specifier used as in pythons datetime.strptime

Change-Id: Ic15a63e3c83674b2e8a05bc79ef2665738e71a5a
2020-08-12 15:07:38 +02:00
Sebastian Dröge
e4f4a40fb4 Merge branch 'file-delete-docs' into 'master'
gfile: Document TOCTTOU avoidance using g_file_delete()

See merge request GNOME/glib!1613
2020-08-12 10:00:12 +00:00
Philip Withnall
373c54a52c gfile: Document TOCTTOU avoidance using g_file_delete()
Don’t call `g_file_query_exists()` followed by `g_file_delete()`. Just
call `g_file_delete()` and check the error.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-12 10:48:28 +01:00
Sebastian Dröge
1cb567f3c0 Merge branch 'g-socket-receive-annotations' into 'master'
gio: add missing (out) annotations to g_socket_receive*

Closes #2176

See merge request GNOME/glib!1614
2020-08-11 18:06:11 +00:00
Phil Clayton
4a848a0aca gio: add missing (out) annotations to g_socket_receive*
This makes the introspection interface to g_socket_receive* consistent
with the interface to g_input_stream_read*.

Closes #2176
2020-08-11 18:34:16 +01:00
Daniel Mustieles
03f1980fb8 Updated Spanish translation 2020-08-11 12:19:50 +02:00
Efstathios Iosifidis
b7db04865d Update Greek translation 2020-08-08 16:06:14 +00:00
Yuri Chornoivan
55018d3f99 Update Ukrainian translation 2020-08-08 15:00:20 +00:00
Emin Tufan Çetin
b660ffe161 Update Turkish translation 2020-08-07 15:04:24 +00:00
Philip Withnall
b99008f57f 2.65.1
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 15:29:26 +01:00
Philip Withnall
e30fc2e116 Merge branch 'uri-tweaks' into 'master'
Various GUri code, documentation and API fixes

Closes #2149

See merge request GNOME/glib!1610
2020-08-07 14:14:29 +00:00
Philip Withnall
cacf9c2926 guri: Add various small new tests to increase branch coverage
Nothing particularly interesting or major.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
b654eb1846 guri: Make G_URI_FLAGS_PARSE_STRICT the default
Make `G_URI_FLAGS_PARSE_RELAXED` available instead, for the
implementations which need to handle user-provided or incorrect URIs.
The default should nudge people towards being compliant with RFC 3986.

This required also adding a new `G_URI_PARAMS_PARSE_RELAXED` flag, as
previously parsing param strings *always* used relaxed mode and there
was no way to control it. Now it defaults to using strict mode, and the
new flag allows for relaxed mode to be enabled if needed.

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

Fixes: #2149
2020-08-07 14:02:18 +01:00
Philip Withnall
943b1e45ab guri: Don’t fail g_uri_is_valid() if URI is missing a hostname
According to my reading of
https://tools.ietf.org/html/rfc3986#section-4, the only requirement for
a URI to be ‘absolute’ (actually, not a relative reference) is for the
scheme to be specified. A hostname doesn’t have to be specified: see any
of the options in the `hier-part` production in
https://tools.ietf.org/html/rfc3986#appendix-A which don’t include
`authority`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
b5c59cc3fc guri: Use gssize for array/string lengths
This reduces the possibility for overflow, and makes the code a little
more conventional to read.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
e446c3487b guri: Change type of g_uri_escape_bytes() to use guint8
`guint8` is the conventional way in modern GLib APIs to represent ‘a byte
which could contain arbitrary binary’. `guchar` is not advised for that
(even though it’s equivalent) because it could be misread as `gchar`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00
Philip Withnall
ceda9755de guri: Clear return values on error from g_uri_params_iter_next()
This reduces the chance of the caller accidentally double-freeing or
use-after-free-ing something.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-07 14:02:18 +01:00