Skip to content

Add set -euo pipefail to remaining bash scripts (15 of 47 today) #49

Description

@mikevitelli

From the 2026-04-09 audit (docs/audits/2026-04-09/01-tui-scripts-audit.md).

The 2026-04-09 audit asked for set -euo pipefail to be added to ~26 scripts that lacked it (priority: power/ scripts — charge.sh, cpu-freq-cap.sh, pmu-voltage-min.sh).

As of 2026-04-25: only 15 of 47 bash scripts under device/scripts/ set the strict mode. Without it, scripts silently continue past errors:

  • set -e — exit on any unchecked failed command
  • set -u — exit on use of an unset variable
  • -o pipefail — propagate failure through pipelines (e.g. something | grep doesn't mask the something exit code)

Acceptance: every shell script under device/scripts/ either has set -euo pipefail near the top OR has a one-line comment explaining why it deliberately doesn't (e.g. "interactive prompt loop relies on read returning non-zero on EOF").

Audit-prioritized scripts to start with (safety-critical):

  • device/scripts/power/charge.sh
  • device/scripts/power/cpu-freq-cap.sh
  • device/scripts/power/pmu-voltage-min.sh

Per CLAUDE.md, battery/power scripts should not be auto-fixed — review each one by hand before adding strict mode, since it can change failure behaviour.

Context: marked partial (15/47) in docs/audits/2026-04-09/STATUS.md as of 2026-04-25.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode refactoring and cleanup

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions