The POSIX shell is a widely deployed, powerful tool for managing computer systems. The shell is the expert's control panel, a necessary tool for configuring, compiling, installing, maintaining, and deploying systems. Even though it is powerful, critical infrastructure, the POSIX shell is maligned and misunderstood. Its power and its subtlety are a dangerous combination. We define a formal, mechanized, executable small-step semantics for the POSIX shell, which we call Smoosh. We compared Smoosh against seven other shells that aim for some measure of POSIX compliance (bash, dash, zsh, OSH, mksh, ksh93, and yash). Using three test suites---the POSIX test suite, the Modernish test suite and shell diagnosis, and a test suite of our own device---we found Smoosh's semantics to be the most conformant to the POSIX standard. Modernish judges Smoosh to have the fewest bugs (just one, from using dash's parser) and no quirks. To show that our semantics is useful beyond yielding a conformant, executable shell, we also implemented a symbolic stepper to illuminate the subtle behavior of the shell. Smoosh will serve as a foundation for formal study of the POSIX shell, supporting research on and development of new shells, new tooling for shells, and new shell designs.
翻译:POSIX 外壳是一个广泛部署的、强大的计算机系统管理工具。 外壳是专家的控制面板, 是配置、 汇编、 安装、 维护、 部署系统的必要工具。 尽管 POSIX 外壳是强大的、 关键的基础设施, 但它是扭曲和误解的。 它的力量和微妙性是危险的组合。 我们定义了一种正式的、 机械化的、 可执行的小型语义, 用于 POSIX 外壳, 我们称之为 Soosh 。 我们比较了Smosh 与其他七枚外壳的相比, 该外壳是用来测量POS 合规性( bash、 show、 zsh、 OS、 OSH、 mkshsh、 kshsh93 和 Yash ) 的必备工具。 使用三个测试套套 — POSIX 测试套件、 现代测试套件和弹壳诊断, 以及我们自己的一个测试套- 我们发现Smoshoosh 的语语语语语系最符合 POSIX 标准 。 现代法官们和最稀少的弹道错误( ) ) ( ),, 用于使用软质支持 的外壳质 和不易变的空的空的空的火箭研究, 和不精化的脚本。