Skip to content

End custom.vmoptions with a comment so added options keep their newline - #465

Merged
pacmano1 merged 1 commit into
OpenIntegrationEngine:mainfrom
pacmano1:fix/custom-vmoptions-last-line
Sep 29, 2026
Merged

pacmano1 merged 1 commit into
OpenIntegrationEngine:mainfrom
pacmano1:fix/custom-vmoptions-last-line

Conversation

@pacmano1

Copy link
Copy Markdown
Contributor

Closes #464

conf/custom.vmoptions now ends with three blank lines and # Add custom options above this comment.

The startup scripts skip a last line that has no newline, so an option typed at the end of the file in an editor that doesn't add one never reaches the JVM. The install4j-generated scripts (oieservice, oieserver, oiecommand) have that loop and aren't ours to fix, so the template now ends with a comment. Options added above it always end in a newline. If an editor leaves the comment itself without one, the scripts drop the comment, which is harmless.

This replaces the warning comment proposed in #464 because it doesn't depend on anyone reading the comments.

How to verify

  1. Install 4.6.0 with oie_unix_4_6_0.sh and replace conf/custom.vmoptions with this branch's copy.
  2. Put -Xmx2g on one of the blank lines, then strip the final newline: printf '%s' "$(cat conf/custom.vmoptions)" > t && mv t conf/custom.vmoptions
  3. ./oieservice start, then jcmd <pid> VM.flags | tr ' ' '\n' | grep MaxHeapSize shows 2147483648. On an unpatched file with -Xmx2g as the unterminated last line, it shows 268435456.

I tested on Linux with Temurin 17.0.20.1. Windows is untested.

The startup scripts read .vmoptions files with a shell `while read`
loop, which skips a last line that has no trailing newline. An option
typed as the last line of conf/custom.vmoptions in an editor that does
not add a final newline never reached the JVM, so the engine kept the
-Xmx256m from base_includes.vmoptions.

The install4j-generated scripts (oieservice, oieserver, oiecommand) use
that loop and are not ours to change, so the template now ends with a
comment line. Options added above it always end in a newline. If an
editor leaves the comment without a newline, the scripts drop the
comment, which is harmless.

Closes OpenIntegrationEngine#464

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Finnegan's Owner <44065187+pacmano1@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

Test Results

127 files  ±0  127 suites  ±0   3m 21s ⏱️ + 1m 7s
723 tests ±0  723 ✅ ±0  0 💤 ±0  0 ❌ ±0 
789 runs  ±0  783 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit 76fb62a. ± Comparison against base commit 1062766.

@pacmano1
pacmano1 merged commit 70b627d into OpenIntegrationEngine:main Sep 29, 2026
11 checks passed
@pacmano1
pacmano1 deleted the fix/custom-vmoptions-last-line branch September 29, 2026 18:26
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.

[BUG] Last line of a .vmoptions file is silently ignored if it has no trailing newline

4 participants