lotabout.skim/fuzz
LoricAndre 24a24619ea
ci: publish .deb, .rpm and winget packages on release (#1129)
* ci: add .deb and .rpm packages to releases via dist

Configure cargo-deb and cargo-generate-rpm to build Linux packages
containing the sk executable, the man pages (sk.1, sk-tmux.1) and the
bash/zsh/fish shell completions.

A new reusable workflow (package.yml) builds both packages and uploads
them under an artifacts-* name. It is wired into the release pipeline as
a dist global-artifacts-job in dist-workspace.toml, and release.yml is
regenerated with `dist generate` (not hand-edited) so dist's host job
attaches the packages to the GitHub Release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: drop sk-tmux man page from .deb and .rpm packages

Package only the sk.1 man page; the sk-tmux.1 page is no longer shipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: temporarily build release artifacts on PRs

Set dist pr-run-mode = "upload" so the .deb and .rpm (and the other
release artifacts) are built and uploaded on pull requests, allowing the
packages to be downloaded and verified before merging.

This is temporary and should be reverted before merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: install packaging tools via taiki-e/install-action

Address review feedback on package.yml:
- Install cargo-deb and cargo-generate-rpm with taiki-e/install-action
  (prebuilt binaries) plus a Swatinem/rust-cache step, matching the
  patterns used in test.yml, instead of compiling them with cargo install.
- Drop the `--output target/debian` flag from `cargo deb`; the default
  target/debian/ directory is what the collect step expects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: build arm64 .deb and .rpm packages too

Turn the package job into a matrix that builds natively for both amd64
(ubuntu-22.04) and arm64 (ubuntu-22.04-arm), producing a .deb and .rpm
per architecture. Artifacts are uploaded under per-arch names so dist's
host job attaches all of them to the release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: submit releases to winget via winget-releaser

Add a dist publish job that, after the GitHub Release is created, submits
the new version to the Windows Package Manager Community Repository using
vedantmgoyal9/winget-releaser and the Windows .zip artifact dist already
attaches to the release.

Uses the package identifier and installer regex from skim-rs/skim#769:
  identifier: skim-rs.skim
  installers-regex: '-pc-windows-msvc\.zip$'

Wired in through publish-jobs in dist-workspace.toml; release.yml is
regenerated with `dist generate` (not hand-edited). Prereleases are never
submitted. Requires a WINGET_TOKEN secret (a public_repo-scoped PAT that
owns a microsoft/winget-pkgs fork under skim-rs).

Refs: skim-rs/skim#769

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* ci: validate package version against the release plan

Consume the `plan` input dist passes to the package job: assert the
crate version equals the version dist planned for this release, so the
source-built .deb/.rpm can't silently drift from the release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* Update .github/workflows/winget.yml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update .github/workflows/package.yml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* docs: document .deb, .rpm, winget and scoop installation

Add the new install methods to the README: winget and Scoop rows plus a
Debian/RPM section with install commands, covering amd64 and arm64.

Also clarify in winget.yml that WINGET_TOKEN must be a classic PAT
(fine-grained tokens can't open the winget-pkgs PR).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw

* fix: install cargo-deb manually to avoid libc version mismatch

* ci: use blacksmith runners for long job

* fix: version spec for cargo install

* chore: revert pr action upload

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-20 22:11:51 +00:00
..
fuzz_targets feat: add cargo-fuzz targets for hand-rolled text parsers (#1106) 2026-07-04 18:01:46 +02:00
.gitignore feat: add cargo-fuzz targets for hand-rolled text parsers (#1106) 2026-07-04 18:01:46 +02:00
Cargo.lock ci: publish .deb, .rpm and winget packages on release (#1129) 2026-07-20 22:11:51 +00:00
Cargo.toml feat: add cargo-fuzz targets for hand-rolled text parsers (#1106) 2026-07-04 18:01:46 +02:00
README.md feat: add cargo-fuzz targets for hand-rolled text parsers (#1106) 2026-07-04 18:01:46 +02:00

Fuzzing

This directory contains cargo-fuzz (libFuzzer) targets for skim's hand-written, untrusted-input-facing parsers: text that flows in from stdin, --ansi sequences, --nth/--with-nth field specs, the search query syntax, and --bind key maps. These are exactly the places where skim does manual byte/char-index bookkeeping on attacker- or data-controlled strings, which is the most panic-prone code in the project.

Targets

Target Exercises
ansi_strip helper::item::strip_ansi — ANSI escape stripping & byte/char index map
field_extract field::{FieldRange, get_string_by_field, parse_matching_fields, parse_transform_fields}--nth/--with-nth
fuzzy_match fuzzy_matcher::{skim, fzy, clangd} — the fuzzy matching algorithms
query_match Matcher::create_engine_factory + DefaultSkimItem — the full query → engine → match pipeline (exact/regex/AND-OR/fuzzy, with ANSI)
keymap_parse binds::KeyMap — the --bind key-map parser

Each target asserts more than "doesn't panic" where a cheap invariant is available (e.g. reported match indices must be valid char indices into the matched text, index mappings must stay monotonic and land on char boundaries).

Running

Install cargo-fuzz (requires a nightly toolchain):

cargo install cargo-fuzz

Run a target:

cargo +nightly fuzz run ansi_strip

Run for a bounded time (useful in CI or for a quick check):

cargo +nightly fuzz run query_match -- -max_total_time=60

Reproducing a crash

cargo fuzz run writes failing inputs to fuzz/artifacts/<target>/. Replay one with:

cargo +nightly fuzz run <target> fuzz/artifacts/<target>/crash-<hash>

Adding a target

Add a new fuzz_targets/<name>.rs, register it in fuzz/Cargo.toml's [[bin]] list, and prefer asserting a real invariant of the function under test (bounds, monotonicity, round-tripping) rather than only catching panics.