File: diff3

package info (click to toggle)
diffutils 1%3A3.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,980 kB
  • sloc: ansic: 116,841; sh: 12,881; perl: 535; makefile: 233; sed: 16
file content (98 lines) | stat: -rw-r--r-- 1,395 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/sh
# This would malfunction in diff-3.4

. "${srcdir=.}/init.sh"; path_prepend_ ../src

echo a > a || framework_failure_
echo b > b || framework_failure_
echo c > c || framework_failure_
cat <<'EOF' > exp || framework_failure_
====
1:1c
  a
2:1c
  b
3:1c
  c
EOF

fail=0

# Use --diff-program=diff since --program-transform-name and similar are
# applied after 'make install'.
diff3 --diff-program=diff a b c > out 2> err || fail=1
compare exp out || fail=1
compare /dev/null err || fail=1

# Repeat, but with all three files the same:
diff3 --diff-program=diff a a a > out 2> err || fail=1
compare /dev/null out || fail=1
compare /dev/null err || fail=1

# This would have provoked a nontrivial leak prior to diffutils-3.5,
# due to the nontrivial list of diff_block structs.
seq 10 40|sed 's/1$/x/' > d || framework_failure_
seq 10 40|sed 's/5$/y/' > e || framework_failure_
seq 10 40|sed 's/8$/z/' > f || framework_failure_
cat <<'EOF' > exp40 || framework_failure_
====1
1:2c
  1x
2:2c
3:2c
  11
====2
1:6c
3:6c
  15
2:6c
  1y
====3
1:9c
2:9c
  18
3:9c
  1z
====1
1:12c
  2x
2:12c
3:12c
  21
====2
1:16c
3:16c
  25
2:16c
  2y
====3
1:19c
2:19c
  28
3:19c
  2z
====1
1:22c
  3x
2:22c
3:22c
  31
====2
1:26c
3:26c
  35
2:26c
  3y
====3
1:29c
2:29c
  38
3:29c
  3z
EOF

diff3 --diff-program=diff d e f > out 2> err
compare exp40 out || fail=1
compare /dev/null err || fail=1

Exit $fail