descriptionCursed version of the standard UNIX utilities
owneralessio.chiapperini@nullbuffer.com
last changeFri, 29 Apr 2022 22:21:59 +0000 (30 00:21 +0200)
content tags
add:
README.md

Cursed Utils

A collection of cursed core tools for a POSIX-compatible operating system.

Goal

The goal of the project is to provide cursed/corrupted versions of the POSIX.1 core tools and utilities. This project is meant as a joke and should not be used in production.

Features

Limitations

Build dependencies

The only dependency is a toolchain supporting the following flags:

CFLAGS = -std=c99 -O2 -Wall -Wextra -Wpedantic \
        -Walloca -Wcast-qual -Wconversion -Wformat=2 -Wformat-security \
        -Wnull-dereference -Wstack-protector -Wvla -Warray-bounds \
        -Wbad-function-cast -Wconversion -Wshadow -Wstrict-overflow=4 -Wundef \
        -Wstrict-prototypes -Wswitch-default -Wfloat-equal -Wimplicit-fallthrough \
        -Wpointer-arith -Wswitch-enum \
        -D_FORTIFY_SOURCE=2 \
        -fstack-protector-strong -fPIE -fstack-clash-protection

LDFLAGS = -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,separate-code

Otherwise you can just remove the security flags and compile it with

CFLAGS = -std=c99 -O2 -Wall -Wextra -Wpedantic
LDFLAGS =

or pass your own flags to make

make CC=gcc CFLAGS=... LDFLAGS=...

Compilation

Each tool can be compiled individually with the following:

cd src/$tool
make

Alternatively, you can compile all of the tools from the top level directory with:

make

Installation

Clone this repository then

$ make PREFIX=/usr install

This will install the compiled binary under PREFIX (/usr/bin) in this case, if not specified PREFIX will default to /usr/local. For staged installs, DESTDIR is also supported. As the binary does not have any dependency it does not have to be installed before use.

Test suite

The test suite consists of a POSIX shell script called harness.sh contained in the test folder. It's output is similar to googletest's and it can be invoked with make test which, if everything is working should output something similar to

(cd test && ./harness.sh)
[----------] Test environment set-up.
[==========] Running 2 test cases.
[ RUN      ] false_should_return_zero
[       OK ] false_should_return_zero
[ RUN      ] true_should_return_nonzero
[       OK ] true_should_return_nonzero
[==========] 2 test cases ran.
[  PASSED  ] 2 tests.
[  FAILED  ] 0 tests.
[----------] Test environment teardown.

Static analysis

Static analysis on the code base is done by using clang's static analyzer run through scan-build.sh which wraps the scan-build utility. The checkers used are part of the Experimental Checkers (aka alpha checkers):

Scope

cursedutils contains some of the POSIX.1-2017 base utilities, but does not support any POSIX.1-2017 option groups. The utilities are not POSIX.1-2017 conformant nor compliant since they (obviously) don't follow the specification. However, when applicable, the utilities will try to adhere to the standard.

Contributing

Send patches on the mailing list, report bugs using git-bug.

License

BSD 2-Clause FreeBSD License, see LICENSE.

shortlog
2022-04-29 Alessio ChiapperiniFix shellcheck errors/warningsmaster
2022-04-19 Alessio ChiapperiniRemove empty line
2022-04-15 Alessio ChiapperiniAdd missing permissions to open
2022-04-15 Alessio ChiapperiniAdd sort
2022-04-15 Alessio ChiapperiniFix non POSIX compliant ==
2022-04-15 Alessio ChiapperiniAdd cat examples
2022-04-15 Alessio ChiapperiniAdd -h flag to cat
2022-04-13 Alessio ChiapperiniRemove empty line
2022-04-06 Alessio ChiapperiniFix GCC's -Wsign-conversion error
2022-04-06 Alessio ChiapperiniAdd cat
2022-04-05 Alessio ChiapperiniFix test scripts
2022-04-04 Alessio ChiapperiniAdd rm
2022-03-30 Alessio ChiapperiniUpdate mailing list and issue tracker
2022-03-30 Alessio ChiapperiniAdd Scope section in README.md
2022-03-30 Alessio ChiapperiniAdd Goal section in README.md
2022-03-24 Alessio ChiapperiniRemove unnecessary Makefile target
...
heads
23 months ago master