[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #33606 [Core Tor/sbws]: Catch common bash errors in sbws scripts
#33606: Catch common bash errors in sbws scripts
-------------------------------+--------------------
Reporter: teor | Owner: (none)
Type: task | Status: new
Priority: Medium | Milestone:
Component: Core Tor/sbws | Version:
Severity: Normal | Keywords:
Actual Points: | Parent ID:
Points: | Reviewer:
Sponsor: |
-------------------------------+--------------------
We're going to gradually update tor, chutney, and fallback-scripts bash
scripts to catch more errors. sbws might also want to make similar
changes.
I'm not sure if sbws uses shellcheck already. Shellcheck helps catch
errors while writing scripts.
To catch more runtime failures, set these options at the start of each
script:
{{{
set -e
set -u
set -o pipefail
}}}
You might also want to set:
{{{
IFS=$'\n\t'
}}}
But it can change how lists are processed.
These settings help catch common errors in bash scripts at runtime:
http://redsymbol.net/articles/unofficial-bash-strict-mode/
But they can cause scripts to fail, so you should have good unit tests and
CI for all your scripts, before making these changes.
Follow-up to #33451.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33606>
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