Bug 366795

Summary: Paste action disabled when copying a local file to smb:// or mtp://
Product: [Frameworks and Libraries] kio-extras Reporter: Vadym Krevs <vkrevs>
Component: defaultAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: major CC: abderrahman.najjar, albertvaka, blargle.ragequit, bugs, elvis.angelaccio, emailmeat, faure, germano.massullo, ibelkov, johan.claudebreuninger, kdelibs-bugs, null, richard.llom, simonandric5, stuartksmith, vlaomao
Priority: NOR    
Version: 5.7.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Possible fix for mtp://

Description Vadym Krevs 2016-08-15 17:29:16 UTC
Regression - "Paste one file"/Ctrl-V disabled when copying a local file to an smb share.

Using:
openSUSE Leap 42.1 with latest KDE rpms from OBS

Dolphin 16.04.3
KDE Frameworks 5.25.0
Qt 5.7.0 (built against 5.7.0)
The xcb windowing system

rpm -qa | egrep "plasma|frameworks" |sort
plasma-framework-5.25.0-134.1.x86_64
plasma-framework-components-5.25.0-134.1.x86_64
plasma-framework-lang-5.25.0-134.1.noarch
plasma-framework-private-5.25.0-134.1.x86_64
plasma-nm5-5.7.3-122.1.x86_64
plasma-nm5-lang-5.7.3-122.1.noarch
plasma-nm5-openconnect-5.7.3-122.1.x86_64
plasma-nm5-openvpn-5.7.3-122.1.x86_64
plasma-nm5-pptp-5.7.3-122.1.x86_64
plasma-nm5-vpnc-5.7.3-122.1.x86_64
plasma-theme-aya-15.08.3-1.6.noarch
plasma-theme-oxygen-16.04.3-1.7.x86_64
plasma5-addons-5.7.3-106.1.x86_64
plasma5-addons-lang-5.7.3-106.1.noarch
plasma5-desktop-5.7.3-184.1.x86_64
plasma5-desktop-branding-upstream-5.7.3-184.1.x86_64
plasma5-desktop-kimpanel-5.7.3-184.1.x86_64
plasma5-desktop-lang-5.7.3-184.1.noarch
plasma5-integration-plugin-5.7.3-18.1.x86_64
plasma5-pa-5.7.3-58.1.x86_64
plasma5-pa-lang-5.7.3-58.1.noarch
plasma5-pk-updates-0.2-18.1.x86_64
plasma5-pk-updates-lang-0.2-18.1.noarch
plasma5-workspace-5.7.3-238.1.x86_64
plasma5-workspace-branding-upstream-5.7.3-238.1.x86_64
plasma5-workspace-debuginfo-5.7.3-238.1.x86_64
plasma5-workspace-lang-5.7.3-238.1.noarch
plasma5-workspace-libs-5.7.3-238.1.x86_64

rpm -q dolphin
dolphin-16.04.3-51.3.x86_64


Reproducible: Always

Steps to Reproduce:
1. Add an SMB share to "Places" in Dolphin.
2. Select any local file in HOME, right-click and select Copy or Cut.
3. Click on the SMB share in "Places" - its contents are displayed
4. Right-click  and attempt to paste the file selected in  step 2 into the share. 
5. The "Paste one file" menu is disabled. Ctrl-V also does not work.
 This is a regression as compared to the previous plasma/frameworks/dolphin version

Actual Results:  
5. The "Paste one file" menu is disabled. Ctrl-V also does not work.

