Commit Graph

22163 Commits

Author SHA1 Message Date
Asier Sarasua Garmendia
e6791aa22a Update Basque translation 2020-08-28 10:39:25 +00:00
Sebastian Dröge
e5c119ea41 Merge branch 'wip/carlosg/cancelled-splice' into 'master'
Fix splice behavior on cancellation

See merge request GNOME/glib!1631
2020-08-28 10:04:47 +00:00
Carlos Garnacho
cf85241aba tests: Add splice cancellation test
This doesn't trigger the cancellation assertion issue when run locally
(the task didn't return yet, so the error is simply overwritten), but
perhaps it ever does in CI. Anyhow, it's good to have a cancellation
test.
2020-08-28 11:38:51 +02:00
Carlos Garnacho
c033450f93 goutputstream: Check individual close operations after splice
After a splice operation is finished, it attempts to 1) close input/output
streams, as per the given flags, and 2) return the operation result (maybe
an error, too).

However, if the operation gets cancelled early and the streams indirectly
closed, the splice operation will try to close both descriptors and return
on the task when both are already closed. The catch here is that getting the
streams closed under its feet is possible, so the completion callback would
find both streams closed after returning on the first close operation and
return the error, but then the second operation could be able to trigger
a second error which would be returned as well.

What happens here is up to further race conditions, if the task didn't
return yet, the returned error will be simply replaced (but the old one not
freed...), if it did already return, it'll result in:

GLib-GIO-FATAL-CRITICAL: g_task_return_error: assertion '!task->ever_returned' failed

Fix this by flagging the close_async() callbacks, and checking that both
close operations did return, instead of checking that both streams are
closed by who knows.

This error triggers a semi-frequent CI failure in tracker, see the summary at
https://gitlab.gnome.org/GNOME/tracker/-/issues/240
2020-08-28 11:22:14 +02:00
Sebastian Dröge
151e171207 Merge branch 'gfileutils_signedness' into 'master'
Fixing signedness warning in glib/gfileutils.c

See merge request GNOME/glib!1632
2020-08-27 16:50:37 +00:00
Sebastian Dröge
dae128e6bb Don't pass more than G_MAXSSIZE bytes at once to write() in glib/gfileutils.c
Behaviour in that case is implementation-defined and how many bytes were
actually written can't be expressed by the return value anymore.

Instead do a short write of G_MAXSSIZE bytes and let the existing loop
for handling short writes takes care of the remaining length.
2020-08-27 19:32:14 +03:00
Emmanuel Fleury
856265fe66 Fixing signedness warning in glib/gfileutils.c
glib/gfileutils.c: In function ‘write_to_file’:
glib/gfileutils.c:1176:19: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
 1176 |       g_assert (s <= length);
      |                   ^~
glib/gmacros.h:939:25: note: in definition of macro ‘G_LIKELY’
  939 | #define G_LIKELY(expr) (expr)
      |                         ^~~~
glib/gfileutils.c:1176:7: note: in expansion of macro ‘g_assert’
 1176 |       g_assert (s <= length);
      |       ^~~~~~~~

Related to issue #1735 (Get back to a -werror build)
2020-08-27 19:32:11 +03:00
Aurimas Černius
0d196a99b5 Updated Lithuanian translation 2020-08-26 22:36:28 +03:00
Philip Withnall
9674d14175 Merge branch 'g_settings_new' into 'master'
gio: Document g_settings_new() missing schema behaviour

See merge request GNOME/glib!1626
2020-08-24 09:02:43 +00:00
Chris Mayo
dc1a1b841c gio: Document g_settings_new() missing schema behaviour
Explain what happens, the rationale and reference another
function that may be helpful.
2020-08-24 09:02:43 +00:00
Sebastian Dröge
e47a7e297c Merge branch 'valentindavid/statx-read-only' into 'master'
gio: Allow no atime from statx

Closes #2189

See merge request GNOME/glib!1630
2020-08-24 08:54:13 +00:00
Valentin David
6fc143bba8
gio: Allow no atime from statx
statx does not provide stx_atime when querying a file in a read-only
mounted file system. So call to statx should not expect it to be in
the mask. Otherwise we would fail with ERANGE for querying any file in
a read-only file system.

Fixes #2189.
2020-08-23 16:41:17 +02:00
Jordi Mas
c0435cd722 Update Catalan translation 2020-08-23 09:00:56 +02:00
Piotr Drąg
b3c0dd27be Update Polish translation 2020-08-22 15:29:41 +02:00
Philip Withnall
153ec62e7e Merge branch 'wip/baedert/fallthrough' into 'master'
Replace a bunch of fallthrough comments with an attribute

See merge request GNOME/glib!1628
2020-08-21 08:49:11 +00:00
Philip Withnall
a1a8016553 Merge branch 'thread-trace' into 'master'
gthread: Add a sysprof mark for thread creation

See merge request GNOME/glib!1627
2020-08-21 08:39:12 +00:00
Timm Bäder
aeed676c08 Replace a bunch of fallthrough comments with an attribute
Parsing comments is hack and clang doesn't do it, so switch to
G_GNUC_FALLTHROUGH, which exists for exactly this case.
2020-08-21 05:50:02 +02:00
Matthias Clasen
5620828f47 gthread: Add a sysprof mark for thread creation
sysprof already shows forks in the waterfall. The
main benefit of adding a mark is that it makes the
thread name show up in the trace, next to the fork.
2020-08-20 15:23:05 -04:00
sicklylife
46a12eaf23 Update Japanese translation 2020-08-20 12:07:56 +00:00
sicklylife
d2803e11ba Update Japanese translation 2020-08-20 11:51:20 +00:00
sicklylife
5725415ac6 Update Japanese translation 2020-08-20 11:33:21 +00:00
Rafael Fontenelle
684e68365d Update Brazilian Portuguese translation 2020-08-20 11:18:58 +00:00
Baurzhan Muftakhidinov
f95723a587 Update Kazakh translation 2020-08-19 09:41:25 +00:00
Philip Withnall
f91af2021c 2.65.2
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-08-18 11:49:43 +01:00
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