add comment explaining why we generate board.json in 2 steps Signed-off-by: John Crispin <j...@phrozen.org> --- package/base-files/files/lib/functions/uci-defaults.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 82ac1d2a4d..fd37088208 100755 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -609,6 +609,10 @@ board_config_update() { } board_config_flush() { + # when calling json_dump with a redirect, the shell will truncate the target + # file and not update it until a close/flush is called. this results in a short + # window where the file is 0 bytes. mitigate the issue by generating the file + # in 2 steps json_dump -i > /tmp/.board.json mv /tmp/.board.json ${CFG} } -- 2.11.0 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev