| 1 | package chrootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/" |
| 5 | "io/fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 7 | "pathscip-go gomod github.com/golang/go/src go1.25.0 path/" |
| 8 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 9 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 10 | "syscallscip-go gomod github.com/golang/go/src go1.25.0 syscall/" |
| 11 | |
| 12 | "github.com/go-git/go-billy/v6scip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/" |
| 13 | "github.com/go-git/go-billy/v6/helper/polyfillscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/" |
| 14 | ) |
| 15 | |
| 16 | // ChrootHelper is a helper to implement billy.Chroot. It is not a security |
| 17 | // boundary; callers that need containment should use a filesystem implementation |
| 18 | // that enforces paths at the OS boundary instead. |
| 19 | type ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper# struct { //nolint |
| 20 | underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying. billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem# |
| 21 | basescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#base. string |
| 22 | } |
| 23 | |
| 24 | const maxFollowedSymlinksscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/maxFollowedSymlinks. = 8 // Aligns with POSIX_SYMLOOP_MAX |
| 25 | |
| 26 | // New creates a new filesystem wrapping the given 'fs', rooted at base. |
| 27 | // All paths passed to the returned filesystem are joined with base before |
| 28 | // being forwarded to the underlying filesystem. |
| 29 | func Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/New().(fs billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#, base string) billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem# { |
| 30 | return &ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#{ |
| 31 | underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying.: polyfillscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/.Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/New().(fs), |
| 32 | basescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#base.: base, |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(filename string) (string, error) { |
| 37 | if isCrossBoundariesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/isCrossBoundaries().(filename) { |
| 38 | return "", billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.ErrCrossedBoundaryscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/ErrCrossedBoundary. |
| 39 | } |
| 40 | |
| 41 | return fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), filename), nil |
| 42 | } |
| 43 | |
| 44 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(filename string, followFinal bool, op string) (string, error) { |
| 45 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(filename) |
| 46 | if err != nil { |
| 47 | return "", err |
| 48 | } |
| 49 | |
| 50 | sl, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 51 | if !ok { |
| 52 | return fullpath, nil |
| 53 | } |
| 54 | |
| 55 | rel, err := fs.relativeToRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#relativeToRoot().(fullpath) |
| 56 | if err != nil { |
| 57 | return "", err |
| 58 | } |
| 59 | |
| 60 | fullpath, err = fs.resolveFollowedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#resolveFollowedPath().(rel, followFinal, op, sl) |
| 61 | if errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Isscip-go gomod github.com/golang/go/src go1.25.0 errors/Is().(err, billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.ErrNotSupportedscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/ErrNotSupported.) { |
| 62 | return fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(filename) |
| 63 | } |
| 64 | |
| 65 | return fullpath, err |
| 66 | } |
| 67 | |
| 68 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) resolveFollowedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#resolveFollowedPath().(rel string, followFinal bool, op string, sl billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) (string, error) { |
| 69 | if rel == "" { |
| 70 | return fs.resolveFollowedRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#resolveFollowedRoot().(followFinal, op, sl) |
| 71 | } |
| 72 | |
| 73 | parts := splitRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/splitRelativePath().(rel) |
| 74 | resolved := "" |
| 75 | followed := 0 |
| 76 | |
| 77 | for len(parts) > 0 { |
| 78 | part := parts[0] |
| 79 | parts = parts[1:] |
| 80 | |
| 81 | currentRel := joinRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/joinRelativePath().(resolved, part) |
| 82 | currentPath := fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), currentRel) |
| 83 | if len(parts) == 0 && !followFinal { |
| 84 | return currentPath, nil |
| 85 | } |
| 86 | |
| 87 | fi, err := sl.Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Lstat.(currentPath) |
| 88 | if err != nil { |
| 89 | if osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { |
| 90 | return fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), joinRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/joinRelativePath().(append([]string{currentRel}, parts...)...)), nil |
| 91 | } |
| 92 | return "", err |
| 93 | } |
| 94 | |
| 95 | if fi.Modescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Mode().()&osscip-go gomod github.com/golang/go/src go1.25.0 os/.ModeSymlinkscip-go gomod github.com/golang/go/src go1.25.0 os/ModeSymlink. == 0 { |
| 96 | resolved = currentRel |
| 97 | continue |
| 98 | } |
| 99 | |
| 100 | followed++ |
| 101 | if followed > maxFollowedSymlinksscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/maxFollowedSymlinks. { |
| 102 | return "", symlinkLoopErrorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/symlinkLoopError().(op, currentPath) |
| 103 | } |
| 104 | |
| 105 | target, err := sl.Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Readlink.(currentPath) |
| 106 | if err != nil { |
| 107 | return "", err |
| 108 | } |
| 109 | |
| 110 | targetRel, err := fs.linkTargetRelscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#linkTargetRel().(currentPath, target) |
| 111 | if err != nil { |
| 112 | return "", err |
| 113 | } |
| 114 | if targetRel == currentRel { |
| 115 | return "", symlinkLoopErrorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/symlinkLoopError().(op, currentPath) |
| 116 | } |
| 117 | |
| 118 | parts = append(splitRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/splitRelativePath().(targetRel), parts...) |
| 119 | resolved = "" |
| 120 | } |
| 121 | |
| 122 | return fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), resolved), nil |
| 123 | } |
| 124 | |
| 125 | func symlinkLoopErrorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/symlinkLoopError().(op, path string) error { |
| 126 | return &osscip-go gomod github.com/golang/go/src go1.25.0 os/.PathErrorscip-go gomod github.com/golang/go/src go1.25.0 os/PathError#{Opscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/PathError#Op.: op, Pathscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/PathError#Path.: path, Errscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/PathError#Err.: syscallscip-go gomod github.com/golang/go/src go1.25.0 syscall/.ELOOPscip-go gomod github.com/golang/go/src go1.25.0 syscall/ELOOP.} |
| 127 | } |
| 128 | |
| 129 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) resolveFollowedRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#resolveFollowedRoot().(followFinal bool, op string, sl billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) (string, error) { |
| 130 | root := fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), "") |
| 131 | if !followFinal { |
| 132 | return root, nil |
| 133 | } |
| 134 | |
| 135 | fi, err := sl.Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Lstat.(root) |
| 136 | if err != nil { |
| 137 | if osscip-go gomod github.com/golang/go/src go1.25.0 os/.IsNotExistscip-go gomod github.com/golang/go/src go1.25.0 os/IsNotExist().(err) { |
| 138 | return root, nil |
| 139 | } |
| 140 | return "", err |
| 141 | } |
| 142 | |
| 143 | if fi.Modescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileInfo#Mode().()&osscip-go gomod github.com/golang/go/src go1.25.0 os/.ModeSymlinkscip-go gomod github.com/golang/go/src go1.25.0 os/ModeSymlink. == 0 { |
| 144 | return root, nil |
| 145 | } |
| 146 | |
| 147 | target, err := sl.Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Readlink.(root) |
| 148 | if err != nil { |
| 149 | return "", err |
| 150 | } |
| 151 | |
| 152 | targetRel, err := fs.linkTargetRelscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#linkTargetRel().(root, target) |
| 153 | if err != nil { |
| 154 | return root, err |
| 155 | } |
| 156 | if targetRel == "" { |
| 157 | return "", symlinkLoopErrorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/symlinkLoopError().(op, root) |
| 158 | } |
| 159 | |
| 160 | return fs.resolveFollowedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#resolveFollowedPath().(targetRel, followFinal, op, sl) |
| 161 | } |
| 162 | |
| 163 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) relativeToRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#relativeToRoot().(filename string) (string, error) { |
| 164 | rel, err := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Relscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Rel().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().()), filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(filename)) |
| 165 | if err != nil || isCrossBoundariesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/isCrossBoundaries().(rel) { |
| 166 | return "", billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.ErrCrossedBoundaryscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/ErrCrossedBoundary. |
| 167 | } |
| 168 | |
| 169 | if rel == "." { |
| 170 | return "", nil |
| 171 | } |
| 172 | return rel, nil |
| 173 | } |
| 174 | |
| 175 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) linkTargetRelscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#linkTargetRel().(linkPath, target string) (string, error) { |
| 176 | target = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(target) |
| 177 | if filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.IsAbsscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/IsAbs().(target) || stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(target, string(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator.)) { |
| 178 | return fs.relativeToRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#relativeToRoot().(target) |
| 179 | } |
| 180 | |
| 181 | return fs.relativeToRootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#relativeToRoot().(fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(linkPath), target)) |
| 182 | } |
| 183 | |
| 184 | func splitRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/splitRelativePath().(filename string) []string { |
| 185 | filename = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(filename) |
| 186 | if filename == "" || filename == "." { |
| 187 | return nil |
| 188 | } |
| 189 | |
| 190 | return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/ToSlash().(filename), "/") |
| 191 | } |
| 192 | |
| 193 | func joinRelativePathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/joinRelativePath().(elem ...string) string { |
| 194 | parts := make([]string, 0, len(elem)) |
| 195 | for _, part := range elem { |
| 196 | if part == "" || part == "." { |
| 197 | continue |
| 198 | } |
| 199 | parts = append(parts, part) |
| 200 | } |
| 201 | |
| 202 | if len(parts) == 0 { |
| 203 | return "" |
| 204 | } |
| 205 | return filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(parts...) |
| 206 | } |
| 207 | |
| 208 | func isCreateExclusivescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/isCreateExclusive().(flag int) bool { |
| 209 | return flag&osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_CREATEscip-go gomod github.com/golang/go/src go1.25.0 os/O_CREATE. != 0 && flag&osscip-go gomod github.com/golang/go/src go1.25.0 os/.O_EXCLscip-go gomod github.com/golang/go/src go1.25.0 os/O_EXCL. != 0 |
| 210 | } |
| 211 | |
| 212 | func isCrossBoundariesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/isCrossBoundaries().(name string) bool { |
| 213 | name = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/ToSlash().(name) |
| 214 | name = stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimLeftscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimLeft().(name, "/") |
| 215 | name = pathscip-go gomod github.com/golang/go/src go1.25.0 path/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 path/Clean().(name) |
| 216 | |
| 217 | return name == ".." || stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(name, "../") |
| 218 | } |
| 219 | |
| 220 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Createscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Create().(filename string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 221 | fullpath, err := fs.followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(filename, true, "create") |
| 222 | if err != nil { |
| 223 | return nil, err |
| 224 | } |
| 225 | |
| 226 | f, err := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Createscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Create.(fullpath) |
| 227 | if err != nil { |
| 228 | return nil, err |
| 229 | } |
| 230 | |
| 231 | return newFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/newFile().(fs, f, filename), nil |
| 232 | } |
| 233 | |
| 234 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Openscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Open().(filename string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 235 | fullpath, err := fs.followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(filename, true, "open") |
| 236 | if err != nil { |
| 237 | return nil, err |
| 238 | } |
| 239 | |
| 240 | f, err := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Openscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Open.(fullpath) |
| 241 | if err != nil { |
| 242 | return nil, err |
| 243 | } |
| 244 | |
| 245 | return newFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/newFile().(fs, f, filename), nil |
| 246 | } |
| 247 | |
| 248 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) OpenFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#OpenFile().(filename string, flag int, mode fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 249 | fullpath, err := fs.followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(filename, !isCreateExclusivescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/isCreateExclusive().(flag), "open") |
| 250 | if err != nil { |
| 251 | return nil, err |
| 252 | } |
| 253 | |
| 254 | f, err := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..OpenFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#OpenFile.(fullpath, flag, mode) |
| 255 | if err != nil { |
| 256 | return nil, err |
| 257 | } |
| 258 | |
| 259 | return newFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/newFile().(fs, f, filename), nil |
| 260 | } |
| 261 | |
| 262 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Statscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Stat().(filename string) (osscip-go gomod github.com/golang/go/src go1.25.0 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.0 os/FileInfo#, error) { |
| 263 | fullpath, err := fs.followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(filename, true, "stat") |
| 264 | if err != nil { |
| 265 | return nil, err |
| 266 | } |
| 267 | |
| 268 | fi, err := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Statscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Stat.(fullpath) |
| 269 | if err != nil { |
| 270 | return nil, err |
| 271 | } |
| 272 | return fileInfoscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#{FileInfoscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#FileInfo.: fi, namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#name.: filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(filename)}, nil |
| 273 | } |
| 274 | |
| 275 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Renamescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Rename().(from, to string) error { |
| 276 | var err error |
| 277 | from, err = fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(from) |
| 278 | if err != nil { |
| 279 | return err |
| 280 | } |
| 281 | |
| 282 | to, err = fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(to) |
| 283 | if err != nil { |
| 284 | return err |
| 285 | } |
| 286 | |
| 287 | return fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Renamescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Rename.(from, to) |
| 288 | } |
| 289 | |
| 290 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Removescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Remove().(path string) error { |
| 291 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(path) |
| 292 | if err != nil { |
| 293 | return err |
| 294 | } |
| 295 | |
| 296 | return fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Removescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Remove.(fullpath) |
| 297 | } |
| 298 | |
| 299 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(elem ...string) string { |
| 300 | return fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Join.(elem...) |
| 301 | } |
| 302 | |
| 303 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) TempFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#TempFile().(dir, prefix string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 304 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(dir) |
| 305 | if err != nil { |
| 306 | return nil, err |
| 307 | } |
| 308 | |
| 309 | tf, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.TempFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/TempFile#) |
| 310 | if !ok { |
| 311 | return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.TempFile") |
| 312 | } |
| 313 | |
| 314 | f, err := tf.TempFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/TempFile#TempFile.(fullpath, prefix) |
| 315 | if err != nil { |
| 316 | return nil, err |
| 317 | } |
| 318 | |
| 319 | return newFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/newFile().(fs, f, fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(dir, filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(f.Namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#Name.()))), nil |
| 320 | } |
| 321 | |
| 322 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) ReadDirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#ReadDir().(path string) ([]fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.DirEntryscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#, error) { |
| 323 | fullpath, err := fs.followedPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#followedPath().(path, true, "readdir") |
| 324 | if err != nil { |
| 325 | return nil, err |
| 326 | } |
| 327 | |
| 328 | d, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Dirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#) |
| 329 | if !ok { |
| 330 | return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Dir") |
| 331 | } |
| 332 | return d.ReadDirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#ReadDir.(fullpath) |
| 333 | } |
| 334 | |
| 335 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) MkdirAllscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#MkdirAll().(filename string, perm fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#) error { |
| 336 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(filename) |
| 337 | if err != nil { |
| 338 | return err |
| 339 | } |
| 340 | |
| 341 | d, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Dirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#) |
| 342 | if !ok { |
| 343 | return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Dir") |
| 344 | } |
| 345 | return d.MkdirAllscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#MkdirAll.(fullpath, perm) |
| 346 | } |
| 347 | |
| 348 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Lstat().(filename string) (osscip-go gomod github.com/golang/go/src go1.25.0 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.0 os/FileInfo#, error) { |
| 349 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(filename) |
| 350 | if err != nil { |
| 351 | return nil, err |
| 352 | } |
| 353 | |
| 354 | sl, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 355 | if !ok { |
| 356 | return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Symlink") |
| 357 | } |
| 358 | return sl.Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Lstat.(fullpath) |
| 359 | } |
| 360 | |
| 361 | // Symlink creates link with the given target. Slashes in target are |
| 362 | // normalised to the host separator. Absolute targets are rewritten to be |
| 363 | // rooted under the chroot base before being stored, so that the link is |
| 364 | // resolvable when the chroot is reopened from a different working directory. |
| 365 | // Relative targets are stored as provided. |
| 366 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Symlink().(target, link string) error { |
| 367 | target = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(target) |
| 368 | |
| 369 | // only rewrite target if it's already absolute |
| 370 | if filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.IsAbsscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/IsAbs().(target) || stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(target, string(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator.)) { |
| 371 | target = fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Join().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().(), target) |
| 372 | target = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(target)) |
| 373 | } |
| 374 | |
| 375 | link, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(link) |
| 376 | if err != nil { |
| 377 | return err |
| 378 | } |
| 379 | |
| 380 | sl, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 381 | if !ok { |
| 382 | return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Symlink") |
| 383 | } |
| 384 | return sl.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Symlink.(target, link) |
| 385 | } |
| 386 | |
| 387 | // Readlink returns the target stored for link. |
| 388 | // |
| 389 | // Relative targets are returned unchanged, preserving the original separators |
| 390 | // as written by [ChrootHelper.Symlink] or the underlying filesystem. Absolute |
| 391 | // targets that resolve under the chroot base are translated back to be |
| 392 | // absolute relative to the chroot (using the host path separator), so callers |
| 393 | // see paths in the chroot's coordinate system rather than the underlying |
| 394 | // filesystem's. Absolute targets that resolve outside the base are returned |
| 395 | // as written. |
| 396 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Readlink().(link string) (string, error) { |
| 397 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(link) |
| 398 | if err != nil { |
| 399 | return "", err |
| 400 | } |
| 401 | |
| 402 | sl, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 403 | if !ok { |
| 404 | return "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Symlink") |
| 405 | } |
| 406 | |
| 407 | target, err := sl.Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Readlink.(fullpath) |
| 408 | if err != nil { |
| 409 | return "", err |
| 410 | } |
| 411 | |
| 412 | rawTarget := target |
| 413 | target = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(target) |
| 414 | if filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator. == '\\' && len(target) >= 3 && |
| 415 | target[0] == '\\' && target[2] == ':' && |
| 416 | filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.VolumeNamescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/VolumeName().(fs.basescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#base.) != "" { |
| 417 | target = target[1:] |
| 418 | } |
| 419 | |
| 420 | if !filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.IsAbsscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/IsAbs().(target) && !stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(target, string(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator.)) { |
| 421 | return rawTarget, nil |
| 422 | } |
| 423 | |
| 424 | target, err = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Relscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Rel().(fs.basescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#base., target) |
| 425 | if err != nil { |
| 426 | return "", err |
| 427 | } |
| 428 | |
| 429 | return string(osscip-go gomod github.com/golang/go/src go1.25.0 os/.PathSeparatorscip-go gomod github.com/golang/go/src go1.25.0 os/PathSeparator.) + target, nil |
| 430 | } |
| 431 | |
| 432 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Chmodscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Chmod().(path string, mode fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#) error { |
| 433 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(path) |
| 434 | if err != nil { |
| 435 | return err |
| 436 | } |
| 437 | |
| 438 | c, ok := fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Chmodscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Chmod#) |
| 439 | if !ok { |
| 440 | return errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Chmod") |
| 441 | } |
| 442 | return c.Chmodscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Chmod#Chmod.(fullpath, mode) |
| 443 | } |
| 444 | |
| 445 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Chrootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Chroot().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem#, error) { |
| 446 | fullpath, err := fs.underlyingPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlyingPath().(path) |
| 447 | if err != nil { |
| 448 | return nil, err |
| 449 | } |
| 450 | |
| 451 | return Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/New().(fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying., fullpath), nil |
| 452 | } |
| 453 | |
| 454 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Root().() string { |
| 455 | return fs.basescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#base. |
| 456 | } |
| 457 | |
| 458 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Underlying().() billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic# { |
| 459 | return fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying. |
| 460 | } |
| 461 | |
| 462 | // Capabilities implements the Capable interface. |
| 463 | func (fs *ChrootHelperscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#) Capabilitiesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#Capabilities().() billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Capabilityscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Capability# { |
| 464 | return billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Capabilitiesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Capabilities().(fs.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/ChrootHelper#underlying.) |
| 465 | } |
| 466 | |
| 467 | type filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file# struct { |
| 468 | billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#File. |
| 469 | namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#name. string |
| 470 | } |
| 471 | |
| 472 | type fileInfoscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo# struct { |
| 473 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.FileInfoscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#FileInfo. |
| 474 | namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#name. string |
| 475 | } |
| 476 | |
| 477 | func newFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/newFile().(fs billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem#, f billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, filename string) billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File# { |
| 478 | filename = fs.Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Join.(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Chroot#Root.(), filename) |
| 479 | filename, _ = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Relscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Rel().(fs.Rootscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Chroot#Root.(), filename) |
| 480 | |
| 481 | return &filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#{ |
| 482 | Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#File.: f, |
| 483 | namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#name.: filename, |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | func (f *filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#) Namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#Name().() string { |
| 488 | return f.namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/file#name. |
| 489 | } |
| 490 | |
| 491 | func (fi fileInfoscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#) Namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#Name().() string { |
| 492 | return fi.namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/chroot`/fileInfo#name. |
| 493 | } |