| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# This is an interdiff(1) testcase. |
| 4 |
# Test: Prevent patch from checking EOF when not necessary |
| 5 |
# |
| 6 |
# I think the reason that this fails is that patch(1) assumes that |
| 7 |
# fewer post-context lines than pre-context lines indicates end of |
| 8 |
# file after the post-context. |
| 9 |
# |
| 10 |
# Possible work-around: get interdiff(1) to trim the pre-context lines |
| 11 |
# so that there aren't more than the post-context lines. |
| 12 |
# |
| 13 |
# IF YOU GET AN UNEXPECTED PASS (XPASS) when running this test you are |
| 14 |
# probably using a version of patch(1) that is missing a fix for |
| 15 |
# flushing stderr before exiting. |
| 16 |
|
| 17 |
|
| 18 |
. ${top_srcdir-.}/tests/common.sh |
| 19 |
|
| 20 |
cat << EOF > file |
| 21 |
LINE 1 |
| 22 |
line 2 |
| 23 |
line 3 |
| 24 |
line 4 |
| 25 |
line 5 |
| 26 |
if |
| 27 |
1 |
| 28 |
fi |
| 29 |
if |
| 30 |
2 |
| 31 |
fi |
| 32 |
A |
| 33 |
B |
| 34 |
C |
| 35 |
EOF |
| 36 |
cat << EOF > patch1 |
| 37 |
--- file |
| 38 |
+++ file |
| 39 |
@@ -1,4 +1,4 @@ |
| 40 |
-line 1 |
| 41 |
+LINE 1 |
| 42 |
line 2 |
| 43 |
line 3 |
| 44 |
line 4 |
| 45 |
EOF |
| 46 |
cat << EOF > patch2 |
| 47 |
--- file |
| 48 |
+++ file |
| 49 |
@@ -5,9 +5,6 @@ |
| 50 |
line 5 |
| 51 |
if |
| 52 |
1 |
| 53 |
-fi |
| 54 |
-if |
| 55 |
-2 |
| 56 |
fi |
| 57 |
A |
| 58 |
B |
| 59 |
EOF |
| 60 |
${INTERDIFF} patch1 patch2 2>errors >patch1-2 |
| 61 |
[ -s errors -o "$?" -gt "0" ] && { cat errors; exit 1;} |
| 62 |
${PATCH} file < patch1-2 >errors || { cat errors; exit 1;} |
| 63 |
if grep fuzz errors; then exit 1; fi |