Bug 22661 - Replace does not preserve line endings in multi line tokens
Summary: Replace does not preserve line endings in multi line tokens
Status: REOPENED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.0
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
: 37660 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-22 15:45 UTC by Antoine Levy-Lambert
Modified: 2018-03-29 02:43 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Levy-Lambert 2003-08-22 15:45:03 UTC
The replace task does not preserve line endings properly.
In revision 1.46, I did a change to avoid \r\n to be changed into \r\r\n on 
Windows (problem reported via email by Morten Mortensen).
Now I have the problem that \n gets replaced into the system's line separator, 
in both source and replacement tokens.
This showed with the test9 of ReplaceTest failing on Windows when the files of 
the test cases were downloaded with the cygwin cvs client (so having \n instead 
or \r\n)
I am not sure what is the best way to tackle this issue.
Maybe not doing any replacements of line endings in (value, token) pairs ?
Not sure.
Comment 1 Antoine Levy-Lambert 2005-10-18 20:33:24 UTC
did not work on this bug, so I am putting it back to the community ...
Comment 2 Stefan Bodewig 2008-12-05 02:21:11 UTC
*** Bug 37660 has been marked as a duplicate of this bug. ***
Comment 3 Stefan Bodewig 2009-02-23 05:18:16 UTC

*** This bug has been marked as a duplicate of bug 46759 ***
Comment 4 Jesse Glick 2009-02-23 09:43:55 UTC
This must have been made duplicate by mistake?
Comment 5 Stefan Bodewig 2009-02-23 19:15:25 UTC
Yes, sorry, must have clicked on the wrong link.
Comment 6 dantewang 2018-03-29 02:43:59 UTC
There should be an option to switch between whether to take line ending into consideration in multi line token or not.

A typical use case is that the build.xml and the file that needs to be modified by <replace> task are both created in Linux (so both having \n), while the build is performed in Windows, where <replace> task replaces \n with \r\n in the token, causing the matching failure.