Executable formal semantics for the POSIX shell

07/11/2019
by   Michael Greenberg, et al.
0

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.

READ FULL TEXT

page 1

page 18

research
06/07/2017

Decoding Lua: Formal Semantics for the Developer and the Semanticist

We provide formal semantics for a large subset of the Lua programming la...
research
04/04/2018

P4K: A Formal Semantics of P4 and Applications

Programmable packet processors and P4 as a programming language for such...
research
02/08/2022

K-ST: A Formal Executable Semantics of PLC Structured Text Language

Programmable Logic Controllers (PLCs) are responsible for automating pro...
research
05/17/2022

Formal verification of an industrial UML-like model using mCRL2 (extended version)

Low-code development platforms are gaining popularity. Essentially, such...
research
09/08/2023

Seeding Contradiction: a fast method for generating full-coverage test suites

The regression test suite, a key resource for managing program evolution...
research
04/01/2022

A Test Suite for the Evaluation of Portuguese-English Machine Translation

This paper describes the development of the first test suite for the lan...
research
11/09/2020

A Semantic Framework for PEGs

Parsing Expression Grammars (PEGs) are a recognition-based formalism whi...

Please sign up or login with your details

Forgot password? Click here to reset