Skip to content

Commit b4a6288

Browse files
authored
build: Add --no-same-owner to TAR (JuliaLang#58796)
tar changes behavior when the current uid is 0 to try to also restore owner uids/gids (if recorded). It is possible for the uid to be 0 in single-uid environments like user namespace sandboxes, in which case the attempt to change the uid/gid fails. Of course ideally, the tars would have been created non-archival (so that the uid/gid wasn't recorded in the first place), but we get source tars from various places, so we can't guarantee this. To make sure we don't run into trouble, manually add the --no-same-owner flag to disable this behavior.
1 parent 9e69f44 commit b4a6288

File tree

7 files changed

+10
-7
lines changed

7 files changed

+10
-7
lines changed

Make.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ $(error "please install either GNU tar or bsdtar")
831831
endif
832832
endif
833833

834+
# Do not try to extract owner uids, even if we're root (e.g. in sandboxes)
835+
TAR += --no-same-owner
836+
834837
ifeq ($(WITH_GC_VERIFY), 1)
835838
JCXXFLAGS += -DGC_VERIFY
836839
JCFLAGS += -DGC_VERIFY

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ endif
590590
ifeq ($(OS), WINNT)
591591
cd $(BUILDROOT)/julia-$(JULIA_COMMIT)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
592592
endif
593-
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)
593+
cd $(BUILDROOT) && $(TAR) -zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)
594594

595595

596596
exe:

contrib/mac/app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dmg/$(APP_NAME): startup.applescript julia.icns
4848
plutil -insert NSHumanReadableCopyright -string "$(APP_COPYRIGHT)" $@/Contents/Info.plist
4949
-mkdir -p $@/Contents/Resources/julia
5050
make -C $(JULIAHOME) binary-dist
51-
tar zxf $(JULIAHOME)/$(JULIA_BINARYDIST_FILENAME).tar.gz -C $@/Contents/Resources/julia --strip-components 1
51+
$(TAR) -xzf $(JULIAHOME)/$(JULIA_BINARYDIST_FILENAME).tar.gz -C $@/Contents/Resources/julia --strip-components 1
5252
find $@/Contents/Resources/julia -type f -exec chmod -w {} \;
5353
# Even though the tarball may already be signed, we re-sign here to make it easier to add
5454
# unsigned executables (like the app launcher) and whatnot, without needing to maintain lists

deps/curl.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $(SRCCACHE)/curl-$(CURL_VER).tar.bz2: | $(SRCCACHE)
3131

3232
$(SRCCACHE)/curl-$(CURL_VER)/source-extracted: $(SRCCACHE)/curl-$(CURL_VER).tar.bz2
3333
$(JLCHECKSUM) $<
34-
cd $(dir $<) && $(TAR) jxf $(notdir $<)
34+
cd $(dir $<) && $(TAR) -jxf $(notdir $<)
3535
echo 1 > $@
3636

3737
checksum-curl: $(SRCCACHE)/curl-$(CURL_VER).tar.bz2

deps/patchelf.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ $(SRCCACHE)/patchelf-$(PATCHELF_VER).tar.bz2: | $(SRCCACHE)
77
$(SRCCACHE)/patchelf-$(PATCHELF_VER)/source-extracted: $(SRCCACHE)/patchelf-$(PATCHELF_VER).tar.bz2
88
$(JLCHECKSUM) $<
99
mkdir $(dir $@)
10-
cd $(dir $@) && $(TAR) jxf $< --strip-components=1
10+
cd $(dir $@) && $(TAR) -jxf $< --strip-components=1
1111
touch -c $(SRCCACHE)/patchelf-$(PATCHELF_VER)/configure # old target
1212
echo 1 > $@
1313

deps/pcre.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $(SRCCACHE)/pcre2-$(PCRE_VER).tar.bz2: | $(SRCCACHE)
2121

2222
$(SRCCACHE)/pcre2-$(PCRE_VER)/source-extracted: $(SRCCACHE)/pcre2-$(PCRE_VER).tar.bz2
2323
$(JLCHECKSUM) $<
24-
cd $(dir $<) && $(TAR) jxf $(notdir $<)
24+
cd $(dir $<) && $(TAR) -jxf $(notdir $<)
2525
echo 1 > $@
2626

2727
checksum-pcre: $(SRCCACHE)/pcre2-$(PCRE_VER).tar.bz2

deps/unwind.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $(SRCCACHE)/libunwind-$(UNWIND_VER).tar.gz: | $(SRCCACHE)
2020

2121
$(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted: $(SRCCACHE)/libunwind-$(UNWIND_VER).tar.gz
2222
$(JLCHECKSUM) $<
23-
cd $(dir $<) && $(TAR) xfz $<
23+
cd $(dir $<) && $(TAR) -xfz $<
2424
touch -c $(SRCCACHE)/libunwind-$(UNWIND_VER)/configure # old target
2525
echo 1 > $@
2626

@@ -102,7 +102,7 @@ $(SRCCACHE)/llvm-project-$(LLVMUNWIND_VER).tar.xz: | $(SRCCACHE)
102102

103103
$(SRCCACHE)/llvm-project-$(LLVMUNWIND_VER)/source-extracted: $(SRCCACHE)/llvm-project-$(LLVMUNWIND_VER).tar.xz
104104
$(JLCHECKSUM) $<
105-
cd $(dir $<) && $(TAR) xf $<
105+
cd $(dir $<) && $(TAR) -xf $<
106106
mv $(SRCCACHE)/llvm-project-$(LLVMUNWIND_VER).src $(SRCCACHE)/llvm-project-$(LLVMUNWIND_VER)
107107
echo 1 > $@
108108

0 commit comments

Comments
 (0)