Skip to content

Commit

Permalink
Patch image-tools for extraction perms as non-root
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrudg committed Jun 13, 2018
1 parent 520625e commit bdd3942
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions mlocal/frags/Makefile.stub
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ collect:
dep:
@printf " GO DEPS\n"
$(V)(dep ensure -vendor-only >/dev/null 2>&1 || true)
$(V)(patch --silent ../vendor/github.com/opencontainers/image-tools/image/manifest.go ../patches/image_tools_manifest.go.patch)

.PHONY: test
test:
Expand Down
17 changes: 17 additions & 0 deletions patches/image_tools_manifest.go.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
275a276,282
> // SINGULARITY_PATCH
> // Add u+w if we aren't root to allow extractions
> extraPerms := os.FileMode(0000)
> if os.Getuid() != 0 {
> extraPerms = 0600
> }
>
287c294
< err = os.MkdirAll(path, info.Mode())
---
> err = os.MkdirAll(path, info.Mode()|extraPerms)
294c301
< f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, info.Mode())
---
> f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY, info.Mode()|extraPerms)

0 comments on commit bdd3942

Please sign in to comment.