ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs TarTest.java ZipTest.java
Date Mon, 19 Feb 2001 13:30:08 GMT
conor       01/02/19 05:30:08

  Modified:    src/etc/testcases/taskdefs Tag: ANT_13_BRANCH tar.xml
                        zip.xml
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_13_BRANCH
                        Tar.java Zip.java
               src/testcases/org/apache/tools/ant/taskdefs Tag:
                        ANT_13_BRANCH TarTest.java ZipTest.java
  Log:
  Add in checks to Zip and Tar so that they do not try to include the target
  file in the archive.
  
  PR:	564
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +11 -1     jakarta-ant/src/etc/testcases/taskdefs/tar.xml
  
  Index: tar.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/tar.xml,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- tar.xml	2000/12/18 15:43:58	1.2
  +++ tar.xml	2001/02/19 13:30:06	1.2.2.1
  @@ -1,6 +1,6 @@
   <?xml version="1.0"?>
   
  -<project name="xxx-test" basedir="." default="test1">
  +<project name="tar-test" basedir="." default="test1">
   
     <target name="test1">
       <tar/>
  @@ -14,4 +14,14 @@
       <tar basedir=""/>
     </target>
   
  +  <target name="test4">
  +    <touch file="test4.tar"/>
  +    <tar tarfile="test4.tar"
  +         basedir="."/>
  +  </target>
  +
  +  
  +  <target name="cleanup"> 
  +    <delete file="test4.tar"/>
  +  </target>
   </project>
  
  
  
  1.2.2.1   +10 -1     jakarta-ant/src/etc/testcases/taskdefs/zip.xml
  
  Index: zip.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/zip.xml,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- zip.xml	2000/12/18 15:44:01	1.2
  +++ zip.xml	2001/02/19 13:30:06	1.2.2.1
  @@ -1,6 +1,6 @@
   <?xml version="1.0"?>
   
  -<project name="xxx-test" basedir="." default="test1">
  +<project name="zip-test" basedir="." default="test1">
   
     <target name="test1">
       <zip/>
  @@ -10,4 +10,13 @@
       <zip zipfile="zip.tmp"/>
     </target>
   
  +  <target name="test3">
  +    <touch file="test3.zip"/>
  +    <tar zipfile="test3.zip"
  +         basedir="."/>
  +  </target>
  +  
  +  <target name="cleanup"> 
  +    <delete file="test3.zip"/>
  +  </target>
   </project>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.5  +6 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java
  
  Index: Tar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v
  retrieving revision 1.10.2.4
  retrieving revision 1.10.2.5
  diff -u -r1.10.2.4 -r1.10.2.5
  --- Tar.java	2001/02/13 13:03:41	1.10.2.4
  +++ Tar.java	2001/02/19 13:30:06	1.10.2.5
  @@ -175,7 +175,12 @@
               
               if (!archiveIsUpToDate(files)) {
                   upToDate = false;
  -                break;
  +            }
  +            
  +            for (int i = 0; i < files.length; ++i) {
  +                if (tarFile.equals(new File(fs.getDir(project), files[i]))) {
  +                    throw new BuildException("A tar file cannot include itself", location);
  +                }
               }
           }
   
  
  
  
  1.30.2.1  +6 -0      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.30
  retrieving revision 1.30.2.1
  diff -u -r1.30 -r1.30.2.1
  --- Zip.java	2001/02/01 13:14:25	1.30
  +++ Zip.java	2001/02/19 13:30:07	1.30.2.1
  @@ -334,6 +334,12 @@
                   return true;
               }
           } else {
  +            for (int i = 0; i < files.length; ++i) {
  +                if (files[i].equals(zipFile)) {
  +                    throw new BuildException("A zip file cannot include itself", location);
  +                }
  +            }
  +
               if (!zipFile.exists()) return false;
   
               SourceFileScanner sfs = new SourceFileScanner(this);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +7 -0      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java
  
  Index: TarTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/TarTest.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- TarTest.java	2001/01/03 14:18:49	1.2
  +++ TarTest.java	2001/02/19 13:30:07	1.2.2.1
  @@ -79,4 +79,11 @@
           expectBuildException("test3", "required argument not specified");
       }
   
  +    public void test4() { 
  +        expectBuildException("test4", "tar cannot include itself");
  +    }
  +
  +    public void tearDown() {
  +        executeTarget("cleanup");
  +    }
   }
  
  
  
  1.2.2.1   +9 -0      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java
  
  Index: ZipTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/ZipTest.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ZipTest.java	2001/01/03 14:18:49	1.2
  +++ ZipTest.java	2001/02/19 13:30:07	1.2.2.1
  @@ -74,4 +74,13 @@
       public void test2() { 
           expectBuildException("test2", "required argument not specified");
       }
  +    
  +    public void test3() { 
  +        expectBuildException("test3", "zip cannot include itself");
  +    }
  +    
  +    public void tearDown() {
  +        executeTarget("cleanup");
  +    }
  +    
   }
  
  
  

Mime
View raw message