[PATCH 10/15] vcs-svn: Reject path nodes without Node-action

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It would be better to flag such errors and let the import proceed
anyway, but for now it is simpler not to worry about recovery
from such weird cases.

Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 t/t9010-svn-fe.sh |   20 ++++++++++++++++++++
 vcs-svn/svndump.c |    7 +++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index 729e73d..cb9a236 100755
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -252,6 +252,26 @@ test_expect_success 'directory with files' '
 	test_cmp hi directory/file2
 '
 
+test_expect_success 'node without action' '
+	cat >inaction.dump <<-\EOF &&
+	SVN-fs-dump-format-version: 3
+
+	Revision-number: 1
+	Prop-content-length: 10
+	Content-length: 10
+
+	PROPS-END
+
+	Node-path: directory
+	Node-kind: dir
+	Prop-content-length: 10
+	Content-length: 10
+
+	PROPS-END
+	EOF
+	test_must_fail test-svn-fe inaction.dump
+'
+
 test_expect_failure 'change file mode but keep old content' '
 	reinit_git &&
 	cat >expect <<-\EOF &&
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 4fdfcbb..78c2de0 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -174,7 +174,8 @@ static void handle_node(void)
 
 	if (node_ctx.srcRev) {
 		repo_copy(node_ctx.srcRev, node_ctx.src, node_ctx.dst);
-		node_ctx.action = NODEACT_CHANGE;
+		if (node_ctx.action == NODEACT_ADD)
+			  node_ctx.action = NODEACT_CHANGE;
 	}
 
 	if (mark && type == REPO_MODE_DIR)
@@ -182,8 +183,10 @@ static void handle_node(void)
 
 	if (node_ctx.action == NODEACT_CHANGE)
 		node_ctx.type = repo_modify_path(node_ctx.dst, 0, mark);
-	else	/* Node-action: add */
+	else if (node_ctx.action == NODEACT_ADD)
 		repo_add(node_ctx.dst, type, mark);
+	else
+		die("invalid dump: Node-path block lacks Node-action");
 
 	if (have_props) {
 		const uint32_t old_mode = node_ctx.type;
-- 
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]