mirror of
https://github.com/containerd/containerd.git
synced 2026-11-06 13:27:16 +00:00
Some rootfs may use symlinks for /etc/passwd and /etc/group. For example, NixOS uses absolute symlinks to files in /nix/store. os.Root is not used because it rejects absolute symlinks. The previous code only handled a symlink on the final path. Add a helper to resolve symlinks in every path component with fs.ReadLinkFS. Absolute symlinks are resolved from the rootfs, and the final path is still opened with fs.FS. When tracing a path through symbolic links, the maximum number of links that can be followed is [40][1]. [1]: <https://man7.org/linux/man-pages/man7/path_resolution.7.html> Signed-off-by: Wei Fu <fuweid89@gmail.com>
26 lines
734 B
Go
26 lines
734 B
Go
//go:build windows
|
|
|
|
/*
|
|
Copyright The containerd Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package oci
|
|
|
|
import "io/fs"
|
|
|
|
func resolveInRootFS(_ fs.ReadLinkFS, name string) (string, error) {
|
|
return name, nil
|
|
}
|