]> Cypherpunks.ru repositories - goredo.git/blob - doc/faq.texi
Change dependency files extension to .rec
[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 no @env{REDO_INODE_NO_TRUST} environment
8 variable is set and target's @file{ctime} differs from the previous one.
9 @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 DJB's proposal with both @file{stdout} and @file{$3} gives that ability
23 to control your desired behaviour. Those who do not capture
24 @file{stdout} -- failed. Those who create an empty file if no
25 @file{stdout} was written -- failed.
26
27 redo is a tool to help people. Literally all targets can be safely
28 @code{redo-stamp < $3}-ed, reducing false positive out-of-dates. Of
29 course, with the correct @file{stdout}/@file{$3} working and placing
30 necessary results in @file{$3}, instead of just silently feeding them in
31 @command{redo-stamp}.
32
33 redo implementations are already automatically record -ifchange on
34 @file{.do} files and -ifcreate on non-existing @file{.do} files. So why
35 they can not record @command{redo-stamp} the same way implicitly? No,
36 Zen of Python does not applicable there, because -ifchange/-ifcreate
37 contradict it already.
38
39 Modern cryptographic hash algorithms and CPUs are so fast, that even all
40 read and writes to or from hard drive arrays can be easily checksummed
41 and transparently compressed, as ZFS with LZ4/Zstandard and
42 Skein/BLAKE[23] algorithms demonstrate us.
43
44 @command{goredo} includes @command{redo-stamp}, that really records the
45 stamp in the @file{.rec} file, but it does not play any role later. It
46 is stayed just for compatibility.
47
48 @section Can removed .do lead to permanent errors of its non existence?
49
50 Yes, because dependency on it was recorded previously. Is it safe to
51 assume that @file{.do}-less target now is an ordinary source-file? I
52 have no confidence in such behaviour. So it is user's decision how to
53 deal with it, probably it was just his inaccuracy mistake. If you really
54 want to get rid of that dependency knowledge for @file{foo/bar} target,
55 then just remove @file{foo/.redo/bar.rec}.
56
57 @section Does redo-always always rebuilds target?
58
59 @command{goredo}, together with @command{apenwarr/redo}, rebuilds target
60 once per @strong{run}.
61 @url{http://news.dieweltistgarnichtso.net/bin/redo-sh.html#why-built-twice, redo-sh}
62 has other opinion, that is why its @file{redo-sh.tests/always_rebuild_1}
63 will fail. Rebuilding of always-ed targets even during the same build
64 process ruins any redo's usability in practice.
65
66 For example if my @file{.h} file contains source code's version number,
67 that is @command{git describe}'s output and all my other files depends
68 on that header, then any @command{redo-ifchange} of @file{.o} will lead
69 to @command{git describe} execution, that is rather heavy. Of course,
70 because of either hashing or possible @command{redo-stamp}-ing its
71 dependants won't be rebuilt further, but build time will be already
72 ruined. If you need to rebuild TeX documents (case mentioned in
73 redo-sh's FAQ) until all references and numbers are ready, then you must
74 naturally expectedly explicitly use while cycle in your @file{.do}, as
75 @command{apenwarr/redo} already suggests.