find-postgres-bug
Fungsinya
Skill ini mencari bug crash di salinan sumber PostgreSQL memakai build debug dan fuzzing otomatis. Skill ini ditujukan untuk pengembang dan kontributor PostgreSQL yang ingin menemukan dan melaporkan cacat nyata.
Kapan dipakai
- βSaat Anda ingin mencari bug crash di pohon sumber PostgreSQL lokal.
- βSaat Anda membutuhkan build debug PostgreSQL untuk diuji dengan fuzzing.
- βSaat Anda menginginkan reproducer minimal dan laporan bug untuk komunitas.
Link skill
https://github.com/digoal/blog/blob/master/skills/find-postgres-bug/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βBangun salinan debug dari checkout PostgreSQL saya, lakukan fuzzing untuk mencari crash, dan buat kasus uji minimal untuk apa pun yang ditemukan.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill membangun instans debug yang ketat, menjalankan fuzzer sampai server crash, membaca core crash, mereduksi input, lalu memeriksa commit mana yang memperkenalkan masalah.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Find Postgres Bug
Overview
Crash-first bug-hunting pipeline for a local PostgreSQL source tree. The order matters and is the whole point:
poison the build β fuzz it β triage the core β minimise to an MRE
β bisect the commit β report (do NOT self-patch)
The leverage is front-loaded. A poisoned build does ~90% of the work by turning latent bugs into immediate crashes; the fuzzer then finds inputs no human would hand-write. Reading commits by eye is a secondary, targeted probe β used to aim the fuzzer, not as the primary search.
Source layout assumed: the standard PG tree (src/backend/,
src/include/, contrib/, src/test/, β¦) at $PG_SRC_DIR.
Three hard rules:
- The skill never auto-stops the instance. Run
scripts/stop_pg.shexplicitly when done. - Never write a patch. The deliverable is an MRE + backtrace + bisect result, posted upstream. A drive-by fix from someone who just met the code is worth less than a clean reproducer.
- A finding only counts if it crashes at HEAD, with the tree exactly as committed. Never revert a fix (or commit a staged revert) to make something crash and call it a bug β that just re-creates an already-fixed bug and is worthless. Before investing in any candidate, run the pre-flight in Step 0. See references/already_fixed.md.
Quick start
export PG_SRC_DIR=/path/to/postgres
# 1. POISON: configure+build+initdb+start with cassert, cache-discard,
# -O0 -ggdb3, core dumps enabled. The 90% lever.
./scripts/build_and_start_pg.sh
# 2. SEED + FUZZ: load some tables, then let sqlsmith run (overnight is best)
psql -h /tmp -p 55432 -d postgres -f your_schema.sql # populate the catalog
./scripts/fuzz_sqlsmith.sh 3600 postgres # 1h; use 28800 overnight
# 3. TRIAGE: a crash leaves a core under $PGDATA
./scripts/triage_core.sh /path/to/$PGDATA/core.NNNN
# 4. MINIMISE: cut the failing query down, confirm it crashes on demand
$EDITOR repro/mybug.sql
./scripts/run_repro.sh repro/mybug.sql mybug # "SERVER IS DOWN" = good
# 5. BISECT: find the commit that introduced it
./scripts/bisect_run.sh repro/mybug.sql REL_17_STABLE HEAD
# 6. REPORT: render markdown for pgsql-bugs (no patch)
$EDITOR /tmp/bug.yaml
./scripts/gen_bug_report.sh /tmp/bug.yaml
# when finished:
./scripts/stop_pg.sh
If a real crash surfaces, the markdown is ready for [pgsql-bugs]. If the fuzzer runs clean, broaden the seed schema / run longer / switch branch.
Workflow
Each step has a success criterion to verify before moving on.
Step 0 β Pre-flight: clean tree & live-at-HEAD gate (do this first)
Before building or investing in any candidate, rule out the two biggest time-wasters: a dirty working tree, and a "bug" that HEAD already fixed.
cd "$PG_SRC_DIR"
git status --short # any M/MM/A? the tree is NOT as-committed
git stash list # stashed reverts hide here too
- Dirty tree β stop and ask. Uncommitted edits (especially a staged
revert of a fix) mean you are no longer testing HEAD. A
git commitcould re-introduce a fixed bug. Surface this to the user and do not build on top of it. Nevergit commit,git checkout,git restore, orgit stashaway the user's changes without explicit permission. - Always build and test the tree exactly as committed. Do not revert a fix to "reproduce" a bug. If you ever need to confirm a fix works, that is a fix-verification task, not a bug find β label it as such and do not report it as a new bug.
When the target is a specific commit (the user said "test this commit" or you picked one in Step 6), check it is not already superseded:
./scripts/check_already_fixed.sh <hash> # is it in HEAD? any later "Fix"/revert touching the same files?
Success: git status is clean (or the user has explicitly accepted a
dirty tree), and the candidate commit is confirmed not already fixed or
reverted upstream. Only then proceed to Step 1. Details and edge cases:
references/already_fixed.md.
Step 1 β Poison the build & start (the 90% lever)
export PG_SRC_DIR=/path/to/postgres
./scripts/build_and_start_pg.sh
Runs ./configure --enable-debug --enable-cassert --enable-debug-symbols --enable-tap-tests with CFLAGS="-O0 -ggdb3",
auto-detects the cache-poison mechanism by **grepping the tree
Pertanyaan umum
Apakah skill akan memperbaiki bugnya?
Tidak. Skill menyatakan agar tidak menulis patch, dan keluarannya adalah reproducer serta laporan.
Apa yang dihitung sebagai temuan nyata?
Temuan hanya dihitung jika crash terjadi di pohon saat ini persis seperti yang sudah di-commit.
Apakah server uji berhenti otomatis?
Tidak. Anda harus menjalankan skrip penghentian sendiri ketika sudah selesai.
Detail
Deskripsi asli dari pembuat
Find latent bugs in a local PostgreSQL source tree (REL_xx_STABLE branch or HEAD) the way a core hacker does: build a heavily-poisoned debug instance (cassert + cache-discard + -O0/-ggdb3 + core dumps), fuzz it (sqlsmith) until the backend crashes, triage the core into a minimal reproducer (MRE), git-bisect the introducing commit, and render a community-style pgsql-bugs markdown report. The instance never auto-shuts-down. Use when the user says "find a bug in postgres", "fuzz postgres", "hunt for a crash", "test a recent commit", "write a repro", "bisect this crash", "ζ PG θ·θ΅·ζ₯ζΎ bug", "fuzz δΈδΈ
repo: digoal/blog
Popularitas
- Bintang GitHub
- 8.6k
- Peringkat
- #12363
- Lisensi
- GPL-2.0
- Diperbarui
- 1/11/2026
Komentar
- β¦
Skill lain dari repositori ini
article-to-podcast-script
8.6kMembantu agent Anda mengubah artikel Markdown menjadi naskah podcast orang pertama untuk satu sampai empat pembicara, disimpan sebagai file teks, dalam bahasa Mandarin secara bawaan.
axiom-explainer
8.6kMembantu agent Anda menulis artikel berbahasa Mandarin yang jelas untuk menjelaskan satu sudut pandang, hukum, atau teori, dengan contoh, batasan, dan diagram sederhana.
blog-cover-poster
8.6kMembantu agent Anda mengubah artikel atau catatan menjadi sekumpulan gambar poster vertikal, dengan sampul dan beberapa slide yang menjelaskan poin-poin utama.
buffett
8.6kMembantu agent Anda memikirkan keputusan tentang perusahaan dan saham seperti cara Warren Buffett, dengan memakai gagasannya tentang parit pertahanan, manajemen, dan margin keamanan.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.