patch taken from openbsd.
Ingo Schwarze says:
If you call the col(1) utility with the -f option, permitting forward
half-line feeds in the output stream, and the input stream actually
contains half-line feeds in either direction, you end up with corrupt
output, containing meaningless escape-digitnine sequences instead of
the required escape-tab sequences.
$ hexdump -C half.txt
00000000 61 1b 09 62 1b 09 63 0a |a..b..c.|
00000008
$ col -f < half.txt | hexdump -C
00000000 61 1b 39 0d 20 62 1b 39 0d 20 20 63 0a |a.9. b.9. c.|
0000000d
Note how the third character changes from 0x09 to 0x39.
OK to commit the following fix? Don't worry, it isn't dangerous,
it only changes two *bits*, only a quarter of a byte.
The bug was introduced by the original author, Michael Rendell,
and committed by Keith Bostic on May 22, 1990 (SCCS rev. 5.1).
The following operating systems are affected:
* 4.3BSD Reno, BSD Net/2, 4.4BSD, 4.4BSD Lite1, 4.4BSD Lite2
* All versions of 386BSD, NetBSD, OpenBSD, FreeBSD and DragonFly
* All versions of Debian GNU/Linux and probably many other Linuxes
sbase - suckless unix tools
===========================
sbase is a collection of unix tools that are inherently portable
across UNIX and UNIX-like systems.
The following programs are currently implemented:
basename
cal
cat
chgrp
chmod
chown
chroot
cksum
cmp
col
cols
comm
cp
csplit
cut
date
dirname
du
echo
env
expand
expr
false
fold
grep
head
hostname
kill
link
ln
logname
ls
md5sum
mkdir
mkfifo
mktemp
mv
nice
nl
nohup
paste
printenv
printf
pwd
readlink
renice
rm
rmdir
sleep
setsid
sort
split
sponge
strings
sync
tail
tar
tee
test
touch
tr
true
tty
uudecode
uuencode
uname
unexpand
uniq
unlink
seq
sha1sum
sha256sum
sha512sum
wc
xargs
yes
sbase is mostly following POSIX but we deviate wherever we think it is
appropriate.
The complement of sbase is ubase[1] which is Linux-specific and
provides all the non-portable tools. Together they are intended to
form a base system similar to busybox but much smaller and suckless.
Building
--------
To build sbase, simply type make. You may have to fiddle with
config.mk depending on your system.
You can also build sbase-box, which generates a single binary
containing all the required tools. You can then symlink the
individual tools to sbase-box.
Ideally you will want to statically link sbase. If you are on Linux
we recommend using musl-libc[2].
Portability
-----------
sbase has been compiled on a variety of different operating systems,
including Linux, *BSD, OSX, Haiku, Solaris, SCO OpenServer and others.
sbase also compiles and runs on minix3 with slight modifications.
They do not provide mmap()/munmap() so you need to use minix_mmap()
and minix_munmap() respectively.
Various combinations of operating systems and architectures have also
been built.
You can build sbase with gcc, clang, tcc, nwcc and pcc.
[1] http://git.suckless.org/ubase/
[2] http://www.musl-libc.org/