Problem
From verification of #1 (P3 finding 16 — security reviewer):
SLUG derivation 用:
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' \
| sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g' \
| cut -c1-40)
最後 sed 's/^-\|-$//g' 用 alternation \| — BSD sed (macOS default) 不支援基本 regex 的 \|,需要 -E flag。GNU sed 才把 \| 當 alternation。
結果: macOS user 可能看到 SLUG 邊緣有殘留 - (-foo-bar 變不掉首 dash)。
此 issue 在 #1 之前就存在 (Step 0.5 PR-mode block 從 v2.40.0 帶過來),只是 verify 順手抓到。
Type
fix / portability
Why P3 (pre-existing)
Recommendation
兩種改法擇一:
A. 切兩段 sed,用 POSIX-portable:
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' \
| sed 's/[^a-z0-9]/-/g' \
| sed 's/--*/-/g' \
| sed -e 's/^-//' -e 's/-$//' \
| cut -c1-40)
B. 改用 -E + alternation:
SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' \
| sed -E 's/[^a-z0-9]/-/g; s/-+/-/g; s/^-|-$//g' \
| cut -c1-40)
-E 在 BSD/GNU 都支援。
Source
Related: #1
Problem
Type
fix / portability
Why P3 (pre-existing)
Recommendation
兩種改法擇一:
A. 切兩段 sed,用 POSIX-portable:
B. 改用
-E+ alternation:-E在 BSD/GNU 都支援。Source
98b7a71(idd-all: 增加 HITL(attended)模式 — direct-commit + 允許 sub-skill AskUserQuestion #1)Related: #1