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 28505] New: - [PATCH] File paths to imported build files should not be canonicalized
Date Tue, 20 Apr 2004 20:58:10 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=28505>.
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=28505

[PATCH] File paths to imported build files should not be canonicalized

           Summary: [PATCH] File paths to imported build files should not be
                    canonicalized
           Product: Ant
           Version: 1.6.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jglick@netbeans.org


If you import a build script fragment via a path that at runtime follows a
Unixish symlink, Ant will define ${ant.file.whatever} to be the canonicalized
(physical) path, rather than the logical path.

If you were using this property to define other paths, as is common, then your
set of path definitions can be "poisoned" by the physical path components. An
example of this problem can be found in the netbeans.org build system, which
recently began using <import> with Ant 1.6.0; this caused a regression whereby
it was no longer possible to build the source tree in case some modules were
stored in a symlink farm, because the imported script paths would refer to the
physical location and further computed paths might no longer be inside the
symlink farm area. A messy workaround for common cases was found; details:

http://www.netbeans.org/issues/show_bug.cgi?id=40892

Generally using File.getCanonicalPath/File except at user request is a bad idea,
as it can break build setups using symlinks. Historically, Ant 1.4 fixed this
problem, so the behavior in 1.6.0 is sort of a regression (only if you use
<import> of course):

---%<---
Date: 2001/07/10 16:39:47
Author: bodewig
Log:
Stop using canonical paths.  This will change the behavior of Ant when
symbolic links are present (but in a way that is probably closer to
what the user expects) and remove some problems on platforms that use
"uncommon" native file names like OS/390 or VMS.

Submitted by:	Jesse Glick <Jesse.Glick@netbeans.com>

WHATSNEW:1.121->1.122 
src/main/org/apache/tools/ant/Project.java:1.62->1.63 
src/main/org/apache/tools/ant/ProjectHelper.java:1.52->1.53 
---%<---

Also cf.

http://marc.theaimsgroup.com/?l=ant-dev&m=99358037323340&w=2

The attached patch corrects the problem for <import>. It seems <subant> still
uses File.getCanonical*, probably incorrectly; I have no patch for that yet.

Includes an additional unit test which (if run on Unix) confirms that the
imported file path is the logical, not physical, path.

If there was some purpose to canonicalizing the file path in ImportTask.java, I
am not aware of it (no apparent comments or unit tests explaining it).

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


Mime
View raw message