Skip to content

overlay: refactor getStagingDir helper #2107

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

Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Sep 24, 2024

simplify the implementation of getStagingDir() to just create a new staging directory and drop the check whether the correct staging base directory as anyway the rename operation would fail later.

Closes: #2092

Copy link
Contributor

openshift-ci bot commented Sep 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@giuseppe giuseppe force-pushed the refactor-get-staging-dir-code branch from 0bd5b74 to ceab862 Compare September 24, 2024 14:36
@giuseppe
Copy link
Member Author

@rhatdan thanks for the review. Addressed the comments

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

This refactoring is correct as is, but it also exposes lingering questions…

func (d *Driver) dir2(id string, useImageStore bool) (string, string, bool) {
var homedir string

func (d *Driver) homeDir(useImageStore bool) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’m confused by the terminology. We have d.homeDir and d.home, and those are different values with different semantics.

What do the values actually mean?

(I mean, I’m generally confused and scared by these code paths and options and indirections. This is just a very clear manifestation of my general confusion. But, still.)


pruneStagingDirectories hard-codes filepath.Join(d.home, stagingDir), not using the useImageStore condition. Which of the two is correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, I've renamed the function, hopefully it is clearer now.

pruneStagingDirectories was using the wrong location, I've fixed this too

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am still generally confused ;), but making the names are much more distinct does help.

@giuseppe giuseppe marked this pull request as draft September 24, 2024 18:52
simplify the implementation of getStagingDir() to just create a new
staging directory and drop the check whether the correct staging base
directory as anyway the rename operation would fail later.

Closes: containers#2092

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe giuseppe force-pushed the refactor-get-staging-dir-code branch from ceab862 to 7f30233 Compare September 24, 2024 19:01
@giuseppe giuseppe changed the title overlay: refactory getStagingDir helper overlay: refactor getStagingDir helper Sep 24, 2024
@giuseppe giuseppe marked this pull request as ready for review September 24, 2024 19:02
@rhatdan
Copy link
Member

rhatdan commented Sep 24, 2024

LGTM

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks again!

@openshift-ci openshift-ci bot added the lgtm label Sep 25, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 42f7874 into containers:main Sep 25, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix d.getStagingDir("")
3 participants