https://bugs.kde.org/show_bug.cgi?id=529174

            Bug ID: 529174
           Summary: FTP directory listings show root folder after network
                    reconnect
    Classification: Frameworks and Libraries
           Product: frameworks-kio
      Version First 6.32.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: FTP
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

DESCRIPTION
When kio_ftp disconnects from a FTP server without quitting, refreshing a
directory listing shows the root contents rather than actual folder.

STEPS TO REPRODUCE
1. Open a FTP subfolder.
2. Disconnect and reconnect to the FTP server (eg. by turning off Wi-Fi,
unplugging Ethernet, turning off game console).
3. Press F5 in Dolphin.

OBSERVED RESULT
Lists content of /.

I've performed some debug logging using 
{ FtpInternal::listDir(QUrl("ftp://192.168.0.63:5000/warmboot_mariko";))
    { FtpInternal::ftpOpenConnection()
    } m_bLoggedOn
    hunting for path "/warmboot_mariko"
    { FtpInternal::ftpFolder
        want "/warmboot_mariko" has "/warmboot_mariko"
    } noop
    { FtpInternal::ftpOpenCommand(MLSD)
        want I has I
        { FtpInternal::ftpSendCmd(PASV)
                >
            Cannot parse valid code from line
            Was not able to communicate with  "192.168.0.63" Attempting to
re-establish connection.
            m_bLoggedOn= true  m_bBusy= false
            { FtpInternal::ftpSendCmd(QUIT)
            } maxretries < 1
            QUIT returned error:  0
            { FtpInternal::ftpOpenConnection()
                ...
                Searching for pwd
                { FtpInternal::ftpSendCmd(PWD)
                    >  257 "/"
                } true
                Initial path set to:  "/"
            } Result::pass
            Logged back in, re-issuing command
        } recurse...
        { FtpInternal::ftpSendCmd(PASV)
            >  227 Entering Passive Mode (192,168,0,63,227,78)
        } true
        { FtpInternal::ftpSendCmd(MLSD)
            >  150 Ready
        } true
        connected with remote.
    } Result::pass
    Starting of list was ok


The problem is that in FtpInternal::listDir(), ftpOpenCommand(MLSD) ->
ftpSendCmd(PASV/MLSD) transparently reconnects to the server ("Logged back in,
re-issuing command"), even when the connection state has been lost. Whenever
the control connection fails, it's necessary to pass an error code all the way
up to the top-level FtpInternal function (eg. listDir()) to retry, or to
restore connection state (eg. cwd, server-side passive sockets) before
returning control to the top-level. I suspect that it's *impossible* to restore
a PASV, and in general the latter is a fraught approach much like Qt dialog
nested event loops.

This issue also involves the same codepaths as reconnection crashes like Bug
503928 and Bug 512354, which I think were enabled by the FTP functions
attempting to "transparently" reconnect to the server and losing error codes
along the way.

EXPECTED RESULT
Lists content of current folder.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.8.3
KDE Frameworks Version: 6.32.0
Qt Version: 6.12.0
Kernel Version: 7.3.4-arch1-2 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-8559U CPU @ 2.70GHz
Memory: 16 GiB of RAM (15.5 GiB usable)
Graphics Processor: Intel® Iris® Plus Graphics 655
Manufacturer: Intel(R) Client Systems
Product Name: NUC8i7BEH
System Version: J72992-303

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to