[tor-bugs] #30002 [Core Tor/Tor]: shellcheck: test_key_expiration.sh issues

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Apr 3 14:44:58 UTC 2019


#30002: shellcheck: test_key_expiration.sh issues
------------------------------+----------------------
     Reporter:  rl1987        |      Owner:  (none)
         Type:  defect        |     Status:  assigned
     Priority:  Medium        |  Milestone:
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+----------------------
 {{{

 In src/test/test_key_expiration.sh line 9:
 if [ $# -eq 0 ] || [ ! -f ${1} ] || [ ! -x ${1} ]; then
                           ^--^ SC2086: Double quote to prevent globbing
 and word splitting.
                                            ^--^ SC2086: Double quote to
 prevent globbing and word splitting.


 In src/test/test_key_expiration.sh line 16:
 UNAME_OS=`uname -s | cut -d_ -f1`
          ^----------------------^ SC2006: Use $(...) notation instead of
 legacy backticked `...`.


 In src/test/test_key_expiration.sh line 50:
 check_no_file() { [ -e "$1" ] && die "$1 was not supposed to exist" ||
 true; }
                               ^-- SC2015: Note that A && B || C is not if-
 then-else. C may run when A is true.


 In src/test/test_key_expiration.sh line 51:
 check_files_eq() { cmp "$1" "$2" || die "$1 and $2 did not match: `dump
 $1` vs `dump $2`"; }
 ^-------^ SC2006: Use $(...) notation instead of legacy backticked `...`.
 ^-- SC2086: Double quote to prevent globbing and word splitting.
 ^-------^ SC2006: Use $(...) notation instead of legacy backticked `...`.
 ^-- SC2086: Double quote to prevent globbing and word splitting.


 In src/test/test_key_expiration.sh line 54:
 DATA_DIR=`mktemp -d -t tor_key_expiration_tests.XXXXXX`
          ^-- SC2006: Use $(...) notation instead of legacy backticked
 `...`.


 In src/test/test_key_expiration.sh line 63:
 trap "rm -rf '$DATA_DIR'" 0
               ^-------^ SC2064: Use single quotes, otherwise this expands
 now rather than when signalled.


 In src/test/test_key_expiration.sh line 66:
 DATA_DIR=`cd "${DATA_DIR}" && pwd`
          ^-----------------------^ SC2006: Use $(...) notation instead of
 legacy backticked `...`.

 For more information:
   https://www.shellcheck.net/wiki/SC2064 -- Use single quotes, otherwise
 this...
   https://www.shellcheck.net/wiki/SC2015 -- Note that A && B || C is not
 if-t...
   https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent
 globbing ...
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30002>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list