Skip to content

Commit ac49959

Browse files
authored
fix for 3307 (windows launcher rejects filenames with utf8 chars) (#3923)
* fix for 3307; windows launcher can run scripts with utf8 chars * fix for macos * corrected SAVED_CODEPAGE * add extensive logging to scala.cli.integration.RunTestsDefault.UTF-8 * MacOS fixes in generate-native-image.sh; scalafmt; disable integration.test UTF-8 on Windows * native image tweaks for MacOS and Linux * RunTestDefinitions Linux/MacOS * set utf8 registry for all windows workflows * fix format errors not caught by ./mill -i integration.test.fix * add BOM to custom.reg file[skip ci] * update windows-reg-import/action.yml * correct action.yml syntax error * revert .github/script/generate-native-image.sh * format with scalafmt instead of mill -i fix * scalafmt build.mill.scala * simplify to minimum required changes * resolve review feedback * remove unneeded code from UTF-8 integration test[skip ci] * update comment and run deferred ci tests
1 parent 2ca7333 commit ac49959

File tree

5 files changed

+76
-4
lines changed

5 files changed

+76
-4
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: windows-reg-import
2+
description: Import a .reg file and verify those registry values (best-effort)
3+
inputs:
4+
reg-file:
5+
description: "Path to the .reg file"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Attempt to import custom registry (best-effort)
11+
shell: pwsh
12+
run: |
13+
try {
14+
$regFile = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.reg-file }}"
15+
if (-not (Test-Path $regFile)) {
16+
Write-Warning "Registry file not found (skipping): $regFile"
17+
} else {
18+
Write-Host "Importing registry from $regFile (attempting, non-fatal)"
19+
reg import $regFile 2>&1 | ForEach-Object { Write-Host $_ }
20+
}
21+
} catch {
22+
Write-Warning "Registry import failed (ignored): $_"
23+
}
24+
25+
- name: Attempt to verify registry values (best-effort)
26+
shell: pwsh
27+
run: |
28+
try {
29+
$acp = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\CodePage' -Name ACP -ErrorAction Stop).ACP
30+
Write-Host "ACP = $acp"
31+
} catch {
32+
Write-Warning "Failed to read ACP (ignored): $_"
33+
}
34+
try {
35+
$eb = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Nls\MUILanguagePreferences' -Name EnableBetaUnicode -ErrorAction Stop).EnableBetaUnicode
36+
Write-Host "EnableBetaUnicode = $eb"
37+
} catch {
38+
Write-Warning "Failed to read EnableBetaUnicode (ignored): $_"
39+
}

.github/ci/windows/custom.reg

488 Bytes
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,10 @@ jobs:
746746
with:
747747
fetch-depth: 0
748748
submodules: true
749+
- name: Import custom registry and verify
750+
uses: ./.github/actions/windows-reg-import
751+
with:
752+
reg-file: .github/ci/windows/custom.reg
749753
- uses: VirtusLab/scala-cli-setup@v1
750754
with:
751755
jvm: "temurin:17"
@@ -778,6 +782,10 @@ jobs:
778782
with:
779783
fetch-depth: 0
780784
submodules: true
785+
- name: Import custom registry and verify
786+
uses: ./.github/actions/windows-reg-import
787+
with:
788+
reg-file: .github/ci/windows/custom.reg
781789
- name: Set up Python
782790
uses: actions/setup-python@v6
783791
with:
@@ -819,6 +827,10 @@ jobs:
819827
with:
820828
fetch-depth: 0
821829
submodules: true
830+
- name: Import custom registry and verify
831+
uses: ./.github/actions/windows-reg-import
832+
with:
833+
reg-file: .github/ci/windows/custom.reg
822834
- name: Set up Python
823835
uses: actions/setup-python@v6
824836
with:
@@ -860,6 +872,10 @@ jobs:
860872
with:
861873
fetch-depth: 0
862874
submodules: true
875+
- name: Import custom registry and verify
876+
uses: ./.github/actions/windows-reg-import
877+
with:
878+
reg-file: .github/ci/windows/custom.reg
863879
- name: Set up Python
864880
uses: actions/setup-python@v6
865881
with:
@@ -901,6 +917,10 @@ jobs:
901917
with:
902918
fetch-depth: 0
903919
submodules: true
920+
- name: Import custom registry and verify
921+
uses: ./.github/actions/windows-reg-import
922+
with:
923+
reg-file: .github/ci/windows/custom.reg
904924
- name: Set up Python
905925
uses: actions/setup-python@v6
906926
with:
@@ -942,6 +962,10 @@ jobs:
942962
with:
943963
fetch-depth: 0
944964
submodules: true
965+
- name: Import custom registry and verify
966+
uses: ./.github/actions/windows-reg-import
967+
with:
968+
reg-file: .github/ci/windows/custom.reg
945969
- name: Set up Python
946970
uses: actions/setup-python@v6
947971
with:
@@ -1518,6 +1542,10 @@ jobs:
15181542
with:
15191543
fetch-depth: 0
15201544
submodules: true
1545+
- name: Import custom registry and verify
1546+
uses: ./.github/actions/windows-reg-import
1547+
with:
1548+
reg-file: .github/ci/windows/custom.reg
15211549
- uses: VirtusLab/scala-cli-setup@v1
15221550
with:
15231551
jvm: "temurin:17"
@@ -1824,6 +1852,10 @@ jobs:
18241852
with:
18251853
fetch-depth: 0
18261854
submodules: true
1855+
- name: Import custom registry and verify
1856+
uses: ./.github/actions/windows-reg-import
1857+
with:
1858+
reg-file: .github/ci/windows/custom.reg
18271859
- uses: VirtusLab/scala-cli-setup@v1
18281860
with:
18291861
jvm: "temurin:17"

mill

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ function to_bash_syntax {
7070
if [[ $IS_WINDOWS ]]; then
7171
# needed for coursier version < 2.1.8, harmless otherwise
7272
IFS=$'\n'
73-
eval "$(to_bash_syntax `"$cs" java --env --jvm temurin:17` || to_bash_syntax `"$cs" java --env --jvm openjdk:1.17.0`)"
73+
# temurin:17 (build 17+35) doesn't support utf8 filenames, although some later 17 versions do
74+
eval "$(to_bash_syntax `"$cs" java --env --jvm zulu:17` || to_bash_syntax `"$cs" java --env --jvm openjdk:1.17.0`)"
7475
unset IFS
7576
else
7677
eval "$("$cs" java --env --jvm temurin:17 || "$cs" java --env --jvm openjdk:1.17.0)"

modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,11 +1077,11 @@ abstract class RunTestDefinitions
10771077
fileName
10781078
)
10791079
.call(cwd = root)
1080-
if (res.out.text(Codec.default).trim != message) {
1081-
pprint.err.log(res.out.text(Codec.default).trim)
1080+
if (res.out.text(Codec.UTF8).trim != message) {
1081+
pprint.err.log(res.out.text(Codec.UTF8).trim)
10821082
pprint.err.log(message)
10831083
}
1084-
expect(res.out.text(Codec.default).trim == message)
1084+
expect(res.out.text(Codec.UTF8).trim == message)
10851085
}
10861086
}
10871087

0 commit comments

Comments
 (0)