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

Also use cache dir as temporary directory, solving cross-disk copy errors #7

Merged
merged 1 commit into from
May 3, 2024

Conversation

inteon
Copy link
Member

@inteon inteon commented May 3, 2024

Prevent the following error from occurring: panic: failed to fetch targets: rename /tmp/klone-1469327034/modules/boilerplate /home/username/.cache/klone/47952611b91a53de34be5ba9fba781: invalid cross-device link

@cert-manager-prow cert-manager-prow bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 3, 2024
…rors

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@ThatsMrTalbot
Copy link
Contributor

I think this would still panic if the home directory was on a different filesystem to the working directory, since rename does not perform a file copy like cp.

@ThatsMrTalbot
Copy link
Contributor

It looked like dep had a function similar to what we want, it attempts a os.Rename, but falls back to doing a copy
https://github.com/golang/dep/blob/v0.5.4/internal/fs/fs.go#L159

@inteon
Copy link
Member Author

inteon commented May 3, 2024

@ThatsMrTalbot
The temporary folder is moved to the cache folder:

klone/pkg/cache/clone.go

Lines 70 to 72 in e2d88b8

if err := os.Rename(outPath, cachePath); err != nil {
return err
}

The cache folder is copied into the project:

klone/pkg/cache/clone.go

Lines 88 to 90 in e2d88b8

if err := cp.Copy(cachePath, destPath); err != nil {
return err
}

So, the only move we do is from temp to cache, which is what this PR changes.

@ThatsMrTalbot
Copy link
Contributor

Ah, ok. I saw the os.Rename at the bottom and it read like the cache was being copied to the destination

/lgtm

@cert-manager-prow
Copy link
Contributor

@ThatsMrTalbot: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

Ah, ok. I saw the os.Rename at the bottom and it read like the cache was being copied to the destination

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@inteon
Copy link
Member Author

inteon commented May 3, 2024

/approve

@cert-manager-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

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

@cert-manager-prow cert-manager-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 3, 2024
@ThatsMrTalbot
Copy link
Contributor

/lgtm

@cert-manager-prow cert-manager-prow bot added the lgtm Indicates that a PR is ready to be merged. label May 3, 2024
@cert-manager-prow cert-manager-prow bot merged commit 75149d8 into cert-manager:main May 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants