Commit Graph

21862 Commits

Author SHA1 Message Date
Philip Withnall
84f188ae24 gspawn: Don’t use getrlimit() or sysconf() in async-signal-safe context
They’re not safe to call in an async-signal-safe context on Linux.
`sysconf()` is safe to call on FreeBSD and OpenBSD (at least), so
continue doing that.

This will reduce performance in the (already low performance) fallback
case where `/proc` is inaccessible to a forked process on Linux, while
spawning a subprocess.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-23 12:03:30 +01:00
Philip Withnall
1051bfe11e gspawn: Don’t use g_assert() in async-signal-safe context
Use the error handling infrastructure which already exists for other
failures in the async-signal-safe context.

`g_assert()` is unlikely to have caused problems in practice because it
is only async-signal-unsafe when the assertion condition fails.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-23 12:03:30 +01:00
Philip Withnall
33948929df gspawn: Don’t use g_ascii_isdigit() in async-signal-safe context
While `g_ascii_isdigit()` *is* currently async-signal-safe, it’s going
to be hard to remember to keep it that way if the implementation changes
in future.

It seems more robust to just reimplement it here, given that it’s not
much code.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-23 12:03:30 +01:00
Philip Withnall
6f46294227 gspawn: Don’t use g_close() in async-signal-safe context
Use normal `close()` instead, which is guaranteed to be
async-signal-safe.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-23 12:03:30 +01:00
Philip Withnall
0e05ef7750 gspawn: Audit for async-signal-safety
Functions called between `fork()` and `exec()` have to be
async-signal-safe.

Add a comment to each function which is called in that context, and
`FIXME` comments to the non-async-signal-safe functions which end up
being called as leaves of the call graph.

The following commits will fix those `FIXME`s.

See `man 7 signal-safety`.

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

Helps: #2140
2020-06-23 12:02:13 +01:00
Sebastian Dröge
50ce2792ff Merge branch 'sane-fixes' into 'master'
tree: Fix various ableist language

See merge request GNOME/glib!1546
2020-06-23 10:41:28 +00:00
Philip Withnall
d1ec0466dd Merge branch 'stringcopyrevert' into 'master'
gvalue: Do copy non-interned strings

Closes #2141

See merge request GNOME/glib!1545
2020-06-23 10:30:55 +00:00
Edward Hervey
e21ab81ce0 gvalue: Do copy non-interned strings
The G_VALUE_NOCOPY_CONTENTS for strings can only be used when collecting them
and not when copying them.

Instead only avoid copies for strings that are interned.

Fixes #2141
2020-06-23 10:30:55 +00:00
Philip Withnall
a63efa4291 tree: Fix various ableist language
In almost all cases, rewording the documentation/comments made things
more specific and a little clearer.

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

See: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1544#note_846645
2020-06-23 10:49:44 +01:00
Matej Urbančič
aa46b2405f Updated Slovenian translation 2020-06-22 21:00:48 +02:00
Philip Withnall
97b5bc4a01 Merge branch 'wip/oholy/remote-attribute-fixes' into 'master'
Various GLocalFile fixes related to the filesystem::remote attribute

See merge request GNOME/glib!1534
2020-06-19 10:08:03 +00:00
Ondrej Holy
92c9960521 glocalfile: Add SMB on the list of remote filesystems
The G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE is set to TRUE only for NFS
filesystem types currently. Let's add also SMB filesystem types. This
also changes g_local_file_is_nfs_home function logic to handle only
NFS filesystems.
2020-06-19 11:35:09 +02:00
Ondrej Holy
a8f97cbe8e glocalfile: Rename g_local_file_is_remote
The g_local_file_is_remote function is misleading as it works only for
NFS filesystem types and only for locations in home directorly. Let's
rename it to g_local_file_is_nfs_home to make it obvious.
2020-06-19 11:34:42 +02:00
Ondrej Holy
f489f6c4ee glocalfile: Do not call statfs/statvfs several times
statfs/statvfs is called several times when querying filesystem info.
This is because the G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE attribute is set
over is_remote_fs function, which calls statfs/statvfs again. Let's use
the already known fstype instead of redundant statfs/statvfs calls.
This also changes g_local_file_is_remote implementation to use
g_local_file_query_filesystem_info to obtain fstype, which allows to
remove duplicated code from is_remote_fs function.
2020-06-19 11:34:40 +02:00
Sebastian Dröge
9792209f3c Merge branch 'mcatanzaro/#1982' into 'master'
Fix issue in GSocketAddressEnumerator documentation

Closes #1982

