Opened 6 months ago

Closed 5 months ago

#30002 closed defect (fixed)

shellcheck: test_key_expiration.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:
Cc: Actual Points:
Parent ID: Points:
Reviewer: cohosh Sponsor:

Description

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 ...

Child Tickets

Change History (6)

comment:1 Changed 6 months ago by rl1987

Owner: set to rl1987
Status: assignedaccepted

comment:2 Changed 6 months ago by rl1987

Status: acceptedneeds_review

comment:3 Changed 6 months ago by asn

Reviewer: cohosh

comment:4 Changed 6 months ago by nickm

Milestone: Tor: 0.4.1.x-final

batch-assigning shellcheck tickets to 0.4.1

comment:5 Changed 5 months ago by cohosh

Status: needs_reviewmerge_ready

Looks good.

Travis is failing, but it looks unrelated.

comment:6 Changed 5 months ago by nickm

Resolution: fixed
Status: merge_readyclosed

merged to master.

Note: See TracTickets for help on using tickets.