From 3193650f130b67471afb58252a7d422c848b9bdd Mon Sep 17 00:00:00 2001 From: June Rhodes <504826+hach-que@users.noreply.github.com> Date: Fri, 17 Mar 2023 05:12:43 +1100 Subject: [PATCH] fix: 'failed to resolve symlink' error messaging This error message currently does not provide useful information, because the `src` value that is interleaved will have been overridden by the call to `osi.ResolveSymbolicLink`. This stores the original `src` before the `osi.ResolveSymbolicLink` call so the error message can be useful. Signed-off-by: June Rhodes <504826+hach-que@users.noreply.github.com> --- pkg/cri/opts/spec_windows_opts.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/cri/opts/spec_windows_opts.go b/pkg/cri/opts/spec_windows_opts.go index b613c9886..5fafb7e67 100644 --- a/pkg/cri/opts/spec_windows_opts.go +++ b/pkg/cri/opts/spec_windows_opts.go @@ -67,9 +67,10 @@ func parseMount(osi osinterface.OS, mount *runtime.Mount) (*runtimespec.Mount, e } } var err error + originalSrc := src src, err = osi.ResolveSymbolicLink(src) if err != nil { - return nil, fmt.Errorf("failed to resolve symlink %q: %w", src, err) + return nil, fmt.Errorf("failed to resolve symlink '%q' (resolved to '%q'): %w", originalSrc, src, err) } // hcsshim requires clean path, especially '/' -> '\'. Additionally, // for the destination, absolute paths should have the C: prefix.