Bug 53036 - FixCRLF does not respect the eol="asis" setting
Summary: FixCRLF does not respect the eol="asis" setting
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: nightly
Hardware: PC All
: P2 normal (vote)
Target Milestone: 1.9.0
Assignee: Ant Notifications List
Depends on:
Reported: 2012-04-04 23:11 UTC by snake.scaly
Modified: 2012-05-26 20:47 UTC (History)
0 users

Sample Windows project to reproduce the bug (779 bytes, application/octet-stream)
2012-04-04 23:11 UTC, snake.scaly

Note You need to log in before you can comment on or make changes to this bug.
Description snake.scaly 2012-04-04 23:11:28 UTC
Created attachment 28545 [details]
Sample Windows project to reproduce the bug

FixCRLF task always converts line endings to platform-default even if eol="asis" option is specified.

Steps to reproduce in Windows:

1) Create a simple Ant project for conversion, for example:

<project name="test">
        <target name="crlf">
                <fixcrlf file="test.txt"

2) Create a test file, test.txt, for example:


where "^I" is a single TAB character and "$" is a single LF character.

3) Build the "crlf" target:

$ ant crlf

Observed result: the out/test.txt file has each TAB character replaced with 4 spaces, and each end of line represented with CRLF sequence.

Expected result: the out/test.txt file should have each TAB character replaced with 4 spaces but EOLs should stay LF-only.

Steps to reproduce in *NIX: same, but make sure that the initial test.txt file in step 2 uses DOS convention for line endings, for example:

$ unix2dos test.txt

After the crlf target is built, the out/test.txt will have LF line endings while expected result is the original CRLF line endings

Attached is a sample project which can be used to reproduce the bug in Windows.

Tested build: apache-ant-1.9.0alpha nightly build #296 (Mar 19, 2012 12:02:44 AM)

Tested platforms:
1) Windows 7 Enterprise
2) Red Hat Enterprise 6.2 kernel 2.6.32-220.4.2.el6.x86_64
Comment 1 J.M. (Martijn) Kruithof 2012-05-26 20:47:19 UTC
Cause found, but the function is quite old.

ASIS currently is implemented to always go to the platform encoding, this has been so since the beginning. Indeed this does not match the documentation.

as the documentation is quite explicit on how to achieve the platform encoding (by not specifying the eol attribute, I will change the behaviour of ASIS to indeed leave eols always alone.

fixlast will never apply in case eol behaviour is ASIS.