Ivan, This is now fixed in cvs.
Thanks for the report !! Gert ----- Original Message ----- From: "Ivan Izaguirre" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 31, 2004 11:04 PM Subject: [nant-dev] An include file with spaces cannot be referenced twice > An error is thrown when a file with spaces in the name is included twice in > a build. The typical scenario would be "a.build" including "b.build" and > "common with space.build", while "b.build" also includes "common with > space.build". But the repro is much easier. > > Create a file "a.build" with the content: > > <?xml version="1.0"?> > <project name="test" default="build"> > <include buildfile="name with spaces.build"/> > <include buildfile="name with spaces.build"/> > <target name="build"> > </target> > </project> > > And a file "name with spaces.build" with the content: > > <?xml version="1.0"?> > <project name="test" default="build2"> > <target name="build2"> > </target> > </project> > > I got the message: > > NAnt 0.84 (Build 0.84.1455.0; net-1.0.win32; release; 26/12/2003) > Copyright (C) 2001-2003 Gerry Shaw > http://nant.sourceforge.net > > Buildfile: file:///D:/Build/NAntProjects/test/a a.build > Target(s) specified: buildb > > BUILD FAILED > > Could not include build file D:\Build\NAntProjects\test\name with > spaces.build. > Item has already been added. Key in dictionary: > "file:///D:/Build/NAntProjects/test/name with spaces.build" Key being > added: "file:///D:/Build/NAntProjects/test/name with spaces.build > " > > Total time: 0.1 seconds. > > When tested with files with no spaces no error is thrown. That is the > expected behavior. > > > > > I think the problem is that, in Nant.Core.LocationMap, the handling of the > Uris is not consistent when inserting and reading in the _fileMap HashTable. > > Method FileIsMapped() uses System.Uri.AbsoluteUri to normalize the given > string to search in the HashTable. While Method Add() just inserts the value > read from XmlNode.BaseURI as the key. > > For build files with spaces, FileIsMapped() searches a Url encoded string > with %20 as spaces when the key in the hash table has real spaces. > > The solution looks to be to start Nant.Core.LocationMap.Add() and > Nant.Core.LocationMap.GetLocation() with: > > public void Add(XmlDocument doc) { > // prevent duplicate mapping > // NOTE: if this becomes a liability then just return when a duplicate map > has happened > Uri uri = new Uri(doc.BaseURI); > string fileName = uri.AbsoluteUri; > ... > } > > > and > > public Location GetLocation(XmlNode node) { > // find hashtable this node's file is mapped under > Uri uri = new Uri(node.BaseURI); > string fileName = uri.AbsoluteUri; > ... > } > > I know too little about NAnt to know if there would be any regression with > this fix. > > Iv�n Izaguirre, www.b-kin.com. > > _________________________________________________________________ > All the action. All the drama. Get NCAA hoops coverage at MSN Sports by > ESPN. http://msn.espn.go.com/index.html?partnersite=espn > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > nant-developers mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/nant-developers > > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click _______________________________________________ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
