Fossil SCM

Add code to the technote editor so that if some future bug causes it to generate an invalid technote artifact, an error will be generated and the artifact will not be applied to the repository.

drh 2015-02-20 00:29 trunk
Commit 3ee0046529c500d13eca9983248e93b112304810
1 file changed +8 -1
+8 -1
--- src/event.c
+++ src/event.c
@@ -399,11 +399,18 @@
399399
md5sum_blob(&event, &cksum);
400400
blob_appendf(&event, "Z %b\n", &cksum);
401401
blob_reset(&cksum);
402402
nrid = content_put(&event);
403403
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
404
- manifest_crosslink(nrid, &event, MC_NONE);
404
+ if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){
405
+ db_end_transaction(1);
406
+ style_header("Error");
407
+ @ Internal error: Fossil tried to make an invalid artifact for
408
+ @ the edited technode.
409
+ style_footer();
410
+ return;
411
+ }
405412
assert( blob_is_reset(&event) );
406413
content_deltify(rid, nrid, 0);
407414
db_end_transaction(0);
408415
cgi_redirectf("technote?name=%T", zId);
409416
}
410417
--- src/event.c
+++ src/event.c
@@ -399,11 +399,18 @@
399 md5sum_blob(&event, &cksum);
400 blob_appendf(&event, "Z %b\n", &cksum);
401 blob_reset(&cksum);
402 nrid = content_put(&event);
403 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
404 manifest_crosslink(nrid, &event, MC_NONE);
 
 
 
 
 
 
 
405 assert( blob_is_reset(&event) );
406 content_deltify(rid, nrid, 0);
407 db_end_transaction(0);
408 cgi_redirectf("technote?name=%T", zId);
409 }
410
--- src/event.c
+++ src/event.c
@@ -399,11 +399,18 @@
399 md5sum_blob(&event, &cksum);
400 blob_appendf(&event, "Z %b\n", &cksum);
401 blob_reset(&cksum);
402 nrid = content_put(&event);
403 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
404 if( manifest_crosslink(nrid, &event, MC_NONE)==0 ){
405 db_end_transaction(1);
406 style_header("Error");
407 @ Internal error: Fossil tried to make an invalid artifact for
408 @ the edited technode.
409 style_footer();
410 return;
411 }
412 assert( blob_is_reset(&event) );
413 content_deltify(rid, nrid, 0);
414 db_end_transaction(0);
415 cgi_redirectf("technote?name=%T", zId);
416 }
417

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button