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

Mats Wichmann mats at wichmann.us
Fri Oct 15 13:32:35 EDT 2021


On 10/15/21 10:04, Gary Oberbrunner wrote:
> 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.

There are several issues on explain, which has the unfortunate 
characteristic that it does its own computation, rather than using the 
determination made by the decider.  I had some work in progress on 
improving the explain logic, but it ended up with some work Bill did and 
there didn't seem to be an appetite at the time to pursue the approach I 
had.

You might look at #3684, #2997, #2996 and #2932 and see if they cover 
any of what you're seeing.


More information about the Scons-users mailing list