Skip to content

Fix for issue #13754#13755

Merged
becker33 merged 2 commits intospack:developfrom
tjfulle:fix-13754
Nov 15, 2019
Merged

Fix for issue #13754#13755
becker33 merged 2 commits intospack:developfrom
tjfulle:fix-13754

Conversation

@tjfulle
Copy link
Copy Markdown
Contributor

@tjfulle tjfulle commented Nov 15, 2019

fixes #13754

@tjfulle
Copy link
Copy Markdown
Contributor Author

tjfulle commented Nov 15, 2019

@becker33 (since he is mentioned in #13754)

@greenc-FNAL
Copy link
Copy Markdown
Member

@gartung

@gartung
Copy link
Copy Markdown
Member

gartung commented Nov 15, 2019

@becker33


def file_is_relocatable(
file, paths_to_relocate=[spack.store.layout.root, spack.paths.prefix]):
def file_is_relocatable(file):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break binary relocation.

If the issue is lists as default arguments, we should change this to def file_is_relocatable(file, paths_to_relocate=None) and insert the defaults below if we see paths_to_relocate is None

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@becker33, see latest change.

@scheibelp
Copy link
Copy Markdown
Member

Using a tuple doesn't appear to resolve the issue, but using None (and then initializing in the function body) as suggested by @becker33 does appear to also resolve the issue (so it does appear to be a problem of the form suggested by @alalazo).

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Nov 15, 2019

@scheibelp I'm trying to understand what's going on. Tuples are immutable so it should be fine to use them as defaults.

@tjfulle
Copy link
Copy Markdown
Contributor Author

tjfulle commented Nov 15, 2019

The fact that these changes make a difference at all is strange to me since this code path does not seem to be even exercised in the example shown in #13754.

@becker33
Copy link
Copy Markdown
Member

Yeah I'm quite confused by this as well. I've confirmed the bug and that my version of the fix resolves the bug without losing the functionality, but I have no idea why this is happening.

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Nov 15, 2019

Okay, this is tricky. The issue seems to be due to spack.store.<something> being in the default values. This triggers a call to spack.config at module definition time, i.e. before we even enter main and surely before the command line is processed. This information seems to be cached and re-used later. Makes sense?

@tjfulle
Copy link
Copy Markdown
Contributor Author

tjfulle commented Nov 15, 2019

Perfect sense... All the more reason to adopt:

def file_is_relocatable(file, paths_to_relocate=None):
    if paths_to_relocate is None:
        paths_to_relocate = ...

@alalazo
Copy link
Copy Markdown
Member

alalazo commented Nov 15, 2019

@tjfulle Or the more idiomatic equivalent:

def file_is_relocatable(file, paths_to_relocate=None):
    paths_to_relocate = paths_to_relocate or default_value

becker33 pushed a commit that referenced this pull request Nov 15, 2019
@becker33 becker33 merged commit 3dbafb5 into spack:develop Nov 15, 2019
@tjfulle tjfulle deleted the fix-13754 branch November 15, 2019 23:40
tgamblin added a commit that referenced this pull request Dec 5, 2019
v0.13.2

This release contains major performance improvements for Spack environments, as well as some bugfixes and minor changes.

* allow missing modules if they are blacklisted (#13540)
* speed up environment activation (#13557)
* mirror path works for unknown versions (#13626)
* environments: don't try to modify run-env if a spec is not installed (#13589)
* use semicolons instead of newlines in module/python command (#13904)
* verify.py: os.path.exists exception handling (#13656)
* Document use of the maintainers field (#13479)
* bugfix with config caching (#13755)
* hwloc: added 'master' version pointing at the HEAD of the master branch (#13734)
* config option to allow gpg warning suppression (#13744)
* fix for relative symlinks when relocating binary packages (#13727)
* allow binary relocation of strings in relative binaries (#13724)
tgamblin added a commit that referenced this pull request Dec 5, 2019
v0.13.2

This release contains major performance improvements for Spack environments, as well as some bugfixes and minor changes.

* allow missing modules if they are blacklisted (#13540)
* speed up environment activation (#13557)
* mirror path works for unknown versions (#13626)
* environments: don't try to modify run-env if a spec is not installed (#13589)
* use semicolons instead of newlines in module/python command (#13904)
* verify.py: os.path.exists exception handling (#13656)
* Document use of the maintainers field (#13479)
* bugfix with config caching (#13755)
* hwloc: added 'master' version pointing at the HEAD of the master branch (#13734)
* config option to allow gpg warning suppression (#13744)
* fix for relative symlinks when relocating binary packages (#13727)
* allow binary relocation of strings in relative binaries (#13724)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--config-scope seems to be ignored

6 participants