find-postgres-bug
하는 일
이 스킬은 디버그 빌드와 자동 퍼징을 사용해 PostgreSQL 소스 체크아웃에서 충돌 버그를 찾습니다. 실제 결함을 찾아 보고하려는 PostgreSQL 개발자와 기여자를 위한 것입니다.
사용하는 경우
- ✓로컬 PostgreSQL 소스 트리에서 충돌 버그를 찾고 싶을 때.
- ✓퍼징으로 테스트할 PostgreSQL 디버그 빌드가 필요할 때.
- ✓최소 재현 사례와 커뮤니티용 버그 보고서를 원할 때.
스킬 링크
https://github.com/digoal/blog/blob/master/skills/find-postgres-bug/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 PostgreSQL 체크아웃의 디버그 복사본을 빌드하고 충돌을 퍼징한 뒤, 발견된 것마다 최소 테스트 사례를 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 엄격한 디버그 인스턴스를 빌드하고, 서버가 충돌할 때까지 퍼저를 실행하며, 충돌 코어를 읽고, 입력을 줄이고, 어떤 커밋이 문제를 만들었는지 확인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
버그를 대신 고쳐 주나요?
아니요. 이 스킬은 패치를 쓰지 않으며, 결과물은 재현 사례와 보고서입니다.
어떤 것을 실제 발견으로 보나요?
커밋된 그대로의 현재 트리에서 정확히 충돌하는 경우에만 발견으로 인정합니다.
테스트 서버를 자동으로 멈추나요?
아니요. 작업이 끝나면 직접 중지 스크립트를 실행해야 합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 8.6k
- 순위
- #12363
- 라이선스
- GPL-2.0
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
article-to-podcast-script
8.6kMarkdown 글을 1인칭 팟캐스트 대본으로 바꿔, 화자 1명부터 4명까지 텍스트 파일로 저장하도록 돕습니다. 기본 언어는 중국어입니다.
axiom-explainer
8.6k하나의 관점, 법칙, 이론을 설명하는 명확한 중국어 글을 쓰도록 돕습니다. 예시, 한계, 간단한 다이어그램을 포함합니다.
blog-cover-poster
8.6k글이나 메모를 세로형 포스터 이미지 묶음으로 바꿉니다. 표지와 핵심 내용을 설명하는 여러 장의 슬라이드를 포함합니다.
buffett
8.6k워런 버핏의 해자, 경영진, 안전마진에 대한 생각을 활용해 기업과 주식에 대한 결정을 신중하게 검토하도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.