Bug 418443 - CopyJob should query free space from slave when URL is not local
Summary: CopyJob should query free space from slave when URL is not local
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: git master
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 409805 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-03-03 19:54 UTC by Patrick Silva
Modified: 2020-05-09 10:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.71


Attachments
message shown when the file transfer is interrupted (16.19 KB, image/png)
2020-03-03 19:54 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-03-03 19:54:18 UTC
Created attachment 126577 [details]
message shown when the file transfer is interrupted

SUMMARY
I tried to copy a big file to a samba share, file transfer was started and a few minutes later Dolphin shown an unhelpful message with "Retry" and "Cancel" buttons (see the attached screenshot). The file transfer was interrupted because no enough free space in destination.

STEPS TO REPRODUCE
1. try to copy amount of data greater than free space available in the file system of a samba share
2. 
3. 

OBSERVED RESULT
Dolphin starts file transfer and shows an error message when file system of destination is full.

EXPECTED RESULT
Dolphin should check if there is enough free space available in destination
before file transfer to be started. File transfer should only start if there is
enough free space avaiable.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1
Comment 1 Harald Sitter 2020-03-04 12:02:11 UTC
That is, I believe, a defect in KIO itself. CopyJob uses KDiskFreeSpaceInfo to determine if there is enough space but KDiskFreeSpaceInfo only looks at mounts. As such this isn't specific to smb but really any remote file system. What either copyjob or kfreediskspaceinfo should do is query the slave for free space info when the URL is non-local.

Easily reproduced with:

fallocate -L 50M foo
mkfs.ext4 foo
mount foo /mnt
chmod 777 /mnt/. -Rv
# share /mnt
# copy file > 50M
Comment 2 Harald Sitter 2020-03-04 13:58:01 UTC
*** Bug 409805 has been marked as a duplicate of this bug. ***
Comment 3 Kai Uwe Broulik 2020-03-06 07:39:25 UTC
There is FileSystemFreeSpaceJob which queries the slave.
Comment 4 Ahmad Samir 2020-05-09 10:55:07 UTC
Git commit 1cac602d9966f82a2e85440d74d9cc3ad014a1aa by Ahmad Samir.
Committed on 09/05/2020 at 10:55.
Pushed by ahmadsamir into branch 'master'.

[CopyJob] Check free space for remote urls before copying and other improvements

Summary:
Use KIO::FileSystemFreeSpaceJob to check free space for remote urls.

Thanks to sitter for pin-pointing the responsible code in the bug report,
and to kbroulik for pointing out the existence of KIO::FileSystemFreeSpaceJob.

Also use UDSEntry to check writability for both local and remote urls.

FIXED-IN: 5.71

Test Plan:
testtrash unit test fails (again...)

- Find/create a local partition with a small capacity, copying a file/dir
  that is bigger than the partition will show the error message as before
- Do the same for a remote url (I tested with sftp://), an error message
  about not having enough free space is shown

Reviewers: #frameworks, dfaure, meven, sitter

Reviewed By: dfaure

Subscribers: ngraham, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29485

M  +51   -35   src/core/copyjob.cpp

https://commits.kde.org/kio/1cac602d9966f82a2e85440d74d9cc3ad014a1aa