Skip to content

Commit a1cd8dd

Browse files
committed
testBreakout: pre-create implied victim directory in breakout test
Pre-create the in-tree "victim" directory used by the leading-slash breakout case so the test remains focused on breakout detection rather than implied directory ownership. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 98b79e1 commit a1cd8dd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

utils_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ func testBreakout(untarFn string, tmpdir string, headers []*tar.Header) error {
5252
if err := os.Mkdir(victim, 0o755); err != nil {
5353
return err
5454
}
55+
// Avoid unrelated ownership failures when the cleaned path remains inside
56+
// dest and requires an implied "victim" directory.
57+
// See https://github.com/moby/go-archive/pull/69#issuecomment-5046037628
58+
if err := os.Mkdir(filepath.Join(dest, "victim"), 0o755); err != nil {
59+
return err
60+
}
5561
hello := filepath.Join(victim, "hello")
5662
helloData, err := time.Now().MarshalText()
5763
if err != nil {

0 commit comments

Comments
 (0)