You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In what version(s) of Spring Integration are you seeing this issue?
6.4.1
Describe the bug
After upgrading from previous version (as part of Spring Boot 2.x -> SpringBoot 3.x migration) SftpInboundFileSynchronizer stopped syncing the files. We have isolated the problem to be related to a situation where the directory to synchronize is a symlink (i.e. last element in the path is a symlink).
To Reproduce
Create /tmp/realdir on SFTP server and place a file (eg aaa.txt there)
Create /tmp/link on SFTP server as a symlink pointing to /tmp/realdir
Configure SftpInboundFileSynchronizer to synchronize the content of /tmp/link
Expected behavior
aaa.txt is downloaded from SFTP to local filesystem
Analysis
SftpInboundFileSynchronizer (via its parent AbstractInboundFileSynchronizer) calls list() method to retrieve the directory content
The problem is that SftpSession calls lstat on a file/directory and if it is not reported as a directory (which it isn't since it's a symbolic link), it fails silently and returns empty list.
That would be great. This is a regression issue for us and it would be great if the retrieval of symlinked dir content worked as described above (and as it worked before migration from JSch)
Fixes: #9821
Issue link: #9821
Previously, Spring Integration used JSch library for SFTP protocol,
and that one was able to follow symlinks.
Currently, the `SftpSession` uses `LSTAT` command which does not follow symlinks
* Fix `SftpSession` to call `sftpClient.stat()` instead of `lstat()`
to mitigate migration pain from JSch
(cherry picked from commit efa8dc5)
Fixes: #9821
Issue link: #9821
Previously, Spring Integration used JSch library for SFTP protocol,
and that one was able to follow symlinks.
Currently, the `SftpSession` uses `LSTAT` command which does not follow symlinks
* Fix `SftpSession` to call `sftpClient.stat()` instead of `lstat()`
to mitigate migration pain from JSch
(cherry picked from commit efa8dc5)
In what version(s) of Spring Integration are you seeing this issue?
6.4.1
Describe the bug
After upgrading from previous version (as part of Spring Boot 2.x -> SpringBoot 3.x migration)
SftpInboundFileSynchronizer
stopped syncing the files. We have isolated the problem to be related to a situation where the directory to synchronize is a symlink (i.e. last element in the path is a symlink).To Reproduce
/tmp/realdir
on SFTP server and place a file (egaaa.txt
there)/tmp/link
on SFTP server as a symlink pointing to/tmp/realdir
SftpInboundFileSynchronizer
to synchronize the content of/tmp/link
Expected behavior
aaa.txt
is downloaded from SFTP to local filesystemAnalysis
SftpInboundFileSynchronizer
(via its parentAbstractInboundFileSynchronizer
) callslist()
method to retrieve the directory contentspring-integration/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java
Line 354 in 478409e
The problem is that
SftpSession
callslstat
on a file/directory and if it is not reported as a directory (which it isn't since it's a symbolic link), it fails silently and returns empty list.spring-integration/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java
Lines 104 to 107 in 478409e
I believe that
SftpSession.doList(String path)
method should callstat()
instead oflstat()
so that it resolves also symlinks.The text was updated successfully, but these errors were encountered: