lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master b25a732 06/18: Resolve all shellcheck "SC2038


From: Greg Chicares
Subject: [lmi-commits] [lmi] master b25a732 06/18: Resolve all shellcheck "SC2038" warnings
Date: Wed, 29 May 2019 18:49:07 -0400 (EDT)

branch: master
commit b25a732ed34d985c6803e3bf86bd202692ae24fa
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Resolve all shellcheck "SC2038" warnings
    
    Null separators
      find ... -print0 | xargs -0 ...
    are supported by both GNU and BSD userlands--i.e., universally--and
    seem less confusing than the POSIX alternative
      find ... -exec ... {} +
    
    This usage, found in a few files:
      grep '!!!!' --count | xargs printf '%d tests succeeded\n'
    seems safe enough to leave alone, as does this:
      git ls-files --deleted | xargs git checkout --
    and in those cases it does seem distasteful to resort to null-separating
    options for the commands (other than 'find') on the right-hand side.
---
 check_git_setup.sh | 4 ++--
 install_msw.sh     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/check_git_setup.sh b/check_git_setup.sh
index 6e033a0..0e35098 100755
--- a/check_git_setup.sh
+++ b/check_git_setup.sh
@@ -43,8 +43,8 @@ case "$lmi_build_type" in
       for d in . gwc; do (\
            printf '%s...' "$d" \
         && find ./$d -maxdepth 1 -type f \
-             -not -name '*.sh' -not -name '*.sed' \
-             | xargs chmod -x \
+             -not -name '*.sh' -not -name '*.sed' -print0 \
+             | xargs -0 chmod -x \
       )done; \
     printf 'all incorrect execute permissions removed\n'
     git config core.filemode false
diff --git a/install_msw.sh b/install_msw.sh
index 0c15c89..6c63cc5 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -234,7 +234,7 @@ mkdir --parents /cache_for_lmi/downloads
 mount
 
 md5sum "$0"
-find /cache_for_lmi/downloads -type f | xargs md5sum
+find /cache_for_lmi/downloads -type f -print0 | xargs -0 md5sum
 
 make $coefficiency --output-sync=recurse -f install_miscellanea.make clobber
 make $coefficiency --output-sync=recurse -f install_miscellanea.make
@@ -270,7 +270,7 @@ do
     ./install_wx.sh
     ./install_wxpdfdoc.sh
 
-    find /cache_for_lmi/downloads -type f | xargs md5sum
+    find /cache_for_lmi/downloads -type f -print0 | xargs -0 md5sum
 
     # Source this script only for commands that depend upon it.
     . ./set_toolchain.sh



reply via email to

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