Weasel panics if a file is removed before it completes
- Dominant language
- Go
- Stars
- 31
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Testcase (run against a reasonably large repo like [apache/trafficcontrol](/apache/trafficcontrol)):
```shell
set -o monitor #enable job control
file=an-arbitrary-file;
touch $file;
weasel&
echo sleeping;
sleep 2;
rm $file;
echo removed file;
fg;
```
Stack trace:
```go
sleeping
removed file
weasel
panic: Failed when enumerating working directory: lstat an-arbitrary-file: no such file or directory
goroutine 1 [running]:
main.loadOverrideFile(0xc007fea480, 0x13, 0x0)
/home/user/go/src/github.com/comcast/weasel/override.go:125 +0x78f
main.loadOverrides.func1(0xc007fea480, 0x13, 0x5e1da0, 0xc0046b04e0, 0x0, 0x0, 0x4ba64f, 0xc0046b04e0)
/home/user/go/src/github.com/comcast/weasel/override.go:40 +0x11e
path/filepath.walk(0xc007fea480, 0x13, 0x5e1da0, 0xc0046b04e0, 0x5b4b50, 0x0, 0x0)
/usr/lib/go/src/path/filepath/path.go:360 +0x425
path/filepath.walk(0x5a4d04, 0x1, 0x5e1da0, 0xc0046b0410, 0x5b4b50, 0x0, 0x54943d)
/usr/lib/go/src/path/filepath/path.go:384 +0x2ff
path/filepath.Walk(0x5a4d04, 0x1, 0x5b4b50, 0x5d98ab, 0x0)
/usr/lib/go/src/path/filepath/path.go:406 +0xff
main.loadOverrides()
/home/user/go/src/github.com/comcast/weasel/override.go:32 +0x42
main.main()
/home/user/go/src/github.com/comcast/weasel/license.go:176 +0x3f9
```
---
Noticed from observing a race condition that the [Traffic Control Pull Request Builder Jenkins job](https://builds.apache.org/job/trafficcontrol-PR/) faces when running against apache/trafficcontrol#4758, depending on whether `BUILD_NUMBER` exists.
Edit: [Permalink](https://web.archive.org/web/20200622201125/https://builds.apache.org/job/trafficcontrol-PR/6125/consoleText) to `Unknown! BUILD_NUMBER` example
~https://builds.apache.org/job/trafficcontrol-PR/6002/console~ (fails: `Unknown! BUILD_NUMBER`)
~https://builds.apache.org/job/trafficcontrol-PR/6003/console~ (succeeds and `BUILD_NUMBER` is gitignored)
~https://builds.apache.org/job/trafficcontrol-PR/6005/consoleFull~ (panics, `BUILD_NUMBER` is still gitignored)
Contributor guide
Assessment
This issue has not been assessed yet.