Commit Graph

27238 Commits

Author SHA1 Message Date
Joan Bruguera
d901b55128 tests/file: Do not rely on du --bytes behaviour
As explained in the previous commit, GNU Coreutils 9.2 changes the behaviour
of `du --bytes` to only count regular files and symlinks.

The previous commit makes the test pass with GNU Coreutils >=9.2, but the
machine running the tests may have an older version, or perhaps even a
reimplementation such as uutils. So we can't rely on the size returned by `du`
to be the consistent across systems any more.

However, the plus side of the new behaviour is that the size reported by `du`
/ `G_FILE_MEASURE_APPARENT_SIZE` is now well-defined across filesystems
(as the sum of the sizes of regular files & symlinks), so we can hardcode it.

Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2965
2023-04-08 00:39:25 +00:00
Joan Bruguera
011fe5ebb2 glocalfile: Sum apparent size only for files and symlinks
Since GNU Coreutils 9.2 (commit 110bcd28386b1f47a4cd876098acb708fdcbbb25),
`du --apparent-size` (including `du --bytes`) no longer counts all kinds of
files (directories, FIFOs, etc.), but only those for which `st_size` in
`struct stat` is defined by POSIX, namely regular files and symlinks
(and also rarely supported memory objects).

This aligns the behaviour of GLib's `G_FILE_MEASURE_APPARENT_SIZE` flag
with the new GNU Coreutils `du` and correct POSIX use.

Note that this may be a breaking change for some uses.

Link: https://lists.gnu.org/archive/html/bug-coreutils/2023-03/msg00007.html
Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2965
2023-04-08 00:39:25 +00:00
Alexander Shopov
6834f225f7 Update Bulgarian translation 2023-04-07 17:12:37 +00:00
Alexander Shopov
3d608960fb Update Bulgarian translation 2023-04-07 16:58:17 +00:00
Dan Yeaw
50851e2706 Fix multiple definition error
Fixes #2966 when compiling with GCC < 9.1 or Clang < 14.0.
2023-04-07 15:22:11 +00:00
Matthias Clasen
e03a96e934 actiongroup: Add a compiler warning
Warn when the boolean return isn't used, since we may not initialize
the out arguments in the FALSE case. Update all internal callers to
use the return value. They were already safe, but users outside GLib
may not be.
2023-04-07 08:44:29 -04:00
Philip Withnall
adcf017eb4 Merge branch 'gwin32-avoid-g-return-macro' into 'main'
gwin32: Avoid use of function call with side effect in g_return_* macro

See merge request GNOME/glib!3365
2023-04-06 13:51:38 +00:00
Kleis Auke Wolthuizen
86ef92d548 gwin32: Avoid use of function call with side effect in g_return_* macro
This ensures that _g_win32_call_rtl_version is always called,
regardless of whether G_DISABLE_CHECKS is defined or not.
2023-04-06 15:19:35 +02:00
Chun-wei Fan
553d82c793 README.win32.md: Update info for G_PLATFORM_WIN32
Correct the info on G_PLATFORM_WIN32, now that we only define it when
GLib is built for native Windows, not Cygwin.  Make it clear that it
should not be used to check for conditional compilation for Cygwin
builds of GLib.
2023-04-06 15:40:07 +08:00
Philip Withnall
ca98d60d6d gdatetime: Improve Markdown formatting of g_date_time_format() docs
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2969
2023-04-05 17:53:41 +01:00
Marco Trevisan
9ec6695a72 Merge branch 'drop-gitignore' into 'main'
build: Drop old .gitignore files from test directories

See merge request GNOME/glib!3333
2023-04-05 14:29:13 +00:00
Marco Trevisan
66d9ab7808 Merge branch '2952-pollable-docs' into 'main'
gpollable: Clarify that can_poll() must be called before other methods

Closes #2952

See merge request GNOME/glib!3348
2023-04-05 14:27:07 +00:00
Marco Trevisan
218daa079e Merge branch '2960-debug-controller-docs' into 'main'
gdebugcontrollerdbus: Fix incorrect paragraph on auth in documentation

