doc/faq.texi | 5 +++-- doc/features.texi | 5 +++-- doc/news.texi | 4 ++++ inode.go | 4 ++++ main.go | 1 + ood.go | 2 +- usage.go | 4 +++- diff --git a/doc/faq.texi b/doc/faq.texi index 72555885f5a3c11e4dc55bdc06bcc6a561c7ca72916dc7561f2825ad9b0bc616..5d9245898ee74730d405bdbb446d483d1401a972b0259f1eaf4b55cc6edc6efc 100644 --- a/doc/faq.texi +++ b/doc/faq.texi @@ -4,8 +4,9 @@ @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. diff --git a/doc/features.texi b/doc/features.texi index 07a16737169242406547ae532b611ebf6d0b95a0fdbbcad1261cace3686799ed..9f0c4bb577f49b07faf3fa843e4884030f56d1a167ed4569991a9dafe4d51a85 100644 --- a/doc/features.texi +++ b/doc/features.texi @@ -12,8 +12,9 @@ the redo, preventing its overwriting, but continuing the build @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 diff --git a/doc/news.texi b/doc/news.texi index 43c1527524e79c0eb28a4c3700dac750277bb429aca3401c63487424f87628f2..b859a7392b783fee8314ac9da96d635d7afb93619c8a5910248e26fb7b2f078f 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -8,6 +8,10 @@ @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 diff --git a/inode.go b/inode.go index c6e5fa0b7d4ba767ee6b0e2c360bb7c98f42334ca9fd35adfc6d1ef77e337879..1d7a0c1cbd5209d4365aeac7cbbc9de50db69eb34baa8ef7ffc2c1d905b68ac0 100644 --- a/inode.go +++ b/inode.go @@ -28,6 +28,10 @@ "go.cypherpunks.ru/recfile" "golang.org/x/sys/unix" ) +const EnvInodeNoTrust = "REDO_INODE_NO_TRUST" + +var InodeTrust bool = false + type Inode struct { Size int64 CtimeSec int64 diff --git a/main.go b/main.go index 6f966d760a652c37d7fd9690342e7f98b15b73ccc850a82d4edc0ca07b2b53de..a8ef0c03fad97a0d5c244b48e981aefb073b917f2e0d6276c717392aa13f46f5 100644 --- a/main.go +++ b/main.go @@ -101,6 +101,7 @@ } NoColor = os.Getenv(EnvNoColor) != "" NoSync = os.Getenv(EnvNoSync) == "1" + InodeTrust = os.Getenv(EnvInodeNoTrust) == "" TopDir = os.Getenv(EnvTopDir) if TopDir == "" { diff --git a/ood.go b/ood.go index a396c6145e2aaf364a16fb73ffe650ca7499b6da5fc779d807f769968876981b..141e0e912eea86c37a8127ae90350f23349d7a6ca306b866c843a622ceb10644 100644 --- a/ood.go +++ b/ood.go @@ -139,7 +139,7 @@ trace(CDebug, "ood: %s%s -> %s: size differs", indent, tgtOrig, dep) 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) diff --git a/usage.go b/usage.go index afc420b68a3acb715458a193000ae4cddf77c461aacda240fd097e211294c7ce..8295e62555c0c69876f5bba29cc428c2f352d00c6c8c6839e4279e91949fcf03 100644 --- a/usage.go +++ b/usage.go @@ -91,5 +91,7 @@ Additional environment variables: 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`) }