Skip to content

docs(cli): correct the stated cause of a bootstrap that never returns - #1183

Merged
Chemaclass merged 1 commit into
mainfrom
docs/1183-bootstrap-mechanism-comment
Aug 13, 2026
Merged

docs(cli): correct the stated cause of a bootstrap that never returns#1183
Chemaclass merged 1 commit into
mainfrom
docs/1183-bootstrap-mechanism-comment

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

#1179 and #1181 state that source is a POSIX special builtin and that a syntax
error therefore terminates the shell. Measured, that is wrong:

case result
set +e, syntax error source returns 1, execution continues
set -e, syntax error shell exits (2)
set +e, bare exit 3 shell exits (3)

A syntax error makes source return non-zero like any other command; the shell
only dies because set -e is active at that point. A bare exit ends it
regardless.

💡 Changes

I wrote that source is a POSIX special builtin and that a syntax error in the
sourced file therefore terminates the shell. Measured, that is wrong:

  set +e, syntax error   source returns 1, execution continues
  set -e, syntax error   shell exits (2)
  set +e, bare exit 3    shell exits (3)

So the two modes have different causes. A syntax error makes source return
non-zero like any other command, and the shell only dies because set -e is
active at that point. A bare exit ends the shell regardless.

The marker and EXIT trap still cover both and stay fork-free, but the
alternative I dismissed -- set +e around the source, then check the status --
would have caught the syntax-error case; it just would not catch a bare exit.
The conclusion held, the reasoning did not.

Comments only; no behaviour change. Corrections also posted on #1179 and #1181.
@Chemaclass Chemaclass added the documentation Improvements or additions to documentation label Aug 13, 2026
@Chemaclass Chemaclass self-assigned this Aug 13, 2026
@Chemaclass
Chemaclass merged commit 866f038 into main Aug 13, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the docs/1183-bootstrap-mechanism-comment branch August 13, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant