Every script a build runs with bash, devvm's own and the user's layers,
now gets the prelude as one line, eval $'…', in place of its #! line, so
bash's errors and $LINENO give the script's own line numbers. A script
without a #! line is one line further down.
- shell.QuoteLine: ANSI-C quoting for bash, on one line of printable
ASCII; every other byte as \xHH, so a multibyte locale's lead byte
(Shift-JIS, GBK, GB18030, Big5) can't swallow the backslash escaping a
quote, and a NUL panics as a caller's bug. image's layer rule allows
internal/shell, a leaf.
- image.WithPrelude, the one place the prelude and a script are joined
(OwnScript calls it), used by base.sh, apt.sh, the built-in layers and
features, the user's layers, shared-tools/build.sh and oci/build.sh.
Every devvm script has a #! line. A leading UTF-8 BOM goes before the
#! check.
- A build's exports for a company proxy (lima's proxyExports) and the
user's CAs (trust's exports) end in "; ", not a newline, so they share
the first line and move no line either; backend.Trust.Env says so.
- The stub logs a bash -s script's second line, which is the script's
own second line with or without the prelude.
- Keys: every build script's bytes change, so base, every image and
every shared tool image are built again once; the CHANGELOG's After
you upgrade says so with git-lfs, and what VMs say until devvm update,
and Breaking has its own heading.
- Tests: TestQuoteLine (every byte but NUL, a break-out word, in
/bin/bash 3.2 and PATH's bash, in C and each of ja_JP.SJIS, zh_CN.GBK,
zh_CN.GB18030 and zh_TW.Big5 that locale -a has), TestQuoteLineNUL,
TestWithPrelude's shebang and BOM cases, TestWithPreludeRuns (the real
prelude's line gives the prelude back; a layer under set -euo pipefail
gets the names, keeps its function and its line numbers, with and
without exports before it).
- e2e nix: the layer copy no longer adds the prelude itself.
- Docs: images.md's prelude section, Customizing's layer bullet,
structure.md.
Co-Authored-By: Claude Opus 5.5 <[email protected]>