Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
S
sbws
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 133
    • Issues 133
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 4
    • Merge Requests 4
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • The Tor Project
  • Network Health
  • sbws
  • Issues
  • #33606

Closed
Open
Opened Mar 13, 2020 by teor@teor

Catch common bash errors in sbws scripts

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 legacy/trac#33451 (moved).

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: tpo/network-health/sbws#33606