You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2016/06/01 04:18:03 UTC

[Bug 59648] New: Ant 1.9.5 breaks scp upload task.

https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

            Bug ID: 59648
           Summary: Ant 1.9.5 breaks scp upload task.
           Product: Ant
           Version: 1.9.5
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optional Tasks
          Assignee: notifications@ant.apache.org
          Reporter: rnmixon@custco.biz

We noticed this at first on a Windows 10 system running Ant 1.9.6 that is
included with Eclipse Mars.2. 

We have since broken this down to a very simple upload running the "zip"
version of Ant 1.9.x on Windows 7, 8.1 and 10.

If we run our test script on using Ant 1.9.4 the scp upload works. If we run it
with Ant 1.9.5 the scp upload actually suceeds but Ant says it BUILD FAILED.

We are using the latest jsch jar we can find at http://www.jcraft.com/jsch/:
    jsch-0.1.53.jar

I'm including a zip of the simple Project (2 files), the script I use to run
the test with and the output for both 1.9.4 and 1.9.5

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #5 from Jaikiran Pai <ja...@apache.org> ---
I did in fact start looking at fixing this today :) Will update this bugzilla
once I have something to show.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #3 from Jaikiran Pai <ja...@gmail.com> ---
I had a few spare minutes, so decided to take a look at this and this indeed
appears to be a bug in this task. What's happening here, IMO, is the SCP task
through this method[1] sends the "localFile" to "remotePath". The "remotePath"
can be either a directory or a file and if it isn't explicitly specified, this
code initializing it to a file matching the local file's name.

Once the transfer is complete, it then attempts to change the permissions on
the remotePath[2]. The problem with this is that it assumes the remotePath is
the single file it transferred. But that won't always be the case and in your
case the remotePath is an explicitly specified directory on the remote server
which already exists. As a result it incorrectly tries to change permissions on
this remote directory and runs into permissions errors. 

This, IMO, is a genuine bug in this part of the code.

[1]
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java#L224
[2]
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessageBySftp.java#L250

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #4 from Stefan Bodewig <bo...@apache.org> ---
Thanks a lot Jaikiran, sounds like you've located the bug :-)

Do you want to take a stab at fixing it yourself?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #7 from Jaikiran Pai <ja...@apache.org> ---
I just submitted a pull request with a potential fix for review, here
https://github.com/apache/ant/pull/35

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #8 from Jaikiran Pai <ja...@apache.org> ---
This has now been fixed[1] in the 1.9.x and master branches upstream.

[1]
https://github.com/apache/ant/commit/b9125733c49256ea7349bba968d9eabd468a9223

P.S: I would have marked this issue resolved myself, but I am not too familiar
with Bugzilla workflow and I don't see 1.9.10 in the "Target milestone" list to
resolve it against that version.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.9.10
             Status|NEW                         |RESOLVED

--- Comment #9 from Jaikiran Pai <ja...@apache.org> ---
>> I don't see 1.9.10 in the "Target milestone"

Never mind, I didn't look correctly and got fooled by the ordering. It's
present in that drop down.

Marking this issue resolved.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

Richard Mixon <rn...@custco.biz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rnmixon@custco.biz

--- Comment #1 from Richard Mixon <rn...@custco.biz> ---
Created attachment 33907
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33907&action=edit
Example project, script to run, output for 1.9.4 and 1.9.5

Thought I had uploaded this when I created the report, but I don't see it now.
Also don't remember it asking me for the file type.
I also had to remove the 1.9MB jar file from the project folder I was using as
a test file to upload because of the bugzilla upload limit. But I have tried
this with several different files - exe, jar, etc - the problem still occurs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #2 from Jaikiran Pai <ja...@gmail.com> ---
Starting 1.9.5 of Ant the SCP task tries to set the permissions on the
files/directories that get transferred to remote. See the documentation of
fileMode and dirMode here[1].

From looking at your log files that you attached, after the transfer is
complete, Ant is trying to set permission on that file and failing with
Permission Denied errors. I don't see a way to skip setting the permissions
since if the user currently doesn't specify the fileMode/dirMode, default
values are used by the task.


[1] https://ant.apache.org/manual-1.9.x/Tasks/scp.html

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59648] Ant 1.9.5 breaks scp upload task.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59648

--- Comment #6 from Stefan Bodewig <bo...@apache.org> ---
sounds great, thank you

-- 
You are receiving this mail because:
You are the assignee for the bug.