]> Cypherpunks.ru repositories - goredo.git/blob - doc/faq.texi
Ability to rely on mtime, instead of ctime
[goredo.git] / doc / faq.texi
1 @node FAQ
2 @unnumbered FAQ
3
4 @anchor{Stamping}
5 @section Hashing and stamping
6
7 All targets are checksummed if target's size, @code{ctime}/@code{mtime}
8 differs from the previous one (depending on @ref{OOD, @env{$REDO_INODE_TRUST}}
9 value). @command{apenwarr/redo} gives
10 @url{https://redo.readthedocs.io/en/latest/FAQImpl/#why-not-always-use-checksum-based-dependencies-instead-of-timestamps, many reasons}
11 why every time checksumming is bad, but in my opinion in practice all of
12 them do not apply.
13
14 @itemize
15 @item Aggregate targets and willing to be out-of-date ones just must not
16   produce empty output files. @command{apenwarr/*}, @command{redo-c} and
17   @command{goredo} implementations consider non existing file as an
18   out-of-date target
19 @item If you really wish to produce an empty target file, just touch @file{$3}
20 @end itemize
21
22 Those who create an empty file if no @file{stdout} was written -- failed
23 implementation.
24
25 redo is a tool to help people. Literally all targets can be safely
26 @code{redo-stamp < $3}-ed, reducing false positive out-of-dates. Of
27 course, with the correct @file{stdout}/@file{$3} working and placing
28 necessary results in @file{$3}, instead of just silently feeding them in
29 @command{redo-stamp}.
30
31 redo implementations are already automatically record -ifchange on
32 @file{.do} files and -ifcreate on non-existing @file{.do} files. So why
33 they can not record @command{redo-stamp} the same way implicitly? No,
34 Zen of Python does not applicable there, because -ifchange/-ifcreate
35 contradict it already.
36
37 Modern cryptographic hash algorithms and CPUs are so fast, that even all
38 read and writes to or from hard drive arrays can be easily checksummed
39 and transparently compressed, as ZFS with LZ4/Zstandard and
40 Skein/BLAKE[23] algorithms demonstrate us.
41
42 @command{goredo} includes @command{redo-stamp}, that really records the
43 stamp in the @file{.rec} file, but it does not play any role later. It
44 is stayed just for compatibility.
45
46 @section Can removed .do lead to permanent errors of its non existence?
47
48 Yes, because dependency on it was recorded previously. Is it safe to
49 assume that @file{.do}-less target now is an ordinary source-file? I
50 have no confidence in such behaviour. So it is user's decision how to
51 deal with it, probably it was just his inaccuracy mistake. If you really
52 want to get rid of that dependency knowledge for @file{foo/bar} target,
53 then just remove @file{foo/.redo/bar.rec}.
54
55 @section Does redo-always always rebuilds target?
56
57 By definition, it should be built always, as
58 @url{http://news.dieweltistgarnichtso.net/bin/redo-sh.html#why-built-twice,
59 redo-sh} and @command{redo-c} implementations do. But that ruins the
60 whole redo usability, potentially rebuilding everything again and again.
61 @command{apenwarr/redo} and @command{goredo} tries to build
62 always-targets only once per @strong{run}, as a some kind of optimization.
63
64 For example if you need to rebuild TeX documents (case mentioned in
65 redo-sh's FAQ) until all references and numbers are ready, then you must
66 naturally expectedly explicitly use while cycle in your @file{.do}, as
67 @command{apenwarr/redo} already suggests.
68
69 @section What to do with OOD targets, that has not changed their output?
70
71 How to prevent building of targets, who depend on the OOD target, that
72 produced the same output? If the target is already decided to be OOD,
73 then the whole tree becomes OOD too. It is clear, simple, reliable and
74 honest way of do-ing things.
75
76 Building of the lower level OOD target first is unfair and dishonest
77 thing to do, because probably top level target, being the OOD, won't be
78 dependant on lower level target anymore at all. Actually @command{goredo}
79 does this as a shameful hack and only for always-targets, still existing
80 in the wild. The whole @command{redo-always} idea is considered harmful.
81
82 If you wish to run something and decide if it must OOD the toplevel
83 targets, then just run @command{redo} to forcefully rebuild it and then
84 run the ordinary top level targets.