Closes #2960

See merge request GNOME/glib!3354
2023-04-05 14:24:50 +00:00
Marco Trevisan
34dc240322 Merge branch '2864-gvalue-docs' into 'main'
gvalue: Fix a typo in a function name in an example in the docs

Closes #2864

See merge request GNOME/glib!3349
2023-04-05 14:17:48 +00:00
Marco Trevisan
913f206b30 Merge branch 'make_clang_happier' into 'main'
Make clang++ happier when using G_STATIC_ASSERT

See merge request GNOME/glib!3357
2023-04-05 14:16:06 +00:00
Philip Withnall
a6f31f3ede Merge branch 'fix-issue-2972' into 'main'
GWin32AppInfo: Fix g_str_has_prefix() check

Closes #2972

See merge request GNOME/glib!3359
2023-04-05 14:09:53 +00:00
Luca Bacci
65e2413dd5 GWin32AppInfo: Fix g_str_has_prefix() check
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2972
2023-04-05 13:50:23 +02:00
Albert Astals Cid
925d2b3b1f Make clang++ happier when using G_STATIC_ASSERT
clang++ says it supports _Static_assert but then will
complain that it's a C11 extension and that you should not use
it in C++ code (which imho is fair enough)

So try to detect a C++ compiler first and then the C compiler,
similarly to what is done for the G_NORETURN case
2023-04-01 11:35:25 +02:00
Jan Tojnar
004f48f4fc build/gmodule-2.0.pc: Move compiler flags from Libs to Cflags
Previously, `-Wl,--export-dynamic` was in `Libs` key of `gmodule-2.0.pc`,
even though `-Wl` is a compiler flag, rather than a linker one.
This caused issues with API reference builds in evolution-data-server,
which passes the output of `pkg-config --libs` through `--ldflags`
argument of `gtkdoc-scan`, which are forwarded unchanged to `ld`:

    ld: unrecognized option '-Wl,--export-dynamic'

Let’s move the flag to `Cflags` so that the compiler can deal with it.

https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/463
2023-03-31 20:44:14 +02:00
Alexander Shopov
4263cd8cbb Update Bulgarian translation 2023-03-31 10:00:41 +00:00
Philip Withnall
eb94540f4c Merge branch 'sam/goptioncontext-docs' into 'main'
Link goption documentation to GOptionContext type

Closes #2953

See merge request GNOME/glib!3350
2023-03-29 14:21:25 +00:00
Philip Withnall
224e4e53e2 gdebugcontrollerdbus: Fix incorrect paragraph on auth in documentation
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2960
2023-03-29 14:05:43 +01:00
Boyuan Yang
c051fc483f Update Chinese (China) translation 2023-03-26 19:14:34 +00:00
Nirbheek Chauhan
32249a22fc meson: Fix detection of a system-provided proxy-libintl
proxy-libintl defines ngettext() as a define in the header that points
to the actual symbol in the library which is g_libintl_ngettext().
Same with bind_textdomain_codeset().
2023-03-26 13:45:37 +01:00
Philip Withnall
a476a047b9 tests: Update Unicode normalisation tests from Unicode 15
The file comes from
https://www.unicode.org/Public/UCD/latest/ucd/NormalizationTest.txt.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-24 12:21:37 +00:00
Philip Withnall
0387c15614 gsocket: Improve wording in a warning message slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-23 14:11:36 +00:00
Philip Withnall
aab9cea326 gwakeup: Use O_NONBLOCK to avoid a fcntl() syscall where possible
Create the wakeup pipe using the `O_NONBLOCK` flag for `pipe2()`, where
possible.

This saves a couple of `fcntl()` syscalls every time a wakeup pipe is
created, which is at least once per `GMainContext`.

