Skip to content

copytool: report a bad path instead of a missing tool - #5337

Open
jandubois wants to merge 1 commit into
lima-vm:masterfrom
jandubois:copytool-parse-error
Open

copytool: report a bad path instead of a missing tool#5337
jandubois wants to merge 1 commit into
lima-vm:masterfrom
jandubois:copytool-parse-error

Conversation

@jandubois

@jandubois jandubois commented Jul 26, 2026

Copy link
Copy Markdown
Member

A path naming an instance that does not exist reached the user as "neither rsync nor scp found on host", because the auto backend discarded the parse error, skipped rsync, and reported whatever the scp fallback said. Only a host without scp saw that message; everywhere else the auto backend built the copy tool without complaint and the real error surfaced later, from the copy command itself. The explicit rsync backend reduced the same error to "rsync not available on guest(s)".

The fallback message no longer guesses which tool is missing, since rsync may well have been found and rejected for another reason.

The fix touches no Windows code and is independent of the native Windows OpenSSH series, so it can merge in any order. But #5299 appends a test to the end of pkg/copytool/copytool_test.go too, so whichever lands second needs a one-line rebase there.

Assisted-by: Claude Opus 5

A path naming an instance that does not exist reached the user as
"neither rsync nor scp found on host", because the auto backend
discarded the parse error, skipped rsync, and reported whatever the scp
fallback said. Only a host without scp saw that message; everywhere else
the auto backend built the copy tool without complaint and the real
error surfaced later, from the copy command itself. The explicit rsync
backend reduced the same error to "rsync not available on guest(s)".

The fallback message no longer guesses which tool is missing, since
rsync may well have been found and rejected for another reason.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
@jandubois
jandubois force-pushed the copytool-parse-error branch from 749ad63 to b2eb831 Compare July 27, 2026 05:35
@jandubois

Copy link
Copy Markdown
Member Author

Ready for review.

AI review: https://jandubois.github.io/lima/20260726-220537-pr-5337.html

The commit message has been updated, and the branch has been rebased since the AI review, but the changes are identical. I don't think any findings are actionable.

@jandubois
jandubois marked this pull request as ready for review July 27, 2026 05:40
@AkihiroSuda AkihiroSuda added this to the v2.3.0 milestone Aug 1, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This kind of PR could be reviewed easier if the console output were attached

paths := []string{"nonexistent-instance-for-test:/tmp/x", "/tmp/y"}

_, err := New(t.Context(), string(BackendAuto), paths, &Options{})
assert.ErrorContains(t, err, "instance `nonexistent-instance-for-test`")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should assert the reason of the error, not just the instance name involved in the error?

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.

2 participants