Maven Wagon
  1. Maven Wagon
  2. WAGON-258

SSH / SCP -o options should be quoted

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-beta-5
    • Fix Version/s: None
    • Component/s: wagon-ssh-external
    • Labels:
      None
    • Environment:
      Maven 2.1.0 and Java 1.5.0_15
    • Number of attachments :
      0

      Description

      I'm currently using Reflection Secure IT, which requires all SSH / SCP -o options
      be placed in quotations unfortunately I cannot deviate from this technology.
      The problem is that ScpExternalWagon.java places the BatchMode option as an
      argument without quotes resulting in a failing SSH command.

      Line 251 of ScpExternalWagon.java
      cl.createArgument().setValue( "BatchMode yes" );

      Results in...
      ssh -o BatchMode yes [REST OF COMMAND]

      What I need is...
      ssh -o "BatchMode yes" [REST OF COMMAND]

        Issue Links

          Activity

          Hide
          Timothy Riley added a comment -

          Brett Porter
          Has suggested the following workarounds...

          One quick workaround might be to put an intervening script in between
          maven and the PATH that corrects the problem, something like: http://blogs.exist.com/bporter/2008/02/25/working-around-non-interactive-problems-in-leopards-subversion/

          > My other option and my prefered option is to
          > submit a patch that gets rolled into the nightly build of the wagon
          > provider.

          This would be best - certainly submit the issue and patch to be rolled
          in. Adding the quotes is not harmful to openssh, so I'd say it's ok to
          add them for all cases.

          I wouldn't recommend using a snapshot though - instead it's best if
          you release the library internally (1.0-beta-5-MYCOMPANY-1) and use
          that. This assumes you've set up your own repository and the builds
          all use it.

          Adding the following will then override the Maven one:
          <build>
          <extensions>
          <extension>
          <groupId>org.apache.maven.wagon</groupId>
          <artifactId>wagon-ssh-external</artifactId>
          <version>1.0-beta-5-MYCOMPANY-1</version>
          </extension>
          </extensions>
          </build>

          Once the Wagon is formally released you can replace the version with
          the new one.

          Cheers,
          Brett

          Show
          Timothy Riley added a comment - Brett Porter Has suggested the following workarounds... One quick workaround might be to put an intervening script in between maven and the PATH that corrects the problem, something like: http://blogs.exist.com/bporter/2008/02/25/working-around-non-interactive-problems-in-leopards-subversion/ > My other option and my prefered option is to > submit a patch that gets rolled into the nightly build of the wagon > provider. This would be best - certainly submit the issue and patch to be rolled in. Adding the quotes is not harmful to openssh, so I'd say it's ok to add them for all cases. I wouldn't recommend using a snapshot though - instead it's best if you release the library internally (1.0-beta-5-MYCOMPANY-1) and use that. This assumes you've set up your own repository and the builds all use it. Adding the following will then override the Maven one: <build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh-external</artifactId> <version>1.0-beta-5-MYCOMPANY-1</version> </extension> </extensions> </build> Once the Wagon is formally released you can replace the version with the new one. Cheers, Brett
          Hide
          Timothy Riley added a comment -

          Brett
          I have tested the suggested workaround by building my own 1.0-beta-5-MYCOMPANY-1 version of the wagon-ssh-external with the quotation fix but this does not work.

          Steps I followed:
          1. Extracted wagon-ssh-external-1.0-beta-5-source.jar
          2. Modified ScpExternalWagon line 251 to correct the quotation issue
          3. Copied wagon-ssh-external-1.0-beta-5.pom to pom.xml and modified the version to 1.0-beta-5-MYCOMPANY-1
          4. Modified my demo project pom file with the suggestion in the workaround
          5. Executed mvnDebug -X deploy

          The result is my code is never executed even though maven debug clearly says it is selected for runtime. My theory is that there is a classloading issue. With the release of maven-2.1.0 the maven-2.1.0-uber.jar came packaged with wagon ssh external. Because of this the ScpExternalWagon in maven-2.1.0-uber.jar is used over my version.

          I hope my theory turns out to be incorrect because this would mean wagon ssh external could not be updated without updating maven.

          Thanks
          Tim

          Show
          Timothy Riley added a comment - Brett I have tested the suggested workaround by building my own 1.0-beta-5-MYCOMPANY-1 version of the wagon-ssh-external with the quotation fix but this does not work. Steps I followed: 1. Extracted wagon-ssh-external-1.0-beta-5-source.jar 2. Modified ScpExternalWagon line 251 to correct the quotation issue 3. Copied wagon-ssh-external-1.0-beta-5.pom to pom.xml and modified the version to 1.0-beta-5-MYCOMPANY-1 4. Modified my demo project pom file with the suggestion in the workaround 5. Executed mvnDebug -X deploy The result is my code is never executed even though maven debug clearly says it is selected for runtime. My theory is that there is a classloading issue. With the release of maven-2.1.0 the maven-2.1.0-uber.jar came packaged with wagon ssh external. Because of this the ScpExternalWagon in maven-2.1.0-uber.jar is used over my version. I hope my theory turns out to be incorrect because this would mean wagon ssh external could not be updated without updating maven. Thanks Tim
          Hide
          Brett Porter added a comment -

          I had particularly fixed an issue in 2.1.0 to make this possible - I'll check

          Show
          Brett Porter added a comment - I had particularly fixed an issue in 2.1.0 to make this possible - I'll check
          Hide
          Brett Porter added a comment -

          it seems overriding the ssh wagon works, but not the ssh-external wagon due to the following:

          [DEBUG] No wagons found in the extensions or other internal error: Unable to lookup component 'org.apache.maven.wagon.Wagonscp', it could not be started
          org.codehaus.plexus.component.repository.exception.ComponentLookupException: Unable to lookup component 'org.apache.maven.wagon.Wagonscp', it could not be started
                  at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:339)
          ...
          Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed for the field knownHostsProvider in object of type org.apache.maven.wagon.providers.ssh.jsch.ScpWagon
                  at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:144)
          

          I'll continue investigating to see if this is a problem in the metadata of the external wagon.

          Show
          Brett Porter added a comment - it seems overriding the ssh wagon works, but not the ssh-external wagon due to the following: [DEBUG] No wagons found in the extensions or other internal error: Unable to lookup component 'org.apache.maven.wagon.Wagonscp', it could not be started org.codehaus.plexus.component.repository.exception.ComponentLookupException: Unable to lookup component 'org.apache.maven.wagon.Wagonscp', it could not be started at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:339) ... Caused by: org.codehaus.plexus.component.composition.CompositionException: Composition failed for the field knownHostsProvider in object of type org.apache.maven.wagon.providers.ssh.jsch.ScpWagon at org.codehaus.plexus.component.composition.FieldComponentComposer.assignRequirementToField(FieldComponentComposer.java:144) I'll continue investigating to see if this is a problem in the metadata of the external wagon.
          Hide
          Brett Porter added a comment -

          ok, if you also add the SCP wagon as well like this:

          <extension>
          <groupId>org.apache.maven.wagon</groupId>
          <artifactId>wagon-ssh</artifactId>
          <version>1.0-beta-5</version>
          </extension>
          

          it should work. This stops the extension initialization from crashing making sure the new ssh-external is loaded properly. I'll file a bug in Maven for this.

          Show
          Brett Porter added a comment - ok, if you also add the SCP wagon as well like this: <extension> <groupId> org.apache.maven.wagon </groupId> <artifactId> wagon-ssh </artifactId> <version> 1.0-beta-5 </version> </extension> it should work. This stops the extension initialization from crashing making sure the new ssh-external is loaded properly. I'll file a bug in Maven for this.
          Hide
          Timothy Riley added a comment -

          I had seen that exact exception even while using version 1.0-beta-5 of the wagon-ssh-external.
          This is great news though I will test that solution and I appreciate all your effort.

          Show
          Timothy Riley added a comment - I had seen that exact exception even while using version 1.0-beta-5 of the wagon-ssh-external. This is great news though I will test that solution and I appreciate all your effort.
          Hide
          Michael Osipov added a comment -

          Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          Show
          Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

            People

            • Assignee:
              Unassigned
              Reporter:
              Timothy Riley
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: