Commit Graph

26680 Commits

Author SHA1 Message Date
Philip Withnall
73fa684e30 Merge branch 'ptr-array-sort-values' into 'main'
garray: Add g_ptr_array_sort_values[_with_data]() wrappers

See merge request GNOME/glib!3155
2023-01-06 12:09:37 +00:00
Marco Trevisan (Treviño)
861e82efbc gio: Use g_ptr_array_sort_values()
Cleanup some code using GPtrArray sorting with functions that were taking
pointer to pointers arguments.
2023-01-06 11:46:01 +00:00
Marco Trevisan (Treviño)
0ffd23cac4 garray: Add g_ptr_array_sort_values[_with_data]() wrappers
Historically GPtrArray made possible to compare pointers of pointers values
that it holds, however this is inconvenient in most cases as it requires
wrapper functions and not friendly castings.

So, add two functions that allow to perform the comparisons between the
pointer values that a GPtrArray holds following the same syntax that we
share everywhere in the codebase.
2023-01-06 11:46:01 +00:00
Emmanuele Bassi
892deb8f93 Merge branch 'coverity-iface-null' into 'main'
gobject: Add a missing NULL check for the return from lookup_type_node_I()

See merge request GNOME/glib!3162
2023-01-05 18:57:21 +00:00
Philip Withnall
d333b06644 Merge branch 'g-win32-app-info-enhancements' into 'main'
GWin32AppInfo: Fixes for UWP (packaged) apps activation

