weasel
weasel copied to clipboard
Weasel panics if a file is removed before it completes
Testcase (run against a reasonably large repo like apache/trafficcontrol):
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:
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 faces when running against apache/trafficcontrol#4758, depending on whether BUILD_NUMBER exists.
Edit: Permalink 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)