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 37268] New: - mkdir task parses path incorrectly when it includes "../" - Fix included.
Date Thu, 27 Oct 2005 13:28:08 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=37268>.
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=37268

           Summary: mkdir task parses path incorrectly when it includes
                    "../" - Fix included.
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: l.guendogdu@feature-it.com


When a mkdir task contains ".." as directory name, it will not be parsed
correctly. Same thing as it happened with Bug #26765. The fix is similar: call
the FiltUtils.normalize() to make sure the path is parsed correctly. Patch included.

diff -Nurb apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
apache-ant-1.6.5-fixed/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
--- apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/Mkdir.java 
2005-06-02 15:19:58.000000000 +0200
+++ apache-ant-1.6.5-fixed/src/main/org/apache/tools/ant/taskdefs/Mkdir.java   
2005-10-27 15:26:50.000000000 +0200
@@ -20,6 +20,7 @@
 import java.io.File;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.util.FileUtils;

 /**
  * Creates a given directory.
@@ -34,6 +35,7 @@
 public class Mkdir extends Task {

     private static final int MKDIR_RETRY_SLEEP_MILLIS = 10;
+    private static final FileUtils fileUtils = FileUtils.getFileUtils();
     /**
      * our little directory
      */
@@ -48,6 +50,9 @@
             throw new BuildException("dir attribute is required", getLocation());
         }

+       // Normalize file name to make sure ".." are resolved correctly.
+       dir = fileUtils.normalize(dir.getAbsolutePath());
+
         if (dir.isFile()) {
             throw new BuildException("Unable to create directory as a file "
                                      + "already exists with that name: "

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message