ultrix-sh is a modern 64-bit Linux port of the historical Bourne shell from ULTRIX V4.2 (Rev. 96).
This project aims to preserve the technical heritage of the Ultrix operating system by making its iconic command interpreter available on contemporary systems while maintaining strict adherence to the original K&R C style and behavior.
- 64-bit Stability: Refactored for modern LP64 architectures (polymorphic
execexpandintptr_tconversions). - Modern Memory Management: Replaced legacy
sbrkwith a robustmalloc-based allocator featuring a magic-header "safe free" mechanism. - Interactive Ready: Restored interactive prompt (
$) and terminal compatibility viagtty/sttyshims. - Historical Accuracy: Includes the original
sh.1manual page and maintains historical syntax (e.g.,VAR=VAL; export VAR).
The port addresses several critical challenges encountered when moving 1990-era Unix source to modern Linux:
- Memory Layout: Transitioned from a contiguous BSS-to-Heap assumption to a standard heap model.
- Pointer Punning: Updated
Rcheat/Lcheatmacros to be 64-bit safe. - Strict Prototyping: Added comprehensive prototypes to
defs.hto satisfy modern GCC requirements while keeping the K&R implementation intact.
To build ultrix-sh on a modern Linux system:
make -f MakefileThe resulting binary sh can be run locally:
./shA basic stress test is provided to verify variable expansion, pipes, and subshell behavior:
# Apply executable bit if needed
chmod +x stress.sh
./stress.shThis project is licensed under the BSD-3-Clause License. See the LICENSE file for the full text and important historical preservation disclaimers.
Preserved and ported by Mario (@wordatet) for research and education.