See merge request GNOME/glib!1542
2020-06-18 19:06:39 +00:00
Michael Catanzaro
75359441cd Fix issue in GSocketAddressEnumerator documentation
We should stop iterating the enumerator the first time it returns NULL,
even if error is set.

Fixes #1982
2020-06-18 13:30:40 -05:00
Philip Withnall
8055dd2702 2.65.0
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-18 16:52:39 +01:00
Sebastian Dröge
086dccaa6f Merge branch '1339-socket-checks' into 'master'
gsocket: Add missing check_socket() checks

Closes #1339

See merge request GNOME/glib!1541
2020-06-18 15:05:28 +00:00
Philip Withnall
39f047e821 gsocket: Add missing check_socket() checks
This makes no great difference, just increases robustness a bit.

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

Closes: #1339
2020-06-18 12:52:39 +01:00
Ondrej Holy
706dc6b5aa glocalfile: Fix G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE outside home
The G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE currently works only for locations
in the home directory. Let's make it work also for files outside the home
directory.
2020-06-18 13:12:07 +02:00
Ondrej Holy
d067b5390a glocalfile: Remove redundant private header
There are glocalfile.h and glocalfileprivate.h header files currently.
None of those header files is public, so it doesn't make sense to have
two private headers for glocalfile.c. Let's remove glocalfileprivate.h.
2020-06-18 13:12:06 +02:00
Ondrej Holy
387709338c glocalfile: Handle smb2 filesystem type
`G_FILE_ATTRIBUTE_FILESYSTEM_TYPE` is not set for CIFS mounts with
`vers=2.0` option, or newer. Add `smb2` to the list of known filesystems.
It is also reported by `stat -f`:
https://github.com/coreutils/coreutils/blob/master/src/stat.c
2020-06-18 13:12:06 +02:00
Nirbheek Chauhan
884d989bd9 Merge branch '2136-option-context-suppressions' into 'master'
glib.supp: Suppress reachable leak of g_set_prgname() string

Closes #2136

See merge request GNOME/glib!1540
2020-06-17 20:03:21 +00:00
Sebastian Dröge
c6647b235d Merge branch 'issue-2135' into 'master'
Add g_get_language_names_with_category() to the suppressions file

Closes #2135

See merge request GNOME/glib!1536
2020-06-17 19:53:13 +00:00
Philip Withnall
86d6e181c3 glib.supp: Suppress reachable leak of g_set_prgname() string
It’s set once and then used throughout the process lifetime.

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

Fixes: #2136
2020-06-17 19:31:22 +01:00
Emmanuele Bassi
99314b14b8 Add g_get_language_names_with_category() to the suppressions file
It's another one-off allocation, mostly triggered by GKeyFile.

Fixes: #2135
2020-06-17 12:48:04 +01:00
Emmanuele Bassi
b79635b391 Merge branch 'more-memcheck' into 'master'
glib.supp improvements

Closes #2134 and #2132

See merge request GNOME/glib!1535
2020-06-17 11:21:39 +00:00
Philip Withnall
784bfaa250 gthreadpool: Fix some typos in the docs for g_thread_pool_free()
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-17 11:46:52 +01:00
Philip Withnall
8bb04fb866 glib.supp: More reachable suppressions for threads and thread pools
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #2132
2020-06-17 11:46:27 +01:00
Philip Withnall
f18f7c9a21 glib.supp: Tweak reachable allocation suppressions
Suppress the cached charset from `g_get_charset()`, and widen the
suppression of the global random number `GRand` instance, since it can
be used outside test cases.

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

Fixes: #2134
2020-06-17 11:26:13 +01:00
Philip Withnall
40ff2a5718 Merge branch 'fix-gnulib-msvc-isnan' into 'master'
meson: Fix gnulib build where isnan*() is needed

See merge request GNOME/glib!1524
2020-06-17 10:15:37 +00:00
Sebastian Dröge
ff7d5b36e7 Merge branch 'variant-get-string-docs' into 'master'
gvariant: Fix documentation for g_variant_get_string() to match reality

See merge request GNOME/glib!1531
2020-06-17 07:45:22 +00:00
Sebastian Dröge
bd7d7ccdf5 Merge branch '1398-getdateformatw-error-handling' into 'master'
gdate: Add some missing error handling to GetDateFormatW() calls

Closes #1398

See merge request GNOME/glib!1529
2020-06-17 06:57:23 +00:00
Philip Withnall
a2e215663c Merge branch 'fix-spelling' into 'master'
win32: spelling fix

See merge request GNOME/glib!1532
2020-06-15 20:56:40 +00:00
Marc-André Lureau
f9be7d2bb5 win32: spelling fix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-06-15 20:33:16 +04:00
Chun-wei Fan
9b59c79e98 meson: Fix gnulib build where isnan*() is needed
We need to include the isnan*.c sources as necessary, if any of the
isnan*() functions cannot be found, so that builds on compilers that
lack these functions could be fixed.

