Skip to content

Fix logging error#20333

Merged
scheibelp merged 2 commits intospack:developfrom
Tech-XCorp:bugfix/fixLogging
Dec 11, 2020
Merged

Fix logging error#20333
scheibelp merged 2 commits intospack:developfrom
Tech-XCorp:bugfix/fixLogging

Conversation

@benc303
Copy link
Copy Markdown
Contributor

@benc303 benc303 commented Dec 11, 2020

This fixes a logging error, observed on macOS 11.0.1 (Big Sur). Running Spack in debugging mode, for instance spack -dd install py-scipy, results in log files from the compiler wrappers not getting written, instead printing errors such as “No such file or directory: None/.” This is because the log file directory gets set from spack.main.spack_working_dir, but that variable is not set in the spawned process. This PR passes the working directory into the subprocess through kwargs, and then assigns spack.main.spack_working_dir to it, so that the logging directory is set correctly.

@scheibelp scheibelp self-assigned this Dec 11, 2020
@scheibelp
Copy link
Copy Markdown
Member

Thanks for the fix! I'm wondering though if you could move this into subprocess_context.PackageInstallContext:

    def __init__(self, pkg):
        if _serialize:
            self.serialized_pkg = serialize(pkg)
        else:
            self.pkg = pkg
        self.spack_working_dir = spack.main.spack_working_dir  # <----- new
        self.test_state = TestState()

    def restore(self):
        self.test_state.restore()
        spack.main.spack_working_dir = self.spack_working_dir  # <----- new
        if _serialize:
            return pickle.load(self.serialized_pkg)
        else:
            return self.pkg

? We're trying to keep track of transmitted state there

@scheibelp scheibelp merged commit cf37e92 into spack:develop Dec 11, 2020
@scheibelp
Copy link
Copy Markdown
Member

Thanks!

@benc303 benc303 deleted the bugfix/fixLogging branch December 13, 2020 23:54
bollig pushed a commit to bollig/spack that referenced this pull request Jan 12, 2021
This fixes a logging error observed on macOS 11.0.1 (Big Sur).
When performing a Spack install in debugging mode (e.g.
`spack -d install py-scipy`) Spack is supposed to write a log of
compiler wrapper command line invocations to the current working
directory.

Due to a regression error introduced by spack#18205, these files were
no-longer generated, and Spack was printing errors such as
"No such file or directory: None/." This is because the log file
directory gets set from `spack.main.spack_working_dir`, but that
variable is not set in the spawned process.

This PR ensures that the working directory (at the time of the
"spack install" invocation) is persisted to the subprocess.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants