Commit Graph

27226 Commits

Author SHA1 Message Date
Ondrej Holy
c965bf23a8 glocalfileinfo: Set is-backup attribute also on Windows
The `is-backup` attribute isn't currently set on Windows. It would
be nice to set such basic attributes on all platforms. Let's set
the attribute to `FALSE` there.
2023-03-06 14:33:39 +01:00
Ondrej Holy
448a163bee glocalfileinfo: Ensure that is-backup is always set
Currently, the `G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP` attribute is set
only when its value is `TRUE`. This is wrong with the latest changes as
the `GLib-GIO-CRITICAL **: 00:54:07.260: GFileInfo created without
standard::is-backup` errors are printed now from the
`g_file_info_get_is_backup` function among others. Let's set this
aattribute also when it is `FALSE`.

Related: https://gitlab.gnome.org/GNOME/glib/-/issues/2934
2023-03-06 14:33:39 +01:00
Ondrej Holy
43066d6960 glocalfileinfo: Mark the lost+found dir as hidden again
The lost+found dir isn't detected as hidden currently. This is regression
caused by the commit 728ad64b. Let's change the code a bit to be sure that
the lost+found dir is marked as hidden again.
2023-03-06 14:10:13 +01:00
Philip Withnall
4e62e55d6d gfile: Check ETag attribute is present before trying to get it
A regression from issue #2907.

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

Fixes: #2932
2023-03-06 13:02:41 +00:00
Ondrej Holy
406143b072 gfile: Fix file size detection when copying on btrfs
When the `g_file_copy` function is used with files on BTRFS, the
`GLib-GIO-FATAL-CRITICAL: GFileInfo created without standard::size`
error is printed. This is because the `g_file_get_size` function
is used to obtain the file size for the progress callback, but it uses
the wrong `GFileInfo` object that is meant for attributes to be copied
with the file. The file size attribute is missing there obviously. Let's
obtain the file size over the `fstat` call the same way as it is done in
the `splice_stream_with_progress` function to get rid of those errors
and to fix the progress reporting.
2023-03-06 10:30:20 +01:00
Marek Černocký
e75ba524fd Update Czech translation 2023-03-05 22:10:44 +00:00
Piotr Drąg
2dad35ff83 Update Polish translation 2023-03-05 16:52:04 +00:00
Alexander Shopov
58a3243f03 Update Bulgarian translation 2023-03-04 17:40:33 +00:00
Aleksandr Melman
73438a5dc5 Update Russian translation 2023-03-04 14:46:22 +00:00
Tim Sabsch
e1c364ca28 Update German translation 2023-03-03 18:39:42 +00:00
Changwoo Ryu
d2c1b03309 Update Korean translation 2023-03-03 15:39:53 +00:00
Philip Withnall
084a35620c
2.75.4
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-03 11:15:47 +00:00
Anders Jonsson
57b0cc1fd7 Update Swedish translation 2023-03-02 22:02:16 +00:00
Philip Withnall
0df2c607a6 Merge branch 'skip-test-under-sandbox' into 'main'
tests: Skip assert-msg-test.py if gdb fails

See merge request GNOME/glib!3304
2023-03-02 17:52:33 +00:00
Emmanuele Bassi
48e62795f6 Merge branch 'g_strerror_error_leak' into 'main'
Fix a memory leak in g_strerror

See merge request GNOME/glib!3305
2023-03-02 16:37:37 +00:00
Dan Carpenter
774d8bd914 Fix a memory leak in g_strerror
If g_locale_to_utf8 sets a GError, it must be freed.
2023-03-02 15:46:00 +01:00
Matt Turner
19a8df9d8b tests: Skip assert-msg-test.py if gdb fails
Similar to commit 6e44151bf7, skip the test if gdb is unable to read
/proc/PID/mem, which gdb does as a fallback if ptrace is unavailable.

This allows the test to skip when run under Gentoo's sandbox.
2023-03-02 09:36:10 -05:00
Simon McVittie
6c22a5ee2b Merge branch '2925-gdbus-threading-test' into 'main'
gdbusconnection: Explicitly destroy an idle source on cleanup

See merge request GNOME/glib!3296
2023-03-02 12:35:21 +00:00
Balázs Úr
e429113878 Update Hungarian translation 2023-03-02 01:39:18 +00:00
Matej Urbančič
f96795b302 Update Slovenian translation 2023-02-27 20:23:04 +00:00
Alan Mortensen
43a7435c9c Update Danish translation 2023-02-26 10:52:38 +00:00
Asier Sarasua Garmendia
c98d65c8c9 Update Basque translation 2023-02-26 07:19:59 +00:00
Philip Withnall
ed6db32677 Merge branch 'fix-g-value-annotations' into 'main'
GObject: Add nullable annotations

See merge request GNOME/glib!3301
2023-02-24 17:37:46 +00:00
badcel
1c15f158b0
gobject: Fix some annotations 2023-02-24 18:06:14 +01:00
Philip Withnall
d1415f857e Merge branch 'ebassi/news-update' into 'main'
Update the NEWS file

See merge request GNOME/glib!3299
2023-02-23 15:16:21 +00:00
Philip Withnall
35c9ab144e Merge branch 'main' into 'main'
gio/tests/cxx.cpp: fix missing sentinel for musl

See merge request GNOME/glib!3294
2023-02-23 14:53:20 +00:00
Emmanuele Bassi
4d2e3e6330 Update the NEWS file
The "emit a critical warning if your object notifies a property during
finalization" entry should have been added in 2.75.1, but better late
than never.
2023-02-23 14:18:25 +00:00
Markus Volk
caab1a41dc gio/tests/cxx.cpp: fix missing sentinel for musl
This fixes:
| ../glib-2.75.3/gio/tests/cxx.cpp: In function 'int main(int, char**)':
| ../glib-2.75.3/gio/tests/cxx.cpp:61:15: error: missing sentinel in function call [-Werror=format=]
|    61 |   g_test_init (&argc, &argv, NULL);

if built with musl libc

Signed-off-by: Markus Volk <f_l_k@t-online.de>
2023-02-23 15:02:26 +01:00
Philip Withnall
49467e3453 Merge branch 'onceinit-joins' into 'main'
tests: Add some missing g_thread_join() calls to onceinit test

See merge request GNOME/glib!3295
2023-02-23 13:05:16 +00:00
Simon McVittie
e5941a3af1 Merge branch '2924-use-after-free-gdbus-method-invocation' into 'main'
gdbusinterfaceskeleton: Fix a use-after-free of a GDBusMethodInvocation

Closes #2924

See merge request GNOME/glib!3297
2023-02-23 12:43:54 +00:00
Philip Withnall
7b101588e9 gdbusconnection: Make GDBusMethodInvocation transfer a bit clearer
Add a missing steal call in `schedule_method_call()`. This introduces no
functional changes, but documents the ownership transfer more clearly.

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

Helps: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
d5710deb9d gdbusinterfaceskeleton: Fix a use-after-free of a GDBusMethodInvocation
This `GDBusMethodInvocation` may be shared across threads, with no
guarantee on the strong ref in one thread outlasting any refs in other
threads — so it needs a ref in this helper struct.

This should fix a use-after-free where the `GDBusMethodInvocation` is
freed from `g_value_unset()` after `g_signal_emit()` returns in
`dispatch_in_thread_func()` in one thread; but then dereferenced again
in `g_source_destroy_internal()` from another thread.

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

Fixes: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
1f86923766 gdbusinterfaceskeleton: Remove an unnecessary helper struct member
The `GDBusInterfaceSkeleton` is already stored as the source object of
the `GTask` here, with a strong reference.

Storing it again in the task’s data struct is redundant, and makes it
look like the `GDBusInterfaceSkeleton` is being used without holding a
strong reference. (There’s not actually a bug there though: the strong
reference from the `GTask` outlives the data struct, so is sufficient.)

Remove the unnecessary helper struct member to clarify the code a bit.

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

Helps: #2924
2023-02-23 12:16:05 +00:00
Philip Withnall
ac5589128c tests: Add some missing g_thread_join() calls to onceinit test
Running the test under asan was failing as the threads were being
leaked.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-23 12:15:13 +00:00
Philip Withnall
81a42f4c59 gsocketclient: Document ownership of connection_attempts better
This introduces no functional changes; just made it while trying to
debug issue #2925.

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

Helps: #2925
2023-02-23 12:14:29 +00:00
Philip Withnall
5a69cc22dc gdbusconnection: Explicitly destroy an idle source on cleanup
Otherwise it’s possible for it to hang around in the `GMainContext`
after the “send message” operation has finished. In the best case, this
will cause the `GTask` and `GDBusMessage` to not be freed when the
calling code expects. In the worst case, it could cause use-after-free
problems if it derefs allocations which have since been freed.

I have not seen either of these problems in practice, but it would be
best for the code to eliminate the risk of them altogether by explicitly
destroying the source when the operation is finished.

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

Helps: #2925
2023-02-23 12:14:29 +00:00
Philip Withnall
ed7044b5f3 gdbusprivate: Improve docs on message ownership in MessageToWriteData
This doesn’t introduce any functional changes, but should make the code
a little clearer.

Drive-by improvements while trying to debug #1264.

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

Helps: #1264
2023-02-23 12:11:24 +00:00
Philip Withnall
90af20d950 gdbusconnection: Improve docs of message ownership in closures
This introduces no functional changes, but makes it a little clearer how
the ownership of these `GDBusMessage` instances works. The free function
is changed to `g_clear_object()` to avoid the possibility of somehow
using the messages after freeing them.

