Skip to content

Conversation

@smazmi
Copy link
Contributor

@smazmi smazmi commented Oct 25, 2025

Fixes #4553

The nerdctl-full tarball was incorrectly creating symlinks for all files in libexec/cni/, including documentation files like README.md and LICENSE. This resulted in non-executable files appearing in the bin/ directory as buildkit-cni-README.md and buildkit-cni-LICENSE.

Root Cause

The symlink creation loop in the Dockerfile (line 170) processed all files in /out/libexec/cni/* without filtering:

# Before (buggy)
for f in /out/libexec/cni/*; do ln -s ../libexec/cni/$(basename $f) /out/bin/buildkit-cni-$(basename $f); done

The CNI plugins tarball includes both executable binaries and documentation files with no execute permissions.

Solution

Added file type and permission checks to filter out non-executable files:

# After (fixed)
for f in /out/libexec/cni/*; do [ -x "$f" ] && [ -f "$f" ] && ln -s ../libexec/cni/$(basename $f) /out/bin/buildkit-cni-$(basename $f); done
  • [ -f "$f" ] - ensures it's a regular file
  • [ -x "$f" ] - ensures it has execute permission

Testing

Built and compared the full artifact before and after the fix:

Before:

  • 46 files in bin/
  • Includes: buildkit-cni-README.md and buildkit-cni-LICENSE

After:

  • 44 files in bin/
  • Documentation symlinks removed
  • All 18 CNI plugin executables still correctly symlinked

Impact

  • Removes incorrect symlinks for documentation files
  • Preserves all 18 CNI plugin executables (bandwidth through vrf)
  • Documentation files remain in libexec/cni/ where they belong
  • No other functionality affected

The nerdctl-full tarball was incorrectly creating symlinks for all
files in libexec/cni/, including documentation files like README.md
and LICENSE. This resulted in non-executable files appearing in bin/
as buildkit-cni-README.md and buildkit-cni-LICENSE.

Add executable and regular file checks to the symlink creation loop
to filter out non-executable files. The fix uses [ -x "$f" ] to check
for execute permission and [ -f "$f" ] to ensure it's a regular file,
so only actual CNI plugin binaries are symlinked.

Tested: bin/ file count reduced from 46 to 44 files (removed 2 doc
symlinks). All 18 CNI plugin executables still correctly symlinked.

Fixes containerd#4553

Signed-off-by: Sadique Azmi <sadiquemobaraka5@gmail.com>
Copy link
Member

@fahedouch fahedouch left a comment

Choose a reason for hiding this comment

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

Thanks

@fahedouch fahedouch added this to the v2.1.7 milestone Oct 26, 2025
@smazmi
Copy link
Contributor Author

smazmi commented Oct 26, 2025

Happy to help! :)

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit b439af6 into containerd:main Oct 27, 2025
54 of 56 checks passed
@smazmi smazmi deleted the fix-buildkit-cni-symlink-docs branch October 27, 2025 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nerdctl-full should not symlink buildkit-cni documents to bin

3 participants