lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [lmi-commits] master 29b03dc 4/5: Improve portability of shell


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 29b03dc 4/5: Improve portability of shell scripts
Date: Sat, 7 Apr 2018 13:01:07 +0200

On Fri,  6 Apr 2018 21:41:37 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit 29b03dc1a807155863cbcf923dcf43ec5c5628dd
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Improve portability of shell scripts
GC>     
GC>     Ran 'shellcheck', at first with no '-e' option, and ultimately thus:
GC>       for z in *.sh; do shellcheck -e2046,2166,2003,2129 $z; done
GC>     and resolved most of the concerns it flagged.
GC>     
GC>     The 'install_*.sh' scripts in particular need careful testing.
[...]
GC> diff --git a/install_wx.sh b/install_wx.sh
GC> index bf35ed2..2b2a5bf 100755
GC> --- a/install_wx.sh
GC> +++ b/install_wx.sh
GC> @@ -48,16 +48,16 @@ then
GC>      wx_dir_parent=${wx_dir%/*}
GC>      [ -d $wx_dir_parent ] || mkdir -p $wx_dir_parent
GC>      cd $wx_dir_parent
GC> -    git clone $wx_git_url ${wx_dir##*/}
GC> +    git clone "$wx_git_url" ${wx_dir##*/}

 Does this mean that all variables expansions now need to be inside quotes?
We can be sure that wx_git_url (nor wx_commit_sha below) contains neither
spaces nor any wildcard characters, so perhaps we could add 2086 to the
list of disabled shellcheck warnings instead? The extra quotes really don't
help the already not very readable shell syntax...

 If not, I'd have to update the PR 80 as it contains some more unquoted
variable expansions (all of which are still safe though).

GC> -[ -n $mingw_bin_dir ] && export PATH="$mingw_bin_dir:${PATH}"
GC> +[ -n "$mingw_bin_dir" ] && export PATH="$mingw_bin_dir:${PATH}"

 This one is a real bug, sorry for letting it slip in and thanks for
finding it!
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]