See merge request GNOME/glib!3167
2023-01-05 17:51:06 +00:00
Luca Bacci
86fccfcb70 GWin32AppInfo: Prefer file activation over URI activation for file URI's
(...unless file:// URI's are actually supported by the target app)

References:

 [1] - https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation
 [2] - https://learn.microsoft.com/en-us/windows/uwp/launch-resume/handle-file-activation
2023-01-05 17:50:15 +01:00
Luca Bacci
02417db370 GWin32AppInfo: Pass only one item to ActivateForProtocol()
IApplicationActivationManager::ActivateForProtocol() only uses the first
item from the IShellItemArray. When we have to activate multiple URI's,
call ActivateForProtocol() repeatedly in a loop, each time with one URI.

References:

 [1] - IApplicationActivationManager::ActivateForProtocol method [MSDN]
       https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-iapplicationactivationmanager-activateforprotocol
2023-01-05 17:46:50 +01:00
Luca Bacci
7bbbb1ee42 GWin32AppInfo: Create IShellItemArray object inside launch_uwp_internal()
The IShellItemArray object is only used in launch_uwp_internal(),
so do not make callers bother with that.
2023-01-05 17:42:03 +01:00
Philip Withnall
92f9c678f5 Merge branch 'nirbheek/meson-subproject-usage-fixes' into 'main'
Various fixes for how we interact with subproject dependencies

See merge request GNOME/glib!3177
2023-01-05 16:02:50 +00:00
Philip Withnall
637b49539b Merge branch 'actualize-links' into 'main'
INSTALL.md,README.win32.md: Actualize links

See merge request GNOME/glib!3181
2023-01-05 15:05:04 +00:00
Philip Withnall
a7d523cd08 Merge branch 'mtime-fix' into 'main'
glocalfileinfo: Don't reset mtime tv_sec when setting tv_usec

See merge request GNOME/glib!3178
2023-01-05 14:40:15 +00:00
Philip Withnall
35d3528623 Merge branch '2857-stpcpy-doc' into 'main'
gstrfuncs: Fix grammar in documentation of stpcpy

Closes #2857

See merge request GNOME/glib!3179
2023-01-05 14:21:04 +00:00
Vasyl Vavrychuk
e422bbb2fd INSTALL.md,README.win32.md: Actualize links 2023-01-04 11:52:07 +02:00
Peter Bloomfield
49ec4d524f gstrfuncs: Fix grammar in documentation of stpcpy
Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2857
2023-01-02 13:27:26 -05:00
Sabri Ünal
b6270f14e6 Update Turkish translation 2023-01-02 13:41:13 +00:00
Maxim Mikityanskiy
a56bc06f16 glocalfileinfo: Don't reset mtime tv_sec when setting tv_usec
Fix a regression that appeared after adding support for nanosecond
timestamps to set_mtime_atime(). User-visible effect: when copying a
file from a gvfs MTP mountpoint to the local filesystem, the file's
mtime is set to 0.

This behavior happens when setting G_FILE_ATTRIBUTE_TIME_MODIFIED first,
then G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC. Setting the second attribute
ends up in set_mtime_atime() with mtime_usec_value set, and mtime_value
== NULL. When mtime_value is NULL, the tv_sec part of the timestamp
should be fetched by lazy_stat(), but set_mtime_atime() fails to assign
it properly, and tv_sec stays at 0, leading to losing the main part of
the timestamp.

Fix the issue by setting times_n[1].tv_sec to the value fetched from
lazy_stat().

Fixes: b33ef610de ("Add functionality to preserve nanosecond timestamps")
Fixes: 15cb123c82 ("glocalfileinfo: don't call both utimes and utimensat")
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
2023-01-02 03:55:43 +02:00
Nirbheek Chauhan
45c2f8c18e ci: Update images to cache wrap downloads
We aren't allowed to download wraps in the build, and we need them on
Android and MinGW
2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
fc6843bec8 ci: Fix podman support in run-docker.sh
In newer Fedora versions, `docker` doesn't exist. You have to use
`podman`.
2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
a587212080 ci: Update docker image generation README 2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
71438c44b7 meson: Don't accidentally pick up intl fallback in the first test
If proxy-libintl has already been configured before we get to glib, we
will pick that up in dependency('intl'), which then does compiler
checks on it. This was written to assume that the first check will not
find a subproject for libintl, so force it with allow_fallback: false.

Also update the proxy-libintl wrap file and get rid of the explicit
subproject() call.

Reported by Benjamin Gilbert at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3172
2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
6abafd64d8 meson: Fix pcre static flag usage with a subproject 2022-12-31 05:13:10 +05:30
Nirbheek Chauhan
a395a7ab3d meson: Don't use outdated 'fallback:' kwarg to dependency()
The mapping is done using the wrap file now. Also update the libffi
and pcre2 subprojects at the same time.

Reported by Benjamin Gilbert at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3172
2022-12-31 05:13:10 +05:30
Philip Withnall
2d5d990c6a Merge branch 'add-null-check-codegen' into 'main'
codegen: Check parameter before calling its interface method

See merge request GNOME/glib!3175
2022-12-30 13:44:20 +00:00
Alynx Zhou
b16201390b codegen: Check parameter before calling its interface method 2022-12-30 13:44:20 +00:00
Nirbheek Chauhan
609d58beea meson: Don't accidentally pick up pcre2 fallback in the first test
This test assumes that pcre2 is not provided by a subproject, so force
it to be that. Explicitly allow fallback in the next check (although
it's implied already).
2022-12-30 17:01:27 +05:30
Marco Trevisan
6d9bff2874 Merge branch 'coverity-fixes2' into 'main'
garray: Add some additional length assertions

See merge request GNOME/glib!3174
2022-12-30 11:17:39 +00:00
Marco Trevisan
8a3b16af23 Merge branch 'coverity-fixes' into 'main'
gdesktopappinfo: Drop an unnecessary NULL check

See merge request GNOME/glib!3173
2022-12-30 11:15:29 +00:00
Philip Withnall
41b6de661d garray: Add some additional length assertions
This should shut Coverity up.

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

Coverity CID: #1502194
2022-12-29 16:09:20 +00:00
Philip Withnall
8463155b21 gdesktopappinfo: Drop an unnecessary NULL check
`search_token` cannot be `NULL` at this point (guaranteed by all the
current call sites of `desktop_file_dir_unindexed_search()`), so remove
an unnecessary `NULL` check.

Add an assertion to make the nullability clear.

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

Coverity CID: #1502196, #1502193
2022-12-29 15:57:53 +00:00
Philip Withnall
0c640cf671 Merge branch 'md' into 'main'
codegen: Support markdown suitable for gi-docgen

See merge request GNOME/glib!3171
2022-12-29 12:42:12 +00:00
Guido Günther
4cb945d780 codegen: Support markdown suitable for gi-docgen 2022-12-29 12:42:12 +00:00
Philip Withnall
46d3a016f3 Merge branch 'write_info_file_fail' into 'main'
GLocalFile: add error handle for trash info file writing

See merge request GNOME/glib!3170
2022-12-29 12:33:55 +00:00
wangrong
95c4312941 GLocalFile: add error handle for trash info file writing 2022-12-29 12:33:55 +00:00
Philip Withnall
955ee5c752 Merge branch 'del_errsv' into 'main'
GLocalFile: Delete redundant error saving statement

See merge request GNOME/glib!3169
2022-12-29 12:29:40 +00:00
wangrong
333e9fc0ba GLocalFile: Delete redundant error saving statement 2022-12-29 12:29:39 +00:00
Philip Withnall
f0bc060e89 Merge branch 'revert-eb12afed' into 'main'
Revert "gsimpleproxyresolver: Make explicit that a port is needed for HTTP/HTTPS"

Closes #2832

See merge request GNOME/glib!3110
2022-12-22 21:57:39 +00:00
Michael Catanzaro
d246d09e5b gproxyresolver: allow implicit ports in URIs
If the port is not specified, then a default port should be assumed.
This is how everybody expects URIs to work and it's how GProxyResolver
should work too.

We already have lots of tests to ensure this works as expected; however,
the documentation currently does not allow it. Change the documentation
to match reality.

Fixes #2832
2022-12-22 15:37:27 -06:00
Michael Catanzaro
1c3f992f11 Revert "gsimpleproxyresolver: Make explicit that a port is needed for HTTP/HTTPS"
This reverts commit eb12afed6f

Instead, let's allow use of URIs without ports specified, which
indicates that a default port should be used.
2022-12-22 15:37:27 -06:00
Philip Withnall
a0ea1d7093 Merge branch 'g-win32-app-info-enhancements' into 'main'
GWin32AppInfo: Check for local file path first

Closes #2843

See merge request GNOME/glib!3160
2022-12-22 15:02:42 +00:00
Luca Bacci
3c2b15fb15 GWin32AppInfo: Fix use-after-free 2022-12-22 15:14:29 +01:00
Luca Bacci
b0b16cf06e GWin32AppInfo: Check for local file path first
When launching a registered handler we compose the command-line
string using the registered command-line template. Applications
expect files in their command-line as local paths rather than
complete URI strings.

For example,

  "Program.exe" "%1"

Should expand to

  "Program.exe" "C:\file.dat"

Rather than

  "Program.exe" "file:///C:\file.dat"

Fixes https://gitlab.gnome.org/GNOME/glib/-/issues/2843
2022-12-22 15:13:10 +01:00
Philip Withnall
b1057f3bb6
2.75.1
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-12-21 21:26:54 +00:00
Philip Withnall
ac459f156d Merge branch '2840-2841-variant-more-fixes' into 'main'
gvariant: Check offset table doesn’t fall outside variant bounds and speed up text parsing

Closes #2840 and #2841

See merge request GNOME/glib!3163
2022-12-21 21:25:20 +00:00
Philip Withnall
21a204147b gvariant: Propagate trust when getting a child of a serialised variant
If a variant is trusted, that means all its children are trusted, so
ensure that their checked offsets are set as such.

This allows a lot of the offset table checks to be avoided when getting
children from trusted serialised tuples, which speeds things up.

No unit test is included because this is just a performance fix. If
there are other slownesses, or regressions, in serialised `GVariant`
performance, the fuzzing setup will catch them like it did this one.

This change does reduce the time to run the oss-fuzz reproducer from 80s
to about 0.7s on my machine.

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

Fixes: #2841
oss-fuzz#54314
2022-12-21 19:50:26 +00:00
Philip Withnall
78da5faccb gvariant: Check offset table doesn’t fall outside variant bounds
When dereferencing the first entry in the offset table for a tuple,
check that it doesn’t fall outside the bounds of the variant first.

This prevents an out-of-bounds read from some non-normal tuples.

This bug was introduced in commit 73d0aa81c2.

Includes a unit test, although the test will likely only catch the
original bug if run with asan enabled.

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

Fixes: #2840
oss-fuzz#54302
2022-12-21 19:50:19 +00:00
Philip Withnall
251bab3e71 gobject: Add a missing NULL check for the return from lookup_type_node_I()
This can cause a `NULL` dereference on the next line if there is no
`TypeNode` for `iface_type`, for example if `iface_type ==
G_TYPE_INVALID`.

Unlikely, but possible since this API is public.

Spotted by Coverity.

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

Coverity CID: #1501602
2022-12-21 19:16:10 +00:00
Philip Withnall
5e378c775a Merge branch 'ptr-array-new-take' into 'main'
garray: Add more G(Ptr)Array constructors to take or copy C arrays

See merge request GNOME/glib!3128
2022-12-21 18:34:13 +00:00
Emmanuele Bassi
f64fc32310 Merge branch 'disable-assert-warning-fix' into 'main'
gmenuexporter: Fix warning of unused n_items when building with G_DISABLE_ASSERT

See merge request GNOME/glib!3159
2022-12-21 18:30:26 +00:00
Emmanuele Bassi
9174af5421 Merge branch '2852-musl-siginfo-t' into 'main'
gmain: Define fallback values for siginfo_t constants for musl

Closes #2852

See merge request GNOME/glib!3158
2022-12-21 13:13:10 +00:00
Philip Withnall
8f213524b9 Merge branch 'gobject-value-set-cleanups' into 'main'
gobject: Some GValue setting code cleanups

See merge request GNOME/glib!3156
2022-12-21 13:12:54 +00:00