Skip to content
  • Luke Shumaker's avatar
    Fixups near unquoted variables · 0432cffc
    Luke Shumaker authored and Eli Schwartz's avatar Eli Schwartz committed
    Using the following command to find unquoted variables (and ignoring
    more than a a few false positives),
    
        grep -Prn --exclude-dir=.git '(?<!["=]|\[\[ |\[\[ -[zn] )\$(?!{?#|\(|\? )'
    
    one is lead to find a few cleanups that are something other than "add
    double-quotes".  That's what these are.  We'll leave dumb adding of
    double-quotes for another commit.
    
    Most of these are still fixing quoting issues, just with a better fix.
    
     - parse_pkgbuilds.sh: Avoid having to escape quotes in `eval` strings
       by using `declare -p`. Updates the logic copied from makepkg, with the
       latest logic copied from makepkg. See
       https://git.archlinux.org/pacman.git/commit/?id=9e52a36794552b77ecf26f7f34b226d096978f1e
     - sourceballs: Avoid using ary=($string) to do field separation by
       using `read` and test that multiple licenses actually work as
       expected.
     - sourceballs: Replace `[[ -z ${ary[*]} ]]` with test for the array
       length
     - db-functions: Replace mangling echo field separators using sed, with
       printf formatters
     - db-functions: Replace for/echo loop to print an array line by line,
       with `printf '%s\n'`
     - db-functions: set_repo_permissions: Line up error messages, quote
       "$group"
     - db-move: Replace `$(echo ${array[@]})` with `${array[*]}`
     - testing2x: Use `"$@"` instead of `$*` when looping over an array
    
    Also, not really quoting related but on the same line as a quoting
    issue, optimize:
    
     - db-functions: Replace
    	[[ -n "$(... | sort | uniq -D)" ]]
       with
    	! ... | awk 'a[$0]++{exit 1}'
    0432cffc