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

Dan McGee dpmcgee at gmail.com
Thu Sep 29 14:10:49 EDT 2011


On Thu, Sep 29, 2011 at 12:37 PM, lolilolicon <lolilolicon at gmail.com> wrote:
> On Fri, Sep 30, 2011 at 1:27 AM, Dave Reisner <d at falconindy.com> wrote:
>> 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.
>
> Good catch... but nevertheless just let me quote it :P
>
>>
>>>          %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.
>
> Yeah, bacman is full of [ "i_like_quotes" ]. I thought about it, then
> I decided if we
> want to bashify it, we better do it all in one go... maybe.

We took the time to do this with scripts/ stuff; would definitely be
fine with doing that in contrib/ too, especially since we don't even
have scripts with a pure sh shebang in there.

-Dan


More information about the pacman-dev mailing list