This uses the `O_NONBLOCK` support added to `g_unix_open_pipe()` in the
previous commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-23 14:11:36 +00:00
Philip Withnall
5c65437d73 glib-unix: Add O_NONBLOCK support to g_unix_open_pipe()
Add support for it, but don’t use it anywhere yet — this is an API
addition, but currently doesn’t cause any functional changes. It’ll be
used in the next commit.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-23 14:11:36 +00:00
Philip Withnall
56c013cb6e inotify: Use IN_NONBLOCK to avoid a fcntl() syscall where possible
The `inotify_init1()` API has supported this flag for a long time
(possibly since it was first introduced, although I haven’t bothered
doing the archaeology).

This saves a syscall when first connecting to inotify.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-23 14:11:36 +00:00
Sam Thursfield
2d216d4d8c Link goption documentation to GOptionContext type
This makes the goption overview visible in the gi-docgen docs as part of
the GOptionContext type. Previously it was not visible anywhere.

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2953
2023-03-23 14:01:45 +00:00
Philip Withnall
3504385eba gvalue: Fix a typo in a function name in an example in the docs
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2864
2023-03-23 12:24:33 +00:00
Philip Withnall
e2d06873f9 gpollable: Clarify that can_poll() must be called before other methods
Both `GPollableInputStream` and `GPollableOutputStream` are dynamic
interfaces, in that their implementation on a class may only be
functional if certain prerequisites are met at runtime. For example,
a `GConverterInputStream` is only pollable if its base stream is
pollable, and that’s determined at runtime rather than compile time.

As such, both interfaces have a `can_poll()` method. If that method
returns `FALSE`, the behaviour of all other methods on the interface is
undefined.

That was mentioned in the documentation for `can_poll()`, but not any of
the other documentation for the interfaces, which made it a bit hard to
find.

Mention it more widely.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #2952
2023-03-23 12:08:08 +00:00
Philip Withnall
8b0cf41d88 gsocket: Use SOCK_NONBLOCK to avoid a fcntl() syscall where possible
If the libc and kernel support `SOCK_NONBLOCK`, we can specify that in
the `socket()` flags, and avoid a subsequent call to `fcntl()` to set
`O_NONBLOCK`.

For modern Linux distributions, this will save a syscall when creating a
socket.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-23 01:13:49 +00:00
Philip Withnall
afcd0bb900 tests: Add some explanatory comments to appmonitor test
This should split the code up into logical blocks a bit better, and make
it a bit easier to see what the test is doing at a glance.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 15:12:52 +00:00
Philip Withnall
e4546614a8 tests: Port appmonitor test from GMainLoop to using GMainContext directly
This makes the exit conditions for each main loop clearer, and
eliminates use of global variables. It introduces no functional changes.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 15:12:52 +00:00
Philip Withnall
666c72c9c5 tests: Fix non-removal of a timeout in appmonitor test
If the first part of the test takes less than 3s (which is normal), the
timeout for it is not removed, and could spuriously fire during the
second part of the test, causing a false failure.

Instead of relying on source IDs, just use (and explicitly destroy) a
`GSource` for the timeouts.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 15:12:52 +00:00
Philip Withnall
c0ca3f995b tests: Fix a FIXME in the appmonitor test
The test thought that calling `g_app_info_get()` was a bit of a hack,
but actually it (or calling another `g_app_info_*()` function) is the
right way to use the `GAppInfoMonitor` API.

See the documentation improvements a couple of commits back for details.

The remaining FIXME higher up in the test should probably be fixed by
getting `g_app_info_monitor_get()` to arm the signal. That requires
changes in `g_app_info_monitor_get()` to call `desktop_file_dir_init()`.
That will have to happen another time.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #799
2023-03-22 15:12:49 +00:00
Marco Trevisan
bd63436fad Merge branch 'default-branch-docs' into 'main'
docs: Drop section about default branch renaming from README.md

