-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
helper: Make sure directories are created before they are passed to container engine (podman) #4763
Conversation
infra/helper.py
Outdated
@@ -278,17 +278,29 @@ def get_dockerfile_path(project_name): | |||
|
|||
def _get_corpus_dir(project_name=''): | |||
"""Returns path to /corpus directory for the given project (if specified).""" | |||
return os.path.join(BUILD_DIR, 'corpus', project_name) | |||
path = os.path.join(BUILD_DIR, 'corpus', project_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think 'corpus' is guaranteed to exist. So how about you use
os.makedirs(directory, exist_ok=True)
.
This will make the parent directory and remove the need for checking the directory exists.
Also, could you please update the docstrings of these functions to reflect the fact that they create the directories if they don't already exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right. I think the same issue will be with the other ones, as the only created path is at this moment BUILD_DIR
.
Added also docstrings. I wanted to keep that sort so hope it is still understandable.
Thanks, I just want some small changes before merging this. |
Thanks, looks like line 288 is slightly too long (102 chars instead of 100 according to CI) can you fix and try pushing again please. |
…ontainer engine (podman)
Sorry. Fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As discussed recently in the containers/podman#8513, there is deliberate difference in the CLI of podman and docker in context of creation of missing directories passed as
-v
arguments. While docker happily creates these, podman is not that generous requires the directory structure to be ready in advance.This PR makes sure directories are in place before invoking podman (symlinked from
docker
by default).I am running oss-fuzz with podman for several years, reproducing issues and all works fine aside of couple of quirks that I would like to capture in this and probably some more PRs, if they will be acceptable.