debhelper
debhelper copied to clipboard
`exists_make_target` edge case bug
exists_make_target fails in an extremely narrow edge case:
user@host:~/tmp/bug$ find
.
./subdir
./Makefile
user@host:~/tmp/bug$ cat Makefile
clean:
true
-$(MAKE) -C subdir clean
user@host:~/tmp/bug$ make clean && echo $?
true
make -C subdir clean
make[1]: Entering directory '/home/adam/tmp/bug/subdir'
make[1]: *** No rule to make target 'clean'. Stop.
make[1]: Leaving directory '/home/adam/tmp/bug/subdir'
make: [Makefile:3: clean] Error 2 (ignored)
0
In this case, exists_make_target believes clean does not exist as a target because it sees output No rule to make target 'clean', but the target does exist, and would have succeeded.
The inline comment mentions parsing make -p output instead of the current behavior which I believe would be more reliable.
(Follow-up from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1047860)