s6-portable-utils
Software
skarnet.org

The s6-ln program

s6-ln creates a link to a file.

Interface

     s6-ln [ -n ] [ -s ] [ -f ] [ -L ] [ -P ] source... target

s6-ln acts as the generic ln utility.

Options

Posixness

s6-ln would be suitable as a Single Unix ln program, except that POSIX mandates that a preexisting target must first be unlink()ed and then (sym)link()ed, which prevents atomic replacements. s6-ln aims to be reliable and allow for atomic replacements, so it deviates from POSIX on that point: when target exists and needs to be replaced, s6-ln first creates a (sym)link to a unique temporary name, then rename()s the temporary name to target. This behaviour makes sure that target is atomically replaced - there's no point in time where it does not exist.