Skip to content

Conversation

@Flamefire
Copy link
Contributor

@Flamefire Flamefire commented Aug 12, 2024

This use case comes up with e.g. --copy-ec /tmp.

The existing code will see that /tmp exists and has a different UID and hence will use shutil.copyfile which expects the target to not be a folder. It hence fails with "[Errno 21] Is a directory"

Check for that case and make sure the target is always a file, not a directory.

This use case comes up with e.g. `--copy-ec /tmp`.
The existing code will see that `/tmp` exists and has a different UID
and hence will use `shutil.copy_file` which expects the target to not be
a folder. It hence fails with "[Errno 21] Is a directory"
Use `shutil.copy` as was likely intended anyway.
`shutil.copy` tries to change permissions which isn't allowed in the case where it is used.
As we already made sure the target is a file we can use `shutil.copyfile`
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 f28f0b1 into easybuilders:develop Aug 13, 2024
@Flamefire Flamefire deleted the fix-copy branch August 14, 2024 12:35
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