Skip to content

Commit 6d0e6ec

Browse files
shartgeaabc
authored andcommitted
Fix race condition during gen_compat_def on filesystems w/o microsecond resolution
This fixes a rather obscure but difficult to track race condition which can occur when the code is compiled on a file system without microseconds ctime/mtime resolution. Because gen_compat_def overwrites the same test.c for every kbuild_test_compile() run, on fast systems this can happen in the same second as the last test, causing make to skip the compilation (and thus the whole test), leading to errors later during module build. I think this was the cause for #152 as I ran into the exact same error. This is also Debian Bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972455 This commit here fixes this by adding -B to make to force it to rebuild every thing every time and not use timestamps to optimize the build process. A different solution would be to create a different temporary directory for each kbuild_test_compile() run, but I opted for the less invasive change.
1 parent adfc631 commit 6d0e6ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gen_compat_def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ kbuild_test_compile() {
2626

2727
cat > test.c
2828
echo obj-m = test.o > Makefile
29-
cmd="make -s -C $KDIR M=$PWD modules"
29+
cmd="make -s -B -C $KDIR M=$PWD modules"
3030
echo "$cmd" > log
3131
if $cmd >> log 2>&1; then
3232
echo " declared" >&2

0 commit comments

Comments
 (0)