See merge request GNOME/glib!3345
2023-03-22 15:09:58 +00:00
Philip Withnall
9279f3b0f9 tests: Use g_assert_*() rather than g_assert() in appmonitor tests
It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 14:38:04 +00:00
Philip Withnall
0a10851faa tests: Add copyright/licensing header to appmonitor tests
This is put together through git archaeology:
```
git log gio/tests/appmonitor.c
```

The following commits were too trivial to have meaningful copyright:
 - 54047080e9
 - 4e7d22e268
 - f2c1cfe8c7
 - f8f344923e
 - 3ce00b29ec
 - 3468369625
 - e9d9edde82

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2023-03-22 14:36:57 +00:00
Philip Withnall
c62643adc3 gappinfo: Clarify one-shot behaviour of GAppInfoMonitor::changed in docs
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Fixes: #799
2023-03-22 14:30:39 +00:00
Marco Trevisan
0be2555704 Merge branch 'drop-check-abis' into 'main'
tools: Drop check-abis.sh script

See merge request GNOME/glib!3344
2023-03-22 13:13:07 +00:00
Philip Withnall
9970ee1c97 docs: Drop section about default branch renaming from README.md
It’s been there for 2 years (since commit d81165216d), people have
probably got the message by now.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 12:53:05 +00:00
Philip Withnall
180713772f
2.76.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 11:28:01 +00:00
Philip Withnall
077b87aa9c tools: Drop check-abis.sh script
It hasn’t been used for years, and isn’t really needed since we changed
to explicitly exporting symbols (using `GLIB_AVAILABLE_IN_*`) rather than
implicitly exporting them unless they were hidden.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-22 10:44:01 +00:00
Danial Behzadi
babd275330 Update Persian translation 2023-03-22 10:34:36 +00:00
Philip Withnall
2aaa3250c9 Merge branch '2907-revert-gfileinfo-criticals' into 'main'
gfileinfo: Temporarily downgrade missing attribute criticals to debugs

See merge request GNOME/glib!3338
2023-03-21 16:15:37 +00:00
Philip Withnall
4cad66580b gfileinfo: Temporarily downgrade missing attribute criticals to debugs
This partially reverts ed8e86a7d4.

The change to add the criticals (commit ed8e86a7d4) is correct, but
landed too late in the cycle. Let’s downgrade the criticals to debugs
for now, to stop applications seeing a lot of new criticals in their
output. Those criticals are particularly disruptive for command line
applications and unit tests.

Early in the next cycle, the debugs will be re-upgraded to criticals.
This will give applications a whole additional cycle to fix their
ambiguous use of API.

It turned out that a lot of applications have latent bugs around
calling `g_file_info_get_*()` without checking whether an attribute
is set first, and were hence relying on the ‘unknown’ return value
also being an appropriate default for them.

This was compounded by the fact that several non-local GVFS backends
were not setting `GFileInfo` attributes all the time, which caused the
‘missing attribute’ code path to be hit more frequently. For example,
they would only call `g_file_info_set_is_hidden()` with a true value and
never bother with a false one.

It was further compounded by the fact that, while this change landed for
the 2.75.4 release, there did not seem to be extensive integration
testing of that release, and distributions and downstreams went straight
to 2.76.0. That meant we missed the window between 2.75.4 and 2.76.0 to
change, fix or revert this behaviour. GLib relies on distros and
downstreams doing integration testing of unstable releases. We test with
downstream GNOME as part of gnome-build-meta, but do not have the
resources to do integration testing for everybody.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

See: #2907
See: #2932
See: #2934
See: #2945
See: #2948
2023-03-21 15:01:10 +00:00
Philip Withnall
2630b7d2d5 Merge branch '352-file-enumerator-docs' into 'main'
gfileenumerator: Clarify termination condition for next_files_async()

Closes #352

See merge request GNOME/glib!3339
2023-03-21 14:58:45 +00:00
Marco Trevisan
076e656f30 Merge branch 'strfuncs-check-results' into 'main'
tests: Check a few results in strfuncs tests

See merge request GNOME/glib!3330
2023-03-21 14:52:59 +00:00