|
@@ -197,6 +197,7 @@ func TestExtensionUncompressed(t *testing.T) {
|
|
|
t.Fatalf("The extension of an uncompressed archive should be 'tar'.")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
func TestExtensionBzip2(t *testing.T) {
|
|
|
compression := Bzip2
|
|
|
output := compression.Extension()
|
|
@@ -204,6 +205,7 @@ func TestExtensionBzip2(t *testing.T) {
|
|
|
t.Fatalf("The extension of a bzip2 archive should be 'tar.bz2'")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
func TestExtensionGzip(t *testing.T) {
|
|
|
compression := Gzip
|
|
|
output := compression.Extension()
|
|
@@ -211,6 +213,7 @@ func TestExtensionGzip(t *testing.T) {
|
|
|
t.Fatalf("The extension of a gzip archive should be 'tar.gz'")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
func TestExtensionXz(t *testing.T) {
|
|
|
compression := Xz
|
|
|
output := compression.Extension()
|
|
@@ -218,6 +221,7 @@ func TestExtensionXz(t *testing.T) {
|
|
|
t.Fatalf("The extension of a xz archive should be 'tar.xz'")
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
func TestExtensionZstd(t *testing.T) {
|
|
|
compression := Zstd
|
|
|
output := compression.Extension()
|
|
@@ -330,7 +334,7 @@ func TestUntarPath(t *testing.T) {
|
|
|
os.Create(filepath.Join(tmpFolder, "src"))
|
|
|
|
|
|
destFolder := filepath.Join(tmpFolder, "dest")
|
|
|
- err = os.MkdirAll(destFolder, 0740)
|
|
|
+ err = os.MkdirAll(destFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatalf("Fail to create the destination file")
|
|
|
}
|
|
@@ -418,13 +422,13 @@ func TestUntarPathWithDestinationSrcFileAsFolder(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
destFolder := filepath.Join(tmpFolder, "dest")
|
|
|
- err = os.MkdirAll(destFolder, 0740)
|
|
|
+ err = os.MkdirAll(destFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatalf("Fail to create the destination folder")
|
|
|
}
|
|
|
// Let's create a folder that will has the same path as the extracted file (from tar)
|
|
|
destSrcFileAsFolder := filepath.Join(destFolder, srcFileU)
|
|
|
- err = os.MkdirAll(destSrcFileAsFolder, 0740)
|
|
|
+ err = os.MkdirAll(destSrcFileAsFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -441,7 +445,7 @@ func TestCopyWithTarInvalidSrc(t *testing.T) {
|
|
|
}
|
|
|
destFolder := filepath.Join(tempFolder, "dest")
|
|
|
invalidSrc := filepath.Join(tempFolder, "doesnotexists")
|
|
|
- err = os.MkdirAll(destFolder, 0740)
|
|
|
+ err = os.MkdirAll(destFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -459,7 +463,7 @@ func TestCopyWithTarInexistentDestWillCreateIt(t *testing.T) {
|
|
|
}
|
|
|
srcFolder := filepath.Join(tempFolder, "src")
|
|
|
inexistentDestFolder := filepath.Join(tempFolder, "doesnotexists")
|
|
|
- err = os.MkdirAll(srcFolder, 0740)
|
|
|
+ err = os.MkdirAll(srcFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -483,15 +487,15 @@ func TestCopyWithTarSrcFile(t *testing.T) {
|
|
|
dest := filepath.Join(folder, "dest")
|
|
|
srcFolder := filepath.Join(folder, "src")
|
|
|
src := filepath.Join(folder, filepath.Join("src", "src"))
|
|
|
- err = os.MkdirAll(srcFolder, 0740)
|
|
|
+ err = os.MkdirAll(srcFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- err = os.MkdirAll(dest, 0740)
|
|
|
+ err = os.MkdirAll(dest, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- os.WriteFile(src, []byte("content"), 0777)
|
|
|
+ os.WriteFile(src, []byte("content"), 0o777)
|
|
|
err = defaultCopyWithTar(src, dest)
|
|
|
if err != nil {
|
|
|
t.Fatalf("archiver.CopyWithTar shouldn't throw an error, %s.", err)
|
|
@@ -512,15 +516,15 @@ func TestCopyWithTarSrcFolder(t *testing.T) {
|
|
|
defer os.RemoveAll(folder)
|
|
|
dest := filepath.Join(folder, "dest")
|
|
|
src := filepath.Join(folder, filepath.Join("src", "folder"))
|
|
|
- err = os.MkdirAll(src, 0740)
|
|
|
+ err = os.MkdirAll(src, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- err = os.MkdirAll(dest, 0740)
|
|
|
+ err = os.MkdirAll(dest, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- os.WriteFile(filepath.Join(src, "file"), []byte("content"), 0777)
|
|
|
+ os.WriteFile(filepath.Join(src, "file"), []byte("content"), 0o777)
|
|
|
err = defaultCopyWithTar(src, dest)
|
|
|
if err != nil {
|
|
|
t.Fatalf("archiver.CopyWithTar shouldn't throw an error, %s.", err)
|
|
@@ -539,7 +543,7 @@ func TestCopyFileWithTarInvalidSrc(t *testing.T) {
|
|
|
}
|
|
|
defer os.RemoveAll(tempFolder)
|
|
|
destFolder := filepath.Join(tempFolder, "dest")
|
|
|
- err = os.MkdirAll(destFolder, 0740)
|
|
|
+ err = os.MkdirAll(destFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -581,11 +585,11 @@ func TestCopyFileWithTarSrcFolder(t *testing.T) {
|
|
|
defer os.RemoveAll(folder)
|
|
|
dest := filepath.Join(folder, "dest")
|
|
|
src := filepath.Join(folder, "srcfolder")
|
|
|
- err = os.MkdirAll(src, 0740)
|
|
|
+ err = os.MkdirAll(src, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- err = os.MkdirAll(dest, 0740)
|
|
|
+ err = os.MkdirAll(dest, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
@@ -604,15 +608,15 @@ func TestCopyFileWithTarSrcFile(t *testing.T) {
|
|
|
dest := filepath.Join(folder, "dest")
|
|
|
srcFolder := filepath.Join(folder, "src")
|
|
|
src := filepath.Join(folder, filepath.Join("src", "src"))
|
|
|
- err = os.MkdirAll(srcFolder, 0740)
|
|
|
+ err = os.MkdirAll(srcFolder, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- err = os.MkdirAll(dest, 0740)
|
|
|
+ err = os.MkdirAll(dest, 0o740)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- os.WriteFile(src, []byte("content"), 0777)
|
|
|
+ os.WriteFile(src, []byte("content"), 0o777)
|
|
|
err = defaultCopyWithTar(src, dest+"/")
|
|
|
if err != nil {
|
|
|
t.Fatalf("archiver.CopyFileWithTar shouldn't throw an error, %s.", err)
|
|
@@ -735,13 +739,13 @@ func TestTarUntar(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
defer os.RemoveAll(origin)
|
|
|
- if err := os.WriteFile(filepath.Join(origin, "1"), []byte("hello world"), 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(origin, "1"), []byte("hello world"), 0o700); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if err := os.WriteFile(filepath.Join(origin, "2"), []byte("welcome!"), 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(origin, "2"), []byte("welcome!"), 0o700); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if err := os.WriteFile(filepath.Join(origin, "3"), []byte("will be ignored"), 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(origin, "3"), []byte("will be ignored"), 0o700); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -753,7 +757,6 @@ func TestTarUntar(t *testing.T) {
|
|
|
Compression: c,
|
|
|
ExcludePatterns: []string{"3"},
|
|
|
})
|
|
|
-
|
|
|
if err != nil {
|
|
|
t.Fatalf("Error tar/untar for compression %s: %s", c.Extension(), err)
|
|
|
}
|
|
@@ -770,7 +773,7 @@ func TestTarWithOptionsChownOptsAlwaysOverridesIdPair(t *testing.T) {
|
|
|
|
|
|
defer os.RemoveAll(origin)
|
|
|
filePath := filepath.Join(origin, "1")
|
|
|
- err = os.WriteFile(filePath, []byte("hello world"), 0700)
|
|
|
+ err = os.WriteFile(filePath, []byte("hello world"), 0o700)
|
|
|
assert.NilError(t, err)
|
|
|
|
|
|
idMaps := []idtools.IDMap{
|
|
@@ -824,10 +827,10 @@ func TestTarWithOptions(t *testing.T) {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
defer os.RemoveAll(origin)
|
|
|
- if err := os.WriteFile(filepath.Join(origin, "1"), []byte("hello world"), 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(origin, "1"), []byte("hello world"), 0o700); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- if err := os.WriteFile(filepath.Join(origin, "2"), []byte("welcome!"), 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(origin, "2"), []byte("welcome!"), 0o700); err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
|
|
@@ -904,7 +907,7 @@ func prepareUntarSourceDirectory(numberOfFiles int, targetPath string, makeLinks
|
|
|
fileData := []byte("fooo")
|
|
|
for n := 0; n < numberOfFiles; n++ {
|
|
|
fileName := fmt.Sprintf("file-%d", n)
|
|
|
- if err := os.WriteFile(filepath.Join(targetPath, fileName), fileData, 0700); err != nil {
|
|
|
+ if err := os.WriteFile(filepath.Join(targetPath, fileName), fileData, 0o700); err != nil {
|
|
|
return 0, err
|
|
|
}
|
|
|
if makeLinks {
|
|
@@ -979,7 +982,7 @@ func TestUntarInvalidFilenames(t *testing.T) {
|
|
|
{
|
|
|
Name: "../victim/dotdot",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -987,7 +990,7 @@ func TestUntarInvalidFilenames(t *testing.T) {
|
|
|
// Note the leading slash
|
|
|
Name: "/../victim/slash-dotdot",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
} {
|
|
@@ -1005,18 +1008,18 @@ func TestUntarHardlinkToSymlink(t *testing.T) {
|
|
|
Name: "symlink1",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "regfile",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
{
|
|
|
Name: "symlink2",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "symlink1",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
{
|
|
|
Name: "regfile",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
} {
|
|
@@ -1033,7 +1036,7 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Name: "dotdot",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "../victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try reading victim/hello (/../)
|
|
@@ -1042,7 +1045,7 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Typeflag: tar.TypeLink,
|
|
|
// Note the leading slash
|
|
|
Linkname: "/../victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try writing victim/file
|
|
@@ -1050,12 +1053,12 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "loophole-victim/file",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try reading victim/hello (hardlink, symlink)
|
|
@@ -1063,13 +1066,13 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "symlink",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "loophole-victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // Try reading victim/hello (hardlink, hardlink)
|
|
@@ -1077,13 +1080,13 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "hardlink",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "loophole-victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // Try removing victim directory (hardlink)
|
|
@@ -1091,12 +1094,12 @@ func TestUntarInvalidHardlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
} {
|
|
@@ -1113,7 +1116,7 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "dotdot",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try reading victim/hello (/../)
|
|
@@ -1122,7 +1125,7 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
// Note the leading slash
|
|
|
Linkname: "/../victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try writing victim/file
|
|
@@ -1130,12 +1133,12 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "loophole-victim/file",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try reading victim/hello (symlink, symlink)
|
|
@@ -1143,13 +1146,13 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "symlink",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "loophole-victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try reading victim/hello (symlink, hardlink)
|
|
@@ -1157,13 +1160,13 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "hardlink",
|
|
|
Typeflag: tar.TypeLink,
|
|
|
Linkname: "loophole-victim/hello",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try removing victim directory (symlink)
|
|
@@ -1171,12 +1174,12 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "loophole-victim",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
{ // try writing to victim/newdir/newfile with a symlink in the path
|
|
@@ -1185,12 +1188,12 @@ func TestUntarInvalidSymlink(t *testing.T) {
|
|
|
Name: "dir/loophole",
|
|
|
Typeflag: tar.TypeSymlink,
|
|
|
Linkname: "../../victim",
|
|
|
- Mode: 0755,
|
|
|
+ Mode: 0o755,
|
|
|
},
|
|
|
{
|
|
|
Name: "dir/loophole/newdir/newfile",
|
|
|
Typeflag: tar.TypeReg,
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
},
|
|
|
},
|
|
|
} {
|
|
@@ -1248,13 +1251,13 @@ func TestImpliedDirectoryPermissions(t *testing.T) {
|
|
|
Name: "deeply/nested/and/implied",
|
|
|
}, {
|
|
|
Name: "explicit/",
|
|
|
- Mode: 0644,
|
|
|
+ Mode: 0o644,
|
|
|
}, {
|
|
|
Name: "explicit/permissions/",
|
|
|
- Mode: 0600,
|
|
|
+ Mode: 0o600,
|
|
|
}, {
|
|
|
Name: "explicit/permissions/specified",
|
|
|
- Mode: 0400,
|
|
|
+ Mode: 0o400,
|
|
|
}}
|
|
|
|
|
|
w := tar.NewWriter(buf)
|
|
@@ -1279,9 +1282,9 @@ func TestImpliedDirectoryPermissions(t *testing.T) {
|
|
|
assertMode("deeply/nested", ImpliedDirectoryMode)
|
|
|
assertMode("deeply/nested/and", ImpliedDirectoryMode)
|
|
|
|
|
|
- assertMode("explicit", 0644)
|
|
|
- assertMode("explicit/permissions", 0600)
|
|
|
- assertMode("explicit/permissions/specified", 0400)
|
|
|
+ assertMode("explicit", 0o644)
|
|
|
+ assertMode("explicit/permissions", 0o600)
|
|
|
+ assertMode("explicit/permissions/specified", 0o400)
|
|
|
}
|
|
|
|
|
|
func TestReplaceFileTarWrapper(t *testing.T) {
|
|
@@ -1342,7 +1345,7 @@ func TestPrefixHeaderReadable(t *testing.T) {
|
|
|
skip.If(t, runtime.GOOS != "windows" && os.Getuid() != 0, "skipping test that requires root")
|
|
|
skip.If(t, userns.RunningInUserNS(), "skipping test that requires more than 010000000 UIDs, which is unlikely to be satisfied when running in userns")
|
|
|
// https://gist.github.com/stevvooe/e2a790ad4e97425896206c0816e1a882#file-out-go
|
|
|
- var testFile = []byte("\x1f\x8b\x08\x08\x44\x21\x68\x59\x00\x03\x74\x2e\x74\x61\x72\x00\x4b\xcb\xcf\x67\xa0\x35\x30\x80\x00\x86\x06\x10\x47\x01\xc1\x37\x40\x00\x54\xb6\xb1\xa1\xa9\x99\x09\x48\x25\x1d\x40\x69\x71\x49\x62\x91\x02\xe5\x76\xa1\x79\x84\x21\x91\xd6\x80\x72\xaf\x8f\x82\x51\x30\x0a\x46\x36\x00\x00\xf0\x1c\x1e\x95\x00\x06\x00\x00")
|
|
|
+ testFile := []byte("\x1f\x8b\x08\x08\x44\x21\x68\x59\x00\x03\x74\x2e\x74\x61\x72\x00\x4b\xcb\xcf\x67\xa0\x35\x30\x80\x00\x86\x06\x10\x47\x01\xc1\x37\x40\x00\x54\xb6\xb1\xa1\xa9\x99\x09\x48\x25\x1d\x40\x69\x71\x49\x62\x91\x02\xe5\x76\xa1\x79\x84\x21\x91\xd6\x80\x72\xaf\x8f\x82\x51\x30\x0a\x46\x36\x00\x00\xf0\x1c\x1e\x95\x00\x06\x00\x00")
|
|
|
|
|
|
tmpDir, err := os.MkdirTemp("", "prefix-test")
|
|
|
assert.NilError(t, err)
|
|
@@ -1374,7 +1377,7 @@ func buildSourceArchive(t *testing.T, numberOfFiles int) (io.ReadCloser, func())
|
|
|
|
|
|
func createOrReplaceModifier(path string, header *tar.Header, content io.Reader) (*tar.Header, []byte, error) {
|
|
|
return &tar.Header{
|
|
|
- Mode: 0600,
|
|
|
+ Mode: 0o600,
|
|
|
Typeflag: tar.TypeReg,
|
|
|
}, []byte("the new content"), nil
|
|
|
}
|
|
@@ -1394,7 +1397,7 @@ func appendModifier(path string, header *tar.Header, content io.Reader) (*tar.He
|
|
|
}
|
|
|
}
|
|
|
buffer.WriteString("\nnext line")
|
|
|
- return &tar.Header{Mode: 0600, Typeflag: tar.TypeReg}, buffer.Bytes(), nil
|
|
|
+ return &tar.Header{Mode: 0o600, Typeflag: tar.TypeReg}, buffer.Bytes(), nil
|
|
|
}
|
|
|
|
|
|
func readFileFromArchive(t *testing.T, archive io.ReadCloser, name string, expectedCount int, doc string) string {
|