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>
Ævar Arnfjörð Bjarmason committed
Aug 24, 2018 at 15:20 UTC
a3c4c8841caaf8bda924d0852670be4ea7461a7d
1 file changed
+28
-28
t/chainlint.sed
+28
-28
@@ -97,11 +97,11 @@
97
/<<[ ]*[-\\']*[A-Za-z0-9_]/ {
98
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
99
s/[ ]*<<//
100
- :hereslurp
100
+ :hered
101
N
102
/^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{
103
s/\n.*$//
104
- bhereslurp
104
+ bhered
105
}
106
s/^<[^>]*>//
107
s/\n.*$//
@@ -149,7 +149,7 @@ s/.*\n//
149
150
:slurp
151
# incomplete line "...\"
152
-/\\$/bincomplete
152
+/\\$/bicmplte
153
# multi-line quoted string "...\n..."?
154
/"/bdqstring
155
# multi-line quoted string '...\n...'? (but not contraction in string "it's")
@@ -171,7 +171,7 @@ s/.*\n//
171
/"[^"]*#[^"]*"/!s/[ ]#.*$//
172
}
173
# one-liner "case ... esac"
174
-/^[ ]*case[ ]*..*esac/bcheckchain
174
+/^[ ]*case[ ]*..*esac/bchkchn
175
# multi-line "case ... esac"
176
/^[ ]*case[ ]..*[ ]in/bcase
177
# multi-line "for ... done" or "while ... done"
@@ -200,32 +200,32 @@ s/.*\n//
200
/^[ ]*fi[ ]*[<>|]/bdone
201
/^[ ]*fi[ ]*)/bdone
202
# nested one-liner "(...) &&"
203
-/^[ ]*(.*)[ ]*&&[ ]*$/bcheckchain
203
+/^[ ]*(.*)[ ]*&&[ ]*$/bchkchn
204
# nested one-liner "(...)"
205
-/^[ ]*(.*)[ ]*$/bcheckchain
205
+/^[ ]*(.*)[ ]*$/bchkchn
206
# nested one-liner "(...) >x" (or "2>x" or "<x" or "|x")
207
-/^[ ]*(.*)[ ]*[0-9]*[<>|]/bcheckchain
207
+/^[ ]*(.*)[ ]*[0-9]*[<>|]/bchkchn
208
# nested multi-line "(...\n...)"
209
/^[ ]*(/bnest
210
# multi-line "{...\n...}"
211
/^[ ]*{/bblock
212
# closing ")" on own line -- exit subshell
213
-/^[ ]*)/bclosesolo
213
+/^[ ]*)/bclssolo
214
# "$((...))" -- arithmetic expansion; not closing ")"
215
-/\$(([^)][^)]*))[^)]*$/bcheckchain
215
+/\$(([^)][^)]*))[^)]*$/bchkchn
216
# "$(...)" -- command substitution; not closing ")"
217
-/\$([^)][^)]*)[^)]*$/bcheckchain
217
+/\$([^)][^)]*)[^)]*$/bchkchn
218
# multi-line "$(...\n...)" -- command substitution; treat as nested subshell
219
/\$([^)]*$/bnest
220
# "=(...)" -- Bash array assignment; not closing ")"
221
-/=(/bcheckchain
221
+/=(/bchkchn
222
# closing "...) &&"
223
/)[ ]*&&[ ]*$/bclose
224
# closing "...)"
225
/)[ ]*$/bclose
226
# closing "...) >x" (or "2>x" or "<x" or "|x")
227
/)[ ]*[<>|]/bclose
228
-:checkchain
228
+:chkchn
229
# mark suspect if line uses ";" internally rather than "&&" (but not ";" in a
230
# string and not ";;" in one-liner "case...esac")
231
/;/{
@@ -244,7 +244,7 @@ n
244
bslurp
245
246
# found incomplete line "...\" -- slurp up next line
247
-:incomplete
247
+:icmplte
248
N
249
s/\\\n//
250
bslurp
@@ -282,11 +282,11 @@ bfolded
282
:heredoc
283
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
284
s/[ ]*<<//
285
-:hereslurpsub
285
+:heredsub
286
N
287
/^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{
288
s/\n.*$//
289
- bhereslurpsub
289
+ bheredsub
290
}
291
s/^<[^>]*>//
292
s/\n.*$//
@@ -316,43 +316,43 @@ x
316
# is 'done' or 'fi' cuddled with ")" to close subshell?
317
/done.*)/bclose
318
/fi.*)/bclose
319
-bcheckchain
319
+bchkchn
320
321
# found nested multi-line "(...\n...)" -- pass through untouched
322
:nest
323
x
324
-:nestslurp
324
+:nstslurp
325
n
326
# closing ")" on own line -- stop nested slurp
327
-/^[ ]*)/bnestclose
327
+/^[ ]*)/bnstclose
328
# comment -- not closing ")" if in comment
329
-/^[ ]*#/bnestcontinue
329
+/^[ ]*#/bnstcnt
330
# "$((...))" -- arithmetic expansion; not closing ")"
331
-/\$(([^)][^)]*))[^)]*$/bnestcontinue
331
+/\$(([^)][^)]*))[^)]*$/bnstcnt
332
# "$(...)" -- command substitution; not closing ")"
333
-/\$([^)][^)]*)[^)]*$/bnestcontinue
333
+/\$([^)][^)]*)[^)]*$/bnstcnt
334
# closing "...)" -- stop nested slurp
335
-/)/bnestclose
336
-:nestcontinue
335
+/)/bnstclose
336
+:nstcnt
337
x
338
-bnestslurp
339
-:nestclose
338
+bnstslurp
339
+:nstclose
340
s/^/>>/
341
# is it "))" which closes nested and parent subshells?
342
/)[ ]*)/bslurp
343
-bcheckchain
343
+bchkchn
344
345
# found multi-line "{...\n...}" block -- pass through untouched
346
:block
347
x
348
n
349
# closing "}" -- stop block slurp
350
-/}/bcheckchain
350
+/}/bchkchn
351
bblock
352
353
# found closing ")" on own line -- drop "suspect" from final line of subshell
354
# since that line legitimately lacks "&&" and exit subshell loop
355
-:closesolo
355
+:clssolo
356
x
357
s/?!AMP?!//
358
p