Skip to contentSkip to conversation

generate-cmdlist.sh: avoid selecting synopsis at wrong place

PATCH In review Nguyễn Thái Ngọc Duy 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 generate-cmdlist.sh: avoid selecting synopsis at wrong place

In "common" man pages there is luckily no "NAME" anywhere except at beginning of documents. If there is another "NAME", sed could mis-select it and lead to common-cmds.h corruption. So better nail it at beginning of line, which would reduce corruption chance.

---
 generate-cmdlist.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
generate-cmdlist.sh +1 -1
index a2913c2..75c68d9 100755
@@ -14,7 +14,7 @@ sort |
 while read cmd
 do
      sed -n '
-     /NAME/,/git-'"$cmd"'/H
+     /^NAME/,/git-'"$cmd"'/H
      ${
             x
             s/.*git-'"$cmd"' - \(.*\)/  {"'"$cmd"'", "\1"},/
Signature · 1 line
1.6.0.96.g2fad1.dirty
#1 lore raw
Quoted 5 lines · Nguyễn Thái Ngọc Duy

In "common" man pages there is luckily no "NAME" anywhere except at beginning of documents. If there is another "NAME", sed could mis-select it and lead to common-cmds.h corruption. So better nail it at beginning of line, which would reduce corruption chance.

You could narrow it even more with /^NAME$/

Santi

#2 lore raw
Quoted 9 lines · Santi Béjar
Quoted 5 lines · Nguyễn Thái Ngọc Duy

In "common" man pages there is luckily no "NAME" anywhere except at beginning of documents. If there is another "NAME", sed could mis-select it and lead to common-cmds.h corruption. So better nail it at beginning of line, which would reduce corruption chance.

You could narrow it even more with /^NAME$/

That may miss "^NAME $", which is hard to recognize by eyes, although I'm pretty sure there is no trailing spaces in git. It's up to Junio to decide how strict he wants.

Signature · 1 line
Duy