tests: use shorter labels in chainlint.sed for AIX sed

Improve the portability of chainlint by using shorter labels. On
AIX sed will complain about:

    sed: 0602-417 The label :hereslurp is greater than eight
    characters

This, in combination with the previous fix to this file makes
GIT_TEST_CHAIN_LINT=1 (which is the default) working again on AIX
without issues, and the "gmake check-chainlint" test also passes.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 2018-08-24 15:20:14 +00:00 committed by Junio C Hamano
parent 2d9ded8acc
commit a3c4c8841c
1 changed files with 28 additions and 28 deletions

View File

@ -97,11 +97,11 @@
/<<[ ]*[-\\']*[A-Za-z0-9_]/ { /<<[ ]*[-\\']*[A-Za-z0-9_]/ {
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</ s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
s/[ ]*<<// s/[ ]*<<//
:hereslurp :hered
N N
/^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{ /^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{
s/\n.*$// s/\n.*$//
bhereslurp bhered
} }
s/^<[^>]*>// s/^<[^>]*>//
s/\n.*$// s/\n.*$//
@ -149,7 +149,7 @@ s/.*\n//


:slurp :slurp
# incomplete line "...\" # incomplete line "...\"
/\\$/bincomplete /\\$/bicmplte
# multi-line quoted string "...\n..."? # multi-line quoted string "...\n..."?
/"/bdqstring /"/bdqstring
# multi-line quoted string '...\n...'? (but not contraction in string "it's") # multi-line quoted string '...\n...'? (but not contraction in string "it's")
@ -171,7 +171,7 @@ s/.*\n//
/"[^"]*#[^"]*"/!s/[ ]#.*$// /"[^"]*#[^"]*"/!s/[ ]#.*$//
} }
# one-liner "case ... esac" # one-liner "case ... esac"
/^[ ]*case[ ]*..*esac/bcheckchain /^[ ]*case[ ]*..*esac/bchkchn
# multi-line "case ... esac" # multi-line "case ... esac"
/^[ ]*case[ ]..*[ ]in/bcase /^[ ]*case[ ]..*[ ]in/bcase
# multi-line "for ... done" or "while ... done" # multi-line "for ... done" or "while ... done"
@ -200,32 +200,32 @@ s/.*\n//
/^[ ]*fi[ ]*[<>|]/bdone /^[ ]*fi[ ]*[<>|]/bdone
/^[ ]*fi[ ]*)/bdone /^[ ]*fi[ ]*)/bdone
# nested one-liner "(...) &&" # nested one-liner "(...) &&"
/^[ ]*(.*)[ ]*&&[ ]*$/bcheckchain /^[ ]*(.*)[ ]*&&[ ]*$/bchkchn
# nested one-liner "(...)" # nested one-liner "(...)"
/^[ ]*(.*)[ ]*$/bcheckchain /^[ ]*(.*)[ ]*$/bchkchn
# nested one-liner "(...) >x" (or "2>x" or "<x" or "|x") # nested one-liner "(...) >x" (or "2>x" or "<x" or "|x")
/^[ ]*(.*)[ ]*[0-9]*[<>|]/bcheckchain /^[ ]*(.*)[ ]*[0-9]*[<>|]/bchkchn
# nested multi-line "(...\n...)" # nested multi-line "(...\n...)"
/^[ ]*(/bnest /^[ ]*(/bnest
# multi-line "{...\n...}" # multi-line "{...\n...}"
/^[ ]*{/bblock /^[ ]*{/bblock
# closing ")" on own line -- exit subshell # closing ")" on own line -- exit subshell
/^[ ]*)/bclosesolo /^[ ]*)/bclssolo
# "$((...))" -- arithmetic expansion; not closing ")" # "$((...))" -- arithmetic expansion; not closing ")"
/\$(([^)][^)]*))[^)]*$/bcheckchain /\$(([^)][^)]*))[^)]*$/bchkchn
# "$(...)" -- command substitution; not closing ")" # "$(...)" -- command substitution; not closing ")"
/\$([^)][^)]*)[^)]*$/bcheckchain /\$([^)][^)]*)[^)]*$/bchkchn
# multi-line "$(...\n...)" -- command substitution; treat as nested subshell # multi-line "$(...\n...)" -- command substitution; treat as nested subshell
/\$([^)]*$/bnest /\$([^)]*$/bnest
# "=(...)" -- Bash array assignment; not closing ")" # "=(...)" -- Bash array assignment; not closing ")"
/=(/bcheckchain /=(/bchkchn
# closing "...) &&" # closing "...) &&"
/)[ ]*&&[ ]*$/bclose /)[ ]*&&[ ]*$/bclose
# closing "...)" # closing "...)"
/)[ ]*$/bclose /)[ ]*$/bclose
# closing "...) >x" (or "2>x" or "<x" or "|x") # closing "...) >x" (or "2>x" or "<x" or "|x")
/)[ ]*[<>|]/bclose /)[ ]*[<>|]/bclose
:checkchain :chkchn
# mark suspect if line uses ";" internally rather than "&&" (but not ";" in a # mark suspect if line uses ";" internally rather than "&&" (but not ";" in a
# string and not ";;" in one-liner "case...esac") # string and not ";;" in one-liner "case...esac")
/;/{ /;/{
@ -244,7 +244,7 @@ n
bslurp bslurp


# found incomplete line "...\" -- slurp up next line # found incomplete line "...\" -- slurp up next line
:incomplete :icmplte
N N
s/\\\n// s/\\\n//
bslurp bslurp
@ -282,11 +282,11 @@ bfolded
:heredoc :heredoc
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</ s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
s/[ ]*<<// s/[ ]*<<//
:hereslurpsub :heredsub
N N
/^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{ /^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{
s/\n.*$// s/\n.*$//
bhereslurpsub bheredsub
} }
s/^<[^>]*>// s/^<[^>]*>//
s/\n.*$// s/\n.*$//
@ -316,43 +316,43 @@ x
# is 'done' or 'fi' cuddled with ")" to close subshell? # is 'done' or 'fi' cuddled with ")" to close subshell?
/done.*)/bclose /done.*)/bclose
/fi.*)/bclose /fi.*)/bclose
bcheckchain bchkchn


