shithub: gefs

Download patch

ref: 7f5ba9667e001b1eaf01d53f2d483bce7688d53e
parent: c424d52fc0dd25568851549bf1e6a309cf74983f
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Apr 27 21:01:38 EDT 2023

tree: fix sparse file deletions

when deleting a sparse file, we need to allow
stray Oclearb's to reach the leaves and apply
to nothing.

--- a/tree.c
+++ b/tree.c
@@ -480,7 +480,9 @@
 			 * new values must always start as
 			 * an insertion, mutations come after.
 			 */
-			if(m.op != Oinsert){
+			if(m.op == Oclearb)
+				ok = 0;
+			else if(m.op != Oinsert){
 				fprint(2, "%d(/%d), %d: %M not insert\n", i, b->nval, j, &m);
 				abort();
 			}
@@ -514,6 +516,8 @@
 		ok = 1;
 		cpkvp(&v, &m, buf, sizeof(buf));
 		p->pullsz += msgsz(&m);
+		if(m.op == Oclearb)
+			continue;
 		if(m.op != Oinsert){
 			fprint(2, "%d(/%d), %d: %M not insert\n", i, b->nval, j, &m);
 			showblk(2, up->b, "parent", 0);
@@ -673,7 +677,9 @@
 			 * new values must always start as
 			 * an insertion, mutations come after.
 			 */
-			if(m.op != Oinsert){
+			if(m.op == Oclearb)
+				ok = 0;
+			else if(m.op != Oinsert){
 				fprint(2, "%d(/%d), %d: %M not insert\n", i, b->nval, j, &m);
 				abort();
 			}