Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve symlink when making log dir writable #4658

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

jfgrimm
Copy link
Member

@jfgrimm jfgrimm commented Sep 26, 2024

When installing EB as a module with EB on Ubuntu 24.04, with read only installdirs, I run into the following crash:

ERROR: Traceback (most recent call last):
  File "/usr/lib/python3.12/shutil.py", line 886, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/eb-tjbo67c2/reprod_20240926154625_739643' -> '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/tools/filetools.py", line 2803, in move_file
    shutil.move(path, target_path)
  File "/usr/lib/python3.12/shutil.py", line 902, in move
    copytree(src, real_dst, copy_function=copy_function,
  File "/usr/lib/python3.12/shutil.py", line 600, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/shutil.py", line 498, in _copytree
    os.makedirs(dst, exist_ok=dirs_exist_ok)
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/main.py", line 137, in build_and_install_software
    (ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/framework/easyblock.py", line 4360, in build_and_install_one
    raise error
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/framework/easyblock.py", line 4354, in build_and_install_one
    move_file(reprod_dir, archive_reprod_dir)
  File "/home/userfs/c/csrv944/.local/lib/python3.12/site-packages/easybuild/tools/filetools.py", line 2806, in move_file
    raise EasyBuildError("Failed to move %s to %s: %s", path, target_path, err)
easybuild.tools.build_log.EasyBuildError: "Failed to move /tmp/eb-tjbo67c2/reprod_20240926154625_739643 to /opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod: [Errno 13] Permission denied: '/opt/york/easybuild/software/EasyBuild/4.9.4/easybuild/reprod'"

This is due to <installdir>/easybuild actually being a symbolic link to <installdir>/local/easybuild thanks to the posix_local debian workaround symlinking (see easybuilders/easybuild-easyblocks#2977). Thus, when the write permissions are changed they end up trying to change the permissions of the symlink itself, not the target of the link.

@jfgrimm jfgrimm added this to the release after 4.9.4 milestone Sep 26, 2024
@jfgrimm
Copy link
Member Author

jfgrimm commented Sep 26, 2024

I believe this should trigger on any system that uses the posix_local scheme when combined with read-only-installdir

Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel merged commit 8ff6ba0 into easybuilders:develop Sep 26, 2024
37 checks passed
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.

2 participants