-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure umask is unset when extracting archive (#727)
* Ensure umask is unset when extracting archive Signed-off-by: Natalie Arellano <[email protected]> * Add test Signed-off-by: Natalie Arellano <[email protected]> * Fix Signed-off-by: Natalie Arellano <[email protected]> * Get the current umask without changing it Signed-off-by: Natalie Arellano <[email protected]> * Fix Signed-off-by: Natalie Arellano <[email protected]> * Fix windows Signed-off-by: Natalie Arellano <[email protected]> * Fix windows Signed-off-by: Natalie Arellano <[email protected]> * Update per review comments Signed-off-by: Natalie Arellano <[email protected]> * Less confusing wording Signed-off-by: Natalie Arellano <[email protected]> * Reduce the diff Signed-off-by: Natalie Arellano <[email protected]> * Fix Signed-off-by: Natalie Arellano <[email protected]> * Added comments Signed-off-by: Natalie Arellano <[email protected]> * Better wording Signed-off-by: Natalie Arellano <[email protected]> * Add test that system umask is used to create non existent directory not in tar file Signed-off-by: Natalie Arellano <[email protected]> * Variable names and formatting Signed-off-by: Natalie Arellano <[email protected]> * Try to fix windows Signed-off-by: Natalie Arellano <[email protected]> * Avoid direct dependency on archive Signed-off-by: Natalie Arellano <[email protected]> * Make test setup simpler and update comment Signed-off-by: Natalie Arellano <[email protected]> * Add build directive Signed-off-by: Natalie Arellano <[email protected]> * Apply suggestions from code review Signed-off-by: Natalie Arellano <[email protected]> * Fix Codecov Signed-off-by: Natalie Arellano <[email protected]> * Fix lint Signed-off-by: Natalie Arellano <[email protected]>
- Loading branch information
1 parent
0de4cff
commit 3051985
Showing
10 changed files
with
86 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package layers_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sclevine/spec" | ||
"github.com/sclevine/spec/report" | ||
|
||
"github.com/buildpacks/lifecycle/layers" | ||
h "github.com/buildpacks/lifecycle/testhelpers" | ||
) | ||
|
||
func TestExtract(t *testing.T) { | ||
spec.Run(t, "Extract", testExtract, spec.Parallel(), spec.Report(report.Terminal{})) | ||
} | ||
|
||
func testExtract(t *testing.T, when spec.G, it spec.S) { | ||
when("#SetUmask", func() { | ||
it("returns the old umask", func() { | ||
first := layers.SetUmask(0) | ||
second := layers.SetUmask(first) | ||
h.AssertEq(t, second, 0) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
//+build linux darwin | ||
|
||
package testhelpers | ||
|
||
const ProvidedUmask = 0022 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package testhelpers | ||
|
||
const ProvidedUmask = 0000 |