[pacman-dev] FS #6246 - makepkg fails if the extensions is wrong on the archive

Johannes Weiner hannes at saeurebad.de
Mon Jan 22 12:15:26 EST 2007


Hi,

On Sun, Jan 21, 2007 at 03:34:39PM -0500, James Rosten wrote:
> +		case "$file_type" in
> +			"application/x-tar, POSIX (GNU) (application/x-gzip)")
>  			cmd="tar --use-compress-program=gzip -xf $file" ;;
> -			*.tar.bz2|*.tbz2)
> +			"application/x-tar, POSIX (GNU) (application/x-bzip2)")
>  			cmd="tar --use-compress-program=bzip2 -xf $file" ;;
> -			*.tar)
> +			"application/x-tar, POSIX (GNU)")
>  			cmd="tar -xf $file" ;;
> -			*.zip)
> +			"*application/x-zip*")
>  			unziphack=1
>  			cmd="unzip -qqo $file" ;;
> -			*.cpio.gz)
> +			"application/x-cpio*")
>  			cmd="bsdtar -x -f $file" ;;
> -			*.cpio.bz2)
> -			cmd="bsdtar -x -f $file" ;;
> -			*.gz)
> +			"application/x-gzip")
>  			cmd="gunzip -f $file" ;;
> -			*.bz2)
> +			"application/x-gzip")
>  			cmd="bunzip2 -f $file" ;;
>  		esac
>  		if [ "$cmd" != "" ]; then

No, this is not readable. What do you have against

	*.gz|application/x-gzip)
		cmd="gunzip -f $file" ;;
	*.bz2|application/x-bzip2)
		cmd="bunzip -f $file" ;;

There is an error at the *.bz2 detection also, you check twice for
application/x-gzip where you meant application/x-bzip2.

Please don't mix up quoting and not-quoting.

Do we need to check for the file-extension AND the `file' result? I
think if they mismatch, we should rather trust `file'.

Thank you very much and please forgive me for being so picky..
Hannes




More information about the pacman-dev mailing list