Skip to content

Fix Windows COPY --parents with skip protected system files - #6369

Merged
rzlink merged 1 commit into
moby:masterfrom
rzlink:fix-windows-copy-with-protected-files
Dec 19, 2025
Merged

rzlink merged 1 commit into
moby:masterfrom
rzlink:fix-windows-copy-with-protected-files

Conversation

@rzlink

@rzlink rzlink commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

Fixes copying from Windows container mount roots by detecting and skipping protected system files ('System Volume Information' and 'WcSandboxState') that cause 'Access is denied' errors.

Changes:

  • Added platformCopy wrapper for Windows copy operations
  • Implemented manual directory enumeration to skip protected files
  • Enabled test case testCopyRelativeParents and testCopyParentsMissingDirectory on Windows

The fix is Windows-specific and only activates when copying from mount roots where protected files exist. All other copy operations use the standard path.

Issue: Resolves #6635 [v0.26] WCOW: Fix COPY --parents tests

@tonistiigi tonistiigi 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.

Could this be simplified when integrating directly to copy.Copy where it already calls RootPath and ReadDir ?

@rzlink

rzlink commented Nov 25, 2025

Copy link
Copy Markdown
Collaborator Author

Could this be simplified when integrating directly to copy.Copy where it already calls RootPath and ReadDir ?

Yes, it will simplify to:

func platformCopy(ctx context.Context, srcRoot string, src string, destRoot string, dest string, opt ...copy.Opt) error {
	// Add Windows protected files to exclude patterns
	opt = append(opt,
		copy.WithExcludePattern("System Volume Information"),
		copy.WithExcludePattern("WcSandboxState"),
	)
	return copy.Copy(ctx, srcRoot, src, destRoot, dest, opt...)
}

@rzlink
rzlink force-pushed the fix-windows-copy-with-protected-files branch from a5aebfe to 1ddae48 Compare December 11, 2025 23:17
@github-actions github-actions Bot added the area/dependencies Pull requests that update a dependency file label Dec 11, 2025
@rzlink
rzlink force-pushed the fix-windows-copy-with-protected-files branch from 1ddae48 to 8113867 Compare December 11, 2025 23:40
Fixes copying from Windows container mount roots by detecting and skipping
protected system files ('System Volume Information' and 'WcSandboxState')
that cause 'Access is denied' errors.

Changes:
- Added platformCopy wrapper for Windows copy operations
- Implemented manual directory enumeration to skip protected files
- Enabled test case testCopyRelativeParents and testCopyParentsMissingDirectory on Windows

The fix is Windows-specific and only activates when copying from mount roots
where protected files exist. All other copy operations use the standard path.

Issue: Resolves moby#6635 [v0.26] WCOW: Fix COPY --parents tests
Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>
@rzlink
rzlink force-pushed the fix-windows-copy-with-protected-files branch from 8113867 to 32850da Compare December 16, 2025 18:47
@rzlink
rzlink requested a review from tonistiigi December 16, 2025 22:29
@rzlink
rzlink merged commit 6ef55fa into moby:master Dec 19, 2025
@rzlink
rzlink deleted the fix-windows-copy-with-protected-files branch December 19, 2025 17:49
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.

3 participants