Skip to content

[2.x] fix: Fixes the handling of special characters in dot files#8558

Merged
eed3si9n merged 7 commits intosbt:developfrom
circlecrystalin:fix/7289-shell-expansion-in-config-files
Jan 19, 2026
Merged

[2.x] fix: Fixes the handling of special characters in dot files#8558
eed3si9n merged 7 commits intosbt:developfrom
circlecrystalin:fix/7289-shell-expansion-in-config-files

Conversation

@circlecrystalin
Copy link
Copy Markdown

Handle special characters in config files safely

Replaces eval echo $line with printf '%s\n' "$line" in loadConfigFile() to prevent shell expansion of special characters like |, *, & in .jvmopts and .sbtopts files.

Problem:
Properties with pipes (e.g., -Dhttp.nonProxyHosts=host1|host2) caused "command not found" errors due to shell expansion.

Solution:
Use printf with quoted variable to output lines literally without shell interpretation.

Testing:
✅ Verified with pipes, wildcards, ampersands - all handled correctly

Fixes #7289


Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=5625555

@circlecrystalin
Copy link
Copy Markdown
Author

@eed3si9n Could you please review my first pr?

@eed3si9n
Copy link
Copy Markdown
Member

@circlecrystalin circlecrystalin force-pushed the fix/7289-shell-expansion-in-config-files branch from af42b81 to dd4d822 Compare January 16, 2026 17:50
@circlecrystalin
Copy link
Copy Markdown
Author

@circlecrystalin
Copy link
Copy Markdown
Author

circlecrystalin commented Jan 16, 2026

@eed3si9n Could you please give me tip to fix this issue?
image

I used this command to test.

./sbt -Dsbt.build.version=1.12.0 launcherPackageIntegrationTest/test

@circlecrystalin circlecrystalin force-pushed the fix/7289-shell-expansion-in-config-files branch from 53616e8 to 6371194 Compare January 16, 2026 19:17
@circlecrystalin circlecrystalin force-pushed the fix/7289-shell-expansion-in-config-files branch from 6371194 to c4fef52 Compare January 16, 2026 19:56
@circlecrystalin
Copy link
Copy Markdown
Author

@eed3si9n I have fixed, could you please test again?

- Replace 'eval echo $line' with 'printf "%s\n" "$line"' in loadConfigFile()
- Prevents shell expansion of special characters like |, *, &, etc.
- Fixes issue where properties with pipes, wildcards, and ampersands
  caused 'command not found' or 'unexpected' errors
- Add test to verify special characters are handled correctly on all platforms
- All special characters are now handled literally as expected
@circlecrystalin circlecrystalin force-pushed the fix/7289-shell-expansion-in-config-files branch from 64fd732 to 459602b Compare January 16, 2026 23:09
@circlecrystalin
Copy link
Copy Markdown
Author

@eed3si9n Could you please take a look again?

@eed3si9n eed3si9n changed the title fix: Handle special characters in config files safely [2.x] fix: Fixes the handling of special characters in dot files Jan 19, 2026
@eed3si9n eed3si9n merged commit 2f348a0 into sbt:develop Jan 19, 2026
16 of 17 checks passed
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Feb 7, 2026
…#8558)

- Replace 'eval echo $line' with 'printf "%s\n" "$line"' in loadConfigFile()
- Prevents shell expansion of special characters like |, *, &, etc.
- Fixes issue where properties with pipes, wildcards, and ampersands
  caused 'command not found' or 'unexpected' errors
- Add test to verify special characters are handled correctly on all platforms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loadConfigFile() does not properly evaluate properties with characters subject to shell expansion

2 participants