[pacman-dev] [PATCH 3/6] bacman: fix missing quotes

Dave Reisner d at falconindy.com
Thu Sep 29 13:27:41 EDT 2011


On Fri, Sep 30, 2011 at 01:14:03AM +0800, lolilolicon wrote:
> 
> Signed-off-by: lolilolicon <lolilolicon at gmail.com>
> ---
>  contrib/bacman.in |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/contrib/bacman.in b/contrib/bacman.in
> index 0069d1e..d43bf78 100755
> --- a/contrib/bacman.in
> +++ b/contrib/bacman.in
> @@ -58,7 +58,7 @@ if [ $EUID -gt 0 ]; then
>      if [ -f /usr/bin/fakeroot ]; then
>          echo "Entering fakeroot environment"
>          export INFAKEROOT="1"
> -        /usr/bin/fakeroot -u -- $0 $1
> +        /usr/bin/fakeroot -u -- "$0" "$@"
>          exit $?
>      else
>          echo "WARNING: installing fakeroot or running ${progname} as root is required to"
> @@ -128,7 +128,7 @@ fi
>  # Begin
>  #
>  pkg_namver="${pkg_dir##*/}"
> -echo Package: ${pkg_namver}
> +echo "Package: ${pkg_namver}"
>  work_dir=$(mktemp -d -p /tmp)
>  cd "$work_dir" || exit 1
>  
> @@ -148,7 +148,7 @@ while read i; do
>          continue
>      fi
>  
> -    case $current in
> +    case "$current" in

Expansion is never performed here.

>          %FILES%)
>              ret=0
>              if [ -e "/$i" ]; then
> @@ -266,7 +266,7 @@ if [ -f "$pkg_dir/install" ] ; then
>      cp "$pkg_dir/install" "$work_dir/.INSTALL"
>      comp_files+=" .INSTALL"
>  fi
> -if  [ -f $pkg_dir/changelog ] ; then
> +if  [ -f "$pkg_dir/changelog" ] ; then

If we took the time to actually clean up bacman to use proper bash, this
wouldn't be necessary. I'd almost rather see that done than to
perpetuate the POSIX syntax in what's clearly a bash program.

>      cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
>      comp_files+=" .CHANGELOG"
>  fi
> @@ -302,7 +302,7 @@ case "$PKGEXT" in
>      *tar.bz2) bzip2 -c -f ;;
>      *tar.xz)  xz -c -z - ;;
>      *tar)     cat ;;
> -esac > ${pkg_file} || ret=$?
> +esac > "${pkg_file}"; ret=$?
>  
>  if [ $ret -ne 0 ]; then
>      echo "ERROR: unable to write package to $pkg_dest"
> -- 
> 1.7.6.4
> 
> 


More information about the pacman-dev mailing list