COPY-on-existing and MOVE-on-existing and Overwrite: F
Peter Makholm
peter at makholm.net
Tue Nov 18 04:47:16 EST 2008
I'm a bit confused by two warnings I get from the copymove tests for
copying and moving to existing destinations with the Overwrite header
set to 'F'.
The RFC says clearly that 412 (Precondition Failed) is the right
return value for both situations (Section 9.8.5 and 9.9.4 of RFC
4918), but litmus contains the following tests:
[in copy_overwrite:]
/* Do it again with Overwrite: F to check that fails. */
ONN("COPY on existing resource with Overwrite: F",
ne_copy(i_session, 0, NE_DEPTH_INFINITE, src, dest) != NE_ERROR);
if (STATUS(412)) {
t_warning("COPY-on-existing fails with 412");
}
[in move:]
/* Try a move with Overwrite: F to check that fails. */
ONM2REQ("MOVE on existing resource with Overwrite: F succeeded",
src2, dest,
ne_move(i_session, 0, src2, dest) != NE_ERROR);
if (STATUS(412)) {
t_warning("MOVE-on-existing should fail with 412");
}
The condition seems to be reversed in both cases if STATUS(412) is the
right status code. In the move case the warning seems to be right even
though the test is wrong, even further confusing the subject.
The fix is simple if I'm right:
--- copymove.c.orig 2008-02-08 11:01:18.000000000 +0100
+++ copymove.c 2008-11-18 10:40:27.000000000 +0100
@@ -73,8 +73,8 @@
ONN("COPY on existing resource with Overwrite: F should fail (RFC2518:S8.8.4)",
ne_copy(i_session, 0, NE_DEPTH_INFINITE, src, dest) != NE_ERROR);
- if (STATUS(412)) {
- t_warning("COPY-on-existing fails with 412");
+ if (!STATUS(412)) {
+ t_warning("COPY-on-existing should fail with 412");
}
ONV(ne_copy(i_session, 1, NE_DEPTH_INFINITE, src, dest),
@@ -258,7 +258,7 @@
src2, dest,
ne_move(i_session, 0, src2, dest) != NE_ERROR);
- if (STATUS(412)) {
+ if (!STATUS(412)) {
t_warning("MOVE-on-existing should fail with 412");
}
More information about the litmus
mailing list