@anchor{Stamping}
@section Hashing and stamping
-All targets are checksummed if their @file{ctime} differs from the
-previous one. @command{apenwarr/redo} gives
+All targets are checksummed if no @env{REDO_INODE_NO_TRUST} environment
+variable is set and target's @file{ctime} differs from the previous one.
+@command{apenwarr/redo} gives
@url{https://redo.readthedocs.io/en/latest/FAQImpl/#why-not-always-use-checksum-based-dependencies-instead-of-timestamps, many reasons}
why every time checksumming is bad, but in my opinion in practice all of
them do not apply.
@end itemize
@item targets, dependency information and their directories are explicitly
synced (can be disabled, should work faster)
-@item file's change is detected by comparing its size, @code{ctime}
- and BLAKE3 hash
+@item file's change is detected by comparing its size, @code{ctime} (if
+ @env{REDO_INODE_NO_TRUST} environment variable is not set) and
+ BLAKE3 hash
@item files creation is @code{umask}-friendly (unlike @code{mkstemp()}
used in @command{redo-c})
@item parallel build with jobs limit, optionally in infinite mode
@item
@code{Size} is stored in the state, for faster OOD detection.
Previous @command{goredo} state files won't work.
+@item
+ Setting of @env{REDO_INODE_NO_TRUST} environment variable brings no
+ trust to file inode's information (except for its size), forcing its
+ checksum checking.
@item
@command{redo-whichdo} resembles @code{apenwarr/redo}'s one behaviour more.
@end itemize
"golang.org/x/sys/unix"
)
+const EnvInodeNoTrust = "REDO_INODE_NO_TRUST"
+
+var InodeTrust bool = false
+
type Inode struct {
Size int64
CtimeSec int64
NoColor = os.Getenv(EnvNoColor) != ""
NoSync = os.Getenv(EnvNoSync) == "1"
+ InodeTrust = os.Getenv(EnvInodeNoTrust) == ""
TopDir = os.Getenv(EnvTopDir)
if TopDir == "" {
ood = true
goto Done
}
- if inode.Equals(theirInode) {
+ if InodeTrust && inode.Equals(theirInode) {
trace(CDebug, "ood: %s%s -> %s: same inode", indent, tgtOrig, dep)
} else {
trace(CDebug, "ood: %s%s -> %s: inode differs", indent, tgtOrig, dep)
NO_COLOR -- disable messages colouring
REDO_NO_SYNC -- disable files/directories explicit filesystem syncing
REDO_TOP_DIR -- do not search for .do above that directory
- (it can contain .redo/top as an alternative)`)
+ (it can contain .redo/top as an alternative)
+ REDO_INODE_NO_TRUST -- do not trust inode information (except for size)
+ and always check file's hash`)
}