Fix xattr copy failures on SELinux systems by kaovilai · Pull Request #6015 · moby/buildkit (original) (raw)

@kaovilai @claude

When copying the buildkit-qemu-emulator binary on systems with SELinux enabled, the copy operation fails with "operation not supported" errors when attempting to copy security.selinux xattrs.

This change adds an XAttrErrorHandler to the copy.Copy call that ignores ENOTSUP errors, allowing the copy to succeed on SELinux-enabled systems.

Fixes moby#5544

🤖 Generated with Claude Code

Signed-off-by: Tiger Kaovilai passawit.kaovilai@gmail.com

Refactor xattr error handler to be a simple function

Changed ignoreSELinuxXAttrErrorHandler from a function that returns a function to a direct error handler function. This simplifies the code while maintaining the same functionality.

🤖 Generated with Claude Code

Signed-off-by: Tiger Kaovilai passawit.kaovilai@gmail.com

Add tests for xattr error handling in exec_binfmt

Signed-off-by: Tiger Kaovilai passawit.kaovilai@gmail.com

Update xattr error handling to ignore ENOTSUP for security.selinux only

Signed-off-by: Tiger Kaovilai passawit.kaovilai@gmail.com

Refactor xattr error handling in exec_binfmt to use a single error handler function

Signed-off-by: Tiger Kaovilai passawit.kaovilai@gmail.com Co-Authored-By: Claude noreply@anthropic.com