]> Cypherpunks.ru repositories - goredo.git/commitdiff
REDO_INODE_NO_TRUST v1.0.0
authorSergey Matveev <stargrave@stargrave.org>
Sat, 16 Jan 2021 18:14:15 +0000 (21:14 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 16 Jan 2021 18:14:15 +0000 (21:14 +0300)
doc/faq.texi
doc/features.texi
doc/news.texi
inode.go
main.go
ood.go
usage.go

index 1c6def3ffa8473be75a65b981e0d17f7b6514614..9b909a653bcdfddeeaa4af907eedd19e51777938 100644 (file)
@@ -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.
index 2c5141e4ef45bca74a1aa84cbc9b3625e9acf619..843222d41147c09428736f3fc011c181187bf046 100644 (file)
@@ -12,8 +12,9 @@
     @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
index bc4322ed31c0be210b70eb1368e25f84557c216b..3d5a651f10d24dd4466f3bed9dbda8bbe8be1d6c 100644 (file)
@@ -7,6 +7,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
index 81e77bbf7d1463c5a32b3caf394fdfb835021eca..2d929a2acbf9bf7b011fa6bfdf683c3f52eaa078 100644 (file)
--- a/inode.go
+++ b/inode.go
@@ -28,6 +28,10 @@ import (
        "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 873582afd0a942f66c02a70082f372ee7dd1cde6..7d1c7192e11b1241ecf8a49e89def3ca224d1b54 100644 (file)
--- a/main.go
+++ b/main.go
@@ -101,6 +101,7 @@ func main() {
 
        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 e75dd43c4f7185dd17b7047d326414a6af9b89cd..5fe110433bf3a8d42d54ca4002cd62d9edfb4b2a 100644 (file)
--- a/ood.go
+++ b/ood.go
@@ -139,7 +139,7 @@ func isOOD(cwd, tgtOrig string, level int, seen map[string]struct{}) (bool, erro
                        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)
index ce838b47e6e58135168828df7e577f78f19c3721..beb221f1a1e805f55a44f4b6649693a9a7ed07cc 100644 (file)
--- 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`)
 }