[ https://issues.apache.org/jira/browse/HADOOP-19130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17831137#comment-17831137 ]
ASF GitHub Bot commented on HADOOP-19130: ----------------------------------------- zj619 opened a new pull request, #6678: URL: https://github.com/apache/hadoop/pull/6678 <!-- Thanks for sending a pull request! 1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute 2. Make sure your PR title starts with JIRA issue id, e.g., 'HADOOP-17799. Your PR title ...'. --> ### Description of PR For more information about this PR, please refer to the following issue: [HADOOP-19130](https://issues.apache.org/jira/browse/HADOOP-19130) fix bug in FTPFileSystem.rename(FTPClient client, Path src, Path dst), pass changeWorkingDirectory absoluteSrc.getParent().toUri().getPath().toString to avoid [file://](file:///) uri prefix, in case that ftp server can not understand [file://](file:///) uri prefix ### How was this patch tested? add FTPFileSystem.testRenameFileWithFullQualifiedPath() ### For code changes: - [ ] Does the title or this PR starts with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')? - [ ] Object storage: have the integration tests been executed and the endpoint declared according to the connector-specific documentation? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, `NOTICE-binary` files? > FTPFileSystem rename with full qualified path broken > ---------------------------------------------------- > > Key: HADOOP-19130 > URL: https://issues.apache.org/jira/browse/HADOOP-19130 > Project: Hadoop Common > Issue Type: Bug > Components: fs > Affects Versions: 0.20.2, 3.3.3, 3.3.4, 3.3.6 > Reporter: shawn > Priority: Major > Attachments: image-2024-03-27-09-59-12-381.png > > Original Estimate: 2h > Remaining Estimate: 2h > > When use fs shell to rename file in ftp server, it always get "Input/output > error", when full qualified path > is passed to it(eg. ftp://user:password@localhost/pathxxx), the reason is that > changeWorkingDirectory command underneath is being passed a string with > file:// uri prefix which will not be understand > by ftp server。 > !image-2024-03-27-09-59-12-381.png! > the solution should be pass > absoluteSrc.getParent().toUri().getPath().toString to avoid > file:// uri prefix, like this: > {code:java} > --- a/FTPFileSystem.java > +++ b/FTPFileSystem.java > @@ -549,15 +549,15 @@ public class FTPFileSystem extends FileSystem { > throw new IOException("Destination path " + dst > + " already exist, cannot rename!"); > } > - String parentSrc = absoluteSrc.getParent().toUri().toString(); > - String parentDst = absoluteDst.getParent().toUri().toString(); > + URI parentSrc = absoluteSrc.getParent().toUri(); > + URI parentDst = absoluteDst.getParent().toUri(); > String from = src.getName(); > String to = dst.getName(); > - if (!parentSrc.equals(parentDst)) { > + if (!parentSrc.toString().equals(parentDst.toString())) { > throw new IOException("Cannot rename parent(source): " + parentSrc > + ", parent(destination): " + parentDst); > } > - client.changeWorkingDirectory(parentSrc); > + client.changeWorkingDirectory(parentSrc.getPath().toString()); > boolean renamed = client.rename(from, to); > return renamed; > }{code} > already related issue as follows > https://issues.apache.org/jira/browse/HADOOP-8653 > I wonder why this bug haven't be fixed > > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org