threads / patch / 15576

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

Subject: [PATCH] generate-cmdlist.sh: avoid selecting synopsis at wrong place

## tl;dr

3 messages between Sep 18, 2008 and Sep 18, 2008. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Nguyễn Thái Ngọc Duy· Sep 18, 2008, 16:01 UTC · lore

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.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 generate-cmdlist.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to generate-cmdlist.sh +1 −1
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index a2913c2..75c68d9 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -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"},/
-- 
1.6.0.96.g2fad1.dirty
Santi Béjar· Sep 18, 2008, 16:09 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH] generate-cmdlist.sh: avoid selecting synopsis at wrong place

On Thu, Sep 18, 2008 at 6:01 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 5 quoted lines
> 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
Nguyen Thai Ngoc Duy· Sep 18, 2008, 16:20 UTC · re: Santi Béjar · lore

Re: [PATCH] generate-cmdlist.sh: avoid selecting synopsis at wrong place

On 9/18/08, Santi Béjar <santi@agolina.net> wrote:
Show 9 quoted lines
> On Thu, Sep 18, 2008 at 6:01 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
>  > 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.

-- 
Duy

← back to recent threads