Add `--no-same-owner` to `tar -xf` in installer (#11940)
This prevents errors like the following tar: protobuf-3.17.3: Cannot change ownership to uid 576694, gid 89939: Invalid argument
Christian Mäder committed
Feb 23, 2022 at 13:44 UTC
192b552ee0272586f5594a946cc56b5fdd380594
1 file changed
+7
-7
netdata-installer.sh
+7
-7
@@ -701,7 +701,7 @@ bundle_protobuf() {
701
"${PROTOBUF_PACKAGE_BASENAME}" \
702
"${tmp}" \
703
"${NETDATA_LOCAL_TARBALL_VERRIDE_PROTOBUF}"; then
704
- if run tar -xf "${tmp}/${PROTOBUF_PACKAGE_BASENAME}" -C "${tmp}" &&
704
+ if run tar --no-same-owner -xf "${tmp}/${PROTOBUF_PACKAGE_BASENAME}" -C "${tmp}" &&
705
build_protobuf "${tmp}/protobuf-${PROTOBUF_PACKAGE_VERSION}" &&
706
copy_protobuf "${tmp}/protobuf-${PROTOBUF_PACKAGE_VERSION}" &&
707
rm -rf "${tmp}"; then
@@ -786,7 +786,7 @@ bundle_judy() {
786
"${JUDY_PACKAGE_BASENAME}" \
787
"${tmp}" \
788
"${NETDATA_LOCAL_TARBALL_OVERRIDE_JUDY}"; then
789
- if run tar -xf "${tmp}/${JUDY_PACKAGE_BASENAME}" -C "${tmp}" &&
789
+ if run tar --no-same-owner -xf "${tmp}/${JUDY_PACKAGE_BASENAME}" -C "${tmp}" &&
790
build_judy "${tmp}/libjudy-${JUDY_PACKAGE_VERSION}" &&
791
copy_judy "${tmp}/libjudy-${JUDY_PACKAGE_VERSION}" &&
792
rm -rf "${tmp}"; then
@@ -870,7 +870,7 @@ bundle_jsonc() {
870
"${JSONC_PACKAGE_BASENAME}" \
871
"${tmp}" \
872
"${NETDATA_LOCAL_TARBALL_OVERRIDE_JSONC}"; then
873
- if run tar -xf "${tmp}/${JSONC_PACKAGE_BASENAME}" -C "${tmp}" &&
873
+ if run tar --no-same-owner -xf "${tmp}/${JSONC_PACKAGE_BASENAME}" -C "${tmp}" &&
874
build_jsonc "${tmp}/json-c-json-c-${JSONC_PACKAGE_VERSION}" &&
875
copy_jsonc "${tmp}/json-c-json-c-${JSONC_PACKAGE_VERSION}" &&
876
rm -rf "${tmp}"; then
@@ -959,7 +959,7 @@ bundle_libbpf() {
959
"${LIBBPF_PACKAGE_BASENAME}" \
960
"${tmp}" \
961
"${NETDATA_LOCAL_TARBALL_OVERRIDE_LIBBPF}"; then
962
- if run tar -xf "${tmp}/${LIBBPF_PACKAGE_BASENAME}" -C "${tmp}" &&
962
+ if run tar --no-same-owner -xf "${tmp}/${LIBBPF_PACKAGE_BASENAME}" -C "${tmp}" &&
963
build_libbpf "${tmp}/libbpf-${LIBBPF_PACKAGE_VERSION}" &&
964
copy_libbpf "${tmp}/libbpf-${LIBBPF_PACKAGE_VERSION}" &&
965
rm -rf "${tmp}"; then
@@ -1539,10 +1539,10 @@ install_go() {
1539
# Install new files
1540
run rm -rf "${NETDATA_STOCK_CONFIG_DIR}/go.d"
1541
run rm -rf "${NETDATA_STOCK_CONFIG_DIR}/go.d.conf"
1542
- run tar -xf "${tmp}/config.tar.gz" -C "${NETDATA_STOCK_CONFIG_DIR}/"
1542
+ run tar --no-same-owner -xf "${tmp}/config.tar.gz" -C "${NETDATA_STOCK_CONFIG_DIR}/"
1543
run chown -R "${ROOT_USER}:${ROOT_GROUP}" "${NETDATA_STOCK_CONFIG_DIR}"
1544
1545
- run tar -xf "${tmp}/${GO_PACKAGE_BASENAME}"
1545
+ run tar --no-same-owner -xf "${tmp}/${GO_PACKAGE_BASENAME}"
1546
run mv "${GO_PACKAGE_BASENAME%.tar.gz}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
1547
if [ "$(id -u)" -eq 0 ]; then
1548
run chown "root:${NETDATA_GROUP}" "${NETDATA_PREFIX}/usr/libexec/netdata/plugins.d/go.d.plugin"
@@ -1671,7 +1671,7 @@ install_ebpf() {
1671
fi
1672
1673
echo >&2 " Extracting ${EBPF_TARBALL} ..."
1674
- tar -xf "${tmp}/${EBPF_TARBALL}" -C "${tmp}"
1674
+ tar --no-same-owner -xf "${tmp}/${EBPF_TARBALL}" -C "${tmp}"
1675
1676
# chown everything to root:netdata before we start copying out of our package
1677
run chown -R root:netdata "${tmp}"