Bug 36847 - [Patch] ZipException when using "tag" in deploy ant task
Summary: [Patch] ZipException when using "tag" in deploy ant task
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Manager (show other bugs)
Version: 5.5.12
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2005-09-28 22:02 UTC by Haroon Rafique
Modified: 2006-04-12 15:31 UTC (History)
1 user (show)



Attachments
Fix for tomcat 5.5.9 remote deploy while using tag via ant task (752 bytes, patch)
2005-09-30 19:52 UTC, Haroon Rafique
Details | Diff
Fix for tomcat 5.5.16 for remote deploy while using tag via ant task (971 bytes, patch)
2006-03-22 18:31 UTC, Haroon Rafique
Details | Diff
Fix for tomcat 5.5.16 for remote deploy while using tag via ant task (872 bytes, patch)
2006-03-22 19:45 UTC, Haroon Rafique
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Haroon Rafique 2005-09-28 22:02:30 UTC
Exactly similar to bug 34654, I have an identical ZipException when using the
tag attribute while deploying remotely using the ant <deploy> task. In bug
34654, comment 2, Yoav had mentioned something to the effect that he couldn't
reproduce it and neither could the OP. I don't think the OP in bug 34654 ever
mentioned that he couldn't reproduce it. I don't know why the OP never disputed
that assumption.

I can easily reproduce it by having a <deploy> ant task with a tag attribute
such as:

<deploy url="http://${host}:8080/manager"
        username="${tomcat.username}"
        password="${tomcat.password}"
        path="/${app.name}"
        update="true"
        tag="${tag.war}"
        war="file:${gen.dir}/war/${webapp.war}"/>

If I take out the tag attribute, the remote deploy works fine.

This is with tomcat 5.5.9, sun-jdk-1.5.0.03 on a Gentoo Linux machine.

What the OP of bug 34654 was referring to in bug 34654, comment 1 was the fact
that if you look inside the remote hosts' work/Catalina/localhost/manager
directory, you will find a fully intact war file with the properly named
directory (as per the tag). And indeed, the war file in that directory is
complete and does not have any defects and/or corruptions.
Comment 1 Haroon Rafique 2005-09-28 22:29:12 UTC
(In reply to comment #0)
> 
> If I take out the tag attribute, the remote deploy works fine.
> 
> This is with tomcat 5.5.9, sun-jdk-1.5.0.03 on a Gentoo Linux machine.
> 

To add some points of reference, this used to work fine in 5.0.28. In addition,
I upgraded to 5.5.12 and it is broken in there as well.
Comment 2 Haroon Rafique 2005-09-30 19:49:17 UTC
My colleague and I have tracked down the problem.

The bug was introduced in revision 1.22 in
jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/ManagerServlet.java

Starting from line 627 (in the 5.5.9 sources):

                    // Copy WAR and XML to the host app base if needed
                    if (tag != null) {
                        deployedPath = deployed;
                        File localWarCopy = new File(deployedPath, basename + ".
war");
                        copy(localWar, localWarCopy);
----------------------> localWar = localWarCopy;
----------------------> copy(localWar, new File(getAppBase(), basename + ".war")
);
                    }

Taking out the above 2 marked lines fixes the problem.
Comment 3 Haroon Rafique 2005-09-30 19:52:03 UTC
Created attachment 16565 [details]
Fix for tomcat 5.5.9 remote deploy while using tag via ant task
Comment 4 Yoav Shapira 2006-03-22 17:16:45 UTC
See ongoing discussion on dev@tomcat.apache.org mailing list titled "yet another
tomcat goes stable and I still have to make a custom package" at Nabble:
http://www.nabble.com/yet-another-tomcat-goes-stable-and-I-still-have-to-make-a-custom-package-t1318004.html
Comment 5 Haroon Rafique 2006-03-22 18:31:03 UTC
Created attachment 17943 [details]
Fix for tomcat 5.5.16 for remote deploy while using tag via ant task
Comment 6 Haroon Rafique 2006-03-22 19:45:24 UTC
Created attachment 17944 [details]
Fix for tomcat 5.5.16 for remote deploy while using tag via ant task
Comment 7 Filip Hanik 2006-04-12 22:31:52 UTC
Fixed and patched, will be available in 5.5.17
The copy method makes a check make sure it doesn't overwrite file A with file B,
if file A==file B