Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • S sbws
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 5
    • Issues 5
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • The Tor Project
  • Network Health
  • sbws
  • Issues
  • #33606
Closed (moved) (moved)
Open
Created 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
Time tracking