systemd/backport-importd-Always-specify-file-unpacked-by-tar.patch
zhaoxiaohu 6883d3543a importd: Always specify file unpacked by tar
Signed-off-by: zhaoxiaohu <zhaoxiaohu@kuaishou.com>
2024-12-04 11:39:44 +08:00

43 lines
1.6 KiB
Diff

From 3a609cf64f74f78697ef1ad05d85f9c0ef07f87c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@gentoo.org>
Date: Sat, 28 Jan 2023 22:32:41 +0100
Subject: [PATCH] importd: Always specify file unpacked by tar
Despite popular belief, the default file extracted by GNU tar is not stdin. It
is the value of the TAPE environment variable, falling back on a compile-time
constant. On my system, the default value is /dev/full, which causes tar to
just spin forever due to --ignore-zeros. Always specifying this flag is the
safe thing to do.
~$ tar --show-defaults
--format=gnu -f/dev/full -b20 --quoting-style=escape
--rmt-command=/usr/sbin/grmt
See also: ``(tar)defaults'', available via Info viewers, and in HTML form at:
https://www.gnu.org/s/tar/manual/html_node/defaults.html
Reference: https://github.com/systemd/systemd/pull/26243/commits/f28d94106d6ed01420079f1034e332193c12d6dd
Signed-off-by: zhaoxiaohu <zhaoxiaohu@kuaishou.com>
Signed-off-by: yuwang <yuwang@kuaishou.com>
---
src/import/import-common.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/import/import-common.c b/src/import/import-common.c
index f77564c..70a0a73 100644
--- a/src/import/import-common.c
+++ b/src/import/import-common.c
@@ -97,6 +97,8 @@ int import_fork_tar_x(const char *path, pid_t *ret) {
"--numeric-owner",
"-C", path,
"-px",
+ "-pxf",
+ "-",
"--xattrs",
"--xattrs-include=*",
use_selinux ? "--selinux" : "--no-selinux",
--
2.33.0