File: quoted-filenames

package info (click to toggle)
patch 2.8-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,888 kB
  • sloc: ansic: 41,776; sh: 7,300; yacc: 1,858; makefile: 143; sed: 54
file content (57 lines) | stat: -rw-r--r-- 1,270 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
# Copyright 2009-2025 Free Software Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# in any medium, are permitted without royalty provided the copyright
# notice and this notice are preserved.

# Don't recognize hunks before a filename has been specified/seen

. $srcdir/test-lib.sh

require cat
require special_characters
use_local_patch
use_tmpdir

# ==============================================================

# Forbidden characters in Windows filenames:
#   \ / : * ? " < > | TAB
# Filenames with trailing space characters

cat > d.diff <<EOF
--- "\\t \\040"
+++ "\\t \\040"
@@ -1 +1 @@
-one
+two
EOF

ncheck 'echo one > "	  "'
ncheck 'patch -s -p0 < d.diff'

check 'cat "	  "' <<EOF
two
EOF

cat > e.diff <<\EOF
*** /dev/null	Sat Sep 14 08:47:53 2024
--- "f\000g"	Tue Sep 17 10:21:17 2024
***************
*** 0 ****
--- 1 ----
+
EOF

check 'patch -f < e.diff; echo status: $?' <<EOF
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|*** /dev/null	Sat Sep 14 08:47:53 2024
|--- "f\000g"	Tue Sep 17 10:21:17 2024
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
status: 1
EOF