Open
Description
filetools.copy_dir
directly calls shutil.copytree
with symlinks=False
by default which means that symlinks will be followed and their contents copied instead of the symlinks
Also many EasyConfigs use the parameter keepsymlinks
which is also set to False
by default and often forgotten. E.g. for the EasyBlocks MakeCp
and Tarball
I propose to switch the default to copy symlinks as symlinks instead and not resolve them. This has the following benefits:
- Especially for
Tarball
I'd say the expectation is that the result is the same as when directly extracting the tarball to the destination - It works more often. The current default may needlessly copy stuff or even result in full failures. Happened during installation of Spack which has a recursive symlink (due to some localization stuff)
- It works for absolute and broken (at install time) symlinks. I doubt we'd ever want to copy the contents of absolute symlinks, do we? And for broken ones they may be resolved later, e.g. to user home directories or similar
As an alternative and extension to #3784 I'd propose that if the directory tree to be copied contains symlinks, then an explicit choice must be made. I.e.
keepsymlinks
defaults toNone
copy_dir
takessymlinks=None
- If the folder does not contain any symlinks then symlinks is set to any value by
copy_dir
- Otherwise: if
symlinks
isNone
an error is thrown
This at least avoids mistakes by forgetting about that param and won't affect most installations.