Also, if we do have the isnan*() functions, improve the build by not
unnecessarily including the isnan*.c sources in the build.

If the isnan*() functions are found, make sure that the
HAVE_ISNAN*_IN_LIBC macros are defined in the CFLags, so that we do not
accidently require the gnulib implementations for these functions.
2020-06-14 23:59:37 +08:00
Philip Withnall
1519962792 gvariant: Fix documentation for g_variant_get_string() to match reality
The implementation didn’t match the documentation. The implementation
has the right behaviour (wrt not allowing embedded nuls, validating
UTF-8, and returning a default value if an invalid string is detected),
so keep that and fix the documentation to match.

The [`GVariant`
specification](https://people.gnome.org/~desrt/gvariant-serialisation.pdf)
is incorrect on this point, and the implementation of GLib was
purposefully changed after the specification was published (but before
`GVariant` became API-stable in GLib). The behaviour in GLib
(specifically concerning all strings being in UTF-8) is consistent with
D-Bus.

Spotted by William Manley.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 18:06:14 +01:00
Philip Withnall
1cd7d1ade2 Merge branch 'codespell' into 'master'
tree: Fix various typos and outdated terminology

See merge request GNOME/glib!1530
2020-06-12 16:18:40 +00:00
Philip Withnall
00bfb3ab44 tree: Fix various typos and outdated terminology
This was mostly machine generated with the following command:
```
codespell \
    --builtin clear,rare,usage \
    --skip './po/*' --skip './.git/*' --skip './NEWS*' \
    --write-changes .
```
using the latest git version of `codespell` as per [these
instructions](https://github.com/codespell-project/codespell#user-content-updating).

Then I manually checked each change using `git add -p`, made a few
manual fixups and dropped a load of incorrect changes.

There are still some outdated or loaded terms used in GLib, mostly to do
with git branch terminology. They will need to be changed later as part
of a wider migration of git terminology.

If I’ve missed anything, please file an issue!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-06-12 15:01:08 +01:00
Philip Withnall
a00320599c gdate: Add some missing error handling to GetDateFormatW() calls
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1398
2020-06-12 11:55:49 +01:00
Kukuh Syafaat
c6ccff0ef4 Update Indonesian translation 2020-06-12 08:25:43 +00:00
Philip Withnall
d8b8cad5a1 Merge branch 'mcatanzaro/peer-certificate' into 'master'
gtlsconnection: Improve documentation of peer-certificate[-errors]

See merge request GNOME/glib!1528
2020-06-11 11:32:26 +00:00
Michael Catanzaro
4db1336ff6 gtlsconnection: Improve documentation of peer-certificate[-errors]
In glib-networking#127, it was reported that we don't properly implement
the documented behavior of these properties. However, we cannot fix it
because libsoup relies on the implemented behavior, and it's hard to
change that without cascading breakage. The practical solution is to
adjust our documentation to match reality. There should be no downsides
to this, and compat risk of changing the documentation is much smaller
than risk of changing the implementation, so I think this is the best we
can make of an unfortunate situation. See glib-networking#127 for full
discussion and glib-networking#129 for the regression when we attempted
to match the documented behavior.
2020-06-10 09:56:47 -05:00
Sebastian Dröge
d918b6bcd1 Merge branch '2106-dead-code' into 'master'
gtranslit: Drop duplicate if case

Closes #2106

See merge request GNOME/glib!1490
2020-06-10 13:00:05 +00:00
sicklylife
374804c19b Update Japanese translation 2020-06-10 12:34:28 +00:00
sicklylife
98b89b739a Update Japanese translation 2020-06-10 12:18:46 +00:00
Philip Withnall
b202604389 Merge branch 'wip/smcv/normalize-trailing-newlines' into 'master'
Normalize C source files to end with exactly one newline

See merge request GNOME/glib!1525
2020-06-10 09:19:55 +00:00
Simon McVittie
44c004c84e Normalize C source files to end with exactly one newline
Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to GLib,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-10 09:48:02 +01:00
Philip Withnall
a50ad8b10e Merge branch 'meson-fix-gnulib-printf-checks' into 'master'
meson: Fix gnulib printf checks

See merge request GNOME/glib!1522
2020-06-08 14:14:53 +00:00
Nirbheek Chauhan
6c76089ccc meson: Fix gnulib printf checks
Some typos, and accidental usage of the strings `'true'` / `'false'`
instead of the booleans `true` / `false`.
2020-06-08 18:45:33 +05:30