Skip to content

[main] BZ 70285- oupt right line-ending for .bat and .sh files - #1136

Closed
Fisherman110 wants to merge 3 commits into
apache:mainfrom
Fisherman110:main
Closed

Fisherman110 wants to merge 3 commits into
apache:mainfrom
Fisherman110:main

Conversation

@Fisherman110

Copy link
Copy Markdown

BZ-70285

I notice currently the .sh file would end with CRLF if compiled in Windows. And I want to make it convient to build and deploy tomcat in multiple host systems. Like compiling code in Windows and deploy in UNIX (Ubuntu, Debian ...). So, the output *.bat files should end with CRLF and *.sh files should end with LF. This is a tiny enhencement that would be helpfule to cross paltform developers.

the original PR only parse .sh file to LF.

@Fisherman110

Copy link
Copy Markdown
Author

I think @markt-asf may have some loal patches or configuration for Ant. Beceause I pull the new code and build, end with CRLF in *.sh files.

@arturobernalg

Copy link
Copy Markdown
Member

Tested locally on current main with JDK 21 and Ant 1.10.15. Reproduced the issue: with a core.autocrlf=true checkout, main generates the .sh files with CRLF and output/build/bin/version.sh fails on Linux with "bad interpreter: /bin/sh^M". With the patch, the .sh files are LF, the .bat files are CRLF, and the script runs.

I also built the tgz, zip, windows-x64 zip, deployer and fulldocs packages with and without the patch and compared every entry: only the JARs differ (build time), and all .sh/.bat files and modes are identical.

I couldn't build the Windows installer (no makensis available).

The changelog conflicts with main and credits (strongox), which isn't a committer initial. I'd leave that to a committer.

Otherwise, looks good. +1.

@Fisherman110

Copy link
Copy Markdown
Author

Tested locally on current main with JDK 21 and Ant 1.10.15. Reproduced the issue: with a core.autocrlf=true checkout, main generates the .sh files with CRLF and output/build/bin/version.sh fails on Linux with "bad interpreter: /bin/sh^M". With the patch, the .sh files are LF, the .bat files are CRLF, and the script runs.

I also built the tgz, zip, windows-x64 zip, deployer and fulldocs packages with and without the patch and compared every entry: only the JARs differ (build time), and all .sh/.bat files and modes are identical.

I couldn't build the Windows installer (no makensis available).

The changelog conflicts with main and credits (strongox), which isn't a committer initial. I'd leave that to a committer.

Otherwise, looks good. +1.

I resolved the conflict. The original commiter is Fiersherman110 (my github name back in college). Later, I get a mail eaststrongox@gmail.com and sign my commit with 'strongox' beceause it's more impressive. To make it clear, I resigned with Fisherman110 in changelog.

@markt-asf

Copy link
Copy Markdown
Contributor

I don't believe there has been a request to modify line-endings in output/build before. I don't see any reason not to do that.
The aim has always been minimal developer and user friction. Developers want text files to have the right line-ending for their platform. Developers and users want the .sh/.bat files to just work.
*.tar.gz has always been primarily for Linux and friends and *.zip for Windows.
With that in mind, I think the desired endpoint is:

  • text files in the *-src.tar.gz distribution should all use LF
  • text files in the *-src.zip distribution should all use CRLF
  • text files in binary *.tar.gz distributions should all use LF except *.bat files which should use CRLF
  • text files in binary *.zip distributions should all use CRLF except *.sh files which should use LF
  • line endings for text files in output/build should be unchanged except that *.bat should use CRLF and *.sh should use LF

I need to check that against the current implementation and any prior bug reports and/or PRs.

My (possibly mistaken) impression from scanning through build.xml was that there were more calls to fixcrlf than were strictly necessary. I'll look at that as well.

As an aside, the current change log edit in this PR looks like a prior rebase went wrong.

@markt-asf

markt-asf commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixed with a broader approach.

@markt-asf markt-asf closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants