Skip to content

Add a FollowSymlink option to AddAndCopyOptions to allow disabling deference of symlinks#6760

Open
BenjaminSchubert wants to merge 1 commit into
containers:mainfrom
BenjaminSchubert:bschubert/add-follow-symlink
Open

Add a FollowSymlink option to AddAndCopyOptions to allow disabling deference of symlinks#6760
BenjaminSchubert wants to merge 1 commit into
containers:mainfrom
BenjaminSchubert:bschubert/add-follow-symlink

Conversation

@BenjaminSchubert
Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds the ability to skip the dereference of symlinks when doing a ADD or COPY.

Depends on #6759

How to verify it

See the bats tests provided

Which issue(s) this PR fixes:

Fixes #6737

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add a --no-follow-symlinks option to `buildah add` to skip dereferencing the symlinks when copying

@BenjaminSchubert BenjaminSchubert force-pushed the bschubert/add-follow-symlink branch 3 times, most recently from cb50e3e to d1763a9 Compare April 9, 2026 10:28
@BenjaminSchubert BenjaminSchubert force-pushed the bschubert/add-follow-symlink branch from d1763a9 to df53e2d Compare April 21, 2026 17:56
@BenjaminSchubert BenjaminSchubert marked this pull request as ready for review April 22, 2026 06:36
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 22, 2026
Copy link
Copy Markdown
Member

@nalind nalind left a comment

Choose a reason for hiding this comment

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

Code and tests look good. The docs should probably be a bit more specific, since this doesn't affect symlinks in directories the way a similar flag might for the regular cp command from coreutils.

Comment thread docs/buildah-add.1.md Outdated
@BenjaminSchubert BenjaminSchubert force-pushed the bschubert/add-follow-symlink branch from 00b562e to 5609eed Compare May 4, 2026 08:34
@BenjaminSchubert BenjaminSchubert force-pushed the bschubert/add-follow-symlink branch from 5609eed to 1d34125 Compare May 17, 2026 16:03
Copy link
Copy Markdown
Member

@nalind nalind left a comment

Choose a reason for hiding this comment

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

LGTM
@containers/buildah-maintainers PTAL

Comment thread docs/buildah-add.1.md Outdated
**--no-follow-symlinks**

When a local source is a symbolic link, copy the link as a symbolic link
instead of dereferencing the link and copying the contents of the target
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.

nit: missing .. at the end of the sentence

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, fixed

This allows disabling deference of symlinks when copying files into a
container

Signed-off-by: Benjamin Schubert <bschubert15@bloomberg.net>
@BenjaminSchubert BenjaminSchubert force-pushed the bschubert/add-follow-symlink branch from 1d34125 to 792524a Compare May 19, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Op_File.Actions.FileAction_Copy.FollowSymlink

3 participants