Version 0.2.2 behavior is documented here. Thesupport record separates local verification frompublished MoonX behavior; moonx examples use registry releases.
Options include -r, -u, -b, -d, -f, and -i, plus -n numeric,-g general numeric, -h human numeric, -M month, and -V versioncomparisons. Repeated -k F[.C][OPTS][,F[.C][OPTS]] keys support field,character, and local comparison modifiers; -t BYTE selects a fieldseparator. -z selects NUL records. -c/--check diagnoses the first disorderand -C/--check=quiet only returns status 1.
Comparison uses C-locale byte rules without changing environment variables.Blank-separated fields retain their leading separator run unless -b applies;case folding maps lowercase ASCII to uppercase, and human numeric order comparessign, suffix magnitude, then numeric value. Key ties use the whole record as thelast resort and remaining ties retain input order. -s/--stable suppresses thatwhole-record fallback, preserving input order among equal keys. -u retainsthe first representative under the selected keys.
-R/--random-sort or --sort=random orders transformed keys byMD5(seed || effective key), comparing digest bytes and then key bytes on adigest collision. Equal keys remain together; ordinary record fallback, -s,-u, reverse ordering, and local key modifiers still apply. An effectiverandom key consumes exactly 16 bytes from --random-source=FILE before inputprocessing, even for empty input. Without a source, the public secure randomAPI supplies the seed. A source named - is a literal file. Repeated identicalsource paths are allowed; different source strings conflict. A source is notread when local key comparison modifiers suppress global random ordering.
-m/--merge merges already-sorted inputs without checking or repairing theirorder. Equal keys keep operand order and then source order with -s or -u.It shares the 16-way heap and temporary runs, including additional rounds formore than 16 operands.
-o/--output=FILE writes to a named file with empty stdout; -o - names aliteral file. Ordinary sorting consumes all input before truncating the output,so existing outputs and input aliases are supported. Missing inputs leave anoutput uncreated; a later read error can leave a newly created output emptywhile retaining an existing output's bytes. Check mode conflicts with output.Repeated identical output strings are allowed and distinct strings conflict.
Merge accepts new output files. Merge into an existing output is rejectedwithout mutation: the released filesystem API has no opened-file identity ordescriptor truncation with which to protect aliased merge inputs. Lifting thisboundary requires those public APIs and alias/error-effect regressions.
Records and transformed keys are prepared once before comparison. Sorting usesa default 64 MiB accounted run budget and at most 16-way heap merges, with64 KiB input, output and merge buffers. Stable sequence IDs and prepared keyssurvive disk runs; -u keeps the first representative across run boundaries.Check mode retains only adjacent records. With no file operand, stdin is readuntil EOF.Spilling requires the host to allow writes in its temporary directory. A deniedtemporary write exits 2 before sorted output is emitted, following GNU sort'sfatal-error status; small in-memory inputand check mode do not create disk runs.Under a Windows sandbox, the host must also provision TMP or TEMP fortemporary-path lookup; the command preserves the environment supplied by the host.
The run budget counts record/key payloads, entry/key slots, sequence IDs andreserved merge buffers/index space. It is not an RSS cap: the active inputrecord, unique-key retention, allocator/GC overhead and oversized individualrecords can add storage. Oversized records are processed without truncation.Temporary directories and files are created exclusively with restrictivepermissions and removed on normal completion or propagated errors; this doesnot promise cleanup after an unobservable crash or SIGKILL.
Standalone --version prints exactly sort 0.2.2 followed by onenewline. Standalone --help starts with Usage: sort, lists bothmetadata options, and ends with a newline. Both write to stdout, leave stdinunread, and exit with status 0. Exact-version publication and verificationremain recorded separately in the support record.