Skip to content

Windows build data generation fails on localized installs due to "Everyone" ACL lookup #3886

Description

@alex-the-third

🐞 bug report

Affected Rule

The issue is caused by the rule:

py_binary / py_test on Windows when rules_python writes build data via
python/private/build_data_writer.ps1.

Is this a regression?

Introduced by PR #3604 - and first rolled out in 1.9.0

Description

On localized Windows installations, build data generation can fail because
python/private/build_data_writer.ps1 creates a file ACL rule using the English
localized account name "Everyone".

That works on English Windows, but fails on German and other localized Windows
installations where the well-known Everyone principal has a localized display
name. On German Windows, the identity is displayed as Jeder.

The script currently does:

$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("Everyone", "Read", "Allow")

This should use the language-neutral well-known SID for Everyone instead of the
localized display name.

🔬 Minimal Reproduction

On a German Windows installation, run a target that causes rules_python to write
build data, for example in the rules_python repository:

bazel test //tests/build_data:build_data_test --config=fast-tests

The failure can also be reproduced directly with the ACL snippet from
python/private/build_data_writer.ps1 on a German Windows host.

🔥 Exception or Error


Ausnahme beim Aufrufen von "SetAccessRule" mit 1 Argument(en):  "Manche oder alle Identitätsverweise konnten nicht
übersetzt werden."
In
<redacted>\execroot\_main\external\rules_python+\python\private\build_data_writer.ps1:25
Zeichen:1
+ $Acl.SetAccessRule($AccessRule)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IdentityNotMappedException

🌍 Your Environment

Operating System:

  
Windows with German locale
  

Output of bazel version:

  
Bazel 9.1.1
  

Rules_python version:

  
current main / 2.1.0
  

Anything else relevant?

The Windows well-known Everyone principal can be referenced using the
language-neutral SID S-1-1-0, or in .NET via
System.Security.Principal.WellKnownSidType.WorldSid.

Using WorldSid preserves the existing behavior, granting read access to
Everyone, while avoiding localized account-name lookup failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions