[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #29062 [Core Tor/Tor]: shellcheck: test_keygen.sh issues



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

 In test_keygen.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 test_keygen.sh line 16:
 UNAME_OS=`uname -s | cut -d_ -f1`
          ^-- SC2006: Use $(..) instead of legacy `..`.


 In test_keygen.sh line 67:
 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 test_keygen.sh line 68:
 check_files_eq() { cmp "$1" "$2" || die "$1 and $2 did not match: `dump
 $1` vs `dump $2`"; }
                                                                   ^--
 SC2006: Use $(..) instead of legacy `..`.
 ^-- SC2086: Double quote to prevent globbing and word splitting.
 ^-- SC2006: Use $(..) instead of legacy `..`.
 ^-- SC2086: Double quote to prevent globbing and word splitting.


 In test_keygen.sh line 71:
 DATA_DIR=`mktemp -d -t tor_keygen_tests.XXXXXX`
          ^-- SC2006: Use $(..) instead of legacy `..`.


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


 In test_keygen.sh line 83:
 DATA_DIR=`cd "${DATA_DIR}" && pwd`
          ^-- SC2006: Use $(..) instead of legacy `..`.


 In test_keygen.sh line 146:
 ${TOR} --DataDirectory "${ME}" --list-fingerprint > "${ME}/stdout" && die
 "Somehow succeeded when missing secret key, certs: `cat ${ME}/stdout`" ||
 true
                                                                    ^--
 SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.
 ^-- SC2006: Use $(..) instead of legacy `..`.
 ^-- SC2086: Double quote to prevent globbing and word splitting.


 In test_keygen.sh line 283:
 ${TOR} --DataDirectory "${ME}" --list-fingerprint > "${ME}/stdout" && die
 "Tor started with encrypted secret key and no certs" || true
                                                                    ^--
 SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.


 In test_keygen.sh line 372:
 ${TOR} --DataDirectory "${ME}" --list-fingerprint >"${ME}/stdout" && die
 "Successfully started with mismatched keys!?" || true
                                                                   ^--
 SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.


 In test_keygen.sh line 388:
 ${TOR} --DataDirectory "${ME}" --passphrase-fd 1 > "${ME}/stdout" && die
 "Successfully started with passphrase-fd but no keygen?" || true
                                                                   ^--
 SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.


 In test_keygen.sh line 404:
 ${TOR} --DataDirectory "${ME}" --no-passphrase > "${ME}/stdout" && die
 "Successfully started with no-passphrase but no keygen?" || true
                                                                 ^--
 SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.


 In test_keygen.sh line 420:
 ${TOR} --DataDirectory "${ME}" --newpass > "${ME}/stdout" && die
 "Successfully started with newpass but no keygen?" || true
                                                           ^-- SC2015: Note
 that A && B || C is not if-then-else. C may run when A is true.


 In test_keygen.sh line 458:
 ${TOR} --DataDirectory "${ME}" --keygen --passphrase-fd ewigeblumenkraft >
 "${ME}/stdout" && die "Successfully started with bogus passphrase-fd?" ||
 true
 ^-- SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.


 In test_keygen.sh line 475:
 ${TOR} --DataDirectory "${ME}" --keygen --passphrase-fd 1 --no-passphrase
 > "${ME}/stdout" && die "Successfully started with bogus passphrase-fd
 combination?" || true
 ^-- SC2015: Note that A && B || C is not if-then-else. C may run when A is
 true.

 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/29062>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs