summaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-lbu-do-not-use-xargs.patch
blob: 42dac498615a2aa9230e758544f03875595562f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 15245c4a0eb62b0e1bcbac5063391e0d57a53799 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 4 Jul 2012 08:09:21 +0200
Subject: [PATCH] lbu: do not use xargs

xargs will execute the command twice if the buffer becomes long enough.
This will break tar.

We also use -z instead of piping via gzip while here.

ref #1240
---
 lbu.in | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/lbu.in b/lbu.in
index 67ad578..3fa157e 100644
--- a/lbu.in
+++ b/lbu.in
@@ -281,10 +281,6 @@ _gen_filelist() {
 	apk audit --backup --quiet --recursive
 }
 
-_gen_filelist_0() {
-	_gen_filelist | tr '\n' '\0'
-}
-
 cmd_package() {
 	local pkg="$1"
 	local rc=0
@@ -311,7 +307,7 @@ cmd_package() {
 
 	tmppkg="$tmpdir/$(basename $pkg)"
 
-	local tar_create="tar -c --no-recursion"
+	local tar_create="tar -c --no-recursion -T -"
 
 	cd "${ROOT:-/}"
 	# remove old package.list
@@ -325,19 +321,17 @@ cmd_package() {
 		echo "Archiving the following files:" >&2
 		# we dont want to mess the tar output with the
 		# password prompt. Lets get the tar output first.
-		_gen_filelist_0 | xargs -0 $tar_create -v > /dev/null
+		_gen_filelist | $tar_create -v > /dev/null
 		rc=$?
 	fi
 	if [ $rc -eq 0 ]; then
 		if [ -z "$ENCRYPTION" ]; then
-			_gen_filelist_0 | xargs -0 $tar_create \
-				| gzip -c  >"$tmppkg"
+			_gen_filelist | $tar_create -z >"$tmppkg"
 			rc=$?
 		else
 			set -- enc "-$ENCRYPTION" -salt
 			[ -n "$PASSWORD" ] && set -- "$@" -pass pass:"$PASSWORD"
-			_gen_filelist_0 | xargs -0 $tar_create \
-				| gzip -c \
+			_gen_filelist | $tar_create -z \
 				| $OPENSSL "$@" > "$tmppkg"
 			rc=$?
 		fi
-- 
1.7.11.1