Skip to content

Clean with empty consvar reference deletes all files in the project #2801

Open
@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2011-11-11 04:27:06.
This issue was reported by: marvids.
marvids said at 2011-11-11 04:27:06

When passing an undefined environment variable to the Clean command, scons --clean will delete all files it can in the root directory of the project.

Example project that demonstrates the problem:

project_root
    |--main.c
    |--SConstruct
 
## SConstruct

env = Environment()
p = env.Program("main.c")
env.Clean(p, "${DUMMY}")

(Contents of main.c is not important)

Output when running scons -c:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed .\.sconsign.dblite
Removed .\SConstruct
Removed .\main.c
scons: Could not remove '.': The process cannot access the file because it is being used by another process
scons: done cleaning targets.
WindowsError: [Error 2] The system cannot find the file specified: '.sconsign.dblite':
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Script\Main.py", line 342:
    _exec_main(parser, values)
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Script\Main.py", line 306:
    _main(parser)
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Script\Main.py", line 070:
    nodes = _build_targets(fs, options, targets, target_top)
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Script\Main.py", line 264:
    jobs.run(postfunc = jobs_postfunc)
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Job.py", line 113:
    postfunc()
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\Script\Main.py", line 1261:
    SCons.SConsign.write()
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\SConsign.py", line 109:
    syncmethod()
  File "C:\Python27\Lib\site-packages\scons-2.1.0\SCons\dblite.py", line 127:
    self._os_unlink(self._file_name)

ajf58 said at 2014-07-07 11:01:22

Still an issue in SCons 2.3.0 on Linux. Given the nature of the issue I suggest increasing the priority of this to P1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions