bazelbuild / bazelbuild/bazel

Changing permissions of an input file does not cause its actions to rerun

Open
#3,400 10 comments 2 reactions 0 assignees View on GitHub
not stale P2 team-Core type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

This is not affecting me personally and I consider it pretty low priority — in fact I'm not sure if you would consider it a bug — but I'm filing it in case it's something you want to address.

### Description of the problem / feature request / question:

Changing the permissions of an input file (e.g. with chmod) do not cause any actions that have that file as an input to rerun. Seems like this might be a bug, although the only scenarios I've been able to come up with are somewhat contrived, such as the example below.

### If possible, provide a minimal example to reproduce the problem:

`BUILD` file:

```
genrule(
name = "main",
srcs = ["main.in"],
outs = ["main.out"],
cmd = "if [[ -x $(SRCS) ]]; then echo $(SRCS) is executable > $@; else echo $(SRCS) is not executable > $@; fi"
)
```

Then, `touch main.in` and then `bazel build :main`. As expected, bazel-genfiles/main.out will say: `main.in is not executable`

Then, `chmod +x main.in` and `bazel build -s :main`. Nothing rebuilds, and bazel-genfiles/main.out has not changed.

### Environment info
* Operating System: OSX and Linux

* Bazel version (output of `bazel info release`): 0.5.2

Contributor guide

Open the contributing guide

Research direction

Start with the minimal BUILD file and reproduce the sequence using main.in: run bazel build :main, change its permissions with chmod, then run bazel build -s :main. Done means the action reruns after the permission change and main.out reflects whether main.in is executable on OSX and Linux.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.