uttamgupta opened a new issue, #717:
URL: https://github.com/apache/mina-sshd/issues/717
### Version
2.14.0
### Bug description
In our environment, few users don't have home folder and it set to /dev/null
. But SshClient tries to read config file and it throws exception.
Although it expects exception NoSuchFileException. see code snippet from
file FileSnapshot.java
`public static FileSnapshot save(Path file, LinkOption... options) throws
IOException {
BasicFileAttributes attributes = null;
Instant now = Instant.now();
try {
attributes = Files.readAttributes(file,
BasicFileAttributes.class, options);
} catch (NoSuchFileException e) {
return NO_FILE;
}
if (attributes == null) {
return NO_FILE;
}
return new FileSnapshot(now, attributes.lastModifiedTime(),
attributes.size(), attributes.fileKey());
}`
### Actual behavior
```
java.nio.file.FileSystemException: /dev/null/.ssh/config: Not a directory
at
java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
at
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at
java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at
java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at
java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:171)
at java.base/java.nio.file.Files.readAttributes(Files.java:1853)
at
org.apache.sshd.common.util.io.FileSnapshot.save(FileSnapshot.java:145)
at
org.apache.sshd.common.util.io.ModifiableFileWatcher.checkReloadRequired(ModifiableFileWatcher.java:109)
at
org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.resolveEffectiveResolver(ConfigFileHostEntryResolver.java:79)
at
org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.resolveEffectiveHost(ConfigFileHostEntryResolver.java:59)
at org.apache.sshd.client.SshClient.resolveHost(SshClient.java:735)
at org.apache.sshd.client.SshClient.connect(SshClient.java:543)
at
org.apache.sshd.client.session.ClientSessionCreator.connect(ClientSessionCreator.java:74)
at
org.apache.sshd.client.session.ClientSessionCreator.connect(ClientSessionCreator.java:57)
```
### Expected behavior
I think it should also expect "Not a directory" .
### Relevant log output
```Shell
```
### Other information
_No response_
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]