[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497065#comment-17497065 ] Sebb commented on NET-707: -- Thanks! So it looks like there is a single space between the end of the timestamp and the start of the filename. That should make it possible to allow for leading spaces in file names. > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496635#comment-17496635 ] Dmytro Sylaiev commented on NET-707: ftp> passive Passive mode on. ftp> ls 227 Entering Passive Mode (185,113,5,134,186,70). 125 List started. -rwxrwx--- 1 LIMMY 0 0 Feb 08 08:15 file -rw-r--r-- 1 LIMMY 0 0 Feb 08 08:34 a1.txt drwxrwx--- 2 LIMMY 0 8192 Feb 08 13:16 tempDir -rw-r--r-- 1 LIMMY 0 0 Feb 22 09:23 abc abc 250 List completed. > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496372#comment-17496372 ] Sebb commented on NET-707: -- Thanks! So what does FTP show for these files? > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496234#comment-17496234 ] Dmytro Sylaiev commented on NET-707: [~sebb] I got the AS400 env on pub400.com. It's not possible to create file with spaces with IBM i env, but when I connect to the same server using SSH it supports filename with spaces and with leading spaces as well. {noformat} ssh li...@pub400.com -p li...@pub400.com's password: Welcome to PUB400! $ ls ' a1.txt' file tempDir $ pwd /home/LIMMY $ uname -a OS400 WWW 4 7 00781B91 powerpc Os $ touch abc\ abc $ ls ' a1.txt' 'abc abc' file tempDir{noformat} > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470643#comment-17470643 ] Sebb commented on NET-707: -- OK, so the ftp server presumably does not support those commands. I've had a look at the PR, and whilst it may support your test case, I'm not sure it is sufficiently general. Also it appears to be more complicated than necessary. Does OS/400 support filenames which start with one or more spaces? Can you experiment to see what the output is in such cases? If there is always a fixed number of spaces after the *STMF column then it will be easy to change the RE accordingly. If the number varies, then it may be impossible to detect such cases. > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17470514#comment-17470514 ] Dmytro Sylaiev commented on NET-707: Hi [~sebb] Thank you for your idea, but mListDir returns an empty array on that server, and mListFile() always returns null (the result of sendCommand(FTPCmd.MLST, pathname) is 500). I submitted a small PR with a fix which works on my side and tests were also OK: https://github.com/apache/commons-net/pull/95/files > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17466150#comment-17466150 ] Sebb commented on NET-707: -- It would be better to use the following, if it is supported: https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html#mlistDir-- listFiles() uses a listing format that was designed for humans to read, and is subject to change. > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17466051#comment-17466051 ] Dmytro Sylaiev commented on NET-707: Hello [~ggregory] Any suggestions? P.S. I got information about server AS400 OS version: V7 R3 M0 and have empirical evidence that spaced are allowed on the OS level. Can we change the parser regex? > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17455322#comment-17455322 ] Dmytro Sylaiev commented on NET-707: Hi [~ggregory] the systemType value in FTPClient::createParser is OS/400 is the remote operating system. The TCP/IP version is "V6R1M0". Linux native bash ftp client works well with fileName with spaces: {noformat} ftp> passive Passive mode on. ftp> cd /home 250-NAMEFMT set to 1. 250 "/home" is current directory. ftp> ls 227 Entering Passive Mode (192,168,244,186,34,255). 125 List started. NOTMYUSER 29550 10/12/08 18:33:53 *STMF AUD_DET_081210_183341_A1_Fichier_demandeurs.pdf NOTMYUSER 13950 10/12/08 18:56:51 *STMF AUD MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt 250 List completed. ftp> syst 215 OS/400 is the remote operating system. The TCP/IP version is "V6R1M0".{noformat} > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (NET-707) FTPClient::listFiles() doesn't include files with spaces for AS400
[ https://issues.apache.org/jira/browse/NET-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17454828#comment-17454828 ] Gary D. Gregory commented on NET-707: - What version of OS/400 are you running. From my understanding a NAME cannot contain spaces: {quote}*NAME The qualifier is a character string that represents a name. The maximum length of the name is 256 bytes. The first character must be alphabetic or one of the special characters, $, @, or #. The remaining characters can be alphanumeric, a period, an underscore, or one of special characters, $, @, or #. The name can also be a string of characters starting and ending with double quotation marks (") or enclosed in parentheses. {quote} > FTPClient::listFiles() doesn't include files with spaces for AS400 > -- > > Key: NET-707 > URL: https://issues.apache.org/jira/browse/NET-707 > Project: Commons Net > Issue Type: Bug > Environment: AS400 ftp server >Reporter: Dmytro Sylaiev >Priority: Major > > For the FTP server on AS400 I got the different response size for > FTPClient::listFiles() and FTPClient::listNames() (first one doesn't include > file with spaces) > > TheOS400FTPEntryParser pattern is > {noformat} > private static final String REGEX = > "(\\S+)\\s+" // user > + "(?:(\\d+)\\s+)?" // size, empty for members > + "(?:(\\S+)\\s+(\\S+)\\s+)?" // date stuff, empty for members > + "(\\*STMF|\\*DIR|\\*FILE|\\*MEM)\\s+" // *STMF/*DIR/*FILE/*MEM > + "(?:(\\S+)\\s*)?"; // file name, missing, when CWD is a > *FILE{noformat} > and the server response for LIST command > {noformat} > MYUSER 3 06/12/21 18:31:29 *STMF file with space.txt {noformat} > doesn't match that regex. -- This message was sent by Atlassian Jira (v8.20.1#820001)