Expected Results:  
5. The "Paste one file" menu is not disabled. Ctrl-V  does work.
Comment 1 Vadym Krevs 2016-08-21 19:30:48 UTC
Very similar issue: https://bugs.kde.org/show_bug.cgi?id=367624
Comment 2 Elvis Angelaccio 2016-08-24 18:58:43 UTC
Confirming and moving to KIO, this is a regression in 5.25
Comment 3 Elvis Angelaccio 2016-08-24 18:59:27 UTC
*** Bug 367624 has been marked as a duplicate of this bug. ***
Comment 5 Elvis Angelaccio 2016-08-24 21:45:23 UTC
(In reply to Elvis Angelaccio from comment #4)
> git bisect points to
> https://quickgit.kde.org/?p=kio.
> git&a=commitdiff&h=732d9782b10f85aef2d80600e73bc88ca24abb4a

Actually this commit looks fine (and is unit-tested), it just exposes that Dolphin calls KIO::pasteActionText() with a null KFileItem destination.

Moving back to Dolphin for now...
David, any idea what's going on here? This doesn't happen with every slave: for example fish:// and ftp:// are not affected...
Comment 6 David Faure 2016-08-25 07:20:34 UTC
Ah, I think this happens when the slave doesn't emit a UDSItem for "." in its directory listing.
This leads to a null root item, which leads (now) to the action being disabled.

I would say that's a bug in the slave, it's supposed to emit a UDSItem for ".".
Comment 7 Elvis Angelaccio 2016-08-25 10:52:33 UTC
(In reply to David Faure from comment #6)
> Ah, I think this happens when the slave doesn't emit a UDSItem for "." in
> its directory listing.
> This leads to a null root item, which leads (now) to the action being
> disabled.
> 
> I would say that's a bug in the slave, it's supposed to emit a UDSItem for
> ".".

Yes I can confirm (tested by patching kio-gdrive, also affected). Thus I'm moving this to kio-extras (where mtp and samba slaves live)
Comment 8 Elvis Angelaccio 2016-08-25 11:22:13 UTC
Git commit 6b9991bbb3b327fea01735a4d844df97c3435bd8 by Elvis Angelaccio.
Committed on 25/08/2016 at 11:18.
Pushed by elvisangelaccio into branch 'master'.

Fix paste action with KIO >= 5.25

After 5.25, KIO::pasteActionText() (called by Dolphin) no longer allows null
KFileItem destinations, so we need to explicitly create a writable UDSEntry for
"."

M  +9    -1    src/kio_gdrive.cpp

http://commits.kde.org/kio-gdrive/6b9991bbb3b327fea01735a4d844df97c3435bd8
Comment 9 Elvis Angelaccio 2016-08-26 17:53:05 UTC
sftp:// is also affected.
Comment 10 Elvis Angelaccio 2016-08-26 21:16:19 UTC
(In reply to Elvis Angelaccio from comment #9)
> sftp:// is also affected.

Actually sftp is fine. I thought that kdeconnect was using sftp://, but instead it has its own kio slave, so I filed another report for it: https://bugs.kde.org/show_bug.cgi?id=367878
Comment 11 Albert Vaca Cintora 2016-08-28 09:16:34 UTC
KDE Connect uses a locally mounted sshfs, and still Paste there appears disabled from Dolphin (even though drag'n drop works :/). The bug can't be in the KIOslave as in this case there is none involved.
Comment 12 Elvis Angelaccio 2016-08-28 09:55:53 UTC
Created attachment 100815 [details]
Possible fix for mtp://

This patch seems to fix mtp:// for me. Please test.
Comment 13 Elvis Angelaccio 2016-08-29 13:37:14 UTC
https://git.reviewboard.kde.org/r/128796/ is an attempt to provide a generic fallback. Please test :)
Comment 14 Vadym Krevs 2016-08-29 17:22:13 UTC
(In reply to Elvis Angelaccio from comment #13)
> https://git.reviewboard.kde.org/r/128796/ is an attempt to provide a generic
> fallback. Please test :)

I've backported your fix to kio-5.25.0-142.1.src.rpm, and tested it. It works for the smb io slave and fixes the issue that was originally reported. 

But there seems to be a corner case where it doesn't.  The menu entry is still disabled the very first time one tries it. If one closes and restarts Dolphin (or if you have 2 smb shares in Places, and you repeat steps 3-5 on against the second sbm share), then it starts working.
Comment 15 Elvis Angelaccio 2016-09-02 15:58:50 UTC
Git commit fcbfb61a5304554483ceb49d8728d0e947a4af9e by Elvis Angelaccio.
Committed on 02/09/2016 at 15:55.
Pushed by elvisangelaccio into branch 'master'.

Provide a fallback if slaves don't list the . entry

If a slave doesn't (or can't) emit an UDSEntry for the "." entry, we do it in the
SlaveBase base class.
REVIEW: 128796

M  +23   -0    src/core/slavebase.cpp

http://commits.kde.org/kio/fcbfb61a5304554483ceb49d8728d0e947a4af9e
Comment 16 Elvis Angelaccio 2016-09-02 16:00:58 UTC
(In reply to Vadym Krevs from comment #14)
> (In reply to Elvis Angelaccio from comment #13)
> > https://git.reviewboard.kde.org/r/128796/ is an attempt to provide a generic
> > fallback. Please test :)
> 
> I've backported your fix to kio-5.25.0-142.1.src.rpm, and tested it. It
> works for the smb io slave and fixes the issue that was originally reported. 
> 
> But there seems to be a corner case where it doesn't.  The menu entry is
> still disabled the very first time one tries it. If one closes and restarts
> Dolphin (or if you have 2 smb shares in Places, and you repeat steps 3-5 on
> against the second sbm share), then it starts working.

Unfortunately I don't have samba shares for testing. But please open another report, it might be a different issue.
Comment 17 Elvis Angelaccio 2016-09-03 11:28:06 UTC
*** Bug 368010 has been marked as a duplicate of this bug. ***
Comment 18 Elvis Angelaccio 2016-09-03 11:30:52 UTC
*** Bug 368099 has been marked as a duplicate of this bug. ***
Comment 19 Elvis Angelaccio 2016-09-03 11:32:50 UTC
*** Bug 368058 has been marked as a duplicate of this bug. ***
Comment 20 Emmanuel Pescosta 2016-09-04 15:47:27 UTC
*** Bug 368237 has been marked as a duplicate of this bug. ***
Comment 21 Vadym Krevs 2016-09-06 06:31:24 UTC
(In reply to Elvis Angelaccio from comment #16)
> (In reply to Vadym Krevs from comment #14)
> > (In reply to Elvis Angelaccio from comment #13)
> > > https://git.reviewboard.kde.org/r/128796/ is an attempt to provide a generic
> > > fallback. Please test :)
> > 
> > I've backported your fix to kio-5.25.0-142.1.src.rpm, and tested it. It
> > works for the smb io slave and fixes the issue that was originally reported. 
> > 
> > But there seems to be a corner case where it doesn't.  The menu entry is
> > still disabled the very first time one tries it. If one closes and restarts
> > Dolphin (or if you have 2 smb shares in Places, and you repeat steps 3-5 on
> > against the second sbm share), then it starts working.
> 
> Unfortunately I don't have samba shares for testing. But please open another
> report, it might be a different issue.

So installing a local samba server on your linux pc with a single exported share is not an option?
Comment 22 Elvis Angelaccio 2016-09-12 19:10:21 UTC
(In reply to Vadym Krevs from comment #21)
> (In reply to Elvis Angelaccio from comment #16)
> > (In reply to Vadym Krevs from comment #14)
> > > (In reply to Elvis Angelaccio from comment #13)
> > > > https://git.reviewboard.kde.org/r/128796/ is an attempt to provide a generic
> > > > fallback. Please test :)
> > > 
> > > I've backported your fix to kio-5.25.0-142.1.src.rpm, and tested it. It
> > > works for the smb io slave and fixes the issue that was originally reported. 
> > > 
> > > But there seems to be a corner case where it doesn't.  The menu entry is
> > > still disabled the very first time one tries it. If one closes and restarts
> > > Dolphin (or if you have 2 smb shares in Places, and you repeat steps 3-5 on
> > > against the second sbm share), then it starts working.
> > 
> > Unfortunately I don't have samba shares for testing. But please open another
> > report, it might be a different issue.
> 
> So installing a local samba server on your linux pc with a single exported
> share is not an option?

No, I don't have time right now, sorry :(
Comment 23 vlaomao 2016-10-30 20:07:04 UTC
Hello! I have installed:

kde-apps/kdebase-kioslaves-16.04.3-r1
kde-apps/kioclient-16.04.3
kde-apps/kio-extras-16.08.2
kde-apps/plasma-apps-16.08.2
kde-apps/plasma-runtime-16.04.3
kde-frameworks/kio-5.27.0
kde-frameworks/plasma-5.27.0
kde-plasma/bluedevil-5.8.2
kde-plasma/breeze-5.8.2
kde-plasma/kactivitymanagerd-5.8.2
kde-plasma/kde-cli-tools-5.8.2
kde-plasma/kdecoration-5.8.2
kde-plasma/kdeplasma-addons-5.8.2
kde-plasma/kgamma-5.8.2
kde-plasma/khotkeys-5.8.2
kde-plasma/kinfocenter-5.8.2
kde-plasma/kmenuedit-5.8.2
kde-plasma/kscreen-5.8.2
kde-plasma/kscreenlocker-5.8.2
kde-plasma/ksshaskpass-5.8.2
kde-plasma/ksysguard-5.8.2
kde-plasma/kwallet-pam-5.8.2
kde-plasma/kwayland-integration-5.8.2
kde-plasma/kwin-5.8.2
kde-plasma/kwrited-5.8.2
kde-plasma/libkscreen-5.8.2
kde-plasma/libksysguard-5.8.2
kde-plasma/milou-5.8.2
kde-plasma/oxygen-5.8.2
kde-plasma/oxygen-fonts-5.4.3
kde-plasma/plasma-desktop-5.8.2
kde-plasma/plasma-integration-5.8.2
kde-plasma/plasma-meta-5.8.2
kde-plasma/plasma-nm-5.8.2
kde-plasma/plasma-workspace-5.8.2
kde-plasma/plasma-workspace-wallpapers-5.8.2
kde-plasma/polkit-kde-agent-5.8.2
kde-plasma/powerdevil-5.8.2
kde-plasma/sddm-kcm-5.8.2
kde-plasma/systemsettings-5.8.2
kde-plasma/user-manager-5.8.2


I unable to write files to root of internal MTP memory (dolphin show permission denied message) my Nexus5, BUT i might write files to subfolders, which have one or more files inside it (drag and drop, CTRL+V, right-click worked)
Comment 24 Elvis Angelaccio 2016-10-30 20:11:07 UTC
@vlaomao: you need kio 5.26 or later
Comment 25 vlaomao 2016-10-31 04:41:56 UTC
(In reply to Elvis Angelaccio from comment #24)
> @vlaomao: you need kio 5.26 or later

I have installed kde-frameworks/kio-5.27.0
Comment 26 Elvis Angelaccio 2017-03-05 21:26:18 UTC
Git commit 6a828b172937a17f56d90a23daf2c7ed77d8ebc7 by Elvis Angelaccio.
Committed on 05/03/2017 at 21:26.
Pushed by elvisangelaccio into branch 'Applications/16.12'.

kio_mtp: add write permissions to root storage folder

Otherwise it's impossible to paste files there.

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

M  +1    -1    mtp/kio_mtp_helpers.cpp

https://commits.kde.org/kio-extras/6a828b172937a17f56d90a23daf2c7ed77d8ebc7
Comment 27 Elvis Angelaccio 2017-03-05 21:27:23 UTC
(In reply to vlaomao from comment #25)
> (In reply to Elvis Angelaccio from comment #24)
> > @vlaomao: you need kio 5.26 or later
> 
> I have installed kde-frameworks/kio-5.27.0

Should be fixed in the upcoming kio-extras 16.12.3
Comment 28 johan.claudebreuninger 2017-05-22 18:06:24 UTC
Problem still exists in  kio-extras 17.04.1-1
Comment 29 David Faure 2017-06-05 09:58:45 UTC
... with which protocol exactly?
Comment 30 johan.claudebreuninger 2017-06-05 11:16:20 UTC
The protocol is MTP.

With the an up to date Arch Linux install.
Comment 31 Vadym Krevs 2017-06-05 15:11:30 UTC
(In reply to David Faure from comment #29)
> ... with which protocol exactly?

smb for me. 

1. Add an SMB share to "Places" in Dolphin.
2. Select any local file in HOME, right-click and select Copy or Cut.
3. Click on the SMB share in "Places" - its contents are displayed
4. Create a new folder in the share.
5. Right-click  and attempt to paste the file selected in  step 2 into the share. 
6. The "Paste one file" menu is disabled. Ctrl-V also does not work.

Interestingly, if I create a new subfolder in the new folder, and perform step 5 again - now the paste action is enabled.
Comment 32 vlaomao 2017-06-06 19:19:36 UTC
For me (MTP protocol with Nexus 5), action "paste" is disabled only when folder have no files. I have installed kio-extras 17.0.4 and kio 5.34.0-r2
Comment 33 Richard Llom 2017-06-16 18:27:54 UTC
I also have the problem with SMB share in dolphin and kio-extras version 17.04; kio version 5.34.

Drag & drop works.

Maybe it is a distro/packaging problem?
Can we provide additional input?
Comment 34 Richard Llom 2017-06-16 18:30:33 UTC
PS:
I just noted that the problem only exist in EMPTY folders!

Once there is a file or sub-folder in the direcotry, paste is enabled/working.
HTH!
Comment 35 Germano Massullo 2017-06-16 18:58:56 UTC
Could it be the same problem of https://bugs.kde.org/show_bug.cgi?id=381238 ?
Comment 36 Elvis Angelaccio 2017-07-06 09:48:50 UTC
I can reproduce the "cannot paste from clipboard to empty folders", let's track it here: https://bugs.kde.org/show_bug.cgi?id=382046
Comment 37 Erica J. 2017-10-16 04:10:50 UTC
I am now having this problem in Arch Linux with kio-extras 17.08.2-1 and dolphin 17.08.2-1.
Comment 38 Elvis Angelaccio 2017-10-16 17:18:43 UTC
(In reply to Erica Clawson from comment #37)
> I am now having this problem in Arch Linux with kio-extras 17.08.2-1 and
> dolphin 17.08.2-1.

Are you sure you are having it with mtp:// or smb:// URLs?
Comment 39 Erica J. 2017-10-18 05:29:23 UTC
I am sure.  The problem appears in empty subfolders of "mtp:/Moto G (5) Plus/Internal shared storage/".
Comment 40 Martin van Es 2018-07-19 18:39:30 UTC
I can confirm the mtp problem still persists in Kubuntu 18.04, using kio 5.47.0a-0ubuntu1~ubuntu18.04~ppa3. ctrl-c/ctrl-v fails, but I can drag'n'drop the files to the mtp device.