Skip to content

Commit 791f4db

Browse files
committed
Removes -z flag from decompress since tar -x detects it automatically.
Omitting the -z flag during extraction (-x) is considered best practice as it works for both compress and non-compressed tars.
1 parent ffb6efc commit 791f4db

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fileutil/tarball_compressor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c tarballCompressor) DecompressFileToDir(tarballPath string, dir string, o
6464
if err != nil {
6565
return bosherr.WrapError(err, "Resolving tarball path")
6666
}
67-
args := []string{sameOwnerOption, "-xzf", resolvedTarballPath, "-C", dir}
67+
args := []string{sameOwnerOption, "-xf", resolvedTarballPath, "-C", dir}
6868
if options.StripComponents != 0 {
6969
args = append(args, fmt.Sprintf("--strip-components=%d", options.StripComponents))
7070
}

fileutil/tarball_compressor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ var _ = Describe("tarballCompressor", func() {
206206
Expect(cmdRunner.RunCommands[0]).To(Equal(
207207
[]string{
208208
"tar", "--no-same-owner",
209-
"-xzf", tarballPath,
209+
"-xf", tarballPath,
210210
"-C", dstDir,
211211
},
212212
))
@@ -228,7 +228,7 @@ var _ = Describe("tarballCompressor", func() {
228228
Expect(cmdRunner.RunCommands[0]).To(Equal(
229229
[]string{
230230
"tar", "--same-owner",
231-
"-xzf", tarballPath,
231+
"-xf", tarballPath,
232232
"-C", dstDir,
233233
},
234234
))
@@ -246,7 +246,7 @@ var _ = Describe("tarballCompressor", func() {
246246
Expect(cmdRunner.RunCommands[0]).To(Equal(
247247
[]string{
248248
"tar", "--no-same-owner",
249-
"-xzf", tarballPath,
249+
"-xf", tarballPath,
250250
"-C", dstDir,
251251
"some/path/in/archive",
252252
},
@@ -265,7 +265,7 @@ var _ = Describe("tarballCompressor", func() {
265265
Expect(cmdRunner.RunCommands[0]).To(Equal(
266266
[]string{
267267
"tar", "--no-same-owner",
268-
"-xzf", tarballPath,
268+
"-xf", tarballPath,
269269
"-C", dstDir,
270270
"--strip-components=3",
271271
},

0 commit comments

Comments
 (0)