Bugs item #1405061, was opened at 2006-01-13 19:23
Message generated for change (Comment added) made by drieseng
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1405061&group_id=31650
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tasks
Group: 0.85
Status: Open
Resolution: None
Priority: 5
Submitted By: Jordan Samuels (jordansamuels)
Assigned to: Nobody/Anonymous (nobody)
Summary: FileSet and DirSet / BuildElement initialization broken
Initial Comment:
=======
The bug
=======
FileSet and DirSet initialization appears to depend on
the path to the nant file itself, and not the current
working directory. In particular, if the nant file is
in a different directory, and FileSet and DirSet
elements are specified in the nant script using
relative paths, then they are incorrectly initialized
based on the relative path of the nant file, not the
current working directory.
Due to the (bug/feature?) that FileSet and DirSet
creation silently masks file-not-found errors, it's
virtually impossible to determine the cause of empty
file/dir sets without intimate knowledge of this
initialization flaw.
============
The platform
============
Windows XP Professional, NAnt 0.85 (Build 0.85.1932.0;
rc3; 4/16/2005).
Reproduction
The attached file "FileAndDirTask.cs" defines a
subclass of Nant.Core.Task task in C#. This task
contains BuildElement's FileSet and DirSet, and it
display the size of each set based on the initialized
performed automatically by nant.
The nant file used for testing is:
<?xml version='1.0'?>
<project name="Bug">
<target name='test'>
<loadtasks assembly='C:\FileAndDir.dll' />
<FileAndDir>
<Files>
<include name='file1.txt' />
</Files>
<Dirs>
<include name='dir1' />
</Dirs>
</FileAndDir>
</target>
</project>
If file1.txt and dir1 are in the current directory, and
I run nant like this:
nant -buildfile:FileAndDir.nant test
The task outputs "I have 1 files and 1 dirs ."
If, however, I move the nant file up one directory, and
run nant like this:
nant -buildfile:..\FileAndDir.nant test
The task outputs "I have 0 files and 0 dirs ."
----------------------------------------------------------------------
>Comment By: Gert Driesen (drieseng)
Date: 2006-01-17 15:12
Message:
Logged In: YES
user_id=707851
Jordan:
I don't think it's likely that we'll change the way
<fileset> works. We always resolve relative path against
the project directory, not the current directory.
Modifying this behaviour would be a major breaking change.
Matthew:
I agree that a mechanism to explictly specify a set of
files could be very useful.
However, I don't think modifying <fileset> is the right
thing to do. We might be better off introducing a
<filelist> type that does not do pattern matching.
The "mustexist" behaviour of a <filelist> would then be
determined by the task in which it's used. I think think
we need an attribute for this purpose.
----------------------------------------------------------------------
Comment By: Jordan Samuels (jordansamuels)
Date: 2006-01-17 14:47
Message:
Logged In: YES
user_id=1426721
I agree re: the "asis" / "mustexist" issue. However, this
is relatively minor compared to the violation of the
"Principle of Least Astonishment" when the path to the nant
file pollutes these file patterns.
----------------------------------------------------------------------
Comment By: Matthew Mastracci (mmastrac)
Date: 2006-01-16 18:27
Message:
Logged In: YES
user_id=85368
NAnt currently treats all entries without the "asis" flag as
patterns. Since a pattern can match zero or more items, it
always succeeds, even if the file doesn't exist.
I just got bit with this using the <touch> task. Perhaps we
should add a "mustexist" flag to the entries.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1405061&group_id=31650
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
nant-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-developers