-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Description
Proposal Details
1.25 AddFS will support resolving symlinks to their target contents,
but it doesn't work for symlinks pointing to locations outside of added fs
func (tw *Writer) AddFS(fsys fs.FS) error {
return fs.WalkDir(fsys, ".", func(name string, d fs.DirEntry, err error) error {Here whole fs is traversed, so fs should be the whole archive contents.
Despite fs not being chroot symlink resolution to targets outside fs doesn't work.
Context
Bazel and rules_oci use symlinks for build actions environment setup, there an OCI image layout can be in one directory but some of base layer blobs be symlink to locations in another directory. If Go archive/tar is used to archive that image AddFS won't be able to package it and fail
Proposal
Replace hardcoded "." walkdir start with a subdirectory string parameter, then it will be possible to archive
symlinks pointing to outside of archive directory, by calling AddFS(os.DirFS("/"), absolutePath) or say AddFS(pwd, subdirectory) when all dependencies are within pwd but archive only needs to contain subdirectory layout