Author: bodewig
Date: Sun Aug 23 06:29:45 2009
New Revision: 806935

URL: http://svn.apache.org/viewvc?rev=806935&view=rev
Log:
the mode specified on a tar/zipfileset wins over the existing permissions in 
the core tasks, make it that way here as well

Modified:
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/ar-test.xml
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tar-test.xml
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Ar.java
 Sun Aug 23 06:29:45 2009
@@ -43,14 +43,13 @@
                     }
 
                     int mode = ArchiveFileSet.DEFAULT_FILE_MODE;
-                    if (r.getResourceFlags().hasModeBeenSet()) {
-                        mode = r.getResourceFlags().getMode();
-                    } else if (!isDir
-                               && r.getCollectionFlags().hasModeBeenSet()) {
+                    if (!isDir && r.getCollectionFlags().hasModeBeenSet()) {
                         mode = r.getCollectionFlags().getMode();
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         mode = r.getCollectionFlags().getDirMode();
+                    } else if (r.getResourceFlags().hasModeBeenSet()) {
+                        mode = r.getResourceFlags().getMode();
                     }
 
                     int uid = 0;

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Cpio.java
 Sun Aug 23 06:29:45 2009
@@ -41,14 +41,13 @@
                     int mode = isDir
                         ? ArchiveFileSet.DEFAULT_DIR_MODE
                         : ArchiveFileSet.DEFAULT_FILE_MODE;
-                    if (r.getResourceFlags().hasModeBeenSet()) {
-                        ent.setMode(r.getResourceFlags().getMode());
-                    } else if (!isDir
-                               && r.getCollectionFlags().hasModeBeenSet()) {
+                    if (!isDir && r.getCollectionFlags().hasModeBeenSet()) {
                         ent.setMode(r.getCollectionFlags().getMode());
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         ent.setMode(r.getCollectionFlags().getDirMode());
+                    } else if (r.getResourceFlags().hasModeBeenSet()) {
+                        ent.setMode(r.getResourceFlags().getMode());
                     } else {
                         ent.setMode(mode);
                     }

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Tar.java
 Sun Aug 23 06:29:45 2009
@@ -40,14 +40,13 @@
                     ent.setModTime(r.getResource().getLastModified());
                     ent.setSize(isDir ? 0 : r.getResource().getSize());
 
-                    if (r.getResourceFlags().hasModeBeenSet()) {
-                        ent.setMode(r.getResourceFlags().getMode());
-                    } else if (!isDir
-                               && r.getCollectionFlags().hasModeBeenSet()) {
+                    if (!isDir && r.getCollectionFlags().hasModeBeenSet()) {
                         ent.setMode(r.getCollectionFlags().getMode());
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         ent.setMode(r.getCollectionFlags().getDirMode());
+                    } else if (r.getResourceFlags().hasModeBeenSet()) {
+                        ent.setMode(r.getResourceFlags().getMode());
                     } else {
                         ent.setMode(isDir
                                     ? ArchiveFileSet.DEFAULT_DIR_MODE

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
 Sun Aug 23 06:29:45 2009
@@ -36,14 +36,13 @@
                     ent.setTime(r.getResource().getLastModified());
                     ent.setSize(isDir ? 0 : r.getResource().getSize());
 
-                    if (r.getResourceFlags().hasModeBeenSet()) {
-                        ent.setUnixMode(r.getResourceFlags().getMode());
-                    } else if (!isDir
-                               && r.getCollectionFlags().hasModeBeenSet()) {
+                    if (!isDir && r.getCollectionFlags().hasModeBeenSet()) {
                         ent.setUnixMode(r.getCollectionFlags().getMode());
                     } else if (isDir
                                && r.getCollectionFlags().hasDirModeBeenSet()) {
                         ent.setUnixMode(r.getCollectionFlags().getDirMode());
+                    } else if (r.getResourceFlags().hasModeBeenSet()) {
+                        ent.setUnixMode(r.getResourceFlags().getMode());
                     } else {
                         ent.setUnixMode(isDir
                                         ? ArchiveFileSet.DEFAULT_DIR_MODE

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/ar-test.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/ar-test.xml?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/ar-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/ar-test.xml Sun Aug 23 
06:29:45 2009
@@ -178,4 +178,15 @@
       </cmp:ar>
     </au:expectfailure>
   </target>
+
+  <target name="testFileSetPermissionsWin" depends="setUp">
+    <cmp:ar destfile="${dest}">
+      <cmp:arfileset src="../resources/asf-logo.gif.ar"
+                     filemode="600"
+                     includes="asf-logo.gif"/>
+    </cmp:ar>
+    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="600"
+                     uid="1000" gid="1000"/>
+  </target>
+
 </project>

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml 
(original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/cpio-test.xml Sun Aug 
23 06:29:45 2009
@@ -210,4 +210,15 @@
       </cmp:hasmode>
     </au:assertTrue>
   </target>
+
+  <target name="testFileSetPermissionsWin" depends="setUp">
+    <cmp:cpio destfile="${dest}">
+      <cmp:arfileset src="../resources/asf-logo.gif.ar"
+                     filemode="600"
+                     includes="asf-logo.gif"/>
+    </cmp:cpio>
+    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="600"
+                     uid="1000" gid="1000"/>
+  </target>
+
 </project>

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tar-test.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tar-test.xml?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tar-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/tar-test.xml Sun Aug 
23 06:29:45 2009
@@ -226,4 +226,15 @@
       </cmp:hasmode>
     </au:assertTrue>
   </target>
+
+  <target name="testFileSetPermissionsWin" depends="setUp">
+    <cmp:tar destfile="${dest}">
+      <cmp:arfileset src="../resources/asf-logo.gif.ar"
+                     filemode="600"
+                     includes="asf-logo.gif"/>
+    </cmp:tar>
+    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="600"
+                     uid="1000" gid="1000"/>
+  </target>
+
 </project>

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml?rev=806935&r1=806934&r2=806935&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml Sun Aug 
23 06:29:45 2009
@@ -194,4 +194,15 @@
       </cmp:hasmode>
     </au:assertTrue>
   </target>
+
+  <target name="testFileSetPermissionsWin" depends="setUp">
+    <cmp:zip destfile="${dest}">
+      <cmp:arfileset src="../resources/asf-logo.gif.ar"
+                     filemode="600"
+                     includes="asf-logo.gif"/>
+    </cmp:zip>
+    <checkProperties dateTime="2009-07-31-20:11:13 +0200" mode="600"
+                     uid="1000" gid="1000"/>
+  </target>
+
 </project>


Reply via email to