You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "Anderson, Rob (Global Trade)" <Ro...@nike.com> on 2005/08/16 19:47:25 UTC
RE: Multiple invocations
That patch does not seem to work. setPassword() is only called once when connecting to the same host again. I have made the following change to fix this issue.
$ diff -p SSHUserInfo.java.orig SSHUserInfo.java
*** SSHUserInfo.java.orig Thu Jun 2 15:20:06 2005
--- SSHUserInfo.java Tue Aug 16 10:37:11 2005
*************** public class SSHUserInfo implements User
*** 152,162 ****
public boolean promptPassword(String passwordPrompt) {
//log(passwordPrompt, Project.MSG_DEBUG);
! if (firstTime) {
! firstTime = false;
! return true;
! }
! return firstTime;
}
public boolean promptYesNo(String message) {
--- 152,158 ----
public boolean promptPassword(String passwordPrompt) {
//log(passwordPrompt, Project.MSG_DEBUG);
! return true;
}
public boolean promptYesNo(String message) {
This bassically negates the need for the firstTime variable. Is that OK? I don't remember what that variable and the code in promptPassword was for anyway.
There is a new issue that comes to light, once again. See the output below...
Buildfile: ssh_twice_build.xml
linux:
[sshexec] Connecting to localhost:22
[sshexec] Hello from localhost
linux:
[sshexec] Connecting to localhost:22
BUILD SUCCESSFUL
Total time: 8 seconds
The first time the target is run, the output is printed to the console. The second time, it is not. There has been discussion about this bug in the past, but no resolution. I tried to look into it, but found myself in over my head.
> -----Original Message-----
> From: ymnk@jcraft.com [mailto:ymnk@jcraft.com]
> Sent: Monday, August 15, 2005 9:28 PM
> To: Anderson, Rob (Global Trade)
> Cc: user@ant.apache.org
> Subject: Re: Multiple <sshexec> invocations
>
>
> Hi,
>
> +-From: "Anderson, Rob (Global Trade)" <Ro...@nike.com> --
> |_Date: Mon, 15 Aug 2005 11:53:12 -0700 _________________________
> |
> |Try the same tests with jsch 0.1.16. What are the results? I
> |believe these are problems with Jsch. -Rob Anderson
> ...
> |> BUILD FAILED
> |> P:\com_lgc\cycle11\infrasdk\build.xml:22:
> |> com.jcraft.jsch.JSchException:
> |> Auth cancel
> ...
>
> I think this problem has come from following lines in
> org/apache/tools/ant/taskdefs/optional/ssh/SSHUserInfo.java
>
> >public boolean promptPassword(String passwordPrompt) {
> > //log(passwordPrompt, Project.MSG_DEBUG);
> > if (firstTime) {
> > firstTime = false;
> > return true;
> > }
> > return firstTime;
> >}
>
> I mean that this method will always return 'false' in the second time.
>
> Here is a quick hack to work around this problem.
> May I ask somebody to test this patch?
>
> diff -Naur ssh/SSHUserInfo.java ssh.new/SSHUserInfo.java
> --- ssh/SSHUserInfo.java 2005-07-08 13:39:23.000000000 +0000
> +++ ssh.new/SSHUserInfo.java 2005-08-16 04:10:40.000000000 +0000
> @@ -112,6 +112,7 @@
> * @param password The password to set
> */
> public void setPassword(String password) {
> + firstTime = true;
> this.password = password;
> }
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Multiple invocations
Posted by Atsuhiko Yamanaka <ym...@jcraft.com>.
Hi,
+-From: "Anderson, Rob (Global Trade)" <Ro...@nike.com> --
|_Date: Tue, 16 Aug 2005 10:47:25 -0700 _________________________
|
|There is a new issue that comes to light, once again.
|See the output below...
|
|Buildfile: ssh_twice_build.xml
|
|linux:
| [sshexec] Connecting to localhost:22
| [sshexec] Hello from localhost
|
|linux:
| [sshexec] Connecting to localhost:22
|
|BUILD SUCCESSFUL
|Total time: 8 seconds
I think that this issue comes from that System.out will be closed in
'close' method of TeeOutputStream[1].
You know that TeeOutputStream has been used in SSHExec[2].
It seems following modification for TeeOutputStream fixes this problem,
public void close() throws IOException {
try {
left.close();
} finally {
if(right!=System.out && right!=System.err) // <---
right.close();
}
}
but I don't know if such a change is acceptable or not.
So, I have planed to re-implement 'execute' method of SSHExec without
TeeOutputStream. How do you think of it?
[1] org.apache.tools.ant.util.TeeOutputStream
[2] org.apache.tools.ant.taskdefs.optional.ssh.SSHExec
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
4-1 OHMACHI 1-CHOME AOBA-KU,
SENDAI, MIYAGI 980-0804 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: Multiple invocations
Posted by Atsuhiko Yamanaka <ym...@jcraft.com>.
Hi,
+-From: "Anderson, Rob (Global Trade)" <Ro...@nike.com> --
|_Date: Tue, 16 Aug 2005 10:47:25 -0700 _________________________
|
|There is a new issue that comes to light, once again.
|See the output below...
|
|Buildfile: ssh_twice_build.xml
|
|linux:
| [sshexec] Connecting to localhost:22
| [sshexec] Hello from localhost
|
|linux:
| [sshexec] Connecting to localhost:22
|
|BUILD SUCCESSFUL
|Total time: 8 seconds
I think that this issue comes from that System.out will be closed in
'close' method of TeeOutputStream[1].
You know that TeeOutputStream has been used in SSHExec[2].
It seems following modification for TeeOutputStream fixes this problem,
public void close() throws IOException {
try {
left.close();
} finally {
if(right!=System.out && right!=System.err) // <---
right.close();
}
}
but I don't know if such a change is acceptable or not.
So, I have planed to re-implement 'execute' method of SSHExec without
TeeOutputStream. How do you think of it?
[1] org.apache.tools.ant.util.TeeOutputStream
[2] org.apache.tools.ant.taskdefs.optional.ssh.SSHExec
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
4-1 OHMACHI 1-CHOME AOBA-KU,
SENDAI, MIYAGI 980-0804 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org