Skip to content

Commit 8629003

Browse files
fix: use locale-neutral Windows ACL for build data (#3887)
On localized Windows installations, `build_data_writer.ps1` could fail when creating the output file ACL because it used the English localized `Everyone` principal name. This changes the ACL rule to use the language-neutral `WorldSid` identity instead, preserving the existing Everyone read permission without depending on the display language of Windows. Before: German and other localized Windows installs could fail with `IdentityMappedException` / `IdentityNotMappedException`. After: build data generation succeeds on localized Windows installs. Fixes #3886 Tests: `bazelisk test //tests/build_data:build_data_test --config=fast-tests` --------- Co-authored-by: Richard Levasseur <richardlev@gmail.com>
1 parent e51d822 commit 8629003

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

news/3886.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(windows) Fixed build data generation on localized Windows installations.

python/private/build_data_writer.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,16 @@ $Utf8NoBom = New-Object System.Text.UTF8Encoding $False
2121
[System.IO.File]::WriteAllLines($OutputPath, $Lines, $Utf8NoBom)
2222

2323
$Acl = Get-Acl $OutputPath
24-
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "Read", "Allow")
24+
# We use WorldSid because the "Everyone" name is locale-dependent.
25+
$EveryoneSid = New-Object System.Security.Principal.SecurityIdentifier(
26+
[System.Security.Principal.WellKnownSidType]::WorldSid,
27+
$null
28+
)
29+
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
30+
$EveryoneSid,
31+
"Read",
32+
"Allow"
33+
)
2534
$Acl.SetAccessRule($AccessRule)
2635
Set-Acl $OutputPath $Acl
2736

0 commit comments

Comments
 (0)