ninja tool can call subst incorrectly
This information is collected from the discord thread at https://discord.com/channels/571796279483564041/1262451038435414027 Filing this to make sure it's captured, I did not discover it.
In the ninja tool, in the file SCons/Tool/ninja/Utils.py, we can see the following code snippet in the generate_command function:
genstring = action.genstring(targets, sources, env)
if executor is not None:
cmd = env.subst(genstring, executor=executor)
else:
cmd = env.subst(genstring, targets, sources)
When env.subst is called with positional arguments only, they are interpreted in order as string, raw, target, source, conv, executor. Thus, the targets value will be interpreted by subst as being raw, and the sources value will be target. Issuing those as keyword arguments fixes the problem:
cmd = env.subst(genstring, targets=targets, sources=sources)
This must not be exercised by a test, since we're not seeing a problem - contribution of a small test case that shows breakage would help move a change along.
Code link for this: https://github.com/SCons/scons/blob/731337725b2ccf668c7187072328faa57ff8c144/SCons/Tool/ninja/Utils.py#L367