summaryrefslogtreecommitdiff
path: root/client/gdaemonfile.c
Commit message (Collapse)AuthorAgeFilesLines
* gdaemonfile: Remove dead codeOndrej Holy2023-02-281-9/+0
| | | | | | | The file_transfer function contains a statement ensuring that the operation fails when files are on different mounts. But this statement is never reached. This case is correctly handled inside the create_proxy_for_file2 functio. Let's remove the dead code.
* gdaemonfile: Disable push/pull for FlatpakOndrej Holy2023-02-281-2/+4
| | | | | | | | | The push/pull methods rely on local paths. This is a problem for Flatpak applications because the GVfs daemons run outside of it, so the same local path might refer to a different file. Let's disable the push/pull methods for Flatpak applications to fix errors when moving/copying. Related: https://github.com/flathub/org.libreoffice.LibreOffice/issues/23
* client: Skip session bus fallback if operation was cancelledOndrej Holy2020-12-181-1/+9
| | | | | | | | Recently added warnings when peer-to-peer connection fails (commit 60ca0cea) makes visible old bug that the session bus fallback is tried regardless of the fact that the operation was cancelled. Let's stop the operation immediately when G_IO_ERROR_CANCELLED is returned and don't print the warnings in this case.
* client: Add fallback to session bus also for synchronous APIOndrej Holy2020-12-081-4/+9
| | | | | | Asynchronous API fallbacks to session bus when peer-to-peer connection fails, however, synchronous API fails in the same case. Let's add fallback to session bus also for the synchronous case.
* client: Show warning when peer-to-peer connection failedOndrej Holy2020-12-081-3/+12
| | | | | | | When peer-to-peer connection fails, the session bus is silently used instead by the asynchronous API. Let's add warnings to make it more obvious and mention that --filesystem=xdg-run/gvfsd is probably missing.
* trash: Do not fail when G_FILE_COPY_NO_FALLBACK_FOR_MOVE is usedwip/oholy/trash-performanceOndrej Holy2020-09-241-8/+0
| | | | | | | | | | | | | | Restoring files from the trash folder is slow in Nautilus as it attempts to do it recursively. This is because G_IO_ERROR_NOT_SUPPORTED is returned from g_file_move when G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag is used. The error is returned from client-side for pull/push operations after commit 2e765449 as in the most cases the copy-and-delete approach is really used there. But the problem is that it is not in all cases, like in the trash backend case, where the native move operation is used in fact. Let's handle the G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag directly in the backends, but not in the trash backend. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1589
* client: Fix mount info cache invalidationOndrej Holy2019-03-041-23/+16
| | | | | | | | | | | | | Mount info cache invalidation is not handled properly and thus client can get "Cache invalid, retry (internally handled)" internal error, which should not be passed to the client. This can happen if mount was unmounted and another mount for the some location is mounted. This is now more common with introducing stable URIs for MTP backend. G_VFS_ERROR_RETRY error handling was probably lost as a consequence of GDBus port by commit 622a5c0d. Let's retry the operation internally again if G_VFS_ERROR_RETRY is returned. https://gitlab.gnome.org/GNOME/gvfs/merge_requests/30
* gdaemonfile: Fix g_file_equal for different mount_prefixOndrej Holy2017-08-211-2/+6
| | | | | | | | | | g_daemon_file_equal() always return FALSE for files with different mount_prefix even though the files can be equal. It happen when comparing two files from different origins, e.g. g_mount_get_root() and g_file_new_for_uri(). Let's do the same which is done in _prefix_matches and _get_relative_path in order to fix this issue. https://bugzilla.gnome.org/show_bug.cgi?id=786217
* gdaemonfile: Fix relative path handlingOndrej Holy2017-08-211-53/+15
| | | | | | | | | | | | | | | | | | g_daemon_file_get_relative_path() fails for files with different mount_prefix and always return NULL. It happen when comparing two files from different origins, e.g. g_mount_get_root() and g_file_new_for_uri(). On the other hand, g_daemon_file_prefix_matches() can succeed in cases, where paths don't have the same prefixes, because it just compares mount_prefix of a parent with a path of a descendant, but a path of the parent is ignored. The code concatenates mount_prefix with a path, so the comparison never succeeds if mount_prefix is set, because mount_prefix is already part of the path in GDaemonFile. Let's ignore mount_prefix when comparing and always compare the paths, so we can significantly simplify the code. https://bugzilla.gnome.org/show_bug.cgi?id=786217
* client: Fix crash when calculating a relative pathMichael Terry2017-08-211-1/+1
| | | | | | Fix an if condition that resulted in trying to strdup(0x1). https://bugzilla.gnome.org/show_bug.cgi?id=786217
* client: Do not leak GDBusConnection referenceOndrej Holy2017-02-071-0/+1
| | | | | | | | | async_construct_proxy() calls g_object_ref() on connection, because the connection is unrefed by async_call_finish(). The returned connection might be NULL in some cases and g_bus_get() is called instead. However, g_bus_get_finish() is "transfer full" and thus one reference is leaked. https://bugzilla.gnome.org/show_bug.cgi?id=747412
* client: Do not modify caller's errorsOndrej Holy2017-01-241-2/+0
| | | | | | | Caller's errors are modified by g_dbus_error_strip_remote_error. Strip the dbus error in the caller directly. https://bugzilla.gnome.org/show_bug.cgi?id=747412
* client: Port GDaemonFile to GTaskOndrej Holy2017-01-241-640/+429
| | | | | | | | GSimpleAsyncResult is deprecated in favour of GTask and should be replaced. Based on patch from Dan Winship. https://bugzilla.gnome.org/show_bug.cgi?id=747412
* gdaemonfile: Pass GFileCreateFlags in write operationsOndrej Holy2016-12-121-0/+1
| | | | | | | | Flags are not passed in write operations on the client side currently, so the daemons always use G_FILE_CREATE_NONE when writting. Pass the flags in to fix this regression... https://bugzilla.gnome.org/show_bug.cgi?id=747412
* gdaemonfile: Remove dead codeOndrej Holy2016-12-121-5/+0
| | | | | | The uri variable is just set, but never used. https://bugzilla.gnome.org/show_bug.cgi?id=747412
* Use Unicode in translatable stringsPiotr Drąg2016-10-031-6/+6
| | | | | | See https://developer.gnome.org/hig/stable/typography.html https://bugzilla.gnome.org/show_bug.cgi?id=772219
* gdaemonfile: fix typo from last commitCarlos Soriano2015-08-181-1/+1
| | | | ugh sorry
* gdaemonfile: check for the correct cancellableCarlos Soriano2015-08-181-1/+1
| | | | | | | | | | We were checking for the newly created data cancellable, which is wrong. That was causing that mounting encloused volumes were not cancellable at all. Check for the actual GCancellable parameter to fix it. https://bugzilla.gnome.org/show_bug.cgi?id=753735
* metadata: Get tree from udev via dbusOndrej Holy2015-06-011-3/+8
| | | | | | | | | | | | We don't want to have dependency on udev in client part of gvfs due to app sandboxing. Thus move the code into the metadata daemon and get tree name via dbus. Common code to get metadata proxy has to be moved in metatree code. Mentioned changes caused that unistd.h is also included in meta-get-tree.c and cause symbol redeclaration error. Variable "pause" has to be renamed to avoid this conflict.
* client: Always set path[12]_out in create_proxy_for_file2Ross Lagerwall2015-05-201-7/+7
| | | | | | | | | | | | | d59e6873086f ("Fix 'path[12]_out' leak in file_transfer()") assumed that path[12]_out were always set by create_proxy_for_file2 but this is not always the case. Fix it so that create_proxy_for_file2 always sets path[12]_out. To reproduce the bug: $ gvfs-copy --progress smb://host/unmounted/a smb://host/unmounted/b Segmentation fault (core dumped) https://bugzilla.gnome.org/show_bug.cgi?id=749462
* Don't return NULL from g_daemon_file_query_writable_namespaces()Christophe Fergeau2015-04-101-1/+4
| | | | | | | | | Since commit b358ca "Make sure metadata is always returned by query_writable_namespaces()", query_writable_namespaces() is expected to return non-NULL values. There is one error case where it's not currently doing that. https://bugzilla.gnome.org/show_bug.cgi?id=747362
* Rework code flow in g_daemon_file_query_writable_namespaces()Christophe Fergeau2015-04-101-15/+11
| | | | | | | This makes the common (non-error) case more linear, and thus a bit more readable. This is in preparation for the next commits. https://bugzilla.gnome.org/show_bug.cgi?id=747362
* Return proper type from g_daemon_file_monitor_{dir,file}Christophe Fergeau2015-04-101-2/+2
| | | | | | | These functions return pointers, so it's better to return NULL rather than FALSE. https://bugzilla.gnome.org/show_bug.cgi?id=747360
* Fix 'path[12]_out' leak in file_transfer()Christophe Fergeau2015-04-101-0/+2
| | | | | | | | | file_transfer() calls create_proxy_for_file2() passing it 'path1_out' and 'path2_out' arguments. These return values are newly allocated strings, so they must be freed when no longer used. This fixes a leak reported by valgrind. https://bugzilla.gnome.org/show_bug.cgi?id=747361
* Always set 'path2_out' value in create_proxy_for_file2Christophe Fergeau2015-04-101-2/+7
| | | | | | | | | | | create_proxy_for_file2() will only set the *path2_out return value if a mount info was found for the 'file2' argument. However, as this return value must be freed, it's much better to set 'path2_out' to NULL rather than leave it unset. This way the caller can call g_free() on the returned value without having to set 'path2_out' to NULL before calling create_proxy_for_file2. https://bugzilla.gnome.org/show_bug.cgi?id=747361
* metadata: don't crash if meta_tree_init failsOndrej Holy2015-01-061-5/+17
| | | | | | | | | | It can fail when e.g. database file is corrupted or doesn't have correct permissions. This patch also adds warnings to be possible determine reason why initialization failed. It is based on patches from Matthew W. S. Bell and Ross Lagerwall. https://bugzilla.gnome.org/show_bug.cgi?id=598561
* client: Use the correct serial with file transfer cancellationRoss Lagerwall2014-11-181-2/+12
| | | | | | | | | When using Copy, Move, Push and Pull with progress callbacks, the progress callbacks increment the connection serial, so retrieve the serial immediately after the dbus method call so that the correct serial is used for cancellation. https://bugzilla.gnome.org/show_bug.cgi?id=720058
* client: Replace deprecated g_memmoveRoss Lagerwall2014-11-041-7/+1
| | | | | | Replace a hand-rolled partial string duplication with g_strndup. https://bugzilla.gnome.org/show_bug.cgi?id=739233
* client: Fix up error handling in find_enclosing_mountRoss Lagerwall2014-11-041-7/+6
| | | | | | | | | | 2a0dc68c7eeb ("client: Remove inconsistencies between async and sync variants") introduced a regression which causes find_enclosing_mount to segfault if a non-NULL GError** is passed in. Fix this. Also, only call g_dbus_error_strip_remote_error () on GErrors that have come from dbus. https://bugzilla.gnome.org/show_bug.cgi?id=739075
* client: Remove inconsistencies between async and sync variantsDebarshi Ray2014-10-291-1/+11
| | | | | | | The async implementation of find_enclosing_mount does not assume that there is a GMountInfo when no error has occurred. https://bugzilla.gnome.org/show_bug.cgi?id=739075
* client: Always set an error if we don't have a mountDebarshi Ray2014-10-291-0/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=739075
* client: Don't guard against g_object_new returning NULLDebarshi Ray2014-10-241-8/+3
| | | | | | | | | | The call to g_daemon_mount_new is a call to g_object_new like any other. There is no point in checking if g_object_new failed to create an object, because it will always succeed unless we have run out of virtual address space and in that case the program will be aborted anyway. https://bugzilla.gnome.org/show_bug.cgi?id=739075
* client: Check for G_FILE_COPY_NO_FALLBACK_FOR_MOVE when push/pullingRoss Lagerwall2014-10-171-0/+8
| | | | | | | Fail if G_FILE_COPY_NO_FALLBACK_FOR_MOVE is specified and either a pull or a push is going to be executed. https://bugzilla.gnome.org/show_bug.cgi?id=737510
* client: Return NULL if set_display_name() failsRoss Lagerwall2014-04-111-0/+2
| | | | | | | | | | | | | Return NULL as per the documentation rather than returning the original file. This prevents errors like the following, where "Permission Denied" should be displayed: $ gvfs-rename smb://localhost/tmp/cat dog Rename successful. New uri: smb://localhost/tmp/cat (gvfs-rename:1385): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed https://bugzilla.gnome.org/show_bug.cgi?id=727007
* Implement truncate support for output streamsRoss Lagerwall2013-12-051-30/+36
| | | | | | | | | | | | | | | | | | | | | Backends receive a TRUNCATE message which contains a size parameter. Truncation is signaled with a TRUNCATED message (which contains no other useful information). In more detail: Add a new dbus method, OpenForWriteFlags, which has a flags parameter to implement can_seek and can_truncate. These flags are used in GDaemonFileOutputStream. Compatability with old clients is maintained. Implement the can_truncate and truncate_fn GDaemonFileOutputStream methods. Add two new message types to the daemon socket protocol: G_VFS_DAEMON_SOCKET_PROTOCOL_REQUEST_TRUNCATE G_VFS_DAEMON_SOCKET_PROTOCOL_REPLY_TRUNCATED Add a new job type, GVfsJobTruncate. Add two new methods to GVfsBackend which backend classes can implement: truncate and try_truncate https://bugzilla.gnome.org/show_bug.cgi?id=573837
* client: Fix SIGSEGV in fallback copyRoss Lagerwall2013-11-071-1/+1
| | | | | | | | If the daemon is killed during the fallback copy, it is possible that proxy is NULL which causes a segfault when unrefing it. Use g_clear_object() instead. https://bugzilla.gnome.org/show_bug.cgi?id=711454
* Don't crash if mount_operation is given as NULLRoss Lagerwall2013-10-311-5/+10
| | | | | | | Check for NULL before using the mount_operation given to any of GDaemonFile's methods to prevent a crash due to refing NULL. https://bugzilla.gnome.org/show_bug.cgi?id=710995
* gdbus: fix compilation warningOndrej Holy2013-09-261-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=591228
* client: Remove unused code for dbus vfs filtersAlexander Larsson2013-09-261-3/+0
| | | | | | This code is not used anymore https://bugzilla.gnome.org/show_bug.cgi?id=708744
* GDaemonFileEnumerator: Only listen to messages one connectionAlexander Larsson2013-09-261-5/+6
| | | | | | | | There is no need to listen to messages on other connections than the one we sent the request on. In fact, doing so is bad as it can cause locking issues as per bug 708721. https://bugzilla.gnome.org/show_bug.cgi?id=708744
* GDaemonFile: fix relative path handling to account for mount_prefixGiovanni Campagna2013-06-131-16/+69
| | | | | | | | | | | | If two files have two different origins (say, one from g_mount_get_root() and one from g_file_new_for_uri()), the mount_spec they use could expose a different mount_prefix, even if the represent the same URI and network object. This in particular fixes the handling of shadow mounts for dav (which rewrites the mount_spec during mount to find the right prefix) https://bugzilla.gnome.org/show_bug.cgi?id=696279
* client: Set default timeout to infinite for all GDaemonFile methodsTomas Bzatek2012-12-031-0/+7
| | | | | | | Certain operations may take a lot of time to complete, don't timeout on that. Use cancellable if you need to control the flow. https://bugzilla.gnome.org/show_bug.cgi?id=687534
* gdbus: Remove debug printsTomas Bzatek2012-07-311-135/+0
|
* gdbus: Don't use NULL values on error with fd passingTomas Bzatek2012-07-311-15/+11
| | | | | Found out that if the remote call fails, some variables are left uninitialized and causes assertion failures while we don't need them.
* gdbus: Fix leaks of GSimpleAsyncResultTomas Bzatek2012-07-311-0/+2
|
* gdbus: Strip unknown GError quark stringsTomas Bzatek2012-07-311-43/+52
| | | | | | This hopefully covers all public methods. Seems like this fixes several memleaks as well.
* gdbus: Use g_clear_error() where appropriateTomas Bzatek2012-07-311-4/+3
|
* gdbus: Use g_clear_object() where appropriateTomas Bzatek2012-07-311-57/+29
|
* gdbus: Construct proxies without connecting signals and propertiesTomas Bzatek2012-07-311-1/+1
| | | | | Use G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS and G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flags where applicable.
* gdbus: Use G_VARIANT_TYPE_HANDLE for fd_id argumentsTomas Bzatek2012-07-311-4/+20
|