~ubuntu-branches/ubuntu/trusty/patch/trusty-security

« back to all changes in this revision

Viewing changes to tests/corrupt-reject-files

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2009-12-02 10:25:26 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20091202102526-5luk0zsqhghu58l2
Tags: 2.6-2
* Update watch file.
* Section: vcs.
* Suggests: diffutils-doc instead of diff-doc, thanks Christoph Anton
  Mitterer for spotting. Closes: #558974.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Free Software Foundation, Inc.
 
2
#
 
3
# Copying and distribution of this file, with or without modification,
 
4
# in any medium, are permitted without royalty provided the copyright
 
5
# notice and this notice are preserved.
 
6
 
 
7
. $srcdir/test-lib.sh
 
8
 
 
9
require_cat
 
10
require_diff
 
11
use_local_patch
 
12
use_tmpdir
 
13
 
 
14
# ==============================================================
 
15
 
 
16
# Regression test for an off-by-one error:
 
17
#
 
18
# Date: Sun, 26 Aug 2007 13:50:45 +0200
 
19
# From: Jim Meyering <jim@meyering.net>
 
20
#
 
21
# The problem arises when the input is a context diff and the second
 
22
# byte on a line of context is not a space or tab.
 
23
# Patch then happily gobbles/ignores that bogus byte and outputs
 
24
# the rest of the line with an additional (NUL) byte at the end.
 
25
 
 
26
seq 1 7 > a
 
27
 
 
28
cat > ab.diff <<EOF
 
29
*** a
 
30
--- b
 
31
***************
 
32
*** 1,7 ****
 
33
  1
 
34
  2
 
35
  3
 
36
- X
 
37
  5
 
38
  6
 
39
 7 yyy
 
40
--- 1,6 ----
 
41
EOF
 
42
 
 
43
check 'patch a < ab.diff || echo "Status: $?"' <<EOF
 
44
patching file a
 
45
Hunk #1 FAILED at 1.
 
46
1 out of 1 hunk FAILED -- saving rejects to file a.rej
 
47
Status: 1
 
48
EOF
 
49
 
 
50
check 'cat -A a.rej' <<EOF
 
51
*** a$
 
52
--- b$
 
53
***************$
 
54
*** 1,7 ****$
 
55
  1$
 
56
  2$
 
57
  3$
 
58
- X$
 
59
  5$
 
60
  6$
 
61
  7 yyy$
 
62
--- 1,6 ----$
 
63
  1$
 
64
  2$
 
65
  3$
 
66
  5$
 
67
  6$
 
68
  7 yyy$
 
69
EOF