Mentions légales du service

Skip to content

Use temporary file names when creating output.

Emmanuel Thomé requested to merge use-temp-name-when-writing into master

This change avoids the pitfall of partially written output files that are indistinguishable from the expected final files. This only works when the C++ ofstream_maybe_compressed layer is used. (doing the same with the C functions would require a more significant interface change).

An illustration can be:

strace -f -e trace=open,openat,rename ./build/localhost/sieve/freerel -poly ./tests/misc/test_renumber.data/mnfs5.poly -renumber /tmp/renumber.gz -out /dev/null -lpbs 11,10,10,10,10 -lcideals > /dev/null
[pid 124055] openat(AT_FDCWD, "/tmp/renumber.gz.tmp.124054", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 1
[...]
[pid 124054] rename("/tmp/renumber.gz.tmp.124054", "/tmp/renumber.gz") = 0
Edited by Emmanuel Thomé

Merge request reports