~nabijaczleweli/voreutils

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

2f45313 Only statvfs() if needed after filtering in df -l /mnt/nfs

27 days ago

e60dc45 cut -d ''

a month 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: ioctl(FICLONE/FICLONERANGE) for head/cat/cp/&c. There's probably something to be gained from FS_IOC_FIEMAP too

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?

#Building

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

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

libselinux-dev and pkg-config will provide SELinux support.
libgmp-dev and pkg-config will provide fast bignum support for factor.

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, VOREUTILS_INSTALL_LINK (apt) is the wayward-user cross-ref for install(1), VOREUTILS_UNAME_O, if nonempty, changes the default -o from the value of -s in uname and uname(1).

Makefile.local is sourced at the top for config persistence.

#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/opining

Post to the tracker (~nabijaczleweli/voreutils@todo.sr.ht, preferable for bugs), the list (~nabijaczleweli/voreutils@lists.sr.ht, preferable for opinions and patches), or me directly (now federated!).

Not picky about patches — inline, attachment, and a git link and ref to pull are fine — just please include the repo name in the subject prefix.

#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
  • Lars Strojny
  • EvModder