bazelbuild/bazel

outputUserRoot doesn't handle backslashes in $USER

Open

#17,961 创建于 2023年4月3日

在 GitHub 查看
 (2 评论) (3 反应) (0 负责人)Java (4,465 fork)batch import
P3help wantedteam-OSStype: bug

仓库指标

Star
 (25,384 star)
PR 合并指标
 (平均合并 22天 20小时) (30 天内合并 77 个 PR)

描述

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

贡献者指南