]> Cypherpunks repositories - goredo.git/commitdiff
Warn if non-top target does not write anything
authorSergey Matveev <stargrave@stargrave.org>
Fri, 16 Jan 2026 12:12:18 +0000 (15:12 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 16 Jan 2026 13:53:17 +0000 (16:53 +0300)
12 files changed:
doc/INSTALL
doc/NEWS
doc/cmd/redo-ifchange
run.go
t/goredo-build-uuid-for-fdood.t
t/goredo-double-consideration.t
t/redo-sh.tests/nothing_written_1/test [new file with mode: 0755]
t/redo-sh.tests/nothing_written_2/test [new file with mode: 0755]
t/redo-sh.tests/parallel_1/test
t/redosh-nothing_written_1.t [new symlink]
t/redosh-nothing_written_2.t [new symlink]
usage.go

index 9b26dedaec37d74ff6d55006671abf15670fcdaa..c488783eb806f83bd352bc5cc4c8e18670b3728d 100644 (file)
@@ -11,7 +11,7 @@ Possibly goredo package already exists for your distribution:
 
 Preferable way is to [Download] tarball with the signature from website:
 
-    $ v=2.8.0
+    $ v=2.9.0
     $ [fetch|wget] http://www.goredo.cypherpunks.su/download/goredo-$v.tar.zst
     $ [fetch|wget] http://www.goredo.cypherpunks.su/download/goredo-$v.tar.zst.{asc,sig,cm}
     [Integrity] verify
index 9044072634780ce4f750d7c1237ebe46a34fa079..e6015e1ac1c16dbe50f2c511383550b1a265a7ca 100644 (file)
--- a/doc/NEWS
+++ b/doc/NEWS
@@ -1,3 +1,8 @@
+A 2.9.0\r
+2.9.0
+    * Warn if non-top target did not write anything.
+      Idea was borrowed from redo-sh.
+
 A 2.8.0\r
 2.8.0
     * Fix always-OOD .do-targets with nearby default.do.
index 8976135f923822445468f586c550fb4119584091..f907f928a3d91c0d5799774634bc01d9c5ba0e32 100644 (file)
@@ -8,6 +8,8 @@ Pay attention that redo-ifchange enables parallel builds of the given
 targets, but ordinary redo is not: it builds specified targets
 sequentially and stops when error happens.
 
+It will warn if non-top target did not write anything.
+
 A [Env] REDO_STOP_IF_MODIFIED\r
 If redo sees some target modified externally, then by default it warns
 user about that, does not build that target, but continues the build
diff --git a/run.go b/run.go
index 412e895d031d4ff8e379cd33f3359735aa0006cb..d043d1aceca9da29f4c5cdfa50bf56b39bb15fe4 100644 (file)
--- a/run.go
+++ b/run.go
@@ -745,6 +745,9 @@ func runScript(tgt *Tgt, errs chan error, forced, traced bool) error {
 
                // Do we need to ifcreate it, or ifchange with renaming?
                if fd == nil {
+                       if Level > 0 {
+                               tracef(CWarn, "%s: nothing written to target", tgt)
+                       }
                        os.Remove(tgt.a)
                        err = ifcreate(fdDepW, fdDep.Name(), tgtT)
                        if err != nil {
index 2930ef0c789afd03d16b86eec4e097798a4ea9f8..d0d7ba1e6e0ac4e5f11378a6207e18ab29123ab1 100755 (executable)
@@ -6,9 +6,12 @@ export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1
 
 echo redo-ifchange l3 l2 >l1.do
 echo redo-ifchange l3 >l2.do
+echo echo ok >>l1.do
+echo echo ok >>l2.do
 cat >l3.do <<EOF
 sleep 1
 touch \$(date +%s).touch
+echo ok
 EOF
 
 redo -j 1 l1
index f915147836f5723d0a57b169ac7db34fc07cfdec..55de358542289db0c06330c7b9f437b325755b92 100755 (executable)
@@ -4,7 +4,10 @@ test_description="Do not fail if two always-ed targets run simultaneously"
 . $SHARNESS_TEST_SRCDIR/sharness.sh
 export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1
 
-echo redo-ifchange version.h >all.do
+cat >all.do <<EOF
+redo-ifchange version.h
+echo ok
+EOF
 cat >version.h.do <<EOF
 redo-ifchange date version version.h.in
 VERSION=\$(cat version)
diff --git a/t/redo-sh.tests/nothing_written_1/test b/t/redo-sh.tests/nothing_written_1/test
new file mode 100755 (executable)
index 0000000..36a3847
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -eu
+# A non-top-level build rule not writing to a target must yield a warning.
+
+>all.do printf 'redo-ifchange a
+'
+
+>a.do :
+
+2>stderr redo
+<stderr grep -q 'a: nothing written to target'
diff --git a/t/redo-sh.tests/nothing_written_2/test b/t/redo-sh.tests/nothing_written_2/test
new file mode 100755 (executable)
index 0000000..9919483
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh -eu
+# Each non-top-level build rule not writing to a target must yield a warning.
+
+>all.do printf 'redo-ifchange a
+'
+
+>a.do printf 'redo-ifchange b
+'
+
+>b.do :
+
+2>stderr redo
+<stderr grep -q 'a: nothing written to target'
+<stderr grep -q 'b: nothing written to target'
index 254b717dd184e63cc19f9a471b03dd4844953097..1930eab25383067ff8c8c5b53ae2677890397b39 100755 (executable)
@@ -10,6 +10,7 @@ EOF
 
 >default.do cat <<EOF
 redo-always
+date +%s
 sleep 1
 EOF
 
diff --git a/t/redosh-nothing_written_1.t b/t/redosh-nothing_written_1.t
new file mode 120000 (symlink)
index 0000000..3f2c214
--- /dev/null
@@ -0,0 +1 @@
+redo-sh.tests/wrapper.rc
\ No newline at end of file
diff --git a/t/redosh-nothing_written_2.t b/t/redosh-nothing_written_2.t
new file mode 120000 (symlink)
index 0000000..3f2c214
--- /dev/null
@@ -0,0 +1 @@
+redo-sh.tests/wrapper.rc
\ No newline at end of file
index 399e85bea0cc5999db1817ce055a699079a4c788..d18f8f157764a9db9f5ef6530cb6553bfb74f0d8 100644 (file)
--- a/usage.go
+++ b/usage.go
@@ -24,7 +24,7 @@ import (
 )
 
 const (
-       Version  = "2.8.1"
+       Version  = "2.9.0"
        Warranty = `Copyright (C) 2020-2026 Sergey Matveev
 
 This program is free software: you can redistribute it and/or modify