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

Message ID 20201020153119.297745-1-michael.straubej@gmail.com
State New
Headers show
Series
  • [pacman-dev] libmakepkg: compress: fix tar extension
Related show

Commit Message

Michael Straube Oct. 20, 2020, 3:31 p.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>
---
 scripts/libmakepkg/util/compress.sh.in | 2 ++
 1 file changed, 2 insertions(+)

Comments

Allan McRae Oct. 21, 2020, 12:41 a.m. UTC | #1
On 21/10/20 1:31 am, Michael Straube wrote:
> 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>
> ---
>  scripts/libmakepkg/util/compress.sh.in | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/libmakepkg/util/compress.sh.in b/scripts/libmakepkg/util/compress.sh.in
> index d35a01fa..6595e0d6 100644
> --- a/scripts/libmakepkg/util/compress.sh.in
> +++ b/scripts/libmakepkg/util/compress.sh.in
> @@ -65,6 +65,8 @@ get_compression_command() {
>  	esac
>  
>  	ext=${ext#*.tar.}
> +	ext=${ext#*.tar}
> +

My first impression is this is fine, but I will have no idea why it is
fine next week...   Can you add a comment?

>  	if [[ -n $ext ]]; then
>  		extarray="COMPRESS${ext^^}[@]"
>  		resolvecmd=("${!extarray}")
>

Patch

diff --git a/scripts/libmakepkg/util/compress.sh.in b/scripts/libmakepkg/util/compress.sh.in
index d35a01fa..6595e0d6 100644
--- a/scripts/libmakepkg/util/compress.sh.in
+++ b/scripts/libmakepkg/util/compress.sh.in
@@ -65,6 +65,8 @@  get_compression_command() {
 	esac
 
 	ext=${ext#*.tar.}
+	ext=${ext#*.tar}
+
 	if [[ -n $ext ]]; then
 		extarray="COMPRESS${ext^^}[@]"
 		resolvecmd=("${!extarray}")