Repository navigation
Conversation
UnixFTPEntryParser mapped 'b' (block device) and 'c' (character device) listing entries to FTPFile.FILE_TYPE, so FTPFile#isFile() reported devices as regular files. They now map to FTPFile.UNKNOWN_TYPE, as agreed on the JIRA issue; the hard-link count is still not parsed for devices. A dedicated regression test covers block and character device entries. Signed-off-by: Inf1mum <vadim.lazuk@mail.ru>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
NET-200:
UnixFTPEntryParsermaps listing entries whose type character isb(block device) orc(character device) toFTPFile.FILE_TYPE, soFTPFile#isFile()reports device nodes as regular files. The code carries a// TODO change this if DEVICE_TYPE implementednote, and the JIRA thread agrees these entries should not be files.Changes
UnixFTPEntryParser.parseFTPEntry():bandcentries now map toFTPFile.UNKNOWN_TYPEinstead ofFTPFile.FILE_TYPE. As before, the hard-link count is not parsed for device entries (isDeviceflag kept), and name/permissions/timestamp parsing is unchanged.src/changes/changes.xml: added afixaction for 3.13.1.Tests
UnixFTPEntryParserTest#testNET200BlockAndCharacterDevicesAreNotFiles(new): block and character device entries parse toFTPFile.UNKNOWN_TYPE, are notisFile()/isDirectory(), areisUnknown(), keep a hard-link count of 0, and still carry a parsed timestamp.UnixFTPEntryParserTest#doAdditionalGoodTests: the existingb/cdevice samples now assertUNKNOWN_TYPE(previously they fell through to theFILE_TYPEassertion next to the same TODO).mvn test -Dtest=UnixFTPEntryParserTestpasses (24/24), and the full FTP parser suite (DefaultFTPFileEntryParserFactoryTest, EnterpriseUnixFTPEntryParserTest, FTPConfigEntryParserTest, FTPTimestampParserImplTest, MLSxEntryParserTest, MVSFTPEntryParserTest, MacOsPeterFTPEntryParserTest, NTFTPEntryParserTest, NetwareFTPEntryParserTest, OS2FTPEntryParserTest, OS400FTPEntryParserAdditionalTest, OS400FTPEntryParserTest, UnixFTPEntryParserTest, VMSFTPEntryParserTest) passes (134 tests, 0 failures).Notes
FTPClient.listFiles()results withisFile()will no longer pick up device nodes; that is the requested fix for NET-200.FTPFileconstants are unchanged.Thanks for considering this contribution!