[Scons-users] bug: --debug=explain gives wrong message

Gary Oberbrunner garyo at oberbrunner.com
Fri Oct 15 12:04:01 EDT 2021


In some cases, --debug=explain gives the wrong message about why a target
is being rebuilt.
Try this:

=== SConstruct:
SConscript('src/SConscript-lictool', variant_dir='Build', duplicate=0)

=== src/SConscript:
import os
tgt=Command('tgt', ['src.txt'], f'echo hi {os.getpid()} > $TARGET')

=== src/src.txt: empty file

Run "scons --debug=explain" twice. The first time it rebuilds because tgt
doesn't exist, that's correct. The second time, the actual reason it
rebuilds is because the build action changed (it's set up to change every
time you run it), but the message says that "src.txt is a new dependency"
which (a) isn't correct, and (b) isn't the actual reason for the rebuild.

The reason appears to be that `explain` in scons/node/__init__.py checks
the Nodes for the old & new dependencies, and somehow the old dep Node is
`src/src.txt` while the new one is `Build/src.txt`. So it spuriously says
that the deps have changed. And a second issue is that in `explain` once it
has printed one kind of reason, it stops looking for other reasons, so it
doesn't print that the build action has also changed. That's as far as I've
tracked it so far.

--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20211015/e50c22b2/attachment.htm>


More information about the Scons-users mailing list