bazelbuild/bazel

outputUserRoot doesn't handle backslashes in $USER

Open

#17.961 aperta il 3 apr 2023

Vedi su GitHub
 (2 commenti) (3 reazioni) (0 assegnatari)Java (4465 fork)batch import
P3help wantedteam-OSStype: bug

Metriche repository

Star
 (25.384 star)
Metriche merge PR
 (Merge medio 22g 20h) (77 PR mergiate in 30 g)

Descrizione

Description of the bug:

When $USER contains a backslash, the default directory created for the local cache will fail:

ERROR: /home/ul931f/.cache/bazel/_bazel_gusb\ul931f/1feca94333236c9bc795c85d5dbf3d33/external/local_jdk/BUILD.bazel:5:90: invalid escape sequence: \u. Use '\\' to insert '\'.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Probably set $USER to include a backslash, then attempt to do a build. Here's what my $USER var is set to:

$ env | grep USER
USER=gusb\ul931f

This is on an Amazon Linux 2 AMI running in an AWS WorkSpace. The user information is coming via winbind, hence the domain\user pattern in $USER

Which operating system are you running Bazel on?

Amazon Linux 2

What is the output of bazel info release?

release 6.1.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

N/A

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

I work around this by adding the following to my .bazelrc file:

startup --output_user_root=/home/ul931f/.cache/bazel/ul931f

Similarly the following also works:

startup --output_user_root=/home/ul931f/.cache/bazel/_bazel_gusb\\\\ul931f

Guida contributor