~nabijaczleweli/voreutils

voreutils/README.md -rw-r--r-- 15.6 KiB
60382426наб Manually exhaust data passed to dd commit_write() instead of assuming it always does everything 15 days ago

#voreutils builds.sr.ht build status Licence

Drop-in Policy-compatible coreutils replacement, at the very least.

This probably wants a better blurb.

#Manual

GNU coreutils provide the following 106 binaries, according to dpkg -L coreutils | grep bin/ on Bullseye (8.32-4+b1):

Also an honorary glibc bug: #1017852: C locale is 7-bit (127 characters), must be 8-bit (256 characters) since POSIX Issue 7 TC2/Issue 8

TODO? for du/df, we process DU_BLOCK_SIZE=Q BLOCK_SIZE=2 as -B2 not as default block size, unlike coreutils

TODO: import descriptions of the one-line 1BSD-style imports

TODO: multicalls should default to something rather than abort when appropriate like netbsd id(1) maybe? This is already what we do with cksum.

TODO: should posix_fadvise(sequential) where appropriate maybe?

TODO: support SMACK in addition to SELinux? or don't either way, rip it out (rm has it) or add it in

TODO: support TrustedBSD maybe?

TODO? does "UNIX Programmer's Manual" want to have some part/entirety .Tned

TODO: some sort of consistent uid/gid/pwent/grent caching?

#Building

You'll need a non-ancient C++ toolchain, a BSD AWK, GNU make, mandoc (linting and HTML manuals only, MANDOC=: to disable), and shellcheck (for shell wrappers, SHELLCHECK=: to disable).

libb2 and libcrypto are required (searched with pkg-config if available). It'd be just libcrypto if the implementation correctly used the result size in EVP_MD.

libselinux-dev and pkg-config will provide SELinux support.

Run GNU make. See the head of the Makefile for tunables, notably VOREUTILS_VERSION, derived from git HEAD by default, and VOREUTILS_DATE{,_MODE}, derived from the latest git commit affecting each file by default, OUTDIR (and {CMD,LIB,MAN,HTMLMAN}DIR) where artifacts land, and OBJDIR where intermediate objects land; these can all be set independently, SYMLINK, if set to "y", will link binary altnames together symbolically. VOREUTILS_LIB_PREFIX (/usr/lib/voreutils/) is the location of libstdbuf.

#Installation

If you just want the manuals, copy MANDIR (out/man by default) to somewhere in your $MANPATH (like /usr/local/man).

Otherwise, point your $PATH at CMDDIR (out/cmd); if you're using groff, $MANPATH works automagically, otherwise, adjust it as well. Or copy {CMD,LIB,MAN}DIR (out/{cmd,lib,man}) to ~/{bin,lib,man}.

If you're feeling brave, copy them to /usr/local/{bin,lib,man}, which globally masks your system coreutils. Depending on which GNU coreutils bugs your system depends on, this may be undesirable.

VOREUTILS_LIB_PREFIX needs to be set correctly (to the final destination of LIBDIR) at build time for stdbuf to work right.

#Organisation

Who knows yet!

The version is included in each output file, via the .version directive (=> it ends up in .note).

Unlocked stdio used by default, toggle comment in include/vore-stdio to disable (for testing or otherwise). TODO: temporarily permanently disabled for testing; enable later.

If C++ were good, gcc would have [[no_destroy]]; it doesn't: use placement new for (function-)static maps et al. like rm.cpp. Ideally we could do the same to main()-scope variables, but it's too verbose.

The environment block is read-only (except as hidden by libc et al., but that's hidden) – argv and environ are const char * const *.

argc doesn't exist because argv is a forward iterator: consecutive elements are *(argv + n); argv[0] is self.

Enable in-line eqn(1) with

.EQ
delim %%
.EN

(or whichever delimiter is best) after .Sh DESCRIPTION and disable it at the end.

If typesetting something that doesn't work in nroff mode (like the big equations in base64.1) provide an .ie n/.el alternative in .Fn-like syntax; otherwise (like the polynomial in cksum.1) enable eqn(1) preprocessing in man(1) by starting with '\" e.

If typesetting something that doesn't work in troff mode, prefer .ie t (cf. pathchk.1).

In mandoc delimited eqn(1) breaks conditionals, wrap them in braces (.el \{ [text] % eqn % [text] \}).

#Tests

Need to be attached to a teletype. Use script(1), for example, if the test environment doesn't allocate one by default.

Test data is compacted per data directory w/find -exec b2sum {} + | sort | mawk '{h = substr($0, 1, 128); fn = substr($0, 1 + 128 + 2); if(h == hash) {tgt = "." fname; split(fn, curs, "/"); if(curs[2] == fnames[2]) tgt = fnames[3]; print "[ -s \"" fn "\" ] && ln -sf -- \"" tgt "\" \"" fn "\""} else {hash = h; fname = fn; split(fname, fnames, "/")}}' | sh.

#Compatibility

Free UNIXes, hopefully. Debian, OpenBSD, and FreeBSD are on CI, as normal, bare, and fucked baselines, respectively. I also test on NetBSD (and TODO: some Illumos distro) before release.

#Contributing

Send a patch inline, as an attachment, or a git link and a ref to pull from to the list (~nabijaczleweli/voreutils@lists.sr.ht) or me directly. I'm not picky, just please include the repo name in the subject prefix.

#Discussion

Please use the tracker, the list, or Twitter.

#Licence

All contents of this repository are subject to the 0-clause BSD licence.

#Special thanks

To all who support further development on Patreon, in particular:

  • ThePhD
  • Embark Studios
  • Jasper Bekkers