Opened 8 months ago

Closed 7 months ago

#29062 closed defect (fixed)

shellcheck: test_keygen.sh issues

Reported by: rl1987 Owned by: rl1987
Priority: Medium Milestone: Tor: 0.4.1.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: technical-debt
Cc: Actual Points:
Parent ID: Points:
Reviewer: asn Sponsor:

Description

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.

Child Tickets

Change History (6)

comment:1 Changed 8 months ago by rl1987

Owner: set to rl1987
Status: newaccepted

comment:2 Changed 8 months ago by rl1987

Status: acceptedneeds_review

comment:3 Changed 8 months ago by nickm

Milestone: Tor: 0.4.1.x-final

comment:4 Changed 7 months ago by dgoulet

Reviewer: asn

comment:5 Changed 7 months ago by asn

Status: needs_reviewmerge_ready

LGTM! Thanks rl1987!

comment:6 Changed 7 months ago by nickm

Resolution: fixed
Status: merge_readyclosed

merged to master (which is now 0.4.1!)

Note: See TracTickets for help on using tickets.