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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
AT_SETUP([dpkg-deb .deb conffiles])
AT_KEYWORDS([dpkg-deb deb conffiles])
DPKG_GEN_CONTROL([pkg-conff-duped])
DPKG_GEN_CTRL_FILE([pkg-conff-duped], [conffiles], [/test-conffile-1
/test-conffile-2
/test-conffile-1])
AT_DATA([pkg-conff-duped/test-conffile-1], [test init
])
AT_DATA([pkg-conff-duped/test-conffile-2], [test init
])
AT_CHECK([
# Duplicate conffile entries should produce a warning.
dpkg-deb -b pkg-conff-duped
], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated
dpkg-deb: warning: ignoring 1 warning about the control file(s)
])
DPKG_GEN_CONTROL([pkg-conff-noeol])
printf "/test-conffile-1" >"pkg-conff-noeol/DEBIAN/conffiles"
AT_DATA([pkg-conff-noeol/test-conffile-1], [test init
])
AT_CHECK([
# Conffiles need a final newline to guarantee there's been no accidental
# file truncation.
dpkg-deb -b pkg-conff-noeol pkg-conff-noeol.deb
], [2], [ignore], [dpkg-deb: error: conffile name '/test-conffile-1' is too long, or missing final newline
])
DPKG_GEN_CONTROL([pkg-conff-noabs])
DPKG_GEN_CTRL_FILE([pkg-conff-noabs], [conffiles], [test-conffile-rel])
AT_DATA([pkg-conff-noabs/test-conffile-rel], [test init
])
AT_CHECK([
# Conffiles must use absolute pathnames.
dpkg-deb -b pkg-conff-noabs pkg-conff-noabs.deb
], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname
])
DPKG_GEN_CONTROL([pkg-conff-empty])
printf " \n" >"pkg-conff-empty/DEBIAN/conffiles"
AT_CHECK([
# Conffiles must not contain empty lines.
dpkg-deb -b pkg-conff-empty pkg-conff-empty.deb
], [2], [ignore], [dpkg-deb: error: empty and whitespace-only lines are not allowed in conffiles
])
DPKG_GEN_CONTROL([pkg-conff-space-prefix])
DPKG_GEN_CTRL_FILE([pkg-conff-space-prefix], [conffiles], [ /test-conffile])
AT_CHECK([
# Conffiles must not contain prefixed spaces.
dpkg-deb -b pkg-conff-space-prefix pkg-conff-space-prefix.deb
], [2], [ignore], [dpkg-deb: error: line with conffile filename '/test-conffile' has leading white spaces
])
DPKG_GEN_CONTROL([pkg-conff-unknown-flag])
DPKG_GEN_CTRL_FILE([pkg-conff-unknown-flag], [conffiles], [unknown-flag /test-conffile])
AT_CHECK([
# Conffiles marked with an unknown flag.
dpkg-deb -b pkg-conff-unknown-flag pkg-conff-unknown-flag.deb
], [2], [ignore], [dpkg-deb: error: unknown flag 'unknown-flag' for conffile '/test-conffile'
])
DPKG_GEN_CONTROL([pkg-conff-missing-pathname])
printf "unknown-flag \n" >"pkg-conff-missing-pathname/DEBIAN/conffiles"
AT_CHECK([
# Conffiles need a pathname, in addition to a flag.
dpkg-deb -b pkg-conff-missing-pathname pkg-conff-missing-pathname.deb
], [2], [ignore], [dpkg-deb: error: conffile name missing after flag 'unknown-flag'
])
DPKG_GEN_CONTROL([pkg-conff-removed-missing])
DPKG_GEN_CTRL_FILE([pkg-conff-removed-missing], [conffiles], [remove-on-upgrade /test-conffile-missing])
AT_CHECK([
# Conffiles marked for removal must not be present.
dpkg-deb -b pkg-conff-removed-missing pkg-conff-removed-missing.deb
], [0], [ignore], [])
DPKG_GEN_CONTROL([pkg-conff-removed-duped])
DPKG_GEN_CTRL_FILE([pkg-conff-removed-duped], [conffiles], [remove-on-upgrade /test-conffile-1
remove-on-upgrade /test-conffile-2
remove-on-upgrade /test-conffile-1])
AT_CHECK([
# Duplicate conffile entries should produce a warning.
dpkg-deb -b pkg-conff-removed-duped
], [0], [ignore], [dpkg-deb: warning: conffile name '/test-conffile-1' is duplicated
dpkg-deb: warning: ignoring 1 warning about the control file(s)
])
DPKG_GEN_CONTROL([pkg-conff-removed-noeol])
printf "remove-on-upgrade /test-conffile-1" >"pkg-conff-removed-noeol/DEBIAN/conffiles"
AT_CHECK([
# Conffiles need a final newline to guarantee there has been no accidental
# file truncation.
dpkg-deb -b pkg-conff-removed-noeol pkg-conff-removed-noeol.deb
], [2], [ignore], [dpkg-deb: error: conffile name 'remove-on-upgrade /test-conffile-1' is too long, or missing final newline
])
DPKG_GEN_CONTROL([pkg-conff-removed-noabs])
DPKG_GEN_CTRL_FILE([pkg-conff-removed-noabs], [conffiles], [remove-on-upgrade test-conffile-rel])
AT_DATA([pkg-conff-removed-noabs/test-conffile-rel], [test init
])
AT_CHECK([
# Conffiles must use absolute pathnames.
dpkg-deb -b pkg-conff-removed-noabs pkg-conff-removed-noabs.deb
], [2], [ignore], [dpkg-deb: error: conffile name 'test-conffile-rel' is not an absolute pathname
])
DPKG_GEN_CONTROL([pkg-conff-removed-present])
DPKG_GEN_CTRL_FILE([pkg-conff-removed-present], [conffiles], [remove-on-upgrade /test-conffile-present])
AT_DATA([pkg-conff-removed-present/test-conffile-present], [test init
])
AT_CHECK([
# Conffiles marked for removal must not be present.
dpkg-deb -b pkg-conff-removed-present pkg-conff-removed-present.deb
], [2], [ignore], [dpkg-deb: error: conffile '/test-conffile-present' is present but is requested to be removed
])
DPKG_GEN_CONTROL([pkg-deb-newline])
touch 'pkg-deb-newline/file
newline'
AT_CHECK([
# Cannot create package with newlines in filenames.
dpkg-deb -b pkg-deb-newline
], [2], [ignore], [dpkg-deb: error: newline not allowed in pathname './file
newline'
])
AT_CLEANUP
|