Closed lannashelton closed 1 month ago
Wow, I've tried and it is valid.
Issue exists with VirtFS and SAF, so bug location is somewhere in SAF. Now I'm thinking whether one of my changes caused this.
log (using VirtFS, moving from /saf/Documents/Test (1).txt to /saf/Documents/COVID/Test (1).txt), everything seems to be legit, but in fact it tries to rename the file to itself:
2024.08.13 11:32 DEBUG org.apache.sshd.server.channel.ChannelSession Received SSH_MSG_CHANNEL_DATA on channel ChannelSession[id=0, recipient=256]
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession Received channel data: 00 00 00 49 12 00 00 50 12 00 00 00 1b 2f 73 61 66 2f 44 6f 63 75 6d 65 6e...
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.PipeDataReceiver IN: 00 00 00 49 12 00 00 50 12 00 00 00 1b 2f 73 61 66 2f 44 6f 63 75 6d 65 6e 74 73 2f 54 45 53...
2024.08.13 11:32 DEBUG org.apache.sshd.server.sftp.SftpSubsystem Received SSH_FXP_RENAME (oldPath=/saf/Documents/TEST (1).txt, newPath=/saf/Documents/COVID/TEST (...
2024.08.13 11:32 DEBUG org.primftpd.filesystem.VirtualSshFileSystemView getFile '/saf/Documents/TEST (1).txt', absolute: '/saf/Documents/TEST (1).txt'
2024.08.13 11:32 DEBUG org.primftpd.filesystem.VirtualSshFileSystemView Using SAF '/Documents/TEST (1).txt' for '/saf/Documents/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(/Documents/TEST (1).txt)
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(abs: /Documents/TEST (1).txt)
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): normalized path parts: '[Documents, TEST (1).txt]'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): current docFile '80AB-022A', current part: 'Documents'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile new SafFile() with documentFile, parent '80AB-022A' and absPath '/Documents/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): current docFile 'Documents', current part: 'TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile new SafFile() with documentFile, parent 'Documents' and absPath '/Documents/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getName()
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getLastModified() -> 1597432476000
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getSize() -> 89
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] isReadable() -> true
2024.08.13 11:32 DEBUG org.primftpd.filesystem.VirtualSshFileSystemView getFile '/saf/Documents/COVID/TEST (1).txt', absolute: '/saf/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 DEBUG org.primftpd.filesystem.VirtualSshFileSystemView Using SAF '/Documents/COVID/TEST (1).txt' for '/saf/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(/Documents/COVID/TEST (1).txt)
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(abs: /Documents/COVID/TEST (1).txt)
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): normalized path parts: '[Documents, COVID, TEST (1).txt]'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): current docFile '80AB-022A', current part: 'Documents'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile new SafFile() with documentFile, parent '80AB-022A' and absPath '/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): current docFile 'Documents', current part: 'COVID'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile new SafFile() with documentFile, parent 'Documents' and absPath '/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFileSystemView getFile(): current docFile 'COVID', current part: 'TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile new SafFile() with name 'TEST (1).txt', parent 'COVID' and absPath '/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getName()
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getLastModified() -> 0
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getSize() -> 0
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] isReadable() -> false
2024.08.13 11:32 TRACE org.primftpd.filesystem.VirtualSshFile [TEST (1).txt] doesExist() -> true
2024.08.13 11:32 TRACE org.primftpd.filesystem.VirtualSshFile [TEST (1).txt] doesExist() -> false
2024.08.13 11:32 TRACE org.primftpd.filesystem.VirtualSshFile move()
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile move()
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getAbsolutePath() -> '/Documents/COVID/TEST (1).txt'
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] move(/Documents/COVID/TEST (1).txt)
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getAbsolutePath() -> '/Documents/TEST (1).txt'
2024.08.13 11:32 INFO org.primftpd.services.SshServerService posting ClientActionEvent: ClientActionEvent{storage=SAF, protocol=SFTP, timestamp=Tue Aug 13 11:...
2024.08.13 11:32 TRACE org.primftpd.filesystem.SafSshFile [TEST (1).txt] getName()
2024.08.13 11:32 DEBUG org.apache.sshd.server.sftp.SftpSubsystem Send SSH_FXP_STATUS (substatus=0, msg=)
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession OUT: 00
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession OUT: 00
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession OUT: 00
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession OUT: 11
2024.08.13 11:32 TRACE org.apache.sshd.server.channel.ChannelSession OUT: 65 00 00 50 12 00 00 00 00 00 00 00 00 00 00 00 00
2024.08.13 11:32 DEBUG org.apache.sshd.server.channel.ChannelSession Send SSH_MSG_CHANNEL_DATA on channel 0
2024.08.13 11:32 TRACE org.apache.sshd.server.session.ServerSession Sending packet #18: 5e 00 00 01 00 00 00 00 15 00 00 00 11 65 00 00 50 12 00 00 00 00 00 00 00 00...
Will likely be fixed in next release.
The root cause is that SAF's DocumentFile abstraction supports only renaming files in the same location.
Though the underlying DocumentsContract abstraction has a moveDocument() method, but DocumentsContract is used only by the ROSAF implementation in pFTPd, and that is read-only currently.
So the PR above will disable moving files on SAF.
We will also consider changes from the other related PRs, especially #376. Let's see how it turns out ...
I can transfer files into my SD card folder without issue. But when I try to move/cut-paste a file/folder in SD card, it reverts back and writes (1) at the end of the file name.