You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/05/29 12:25:51 UTC

DO NOT REPLY [Bug 45094] New: Token substitution problem - where file includes literal character the same as the token

https://issues.apache.org/bugzilla/show_bug.cgi?id=45094

           Summary: Token substitution problem - where file includes literal
                    character the same as the token
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: stuart@henderson-web.co.uk


One of my targets is doing a copy, with a re-name and token substitution, with
the code below.


        <copy  todir="${build.dir}" >
            <fileset  dir="." />
            <mapper  type="regexp"
                     from="(.*)\.IN"
                     to="\1" />
            <filterset  begintoken="${TOKEN}"
                        endtoken="${TOKEN}" >
                <filtersfile  file="token.values" />
            </filterset>
        </copy>


I have TOKEN defined in a property file.
Initially I used '@', but I would prefer to use '@@'

In one of the files that get copied, I need a line ending up like this :
    username@hostname
i.e it has a literal character @ which isn't part of a tokenized value.

So in its' tokenized form, I have
EITHER
    @USER@@@HOST@           .... if I use a single @ for the token delimiters
OR
    @@USER@@@@@HOST@@       .... if I use a double @@ for the token delimiters

The token substitution works OK for the single '@' delimiter
But when using the '@@' delimiter it fails. The copied file ends up with :
    username@@@HOST@@

Strangely, if I needed the result   username@@hostname   then use of either a
single @ or double @@
delimiter works correctly!


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

DO NOT REPLY [Bug 45094] Token substitution problem - where file includes literal character the same as the token

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45094


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.0




--- Comment #1 from Stefan Bodewig <bo...@apache.org>  2008-09-25 08:28:31 PST ---
I can see the reason.

when looking for the begin token in username@@@HOST@@ ant will stop at the
first
two @ and determine that it doesn't have a replacement for "@HOST" and 
continues looking for a begin token after the last candidate begin token
- while your real begin token actually starts inside the first candidate token.

fixed in svn rev 699002.


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