ref: 6b5d2ac468490a417e2dc36d13662b021d360200
parent: 107a7ba9717429ae34294d9afa804b5271157ab0
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 23 10:26:44 EDT 2024
gefs: weaken overzealous assert When modifying a sparse file, it's possible to get clobbers and clears to item s that don't exist; in this case, we try to apply to an empty kvp, and assert -- we should just not apply.
--- a/sys/src/cmd/gefs/tree.c
+++ b/sys/src/cmd/gefs/tree.c
@@ -405,11 +405,12 @@
Tree t;
switch(m->op){
- case Oclearb:
case Odelete:
- case Oclobber:
assert(keycmp(kv, m) == 0);
return 0;
+ case Oclearb:
+ case Oclobber:
+ return 0;
case Oinsert:
cpkvp(kv, m, buf, nbuf);
return 1;
@@ -1359,9 +1360,10 @@
j = bufsearch(p[i], k, &m, &same);
if(j < 0 || !same)
continue;
- if(!(ok || m.op == Oinsert || m.op == Oclearb))
+ if(ok || m.op == Oinsert)
+ ok = apply(r, &m, buf, nbuf);
+ else if(m.op != Oclearb && m.op != Oclobber)
fatal("lookup %K << %M missing insert\n", k, &m);
- ok = apply(r, &m, buf, nbuf);
for(j++; j < p[i]->nbuf; j++){
getmsg(p[i], j, &m);
if(keycmp(k, &m) != 0)