The following is a valid entry from a FreeBSD system:
crw-r----- 1 root kmem 0, 27 Jan 30 11:42 kmem
This causes a parse error, because the regular expression does not allow for the major and minor device numbers.
Description
The following is a valid entry from a FreeBSD system:
crw-r----- 1 root kmem 0, 27 Jan 30 11:42 kmem
This causes a parse error, because the regular expression does not allow for the major and minor device numbers.
We found the same issue on a Solaris server a while back, and resorted to a workaround of not showing the file (because we reckoned that users cannot do much with a character special device anyways).
The point is that Commons Net throws a parse exception, because it expects a single number ("size") where it finds the device numbers ("0, 27"). What we did is catch the exception and ignore the file. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=197105
A possible fix should be in UnixFTPEntryParser.java line 94, replace
+ "(\\d+) s+"
by
+ "(\\d+(?:,\\s*\\d+)?) s+"
This will result in a valid FTPFile with size=0 and valid raw listing attached. I do not think that it is worth changing the FTPFile API to have separate fields for the major and minor numbers.
Martin Oberhuber added a comment - 16/Mar/08 01:21 PM We found the same issue on a Solaris server a while back, and resorted to a workaround of not showing the file (because we reckoned that users cannot do much with a character special device anyways).
The point is that Commons Net throws a parse exception, because it expects a single number ("size") where it finds the device numbers ("0, 27"). What we did is catch the exception and ignore the file. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=197105
A possible fix should be in UnixFTPEntryParser.java line 94, replace
+ "(\\d+) s+"
by
+ "(\\d+(?:,\\s*\\d+)?) s+"
This will result in a valid FTPFile with size=0 and valid raw listing attached. I do not think that it is worth changing the FTPFile API to have separate fields for the major and minor numbers.
The point is that Commons Net throws a parse exception, because it expects a single number ("size") where it finds the device numbers ("0, 27"). What we did is catch the exception and ignore the file. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=197105
A possible fix should be in UnixFTPEntryParser.java line 94, replace
+ "(\\d+)
s+"
by
+ "(\\d+(?:,\\s*\\d+)?)
s+"
This will result in a valid FTPFile with size=0 and valid raw listing attached. I do not think that it is worth changing the FTPFile API to have separate fields for the major and minor numbers.