[ 
https://issues.apache.org/jira/browse/SSHD-1164?focusedWorklogId=597256&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-597256
 ]

ASF GitHub Bot logged work on SSHD-1164:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/May/21 16:58
            Start Date: 15/May/21 16:58
    Worklog Time Spent: 10m 
      Work Description: alex-sherwin commented on a change in pull request #196:
URL: https://github.com/apache/mina-sshd/pull/196#discussion_r632982475



##########
File path: 
sshd-common/src/main/java/org/apache/sshd/client/config/hosts/HostConfigEntry.java
##########
@@ -1087,6 +1087,7 @@ public static void writeHostConfigEntries(
      */
     public static List<String> parseConfigValue(String value) {
         String s = GenericUtils.replaceWhitespaceAndTrim(value);
+        s = GenericUtils.collapseSpaces(s);

Review comment:
       I see, this is re-used for various types of config file values.  In the 
case I'm trying to fix it's limited to `Host` only, but I suppose the problem 
would be generic to any kind of config that supports multiple values (not sure 
how many of those exist)
   
   I could change the PR to work inside the `if 
(HOST_CONFIG_PROP.equalsIgnoreCase(key)) {` block, but it would work 
differently, at this point it would have to filter out empty string values from 
the list that was parsed incorrectly




-- 
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.

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 597256)
    Time Spent: 40m  (was: 0.5h)

> Parsing of ~/.ssh/config Host patterns fails with extra whitespace
> ------------------------------------------------------------------
>
>                 Key: SSHD-1164
>                 URL: https://issues.apache.org/jira/browse/SSHD-1164
>             Project: MINA SSHD
>          Issue Type: New Feature
>            Reporter: Alex Sherwin
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Parsing of ~/.ssh/config Host patterns fails with extra whitespace between 
> entries
>  
> For example (note two spaces between {{host2}} and {{host3}})
> {code}
> Host host1 host2  host3
> {code}
> Will result in an exception
> {code}
> java.io.IOException: java.lang.IllegalArgumentException: No pattern for 
> java.io.IOException: java.lang.IllegalArgumentException: No pattern for 
>  at 
> org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.resolveEffectiveHost(ConfigFileHostEntryResolver.java:72)
>  at org.apache.sshd.client.SshClient.resolveHost(SshClient.java:661) at 
> org.apache.sshd.client.SshClient.connect(SshClient.java:539) at 
> org.apache.sshd.client.session.ClientSessionCreator.connect(ClientSessionCreator.java:74)
>  at 
> org.apache.sshd.client.session.ClientSessionCreator.connect(ClientSessionCreator.java:57)
>  at 
> org.apache.sshd.client.opensshcerts.ClientOpenSSHCertificatesTest.clientCertAuth(ClientOpenSSHCertificatesTest.java:168)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:498) at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
>  at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
>  at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at 
> org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
>  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
>  at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
>  at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at 
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at 
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at 
> org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at 
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at 
> org.junit.runners.ParentRunner.run(ParentRunner.java:413) at 
> org.junit.runners.Suite.runChild(Suite.java:128) at 
> org.junit.runners.Suite.runChild(Suite.java:27) at 
> org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at 
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at 
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at 
> org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at 
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
> at 
> org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:30)
>  at org.junit.rules.RunRules.evaluate(RunRules.java:20) at 
> org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at 
> org.junit.runners.ParentRunner.run(ParentRunner.java:413) at 
> org.junit.runner.JUnitCore.run(JUnitCore.java:137) at 
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
>  at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>  at 
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
>  at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)Caused by: 
> java.lang.IllegalArgumentException: No pattern for  at 
> org.apache.sshd.common.util.ValidateUtils.createFormattedException(ValidateUtils.java:213)
>  at 
> org.apache.sshd.common.util.ValidateUtils.throwIllegalArgumentException(ValidateUtils.java:179)
>  at 
> org.apache.sshd.common.util.ValidateUtils.checkTrue(ValidateUtils.java:168) 
> at 
> org.apache.sshd.common.util.ValidateUtils.checkNotNull(ValidateUtils.java:40) 
> at 
> org.apache.sshd.client.config.hosts.HostPatternsHolder.parsePatterns(HostPatternsHolder.java:246)
>  at 
> org.apache.sshd.client.config.hosts.HostConfigEntry.setHost(HostConfigEntry.java:156)
>  at 
> org.apache.sshd.client.config.hosts.HostConfigEntry.readHostConfigEntries(HostConfigEntry.java:920)
>  at 
> org.apache.sshd.client.config.hosts.HostConfigEntry.readHostConfigEntries(HostConfigEntry.java:850)
>  at 
> org.apache.sshd.client.config.hosts.HostConfigEntry.readHostConfigEntries(HostConfigEntry.java:844)
>  at 
> org.apache.sshd.client.config.hosts.HostConfigEntry.readHostConfigEntries(HostConfigEntry.java:831)
>  at 
> org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.reloadHostConfigEntries(ConfigFileHostEntryResolver.java:100)
>  at 
> org.apache.sshd.client.config.hosts.DefaultConfigFileHostEntryResolver.reloadHostConfigEntries(DefaultConfigFileHostEntryResolver.java:84)
>  at 
> org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.resolveEffectiveResolver(ConfigFileHostEntryResolver.java:84)
>  at 
> org.apache.sshd.client.config.hosts.ConfigFileHostEntryResolver.resolveEffectiveHost(ConfigFileHostEntryResolver.java:59)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to