logo

utils-std

Collection of commonly available Unix tools

README.md (3810B)


  1. # utils-std: Collection of commonly available Unix tools
  2. Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. SPDX-License-Identifier: MPL-2.0
  4. This is my own collection of commonly available Unix utilities, most of them implemented by me.
  5. POSIX is used as a guide, but current Unix systems are the biggest inspiration and compatibility with portable scripts is intended.
  6. Developed on Linux+musl, automatically tested on FreeBSD and NetBSD thanks to [SourceHut](https://builds.sr.ht/~lanodan/utils-std).
  7. ## Dependencies
  8. - C99 Compiler + POSIX C Library
  9. - POSIX yacc(1) implementation
  10. - POSIX Shell
  11. - POSIX Make (optional, see `makeless.sh`)
  12. - (optional, test) ATF: <https://github.com/jmmv/atf>
  13. - (optional, test) Kyua: <https://github.com/jmmv/kyua>
  14. - (optional, test) bwrap: <https://github.com/containers/bubblewrap/> For safely overlaying false files on the root filesystem
  15. - (optional, test) [prysk](https://www.prysk.net/) (or [cram](https://bitheap.org/cram/) but it got abandonned)
  16. - (optional, lint) mandoc: <https://mdocml.bsd.lv/> For linting the manual pages
  17. - (optional, lint) shellcheck: <https://www.shellcheck.net/> For linting `./configure` and shell scripts
  18. ## Packaging
  19. - The `./configure` script isn't auto*hell based, you can pass it arguments via key-value arguments or environment variables
  20. - You can define the `NO_BWRAP` environment variable to skip the bwrap-based tests which can cause issues in some environments like Gentoo `sandbox`
  21. - If you want statically linked executables, pass `LDSTATIC=-static` to configure (environment or argument)
  22. ## Design differences
  23. - All programs prefix their messages with their name. This way you don't end up with context-less messages in scripts.
  24. - When the output is structured data, a terminal gets human-oriented output, others like piped programs get machine-oriented output (no padding, line separation, CSV, JSON, …). Prior art: most `ls(1)` implementations, i3/sway, FreeBSD utils via `libxo`, …
  25. - As the `utmp` and `wtmp` files are considered broken by design, utilities dependant on them like `who` and `lastlog` won't be implemented. Proper authentication logs shouldn't be writable into by multiple programs, some of them third-party (like SSH and Display Managers typically are).
  26. - Minimal dependencies, allowing to bootstrap utils-std with barely having unix utilities.
  27. ### Difference with coreutils
  28. Straightforward code, similarly to glibc, coreutils codebase often has it's actual code hidden under layers of macros and wrapper functions.
  29. ### Difference with BusyBox/ToyBox
  30. Instead of minimalism as a constraint, here it is seen as a virtue of good design and as such as a process/long-term-goal.
  31. But being a near drop-in replacement is utils-std reason for existing.
  32. Also Toybox is stuck with reimplementing everything free of copyright issues due to it's choice of 0BSD.
  33. utils-std default license is the MPL-2.0 to be able to take code and design back without legal issues, but also is able to take code from other implementations.
  34. ## Goals
  35. - (long-run) Effectively serve as one of the blocks to get base utilities, replacing GNU coreutils and part of BusyBox/ToyBox
  36. - Code readability and hackability
  37. - Portability, should run on modern libre POSIX systems as to not introduce vendor-locking
  38. - Efficiency, but not without sacrifying the other goals
  39. ## Non-Goals
  40. - Reimplementing complex utilities that already have great code or ought to be maintained separately
  41. - Implementing utilities which aren't in your usual base system. This is covered by [utils-extra](https://hacktivis.me/git/utils-extra), and I'd also recommend checking out [moreutils](https://joeyh.name/code/moreutils/)
  42. - Reimplementing OS-specific utilities like [util-linux](https://www.kernel.org/pub/linux/utils/util-linux/)