[pacman-dev,v2] libmakepkg: compress: fix tar extension

Message ID 20201021080543.25339-1-michael.straubej@gmail.com
State Accepted, archived
Headers show
Series [pacman-dev,v2] libmakepkg: compress: fix tar extension | expand

Commit Message

Michael Straube Oct. 21, 2020, 8:05 a.m. UTC
With commit 74aacf44958e1343b910b3fbdcf753393857f070 creating uncompressed .tar
packages fails.

  -> Compressing package...
/usr/share/makepkg/util/compress.sh: line 70: COMPRESS.TAR[@]: invalid variable name
bsdtar: Write error

Empty the '$ext' variable for the '.tar' extension in get_compress_command() to
fix this. We would fallback to cat for 'tar' anyways.

Signed-off-by: Michael Straube <michael.straubej@gmail.com>
---
v1 -> v2
Added a comment.

 scripts/libmakepkg/util/compress.sh.in | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/scripts/libmakepkg/util/compress.sh.in b/scripts/libmakepkg/util/compress.sh.in
index d35a01fa..b88d0c2f 100644
--- a/scripts/libmakepkg/util/compress.sh.in
+++ b/scripts/libmakepkg/util/compress.sh.in
@@ -65,6 +65,10 @@  get_compression_command() {
 	esac
 
 	ext=${ext#*.tar.}
+	# empty the variable for tar so we fallback to cat, otherwise we would
+	# have '.tar' and get an error in the next if block
+	ext=${ext#*.tar}
+
 	if [[ -n $ext ]]; then
 		extarray="COMPRESS${ext^^}[@]"
 		resolvecmd=("${!extarray}")