tomoyo: remove a temporary output file
Subsystems (2)
PATCH 1/1 tomoyo: remove a temporary output file
Commit 8ab5bc40aad4 ("tomoyo: Omit use of bin2c") was locally modified on top of the patch I submitted.
I recommend writing to the target directly.
If the recipe command fails, Kbuild will automatically delete the target because scripts/Kbuild.include defines .DELETE_ON_ERROR.
If the recipe command is interrupted, GNU Make will automatically delete the target if it has been partially updated. There was a corner case where the target was not cleaned up, but it was fixed by Commit a7f3257da8a8 ("kbuild: remove the target in signal traps when interrupted").
Since this is a general problem, you can leave it to Kbuild instead of introducing unneeded complexity.
---
If it is not too late, please squash this.
security/tomoyo/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/tomoyo/Makefile +1 -1
@@ -9,7 +9,7 @@ quiet_cmd_policy = POLICY $@ printf 'static char tomoyo_builtin_$x[] __initdata =\n'; \ sed -e 's/\\/\\\\/g' -e 's/\"/\\"/g' -e 's/\(.*\)/\t"\1\\n"/' -- $(firstword $(filter %/$x.conf %/$x.conf.default, $^) /dev/null); \ printf '\t"";\n';) \ - } > [email protected] && mv [email protected] $@ + } > $@ $(obj)/builtin-policy.h: $(wildcard $(obj)/policy/*.conf $(srctree)/$(src)/policy/*.conf.default) FORCE $(call if_changed,policy)
Signature · 1 line
2.34.1
Tetsuo Handa
maintainerQuoted 4 lines · Masahiro Yamada
Since this is a general problem, you can leave it to
Kbuildinstead of introducing unneeded complexity.If it is not too late, please squash this.
It is not too late to apply. But how do you handle a case where the process who is responsible for deleting incomplete file was killed by e.g. OOM-killer?
Quoted 11 lines · Tetsuo Handa
Quoted 4 lines · Masahiro Yamada
Since this is a general problem, you can leave it to
Kbuildinstead of introducing unneeded complexity.If it is not too late, please squash this.
It is not too late to apply. But how do you handle a case where the process who is responsible for deleting incomplete file was killed by e.g. OOM-killer?
Good point.
That is a rare case that Kbuild cannot handle.
One idea is to make if_changed to write the command to *.cmd.tmp and rename it to *.cmd after everything succeeds.
So, it is a similar approach, but the difference is that it is done in the Kbuild core scripts instead of every command. I will consider it.
--
Best Regards
Masahiro Yamada
Tetsuo Handa
maintainerQuoted 5 lines · Masahiro Yamada
One idea is to make
if_changedto write the command to *.cmd.tmp and rename it to *.cmd after everything succeeds.
So, it is a similar approach, but the difference is that it is done in theKbuildcore scripts instead of every command. I will consider it.
I see. Applied as
https://osdn.net/projects/tomoyo/scm/git/tomoyo-test1/commits/80f8be7af03ffe90dc4df998b16bfa212afbdde9 .
Thank you.