[vlc-devel] [PATCH] contrib/extras: force uid/gid during tarball extractions

Simon Latapie garf at videolan.org
Fri Jan 11 14:14:18 CET 2019


Under rare circonstances, tar will try to preserve uid/gid no matter what,
and fail.
This can happen for example when trying to build the contribs/extras as a
privileged user inside a namespaced container.
---
 contrib/src/aom/rules.mak     | 2 +-
 contrib/src/directx/rules.mak | 2 +-
 contrib/src/dshow/rules.mak   | 2 +-
 contrib/src/ffmpeg/rules.mak  | 2 +-
 contrib/src/lua/rules.mak     | 2 +-
 contrib/src/main.mak          | 6 +++---
 contrib/src/x264/rules.mak    | 4 ++--
 contrib/src/x265/rules.mak    | 2 +-
 extras/tools/tools.mak        | 6 +++---
 9 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/contrib/src/aom/rules.mak b/contrib/src/aom/rules.mak
index 2eec6b5b27..417ef73efb 100644
--- a/contrib/src/aom/rules.mak
+++ b/contrib/src/aom/rules.mak
@@ -18,7 +18,7 @@ $(TARBALLS)/aom-$(AOM_VERSION).tar.gz:
 aom: aom-$(AOM_VERSION).tar.gz .sum-aom
 	rm -Rf $@-$(AOM_VERSION) $@
 	mkdir -p $@-$(AOM_VERSION)
-	tar xvzf "$<" -C $@-$(AOM_VERSION)
+	tar xvzfo "$<" -C $@-$(AOM_VERSION)
 	$(APPLY) $(SRC)/aom/aom-target-cpu.patch
 ifdef HAVE_WINSTORE
 	$(APPLY) $(SRC)/aom/aom-pthreads-win32.patch
diff --git a/contrib/src/directx/rules.mak b/contrib/src/directx/rules.mak
index 6bfba74c72..18fcce14ff 100644
--- a/contrib/src/directx/rules.mak
+++ b/contrib/src/directx/rules.mak
@@ -19,6 +19,6 @@ $(TARBALLS)/dxva2api.h:
 
 .directx: directx-oss.tar.bz2 dxva2api.h .sum-directx
 	mkdir -p -- "$(PREFIX)/include"
-	tar xvjf $< -C "$(PREFIX)/include"
+	tar xvjfo $< -C "$(PREFIX)/include"
 	$(CC) -E -include dxva2api.h - < /dev/null > /dev/null 2>&1 || cp $(TARBALLS)/dxva2api.h "$(PREFIX)/include/"
 	touch $@
diff --git a/contrib/src/dshow/rules.mak b/contrib/src/dshow/rules.mak
index f9ddb37e22..c8e3acf059 100644
--- a/contrib/src/dshow/rules.mak
+++ b/contrib/src/dshow/rules.mak
@@ -17,6 +17,6 @@ DSHOW_SOURCES := dshow-headers-oss.tar.bz2
 
 .dshow: $(DSHOW_SOURCES) .sum-dshow
 	mkdir -p -- "$(PREFIX)/include"
-	tar xjf $< -C "$(PREFIX)/include" \
+	tar xjfo $< -C "$(PREFIX)/include" \
 		--wildcards --no-anchored '*.h' --strip-components=1
 	touch $@
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 88ab1531d1..fa5cff1034 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -239,7 +239,7 @@ $(TARBALLS)/ffmpeg-$(FFMPEG_BASENAME).tar.xz:
 ffmpeg: ffmpeg-$(FFMPEG_BASENAME).tar.xz .sum-ffmpeg
 	rm -Rf $@ $@-$(FFMPEG_BASENAME)
 	mkdir -p $@-$(FFMPEG_BASENAME)
-	tar xvJf "$<" --strip-components=1 -C $@-$(FFMPEG_BASENAME)
+	tar xvJfo "$<" --strip-components=1 -C $@-$(FFMPEG_BASENAME)
 ifdef USE_FFMPEG
 	$(APPLY) $(SRC)/ffmpeg/armv7_fixup.patch
 	$(APPLY) $(SRC)/ffmpeg/dxva_vc1_crash.patch
