These properties all have their names prefixed with 'g-', in order to
avoid conflicts with property names coming directly from an actual D-Bus
interface that a derived type might want to install. The corresponding
accessor methods are identified by theit full C symbol name, so their
names are not prefixed.
But this resulted in g-ir-scanner being unable to see the connection
between the properties and their accessors. Help it out with explicit
annotations.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Previously, the config file for the mock bus daemon was deleted as soon
as the daemon had started up. That was fine, until when the daemon came
to reload its configuration at runtime, which can happen if (for
example) a new activatable service is added to the service directory
specified in `g_test_dbus_add_service_dir()` at runtime. The daemon
would error and not load the new activatable service config.
Avoid that by keeping the config file around until the daemon exits, and
then deleting it.
Change the deletion code to ignore `ENOENT` (as the config file might
have been cleaned up by the `G_TEST_OPTION_ISOLATE_DIRS` code, or
similar, by then) and to print a warning rather than aborting (like the
`kill()` code above).
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
The documentation for g_file_info_get_is_backup() and the
G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP attribute did not define
what constitutes a backup file.
Closes#3885
It appears that this has been broken from when GIO was merged into GLib,
as the arguments to `symlink()` were the wrong way round.
Add a unit test, and fix the arguments.
Currently the unit test needs to create a symlink on disk first, as GIO
apparently doesn’t support creating symlinks from scratch — only
changing the target of existing ones.
Diagnosed by Michael Catanzaro.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3897
With valid values, the set command would leak a GVariant object
from g_variant_parse:
gsettings set org.gnome.desktop.interface enable-animations false
With invalid values, the set command would leak a string from
g_variant_parse_error_print_context:
gsettings set org.gnome.desktop.interface enable-animations foo
The freeme string was unused since commit 8148a3c39.
The comparison was between a gint and guint which could cause issues.
Cast len to guint for the comparison since res_query() can return
values up to the buffer size.
Using gint for string length and iteration indices could overflow for
paths longer than INT_MAX, though this is unlikely in practice.
Using size_t makes the code consistent with strlen() return type and
prevents potential signedness issues.
This patch fixes several const qualifiers by adjusting where required.
Since glibc-2.43 and ISO C23, the functions bsearch, memchr, strchr,
strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr
that return pointers into their input arrays now have definitions as
macros that return a pointer to a const-qualified type when the input
argument is a pointer to a const-qualified type.
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
g_socket_connection_get_remote_address() has 2.40 been able to get the
remote address for not connected sockets by caching the name when
connecting. However, it never set an error when there was no address
cached. This appears to happen sometimes when trying to print the remote
address of incoming connections of a GSocketService. Fix this by setting
a 'not-connected' error when not connected and there was no address
cached.
Currently we're showing the progress by indicating the average speed
rather than the actual current speed and this could be misleading.
So report both while the transfer is in progress
The rate calculation divided elapsed time in microseconds by
G_USEC_PER_SEC before dividing bytes by the result. For transfers
completing in under 1 second, this caused the time to truncate to 0,
making MAX() clamp it to 1, resulting in bytes/1. This byte count was
then passed to g_format_size(). So for example in this case:
gio copy -p "/tmp/copy-src" /tmp/copy-dest
Transferred 79,5 kB out of 79,5 kB (79,5 kB/s)
The actual rate should have been "12.2 MB/s" or higher.
Fixed by multiplying bytes by G_USEC_PER_SEC before dividing by
elapsed microseconds, ensuring correct bytes-per-second calculation
for all transfer durations.
- Creating and destroying the HWND in a worker thread.
- HWND message loop is handled in worker thread, currently only handling
"TaskbarCreated" message to re-initialize the tray icon.
- send_notification waits for the notification icon to be created if it failed
to call Shell_NotifyIcon(), or time out trying to wait.
Method names weren’t previously validated in the argument parser, which
resulted in them being passed into the GDBus call, which would then
print a critical warning and abort.
Avoid that by validating them in the argument parser, and add a unit
test to prevent regressions.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3886
It’s nowhere near complete, but it gives us somewhere to easily bolt new
tests in future.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3628
Previously it would print an error if called as `gdbus --help`. By
contrast, `gdbus help` worked as expected.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
The strings involved here all come from the `G_RESOURCE_OVERLAYS`
environment variable, so are all trusted as much as any other
environment variable (including `LD_PRELOAD`). Still, if one of them
ends up being too long, it would be better to skip that overlay than
crash.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3881
It seems unlikely that this path would be long enough to cause an
overflow, but particularly given that we’re using `alloca()` here, we
should limit its length to prevent a possible stack overflow.
The path comes from the `GIO_LAUNCHED_DESKTOP_FILE` environment
variable, so is as trusted as any input from the environment (i.e. it’s
trusted; an untrusted environment can contain arbitrary `LD_PRELOAD`, so
has full permissions anyway).
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #3880
Since we require macOS 11 (and 10.13 support is best-effort), we do
not need to support older than Xcode 8 which added TARGET_OS_OSX and
shipped with macOS 10.12.
When we try to load that dir on a real phone, nothing happens because
the path doesn't exist since the app is a statically-linked bundle.
When we try on the simulator, we get warnings when the compiled-in
path exists in the user machine because the modules fail to load.