Mercurial > hg
comparison tests/test-verify.t @ 30556:c059286a0f9c
tests: replace "cp -r" with "cp -R"
The POSIX documentation about "cp" [1] says:
....
RATIONALE
....
Earlier versions of this standard included support for the -r option to
copy file hierarchies. The -r option is historical practice on BSD and
BSD-derived systems. This option is no longer specified by POSIX.1-2008
but may be present in some implementations. The -R option was added as a
close synonym to the -r option, selected for consistency with all other
options in this volume of POSIX.1-2008 that do recursive directory
descent.
The difference between -R and the removed -r option is in the treatment
by cp of file types other than regular and directory. It was
implementation-defined how the - option treated special files to allow
both historical implementations and those that chose to support -r with
the same abilities as -R defined by this volume of POSIX.1-2008. The
original -r flag, for historic reasons, did not handle special files any
differently from regular files, but always read the file and copied its
contents. This had obvious problems in the presence of special file
types; for example, character devices, FIFOs, and sockets.
....
....
Issue 6
The -r option is marked obsolescent.
....
Issue 7
....
The obsolescent -r option is removed.
....
(No "Issue 8" yet)
Therefore it's clear that "cp -R" is strictly better than "cp -r".
The issue was discovered when running tests on OS X after 0d87b1caed92.
[1]: pubs.opengroup.org/onlinepubs/9699919799/utilities/cp.html
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 30 Nov 2016 19:25:18 +0000 |
parents | 408446e4b10c |
children | a2ab9ebcd85b |
comparison
equal
deleted
inserted
replaced
30555:6a672c3b7860 | 30556:c059286a0f9c |
---|---|
67 | 67 |
68 $ hg init missing-entries | 68 $ hg init missing-entries |
69 $ cd missing-entries | 69 $ cd missing-entries |
70 $ echo 0 > file | 70 $ echo 0 > file |
71 $ hg ci -Aqm0 | 71 $ hg ci -Aqm0 |
72 $ cp -r .hg/store .hg/store-partial | 72 $ cp -R .hg/store .hg/store-partial |
73 $ echo 1 > file | 73 $ echo 1 > file |
74 $ hg ci -Aqm1 | 74 $ hg ci -Aqm1 |
75 $ cp -r .hg/store .hg/store-full | 75 $ cp -R .hg/store .hg/store-full |
76 | 76 |
77 Entire changelog missing | 77 Entire changelog missing |
78 | 78 |
79 $ rm .hg/store/00changelog.* | 79 $ rm .hg/store/00changelog.* |
80 $ hg verify -q | 80 $ hg verify -q |
82 manifest@0: d0b6632564d4 not in changesets | 82 manifest@0: d0b6632564d4 not in changesets |
83 manifest@1: 941fc4534185 not in changesets | 83 manifest@1: 941fc4534185 not in changesets |
84 3 integrity errors encountered! | 84 3 integrity errors encountered! |
85 (first damaged changeset appears to be 0) | 85 (first damaged changeset appears to be 0) |
86 [1] | 86 [1] |
87 $ cp -r .hg/store-full/. .hg/store | 87 $ cp -R .hg/store-full/. .hg/store |
88 | 88 |
89 Entire manifest log missing | 89 Entire manifest log missing |
90 | 90 |
91 $ rm .hg/store/00manifest.* | 91 $ rm .hg/store/00manifest.* |
92 $ hg verify -q | 92 $ hg verify -q |
93 0: empty or missing manifest | 93 0: empty or missing manifest |
94 1 integrity errors encountered! | 94 1 integrity errors encountered! |
95 (first damaged changeset appears to be 0) | 95 (first damaged changeset appears to be 0) |
96 [1] | 96 [1] |
97 $ cp -r .hg/store-full/. .hg/store | 97 $ cp -R .hg/store-full/. .hg/store |
98 | 98 |
99 Entire filelog missing | 99 Entire filelog missing |
100 | 100 |
101 $ rm .hg/store/data/file.* | 101 $ rm .hg/store/data/file.* |
102 $ hg verify -q | 102 $ hg verify -q |
107 1 warnings encountered! | 107 1 warnings encountered! |
108 hint: run "hg debugrebuildfncache" to recover from corrupt fncache | 108 hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
109 3 integrity errors encountered! | 109 3 integrity errors encountered! |
110 (first damaged changeset appears to be 0) | 110 (first damaged changeset appears to be 0) |
111 [1] | 111 [1] |
112 $ cp -r .hg/store-full/. .hg/store | 112 $ cp -R .hg/store-full/. .hg/store |
113 | 113 |
114 Entire changelog and manifest log missing | 114 Entire changelog and manifest log missing |
115 | 115 |
116 $ rm .hg/store/00changelog.* | 116 $ rm .hg/store/00changelog.* |
117 $ rm .hg/store/00manifest.* | 117 $ rm .hg/store/00manifest.* |
118 $ hg verify -q | 118 $ hg verify -q |
119 warning: orphan revlog 'data/file.i' | 119 warning: orphan revlog 'data/file.i' |
120 1 warnings encountered! | 120 1 warnings encountered! |
121 $ cp -r .hg/store-full/. .hg/store | 121 $ cp -R .hg/store-full/. .hg/store |
122 | 122 |
123 Entire changelog and filelog missing | 123 Entire changelog and filelog missing |
124 | 124 |
125 $ rm .hg/store/00changelog.* | 125 $ rm .hg/store/00changelog.* |
126 $ rm .hg/store/data/file.* | 126 $ rm .hg/store/data/file.* |
135 1 warnings encountered! | 135 1 warnings encountered! |
136 hint: run "hg debugrebuildfncache" to recover from corrupt fncache | 136 hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
137 6 integrity errors encountered! | 137 6 integrity errors encountered! |
138 (first damaged changeset appears to be 0) | 138 (first damaged changeset appears to be 0) |
139 [1] | 139 [1] |
140 $ cp -r .hg/store-full/. .hg/store | 140 $ cp -R .hg/store-full/. .hg/store |
141 | 141 |
142 Entire manifest log and filelog missing | 142 Entire manifest log and filelog missing |
143 | 143 |
144 $ rm .hg/store/00manifest.* | 144 $ rm .hg/store/00manifest.* |
145 $ rm .hg/store/data/file.* | 145 $ rm .hg/store/data/file.* |
150 1 warnings encountered! | 150 1 warnings encountered! |
151 hint: run "hg debugrebuildfncache" to recover from corrupt fncache | 151 hint: run "hg debugrebuildfncache" to recover from corrupt fncache |
152 2 integrity errors encountered! | 152 2 integrity errors encountered! |
153 (first damaged changeset appears to be 0) | 153 (first damaged changeset appears to be 0) |
154 [1] | 154 [1] |
155 $ cp -r .hg/store-full/. .hg/store | 155 $ cp -R .hg/store-full/. .hg/store |
156 | 156 |
157 Changelog missing entry | 157 Changelog missing entry |
158 | 158 |
159 $ cp -f .hg/store-partial/00changelog.* .hg/store | 159 $ cp -f .hg/store-partial/00changelog.* .hg/store |
160 $ hg verify -q | 160 $ hg verify -q |
163 file@?: rev 1 points to nonexistent changeset 1 | 163 file@?: rev 1 points to nonexistent changeset 1 |
164 (expected 0) | 164 (expected 0) |
165 1 warnings encountered! | 165 1 warnings encountered! |
166 3 integrity errors encountered! | 166 3 integrity errors encountered! |
167 [1] | 167 [1] |
168 $ cp -r .hg/store-full/. .hg/store | 168 $ cp -R .hg/store-full/. .hg/store |
169 | 169 |
170 Manifest log missing entry | 170 Manifest log missing entry |
171 | 171 |
172 $ cp -f .hg/store-partial/00manifest.* .hg/store | 172 $ cp -f .hg/store-partial/00manifest.* .hg/store |
173 $ hg verify -q | 173 $ hg verify -q |
174 manifest@1: changeset refers to unknown revision 941fc4534185 | 174 manifest@1: changeset refers to unknown revision 941fc4534185 |
175 file@1: c10f2164107d not in manifests | 175 file@1: c10f2164107d not in manifests |
176 2 integrity errors encountered! | 176 2 integrity errors encountered! |
177 (first damaged changeset appears to be 1) | 177 (first damaged changeset appears to be 1) |
178 [1] | 178 [1] |
179 $ cp -r .hg/store-full/. .hg/store | 179 $ cp -R .hg/store-full/. .hg/store |
180 | 180 |
181 Filelog missing entry | 181 Filelog missing entry |
182 | 182 |
183 $ cp -f .hg/store-partial/data/file.* .hg/store/data | 183 $ cp -f .hg/store-partial/data/file.* .hg/store/data |
184 $ hg verify -q | 184 $ hg verify -q |
185 file@1: manifest refers to unknown revision c10f2164107d | 185 file@1: manifest refers to unknown revision c10f2164107d |
186 1 integrity errors encountered! | 186 1 integrity errors encountered! |
187 (first damaged changeset appears to be 1) | 187 (first damaged changeset appears to be 1) |
188 [1] | 188 [1] |
189 $ cp -r .hg/store-full/. .hg/store | 189 $ cp -R .hg/store-full/. .hg/store |
190 | 190 |
191 Changelog and manifest log missing entry | 191 Changelog and manifest log missing entry |
192 | 192 |
193 $ cp -f .hg/store-partial/00changelog.* .hg/store | 193 $ cp -f .hg/store-partial/00changelog.* .hg/store |
194 $ cp -f .hg/store-partial/00manifest.* .hg/store | 194 $ cp -f .hg/store-partial/00manifest.* .hg/store |
197 (expected 0) | 197 (expected 0) |
198 file@?: c10f2164107d not in manifests | 198 file@?: c10f2164107d not in manifests |
199 1 warnings encountered! | 199 1 warnings encountered! |
200 2 integrity errors encountered! | 200 2 integrity errors encountered! |
201 [1] | 201 [1] |
202 $ cp -r .hg/store-full/. .hg/store | 202 $ cp -R .hg/store-full/. .hg/store |
203 | 203 |
204 Changelog and filelog missing entry | 204 Changelog and filelog missing entry |
205 | 205 |
206 $ cp -f .hg/store-partial/00changelog.* .hg/store | 206 $ cp -f .hg/store-partial/00changelog.* .hg/store |
207 $ cp -f .hg/store-partial/data/file.* .hg/store/data | 207 $ cp -f .hg/store-partial/data/file.* .hg/store/data |
209 manifest@?: rev 1 points to nonexistent changeset 1 | 209 manifest@?: rev 1 points to nonexistent changeset 1 |
210 manifest@?: 941fc4534185 not in changesets | 210 manifest@?: 941fc4534185 not in changesets |
211 file@?: manifest refers to unknown revision c10f2164107d | 211 file@?: manifest refers to unknown revision c10f2164107d |
212 3 integrity errors encountered! | 212 3 integrity errors encountered! |
213 [1] | 213 [1] |
214 $ cp -r .hg/store-full/. .hg/store | 214 $ cp -R .hg/store-full/. .hg/store |
215 | 215 |
216 Manifest and filelog missing entry | 216 Manifest and filelog missing entry |
217 | 217 |
218 $ cp -f .hg/store-partial/00manifest.* .hg/store | 218 $ cp -f .hg/store-partial/00manifest.* .hg/store |
219 $ cp -f .hg/store-partial/data/file.* .hg/store/data | 219 $ cp -f .hg/store-partial/data/file.* .hg/store/data |
220 $ hg verify -q | 220 $ hg verify -q |
221 manifest@1: changeset refers to unknown revision 941fc4534185 | 221 manifest@1: changeset refers to unknown revision 941fc4534185 |
222 1 integrity errors encountered! | 222 1 integrity errors encountered! |
223 (first damaged changeset appears to be 1) | 223 (first damaged changeset appears to be 1) |
224 [1] | 224 [1] |
225 $ cp -r .hg/store-full/. .hg/store | 225 $ cp -R .hg/store-full/. .hg/store |
226 | 226 |
227 Corrupt changelog base node to cause failure to read revision | 227 Corrupt changelog base node to cause failure to read revision |
228 | 228 |
229 $ printf abcd | dd conv=notrunc of=.hg/store/00changelog.i bs=1 seek=16 \ | 229 $ printf abcd | dd conv=notrunc of=.hg/store/00changelog.i bs=1 seek=16 \ |
230 > 2> /dev/null | 230 > 2> /dev/null |
236 (expected 1) | 236 (expected 1) |
237 1 warnings encountered! | 237 1 warnings encountered! |
238 4 integrity errors encountered! | 238 4 integrity errors encountered! |
239 (first damaged changeset appears to be 0) | 239 (first damaged changeset appears to be 0) |
240 [1] | 240 [1] |
241 $ cp -r .hg/store-full/. .hg/store | 241 $ cp -R .hg/store-full/. .hg/store |
242 | 242 |
243 Corrupt manifest log base node to cause failure to read revision | 243 Corrupt manifest log base node to cause failure to read revision |
244 | 244 |
245 $ printf abcd | dd conv=notrunc of=.hg/store/00manifest.i bs=1 seek=16 \ | 245 $ printf abcd | dd conv=notrunc of=.hg/store/00manifest.i bs=1 seek=16 \ |
246 > 2> /dev/null | 246 > 2> /dev/null |
248 manifest@0: reading delta d0b6632564d4: * (glob) | 248 manifest@0: reading delta d0b6632564d4: * (glob) |
249 file@0: 362fef284ce2 not in manifests | 249 file@0: 362fef284ce2 not in manifests |
250 2 integrity errors encountered! | 250 2 integrity errors encountered! |
251 (first damaged changeset appears to be 0) | 251 (first damaged changeset appears to be 0) |
252 [1] | 252 [1] |
253 $ cp -r .hg/store-full/. .hg/store | 253 $ cp -R .hg/store-full/. .hg/store |
254 | 254 |
255 Corrupt filelog base node to cause failure to read revision | 255 Corrupt filelog base node to cause failure to read revision |
256 | 256 |
257 $ printf abcd | dd conv=notrunc of=.hg/store/data/file.i bs=1 seek=16 \ | 257 $ printf abcd | dd conv=notrunc of=.hg/store/data/file.i bs=1 seek=16 \ |
258 > 2> /dev/null | 258 > 2> /dev/null |
259 $ hg verify -q | 259 $ hg verify -q |
260 file@0: unpacking 362fef284ce2: * (glob) | 260 file@0: unpacking 362fef284ce2: * (glob) |
261 1 integrity errors encountered! | 261 1 integrity errors encountered! |
262 (first damaged changeset appears to be 0) | 262 (first damaged changeset appears to be 0) |
263 [1] | 263 [1] |
264 $ cp -r .hg/store-full/. .hg/store | 264 $ cp -R .hg/store-full/. .hg/store |
265 | 265 |
266 $ cd .. | 266 $ cd .. |
267 | 267 |
268 test changelog without a manifest | 268 test changelog without a manifest |
269 | 269 |