Basically just some drive-by docs improvements while trying to debug
issue #1264.

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

Helps: #1264
2023-02-23 12:11:24 +00:00
Philip Withnall
127c899a2e gdbusconnection: Fix the type of a free function
This didn’t actually cause any observable bugs, since the structures of
`PropertyData` and `PropertyGetAllData` were equivalent for the members
which the free function touches.

Definitely should be fixed though.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-02-23 12:11:24 +00:00
Philip Withnall
4900ea5215 gdbusconnection: Fix double unref on timeout/cancel sending a message
This appears to fix an intermittent failure seen when sending a D-Bus
message with either of a cancellable or a timeout set.

In particular, I can reliably reproduce it with:
```
meson test gdbus-test-codegen-min-required-2-64 --repeat 10000
```

It can be caught easily with asan when reproduced. Tracking down the
location of the refcount mismatch was a little tricky, but was
simplified by replacing a load of `g_object_ref (message)` calls with
`g_dbus_message_copy (message, NULL)` to switch `GDBusMessage` handling
to using copy semantics. This allowed asan to home in on where the
refcount mismatch was happening.

The problem was that `send_message_data_deliver_error()` takes ownership
of the `GTask` passed to it, but the
`send_message_with_replace_cancelled_idle_cb()` and
`send_message_with_reply_timeout_cb()` functions which were calling it,
were not passing in a strong reference as they should have.

Another approach to fixing this would have been to change the transfer
semantics of `send_message_data_deliver_error()` so it was `(transfer
none)` on its `GTask`. That would probably have resulted in cleaner
code, but would have been a lot harder to verify/review the fix, and
easier to inadvertently introduce new bugs.

The fact that the bug was only triggered by the cancellation and timeout
callbacks explains why it was intermittent: these code paths are
typically never hit, but the timeout path may sometimes be hit on a very
slow test run.

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

Fixes: #1264
2023-02-23 12:11:24 +00:00
Simon McVittie
88fd3f0a76 Merge branch 'build-with-llvm-toolchain' into 'main'
Fix building gio/tests/test_resources.o with LLVM ld

Closes #2720

See merge request GNOME/glib!3186
2023-02-22 16:51:05 +00:00
Philip Withnall
0a715be599 Merge branch 'cloexec-other' into 'main'
Close-on-exec flag few missed places

See merge request GNOME/glib!3292
2023-02-22 13:07:35 +00:00
Philip Withnall
ddf85f9d9e Merge branch 'g-win32-app-info-enhancements-2' into 'main'
GWin32AppInfo: Retrieve display name for UWP / Packaged apps

See merge request GNOME/glib!3168
2023-02-22 12:55:24 +00:00
Emmanuele Bassi
4c17e3b122 Merge branch '2907-file-info-docs' into 'main'
gfileinfo: Document required attributes for helper getters

Closes #2907

See merge request GNOME/glib!3261
2023-02-22 12:35:38 +00:00
Luca Bacci
01889cd348 GWin32AppInfo: Retrieve display name of UWP (packaged) apps 2023-02-22 13:24:13 +01:00
Sabri Ünal
df40317a74 Update Turkish translation 2023-02-22 11:55:19 +00:00
Philip Withnall
d8c913ac83 Merge branch 'fix-c4141' into 'main'
gstring.h/gmacros.h: Avoid compiler warnings on Visual Studio

Closes #2905

See merge request GNOME/glib!3285
2023-02-22 03:30:41 +00:00
Chun-wei Fan
c8730dc6f9 gmacros.h: Fix C++ macros for Visual Studio
,,,for G_ALWAYS_INLINE and G_NO_INLINE, since the msvc::forceinline and
msvc::noinline attributes require C++-20 support, not just C++-11
support.  This will avoid warning C5051 (unsupported attribute ...,
ignored) if pre-C++-20 was used.
2023-02-22 10:24:20 +08:00
Chun-wei Fan
994209dbee gstring.h: Avoid compiler warning on Visual Studio
The recent optimizations to gstring.h used G_ALWAYS_INLINE (meaning
'__forceinline' on Visual Studio) together with 'static inline', which
will cause warning C4141 indicating that 'inline' was used more than
once on the function.

Avoid this by temporarily disabling warning C4141 in gstring.h when
building the code that uses 'G_ALWAYS_INLINE'.

Fixes issue #2905.
2023-02-22 10:24:20 +08:00
Emmanuele Bassi
796e21ee1c Merge branch 'w-sign-conversion' into 'main'
tests: Add a -Wsign-conversion test for gstring.h

See merge request GNOME/glib!3275
2023-02-22 01:41:25 +00:00