bazel icon indicating copy to clipboard operation
bazel copied to clipboard

--output_base does not replace user prefix ~

Open guibou opened this issue 4 years ago • 5 comments

Description of the problem / feature request:

The --output_base option does not seem to replace the user home directory ~ pattern.

Feature requests: what underlying problem are you trying to solve with this feature?

I'd like to specify an --output_base relative to the user home directory.

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

Add a path with ~ in your .bazelrc:

$ tail -n 1 .bazelrc 
startup --output_base ~/fromage

Build:

$ bazel build //...

Look is the different directories and observe that the ~ was not replaced:

$ ls ~/fromage
ls: cannot access '/home/guillaume/fromage': No such file or directory
$  ls ./\~/fromage
bazel-remote-logs  bazel-workers  command.log  DO_NOT_BUILD_HERE  execroot  external  install  java.log  java.log.paddle.guillaume.log.java.20210125-170253.13883  javalog.properties  lock  README  server

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

$ kazel info release
INFO: Invocation ID: b730d2ac-1af0-4106-842c-754a0b37e740
release 3.3.1- (@non-git)

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

I picked the one from nixpkgs.

Please note that it works with a few other options, such as --disk_cache.

guibou avatar Jan 25 '21 16:01 guibou

huh, that's weird - it works for me on debian

meisterT avatar Jan 28 '21 16:01 meisterT

Does this happen for all uses of --output_base or only when it's from a bazelrc file?

michajlo avatar Jan 28 '21 16:01 michajlo

@michajlo what I observes here:

  • does not work in .bazelrc
  • works in the shell if --output_base ~/path
  • does not work in the shel if --output_base=~/path

guibou avatar Jan 29 '21 08:01 guibou

Ok, so it's that --output_base don't support shell expansion, which I suspect is the case for many flags. The --output_base ~/path works because the path is expanded before it's passed to bazel, while in the other two bazel sees the unexpanded ~/path. I think this can be combined with https://github.com/bazelbuild/bazel/issues/10904.

michajlo avatar Jan 29 '21 13:01 michajlo

I think this issue better matches team-Configurability.

comius avatar Aug 08 '22 10:08 comius

@guibou bazelrc does not have support for shell expansion. We unfortunately do not have plan to prioritize this any time soon. I'm marking this as duplicate of https://github.com/bazelbuild/bazel/issues/10904. Please feel free to share your thoughts in the doc mentioned in https://github.com/bazelbuild/bazel/issues/10904#issuecomment-1212144290

aranguyen avatar Sep 14 '22 03:09 aranguyen

https://github.com/bazelbuild/bazel/pull/15417 is an example of changing a flag to accept tildes. I think we can do that for this flag, and others, as well.

brentleyjones avatar Sep 14 '22 11:09 brentleyjones