--- title: Run git pbchk, cstyle -pP and hdrchk before an RTI; check the binaries with wsdiff and check_rtime area: gate impact: MEDIUM tags: [illumos-gate, git-pbchk, cstyle, hdrchk, mapfilechk, wsdiff, check_rtime, onbld, review] verified: 2026-11-05 --- # Run git pbchk, cstyle -pP and hdrchk before an RTI; check the binaries with wsdiff and check_rtime Before you send an RTI, run `git pbchk` and fix what it reports (a missing copyright line is optional). New C files must be `cstyle -pP` clean. The RTI wants the `git pbchk` output. **Antipattern** ```sh git pbchk # outside bldenv and without /opt/onbld/bin on PATH: run it under one cstyle foo.c # only the base check, for a new file: new files must be -pP clean git push ssh://@code.illumos.org/illumos-gate :refs/for/master # review, then an RTI with pbchk findings open ``` **The Solnix way** ```sh # Solnix has no gate check step of its own. When pkgs/illumos/gate.nix builds from source (srcDir or srcHash), it # runs nightly with illumos.sh's NIGHTLY_OPTIONS ('-FnCDAmprt', kernel-nd.nix header), so nightly runs make check (-C, hdrchk and # cstyle) and check_rtime (-r, on the proto), but the build decides by its proto assertions, not by nightly's exit code or mail_msg. For a change you send upstream, run the # checks the illumos way below, on an illumos build host. ``` **The illumos way** (upstream illumos-gate, whichever distribution you build on) ```sh /opt/onbld/bin/bldenv -d ./illumos.sh # or put /opt/onbld/bin on PATH git pbchk # compares with the parent branch: -p branch, else the git branch # config, else origin/master git pbchk -l # the checks: comchk copyright cstyle hdrchk jstyle keywords manlint # mapfilechk shelllint pkgfmt winnames wscheck symlinks git nits -c cstyle usr/src/uts/common/io/foo/foo.c # one check, named files cstyle -pP usr/src/uts/common/io/foo/foo.c # -p picky, -P non-POSIX types: both part of the putback checks hdrchk usr/src/uts/common/sys/foo.h # copyright comment, include guard, ident; system headers also # _FILENAME_H guard, <> includes, extern "C" guard mv proto proto.old # a built workspace; then rebuild with your change, and: wsdiff proto.old proto # which proto objects your change altered (nightly -w does this too) check_rtime # what nightly -r runs: missing or unused dependencies, unsatisfied # relocations, text relocations, ...; -i also prints deps and runpaths ``` cstyle rule for existing files: run `cstyle`, `cstyle -p` and `cstyle -pP` on the old and the new file. If the old file passed one of them, the new file must pass it too. git pbchk's exception lists, named after a check, live in `$CODEMGR_WS/exception_lists` (or `.git/info/`, with a `.NOT` suffix). **The difference.** Same as illumos: Solnix adds no checks of its own and runs no `git pbchk` on a gate change. When Solnix's gate.nix builds from source, it runs the template's `-C` and `-r` passes inside nightly, but it does not fail on what they report, so a successful Solnix gate build does not show that your change is clean. Run the checks on the illumos build host where you build the change (rule `gate-build-nightly-bldenv.md`). **Check.** `git pbchk` (under `bldenv`) prints no findings except, if you choose, a copyright one. Its output goes in the RTI (rule `gate-upstream-rti.md`); the RTI may leave it out when `git pbchk` prints nothing and exits 0. **Unverified** - The exit status of `git pbchk` when it finds problems: git-pbchk(1onbld) at b566148 has no EXIT STATUS section. - What `manlint`, `shelllint` and `pkgfmt` check in detail: the man page names them in one line each. **Sources** - [git-pbchk(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/git-pbchk.1onbld) (illumos-gate b566148, CDDL), SYNOPSIS (git-nits); OPTIONS (-c, -p, -l); CHECKS; FILES (exception lists) - [cstyle(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/cstyle.1onbld) (illumos-gate b566148, CDDL), OPTIONS -p, -P; NOTES (new files -pP clean; old and new file rule) - [hdrchk(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/hdrchk.1onbld) (illumos-gate b566148, CDDL), HEADER STANDARDS - [mapfilechk(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/mapfilechk.1onbld) (illumos-gate b566148, CDDL), DESCRIPTION - [wsdiff(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/wsdiff.1onbld) (illumos-gate b566148, CDDL), DESCRIPTION; EXAMPLES 1 (mv proto proto.old) - [check_rtime(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/check_rtime.1onbld) (illumos-gate b566148, CDDL), DESCRIPTION (called from nightly -r; the checks); OPTIONS -i - [nightly(1onbld)](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/scripts/nightly.1onbld) (illumos-gate b566148, CDDL), NIGHTLY_OPTIONS -C, -r, -w - [usr/src/tools/env/illumos.sh](https://github.com/illumos/illumos-gate/blob/b56614870515295c253babb2b10fffdd3c60fdbe/usr/src/tools/env/illumos.sh) (illumos-gate b566148), NIGHTLY_OPTIONS='-FnCDAmprt' - [Developer's Guide: Workflow](https://illumos.org/books/dev/workflow.html) (PDL), pbchk; Gerrit (git push ... refs/for/master); Binary verification between proto areas (wsdiff, -w) - [Developer's Guide: Integrating](https://illumos.org/books/dev/integrating.html) (PDL), git pbchk (clean; copyright optional) - [Developer's Guide: Debugging](https://illumos.org/books/dev/debugging.html) (PDL), Build Failures (cstyle and hdrchk errors; check_rtime) - [illumos docs: Contributing](https://illumos.org/docs/contributing/) (MPL-2.0), Submitting A Patch (git pbchk under bldenv; optional if it prints nothing and exits 0) - [pkgs/illumos/gate.nix](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/pkgs/illumos/gate.nix) (solnix 5a8e5ce), header (exit code is not the verdict; proto assertions); srcDir/srcHash (else the prebuilt proto, no build) - [pkgs/illumos/kernel-nd.nix](https://codeberg.org/solnix/solnix/src/commit/5a8e5ce75a33086d7be4410149847bdf7501b8fc/pkgs/illumos/kernel-nd.nix) (solnix 5a8e5ce), header (gate.nix runs nightly with illumos.sh's NIGHTLY_OPTIONS '-FnCDAmprt')