You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Martin Oberhuber (JIRA)" <ji...@apache.org> on 2008/03/16 14:22:24 UTC

[jira] Commented: (NET-201) UnixFTPEntryParser does not handle character/block special devices properly

    [ https://issues.apache.org/jira/browse/NET-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579189#action_12579189 ] 

Martin Oberhuber commented on NET-201:
--------------------------------------

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.

> UnixFTPEntryParser does not handle character/block special devices properly
> ---------------------------------------------------------------------------
>
>                 Key: NET-201
>                 URL: https://issues.apache.org/jira/browse/NET-201
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.