Skip to content

Dependent Builder exceptions in Configure tests are mishandled #2523

Open

Description

@bdbaddog

This issue was originally created at: 2009-11-24 09:10:46.
This issue was reported by: marcnarc.

marcnarc said at 2009-11-24 09:10:46

Sometimes a Configure test needs to invoke some other builders before the test itself, for example to set up the code tree for the test. A failure in one of these dependent builders should be reported to the user and halt the build with an error.

Instead, Configure just treats it as a test failure and continues.

It would also be great if the dependent builder's command and output were displayed to the user as normal, instead of being piped to the Configure log.

See https://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2423890 [tigris links are dead] for additional background.

marcnarc said at 2009-11-24 09:14:08 Created an attachment (id=656)

Toy build displaying the issue

marcnarc said at 2009-11-24 09:32:54

I've attached a toy build displaying the issue.

The build extracts a few header files from a tarball and uses them both in a Configure test and in the main source code. The symlink structure in the tarball mimics what you might find in a prepared Linux kernel. The file
code/main.c includes three headers:

  • nosuchheader.h is tested for in config/SConscript and made available when the test fails.
  • one.h lives in include1/ and it in turn includes implied.h which comes from the tarball. The test for nosuchheader.h also includes one.h, so the test depends on the extracted tarball.
  • bar/b/thing.h is also from the tarball, but accessed via various symlinks instead of through the file's real path.

The tarball's extraction is handled by an UnTarbuilder. The first run of the build works fine:

$ scons .
scons: Reading SConscript files ...
Checking for C header file nosuchheader.h... no
Installing nosuchheader.h
scons: done reading SConscript files.
scons: Building targets ...
Install file: "build/config/nosuchheader.h" as "build/config/include/nosuchheader.h"
scons: Configure: creating build/config/config.h
Install file: "build/config/config.h" as "build/config/include/config.h"
gcc -o build/code/main.o -c -Ibuild/include2 -Iinclude1 -Ibuild/config/include
build/code/main.c
gcc -o build/code/main build/code/main.o
scons: done building targets.
$

But the UnTar builder's output is not displayed. Instead it appears in config.log.

If you edit code/main.c (say, change the string in the printf call) and try to rebuild, nothing seems to happen.

$ edit code/main.c
$ scons .
scons: Reading SConscript files ...
Checking for C header file nosuchheader.h... (cached) no
Installing nosuchheader.h
scons: done reading SConscript files.
scons: Building targets ...
scons: done building targets.
$ echo $?
0
$

NOTE: Running scons . --tree=all here does not output any dependency tree at all! But config.log shows an exception:

$ cat config.log
file /home/marcnarc/Code/scons-bugs/SymlinkMadness/build/config/SConscript,line 4:
        Configure(confdir = build/config/tests)
scons: Configure: Checking for C header file nosuchheader.h...
scons: Configure: "build/config/tests/conftest_0.c" is up to date.
scons: Configure: The original builder output was:
  |build/config/tests/conftest_0.c <-
  |  |#include "one.h"
  |  |
  |  |#include "nosuchheader.h"
  |  |
  |  |
  |
scons: Configure: Caught exception while building "build/include2/implied.h":
 
Traceback (most recent call last):
  File "/home/marcnarc/lib/scons-1.2.0/SCons/Job.py", line 199, in start task.execute()
  File "/home/marcnarc/lib/scons-1.2.0/SCons/SConf.py", line 293, in execute
    is_up_to_date, cached_error, cachable = self.collect_node_states()
  File "/home/marcnarc/lib/scons-1.2.0/SCons/SConf.py", line 264, in collect_node_states
    bi = t.get_stored_info().binfo
AttributeError: 'NoneType' object has no attribute 'binfo'
scons: Configure: (cached) no
$

Note that the error mentions build/include2/implied.h when in fact the problem is really with the build/include2/foo/b symlink.

To fix the build, edit the emitter in site_scons/site_tools/UnTar.py to remove foo/b from the targets and add bar/b/thing.h (note that bar/a/thing.h is already among the targets).

(You may find it useful to see the different errors that occur if you just remove the foo/b target.)

gregnoel said at 2010-01-18 15:09:42

Bug party triage. Should be part of SConf revamp after symlink support is added (which will clear up most of the issue).

marcnarc attached SymlinkMadness.tgz at 2009-11-24 09:14:08.

Toy build displaying the issue

Activity

  1. added this to the 2.x milestone on Jan 2, 2018
  2. added
    Configure
    on Nov 6, 2020
  3. modified the milestones: 2.x, anytime on Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfigureVersion: 1.2.0bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions