artembilan commented on issue #397:
URL: https://github.com/apache/mina-sshd/issues/397#issuecomment-1638258682

   Well, that's really the point. Our unit test has this piece of code:
   ```
                template.execute(session -> {
                        session.mkdir("/foo/");
                        return session.mkdir("/foo/bar/");
                });
   ```
   That `session` is a wrapper around `SftpClient`.
   According to my debugging investigation, the dot is added here in the 
`SelectorUtils`:
   ```
     /*
            * At this point we know for sure that 'path' contains only SINGLE 
slashes. According to section 4.11 - Pathname
            * resolution
            *
            * A pathname that contains at least one non-slash character and 
that ends with one or more trailing slashes
            * shall be resolved as if a single dot character ( '.' ) were 
appended to the pathname.
            */
           if ((path.length() > 1) && (path.charAt(path.length() - 1) == 
sepChar)) {
               return path + ".";
           } else {
               return path;
           }
   ```
   
   I see that if I remove trailing slash from my remote dir to create, the dot 
is not added:
   ```
   2023-07-17 10:19:25,424 TRACE [sshd-SftpSubsystem-8948-thread-1] 
[org.apache.sshd.common.file.root.RootedFileSystem] - getPath(/foo, []): /foo
   2023-07-17 10:19:25,424 TRACE [sshd-SftpSubsystem-8948-thread-1] 
[org.apache.sshd.sftp.server.SftpSubsystem] - 
resolveFile(ServerSessionImpl[foo@/127.0.0.1:52418]) /foo => /foo
   ```
   
   Is it really what recommended now? Why a trailing slash is considered to by 
as some extra signal to do something else?
   
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to