diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-20 23:05:01 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-20 23:19:37 -0400 |
commit | cdc456c8b7c6e3eb4b11d668fb9c6e9bdec7230e (patch) | |
tree | d54d0c816a146023fbc7a54c0d5f71ecd0e69937 /src/librefetch | |
parent | 23213bda24af601acbbea5731246a055680b48d0 (diff) |
Don't use subshells in local/export/declare commands.
Only make this change in places where it shouldn't make a difference, and
something weird has to be going on for the subshell to fail. This is on
par with checking the return value of malloc. We don't need tests for each
of these failure cases.
Diffstat (limited to 'src/librefetch')
-rwxr-xr-x | src/librefetch/librefetch | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 2b8af61..855719d 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -1,7 +1,7 @@ #!/usr/bin/env bash # librefetch # -# Copyright (C) 2013-2016 Luke Shumaker <lukeshu@sbcglobal.net> +# Copyright (C) 2013-2017 Luke Shumaker <lukeshu@sbcglobal.net> # # For just the create_signature() function: # Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org> @@ -236,7 +236,8 @@ parse_options() { local {shrt,long}{1,2} # makepkg options - local makepkg_orig="$(which makepkg)" + local makepkg_orig + makepkg_orig="$(which makepkg)" shrt1=($(LC_ALL=C "${makepkg_orig}" -h | sed -rn 's/^ +-(.)(,| [^<]).*/\1/p')) shrt2=($(LC_ALL=C "${makepkg_orig}" -h | sed -rn 's/^ +-(.) <.*/\1/p')) long1=($(LC_ALL=C "${makepkg_orig}" -h | sed -rn -e 's/^ +(-., )?--(\S*) [^<].*/\2/p')) @@ -310,7 +311,8 @@ parse_options() { # Modify makepkg ############################################################### modified_makepkg() { - local dir="$(mktemp --tmpdir --directory "${cmd}.XXXXXXXXXXX.makepkg")" + local dir + dir="$(mktemp --tmpdir --directory "${cmd}.XXXXXXXXXXX.makepkg")" make -s -f "$(librelib librefetchdir/Makefile)" new="$dir" realpath -es "$dir/makepkg" } @@ -358,7 +360,8 @@ package() { cp -a "$srcdir"/*/ "$pkgdir/"; } modified_pkgbuild() { local pkgbuild=$1 - local srcbuild="$(mktemp "${pkgbuild%/*}/${cmd}.XXXXXXXXXXX.PKGBUILD.to.SRCBUILD")" + local srcbuild + srcbuild="$(mktemp "${pkgbuild%/*}/${cmd}.XXXXXXXXXXX.PKGBUILD.to.SRCBUILD")" printf '%s' "$pkgbuild_append" | cat "$pkgbuild" - > "$srcbuild" printf '%s\n' "$srcbuild" } |