# found nested multi-line "(...\n...)" -- pass through untouched # found nested multi-line "(...\n...)" -- pass through untouched
:nest :nest
x x
:nestslurp :nstslurp
n n
# closing ")" on own line -- stop nested slurp # closing ")" on own line -- stop nested slurp
/^[ ]*)/bnestclose /^[ ]*)/bnstclose
# comment -- not closing ")" if in comment # comment -- not closing ")" if in comment
/^[ ]*#/bnestcontinue /^[ ]*#/bnstcnt
# "$((...))" -- arithmetic expansion; not closing ")" # "$((...))" -- arithmetic expansion; not closing ")"
/\$(([^)][^)]*))[^)]*$/bnestcontinue /\$(([^)][^)]*))[^)]*$/bnstcnt
# "$(...)" -- command substitution; not closing ")" # "$(...)" -- command substitution; not closing ")"
/\$([^)][^)]*)[^)]*$/bnestcontinue /\$([^)][^)]*)[^)]*$/bnstcnt
# closing "...)" -- stop nested slurp # closing "...)" -- stop nested slurp
/)/bnestclose /)/bnstclose
:nestcontinue :nstcnt
x x
bnestslurp bnstslurp
:nestclose :nstclose
s/^/>>/ s/^/>>/
# is it "))" which closes nested and parent subshells? # is it "))" which closes nested and parent subshells?
/)[ ]*)/bslurp /)[ ]*)/bslurp
bcheckchain bchkchn


# found multi-line "{...\n...}" block -- pass through untouched # found multi-line "{...\n...}" block -- pass through untouched
:block :block
x x
n n
# closing "}" -- stop block slurp # closing "}" -- stop block slurp
/}/bcheckchain /}/bchkchn
bblock bblock


# found closing ")" on own line -- drop "suspect" from final line of subshell # found closing ")" on own line -- drop "suspect" from final line of subshell
# since that line legitimately lacks "&&" and exit subshell loop # since that line legitimately lacks "&&" and exit subshell loop
:closesolo :clssolo
x x
s/?!AMP?!// s/?!AMP?!//
p p