Open junkblocker opened 8 years ago
Easier to demonstrate.
% cat Makefile .PHONY: all test clean BAD1 = a BAD2 = a-b GOOD1 = a-x GOOD2 = a-y .PHONY: template good bad template: rm -rf test mkdir -p test/$(VAR1) test/$(VAR2) ls > test/$(VAR1)/a ls > test/$(VAR2)/a rm -f test/.csearchindex /usr/bin/env CSEARCHINDEX=test/.csearchindex $(GOPATH)/bin/cindex test/$(VAR1) test/$(VAR2) /usr/bin/env CSEARCHINDEX=test/.csearchindex $(GOPATH)/bin/cindex -list # Just index them again to reproduce the bug /usr/bin/env CSEARCHINDEX=test/.csearchindex $(GOPATH)/bin/cindex -verbose /usr/bin/env CSEARCHINDEX=test/.csearchindex $(GOPATH)/bin/cindex -list test `/usr/bin/env CSEARCHINDEX=test/.csearchindex $(GOPATH)/bin/cindex -list | wc -l` = 2 bad: VAR1=$(BAD1) VAR2=$(BAD2) $(MAKE) template good: VAR1=$(GOOD1) VAR2=$(GOOD2) $(MAKE) template
No bug when test run with two directories where basenames are not a prefix or another:
% make good VAR1=a-x VAR2=a-y /Applications/Xcode.app/Contents/Developer/usr/bin/make template rm -rf test mkdir -p test/a-x test/a-y ls > test/a-x/a ls > test/a-y/a rm -f test/.csearchindex /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex test/a-x test/a-y 2016/02/08 17:37:14 index /Users/xxxx/work/codesearch/test/a-x 2016/02/08 17:37:14 index /Users/xxxx/work/codesearch/test/a-y 2016/02/08 17:37:14 flush index 2016/02/08 17:37:14 merge 0 files + mem 2016/02/08 17:37:14 166 data bytes, 1596 index bytes 2016/02/08 17:37:14 done /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list /Users/xxxx/work/codesearch/test/a-x /Users/xxxx/work/codesearch/test/a-y # Just index them again to reproduce the bug /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -verbose 2016/02/08 17:37:14 index /Users/xxxx/work/codesearch/test/a-x 2016/02/08 17:37:14 83 79 /Users/xxxx/work/codesearch/test/a-x/a 2016/02/08 17:37:14 index /Users/xxxx/work/codesearch/test/a-y 2016/02/08 17:37:14 83 79 /Users/xxxx/work/codesearch/test/a-y/a 2016/02/08 17:37:14 flush index 2016/02/08 17:37:14 merge 0 files + mem 2016/02/08 17:37:14 166 data bytes, 1596 index bytes 2016/02/08 17:37:14 merge test/.csearchindex test/.csearchindex~ 2016/02/08 17:37:14 done /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list /Users/xxxx/work/codesearch/test/a-x /Users/xxxx/work/codesearch/test/a-y test `/usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list | wc -l` = 2
Bug seen when test run with two directories where one basename is prefix of another:
% make bad VAR1=a VAR2=a-b /Applications/Xcode.app/Contents/Developer/usr/bin/make template rm -rf test mkdir -p test/a test/a-b ls > test/a/a ls > test/a-b/a rm -f test/.csearchindex /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex test/a test/a-b 2016/02/08 17:37:11 index /Users/xxxx/work/codesearch/test/a 2016/02/08 17:37:11 index /Users/xxxx/work/codesearch/test/a-b 2016/02/08 17:37:11 flush index 2016/02/08 17:37:11 merge 0 files + mem 2016/02/08 17:37:11 166 data bytes, 1592 index bytes 2016/02/08 17:37:11 done /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list /Users/xxxx/work/codesearch/test/a /Users/xxxx/work/codesearch/test/a-b # Just index them again to reproduce the bug /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -verbose 2016/02/08 17:37:11 index /Users/xxxx/work/codesearch/test/a 2016/02/08 17:37:11 83 79 /Users/xxxx/work/codesearch/test/a/a 2016/02/08 17:37:11 index /Users/xxxx/work/codesearch/test/a-b 2016/02/08 17:37:11 83 79 /Users/xxxx/work/codesearch/test/a-b/a 2016/02/08 17:37:11 flush index 2016/02/08 17:37:11 merge 0 files + mem 2016/02/08 17:37:11 166 data bytes, 1592 index bytes 2016/02/08 17:37:11 merge test/.csearchindex test/.csearchindex~ 2016/02/08 17:37:11 done /usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list /Users/xxxx/work/codesearch/test/a test `/usr/bin/env CSEARCHINDEX=test/.csearchindex /Users/xxxx/pkgs/go/bin/cindex -list | wc -l` = 2 make[1]: *** [template] Error 1 make: *** [bad] Error 2
Easier to demonstrate.
No bug when test run with two directories where basenames are not a prefix or another:
Bug seen when test run with two directories where one basename is prefix of another: