[Scons-dev] Likely bug - installing side effect files

Dirk Bächle tshortik at gmx.de
Mon Nov 3 07:08:37 EST 2014


Hi Ben,

On 03.11.2014 11:48, Ben Golding wrote:
> It seems one possible fix for this bug could be a warning/error if the user tries to Install() a side-effect file, and expanding/clarifying the docs for SideEffect(). Also, if Install() is permitted with a warning, the current behaviour (silently ignoring the file) must be fixed.
>
> A few other comments/questions come to mind:
>
> 1) If the contents of a side-effect file are indeterminate, how does telling SCons about this file help to have a deterministic (or "convergent") build? What purpose does SideEffect() have at all? What would be the remaining valid use-cases, if Install() is not permitted?
I tried to explain this in my last mail. SideEffect() kind of "marks" a 
file that isn't supposed to be used as a target, but exists intermediary 
during the build process/step. The name of this intermediary file is 
always the same (it's hard-wired into the compiler/builder), so when you 
would run SCons in parallel mode ("-j n") you could get in trouble: one 
build thread could get started, while another one is running...so the 
intermediary file (the SideEffect) could get mixed up.
As far as I know, that's the scenario the SideEffect() functionality was 
designed for, and is actually the only situation where the method should 
be used.

As soon as the name of the intermediary file isn't hard-wired for 
example, but built from the file stem of its target/source files, the 
usage of SideEffect() gets superfluous: each target would create a 
uniquely named intermediary file along with it, so there's no danger of 
mixing up things.

Another thing that "SideEffect()" does, is to mark the file for getting 
removed on a "scons -c". In the past, this has misled many writers of 
builders/tools, to use SideEffect() in favour of the more correct Clean()...
> 2) The example given in docs of .pdb file is an interesting one. It looks like SideEffect() is not actually used in msvc.py.
It's very well possible that the docs aren't up-to-date, so let's do 
something about it! :)
A better example would probably be the "docbook" Tool when it builds an 
EPUB file...
> In fact, this "indeterminate" behaviour depends on whether the option -Fd [1] is used, what filename is specified with -Fd, and the debug information format option [2].
>
> It is both possible and desirable, particularly in a parallel build, to either use -Z7 (foo.cc => foo.obj; no .pdb), or to use -Zi / -ZI with -Fd and a suitably unique filename (foo.cc => foo.obj, foo.pdb). However, using -Zi without explicit -Fd gives something like (foo.cc => foo.obj, vc100.pdb).
As I wrote above, if the filenames are guaranteed to be unique, you 
don't need SideEffect at all...

Best regards,

Dirk



More information about the Scons-dev mailing list