ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28419] New: - Jar task removes existing read-only destfile when permission is denied to overwrite
Date Thu, 15 Apr 2004 21:16:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28419>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28419

Jar task removes existing read-only destfile when permission is denied to overwrite

           Summary: Jar task removes existing read-only destfile when
                    permission is denied to overwrite
           Product: Ant
           Version: 1.6.1
          Platform: Sun
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: tmpuser@scummer.org


I've encountered an issue with the Jar task, evidenced by the
sequence contained in the sample build.xml content below:

===== BEGIN build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="bugdemo" name="Jar deletion bug demo">

        <target name="bugdemo">
                <echo message="Remove any existing jar file" />
                <delete file="bugdemo.jar" />
                <exec executable="/bin/ls">
                        <arg value="-la" />
                        <arg value="bugdemo.jar" />
                </exec>

                <echo message="Create a read-only jar file" />
                <touch file="fileone"/>
                <jar basedir="." includes="fileone" destfile="bugdemo.jar" />
                <chmod file="bugdemo.jar" perm="444" verbose="true" />
                <exec executable="/bin/ls">
                        <arg value="-la" />
                        <arg value="bugdemo.jar" />
                </exec>

                <echo message="Try to overwrite the read-only jar file" />
                <touch file="filetwo"/>
                <jar basedir="." includes="filetwo" destfile="bugdemo.jar" />

                <!-- This line not reached... -->

                <exec executable="/bin/ls">
                        <arg value="-la" /> 
                        <arg value="bugdemo.jar" />
                </exec>
        </target>
</project>
===== END build.xml

When executed, the above produces the following output:

=====  BEGIN OUTPUT
Buildfile: build.xml

bugdemo:
     [echo] Remove any existing jar file
     [exec] bugdemo.jar: No such file or directory


     [exec] Result: 2
     [echo] Create a read-only jar file
      [jar] Building jar: /home/mcumings/cvs/swie/Project/jaxb/bugdemo.jar


    [chmod] Applied chmod to 1 file and 0 directories.
     [exec] -r--r--r--   1 mcumings staff        418 Apr 15 14:08 bugdemo.jar


     [echo] Try to overwrite the read-only jar file
      [jar] Building jar: /home/mcumings/cvs/swie/Project/jaxb/bugdemo.jar

BUILD FAILED
/home/mcumings/cvs/swie/Project/jaxb/build.xml:23: Problem creating jar: 
/home/mcumings/cvs/swie/Project/jaxb/bugdemo.jar (Permission denied)

    Total time: 6 seconds
=====  END OUTPUT

The problem lies in the fact that in the process of failing, the Jar
task seems to like to remove the read-only jar file target, as evidenced
in the following output of 'ls -la':

===== BEGIN OUTPUT
total 25
drwxr-xr-x   2 user staff         512 Apr 15 14:08 ./
drwxr-xr-x  33 user staff        1024 Apr 14 12:22 ../
-rw-r--r--   1 user staff         907 Apr 15 14:07 build.xml
-rw-r--r--   1 user staff           0 Apr 15 14:08 fileone
-rw-r--r--   1 user staff           0 Apr 15 14:08 filetwo
===== END OUTPUT

My use of Ant in this case is a bit out of the ordinary, but read/write
permissions setup by the operating system should be observed and handled
properly within Ant.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message