diff --git a/contrib/src/lua/rules.mak b/contrib/src/lua/rules.mak
index 103898f2bc..fe04b1631b 100644
--- a/contrib/src/lua/rules.mak
+++ b/contrib/src/lua/rules.mak
@@ -98,7 +98,7 @@ luac: lua-$(LUA_VERSION).tar.gz .sum-luac
 	# DO NOT use the same intermediate directory as the lua target
 	rm -Rf -- $@-$(LUA_VERSION) $@
 	mkdir -- $@-$(LUA_VERSION)
-	tar -x -v -z -C $@-$(LUA_VERSION) --strip-components=1 -f $<
+	tar -x -v -z -C -o $@-$(LUA_VERSION) --strip-components=1 -f $<
 	(cd luac-$(LUA_VERSION) && patch -p1) < $(SRC)/lua/luac-32bits.patch
 	mv luac-$(LUA_VERSION) luac
 
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 84205dcf66..4b3aee45fb 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -339,9 +339,9 @@ checksum = \
 		"$(SRC)/$(patsubst .sum-%,%,$@)/$(2)SUMS"
 CHECK_SHA512 = $(call checksum,$(SHA512SUM),SHA512)
 UNPACK = $(RM) -R $@ \
-	$(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzf $(f)) \
-	$(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
-	$(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
+	$(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzfo $(f)) \
+	$(foreach f,$(filter %.tar.bz2,$^), && tar xvjfo $(f)) \
+	$(foreach f,$(filter %.tar.xz,$^), && tar xvJfo $(f)) \
 	$(foreach f,$(filter %.zip,$^), && unzip $(f))
 UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
 APPLY = (cd $(UNPACK_DIR) && patch -fp1) <
diff --git a/contrib/src/x264/rules.mak b/contrib/src/x264/rules.mak
index 7f96b0024d..352f556332 100644
--- a/contrib/src/x264/rules.mak
+++ b/contrib/src/x264/rules.mak
@@ -86,14 +86,14 @@ $(TARBALLS)/$(X264_BASENAME):
 x264 x26410b: %: $(X264_BASENAME) .sum-%
 	rm -Rf $*-git
 	mkdir -p $*-git
-	tar xvjf "$<" --strip-components=1 -C $*-git
+	tar xvjfo "$<" --strip-components=1 -C $*-git
 	$(UPDATE_AUTOCONFIG)
 	mv $*-git $*
 
 x262: x262-git.tar.gz .sum-x262
 	rm -Rf $@-git
 	mkdir -p $@-git
-	tar xvzf "$<" --strip-components=1 -C $@-git
+	tar xvzfo "$<" --strip-components=1 -C $@-git
 	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
 
diff --git a/contrib/src/x265/rules.mak b/contrib/src/x265/rules.mak
index 01859b99b3..9b355f6860 100644
--- a/contrib/src/x265/rules.mak
+++ b/contrib/src/x265/rules.mak
@@ -25,7 +25,7 @@ $(TARBALLS)/x265-$(X265_VERSION).tar.bz2:
 x265: x265-$(X265_VERSION).tar.bz2 .sum-x265
 	rm -Rf $@-$(X265_VERSION)
 	mkdir -p $@-$(X265_VERSION)
-	tar xvjf "$<" --strip-components=1 -C $@-$(X265_VERSION)
+	tar xvjfo "$<" --strip-components=1 -C $@-$(X265_VERSION)
 	$(APPLY) $(SRC)/x265/x265-ldl-linking.patch
 	$(APPLY) $(SRC)/x265/x265-no-pdb-install.patch
 	$(call pkg_static,"source/x265.pc.in")
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 5bc11a548a..63e5e62668 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -39,9 +39,9 @@ download_pkg = $(call download,$(VIDEOLAN)/$(2)/$(lastword $(subst /, ,$(@)))) |
 	&& grep $(@) SHA512SUMS| $(SHA512SUM)
 
 UNPACK = $(RM) -R $@ \
-    $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzf $(f)) \
-    $(foreach f,$(filter %.tar.bz2,$^), && tar xvjf $(f)) \
-    $(foreach f,$(filter %.tar.xz,$^), && tar xvJf $(f)) \
+    $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzfo $(f)) \
+    $(foreach f,$(filter %.tar.bz2,$^), && tar xvjfo $(f)) \
+    $(foreach f,$(filter %.tar.xz,$^), && tar xvJfo $(f)) \
     $(foreach f,$(filter %.zip,$^), && unzip $(f))
 
 UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<)))
-- 
2.11.0



More information about the vlc-devel mailing list