Fossil SCM

Try to provide better information on manifest errors.

mistachkin 2014-10-22 19:52 trunk merge
Commit e9bccd1c1270145ee3e13d9e2df197af9779658f
2 files changed +17 -2 +1 -1
+17 -2
--- src/manifest.c
+++ src/manifest.c
@@ -361,10 +361,11 @@
361361
char *z;
362362
int n;
363363
char *zUuid;
364364
int sz = 0;
365365
int isRepeat, hasSelfRefTag = 0;
366
+ Blob bUuid = BLOB_INITIALIZER;
366367
static Bag seen;
367368
const char *zErr = 0;
368369
369370
if( rid==0 ){
370371
isRepeat = 1;
@@ -404,10 +405,15 @@
404405
if( verify_z_card(z, n)==2 ){
405406
blob_reset(pContent);
406407
blob_appendf(pErr, "incorrect Z-card cksum");
407408
return 0;
408409
}
410
+
411
+ /* Store the UUID (before modifying the blob) only for error
412
+ ** reporting purposes.
413
+ */
414
+ sha1sum_blob(pContent, &bUuid);
409415
410416
/* Allocate a Manifest object to hold the parsed control artifact.
411417
*/
412418
p = fossil_malloc( sizeof(*p) );
413419
memset(p, 0, sizeof(*p));
@@ -945,13 +951,18 @@
945951
if( !seenZ ) SYNTAX("missing Z-card on control");
946952
p->type = CFTYPE_CONTROL;
947953
}
948954
md5sum_init();
949955
if( !isRepeat ) g.parseCnt[p->type]++;
956
+ blob_reset(&bUuid);
950957
return p;
951958
952959
manifest_syntax_error:
960
+ if(bUuid.nUsed){
961
+ blob_appendf(pErr, "manifest [%.40s] ", blob_str(&bUuid));
962
+ blob_reset(&bUuid);
963
+ }
953964
if( zErr ){
954965
blob_appendf(pErr, "line %d: %s", lineNo, zErr);
955966
}else{
956967
blob_appendf(pErr, "unknown error on line %d", lineNo);
957968
}
@@ -1734,11 +1745,14 @@
17341745
17351746
if( (p = manifest_cache_find(rid))!=0 ){
17361747
blob_reset(pContent);
17371748
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
17381749
assert( blob_is_reset(pContent) || pContent==0 );
1739
- if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "syntax error in manifest");
1750
+ if( (flags & MC_NO_ERRORS)==0 ){
1751
+ fossil_error(1, "syntax error in manifest [%s]",
1752
+ db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
1753
+ }
17401754
return 0;
17411755
}
17421756
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
17431757
manifest_destroy(p);
17441758
assert( blob_is_reset(pContent) );
@@ -1747,11 +1761,12 @@
17471761
}
17481762
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
17491763
manifest_destroy(p);
17501764
assert( blob_is_reset(pContent) );
17511765
if( (flags & MC_NO_ERRORS)==0 ){
1752
- fossil_error(1, "cannot fetch baseline manifest");
1766
+ fossil_error(1, "cannot fetch baseline for manifest [%s]",
1767
+ db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
17531768
}
17541769
return 0;
17551770
}
17561771
db_begin_transaction();
17571772
if( p->type==CFTYPE_MANIFEST ){
17581773
--- src/manifest.c
+++ src/manifest.c
@@ -361,10 +361,11 @@
361 char *z;
362 int n;
363 char *zUuid;
364 int sz = 0;
365 int isRepeat, hasSelfRefTag = 0;
 
366 static Bag seen;
367 const char *zErr = 0;
368
369 if( rid==0 ){
370 isRepeat = 1;
@@ -404,10 +405,15 @@
404 if( verify_z_card(z, n)==2 ){
405 blob_reset(pContent);
406 blob_appendf(pErr, "incorrect Z-card cksum");
407 return 0;
408 }
 
 
 
 
 
409
410 /* Allocate a Manifest object to hold the parsed control artifact.
411 */
412 p = fossil_malloc( sizeof(*p) );
413 memset(p, 0, sizeof(*p));
@@ -945,13 +951,18 @@
945 if( !seenZ ) SYNTAX("missing Z-card on control");
946 p->type = CFTYPE_CONTROL;
947 }
948 md5sum_init();
949 if( !isRepeat ) g.parseCnt[p->type]++;
 
950 return p;
951
952 manifest_syntax_error:
 
 
 
 
953 if( zErr ){
954 blob_appendf(pErr, "line %d: %s", lineNo, zErr);
955 }else{
956 blob_appendf(pErr, "unknown error on line %d", lineNo);
957 }
@@ -1734,11 +1745,14 @@
1734
1735 if( (p = manifest_cache_find(rid))!=0 ){
1736 blob_reset(pContent);
1737 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
1738 assert( blob_is_reset(pContent) || pContent==0 );
1739 if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "syntax error in manifest");
 
 
 
1740 return 0;
1741 }
1742 if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
1743 manifest_destroy(p);
1744 assert( blob_is_reset(pContent) );
@@ -1747,11 +1761,12 @@
1747 }
1748 if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
1749 manifest_destroy(p);
1750 assert( blob_is_reset(pContent) );
1751 if( (flags & MC_NO_ERRORS)==0 ){
1752 fossil_error(1, "cannot fetch baseline manifest");
 
1753 }
1754 return 0;
1755 }
1756 db_begin_transaction();
1757 if( p->type==CFTYPE_MANIFEST ){
1758
--- src/manifest.c
+++ src/manifest.c
@@ -361,10 +361,11 @@
361 char *z;
362 int n;
363 char *zUuid;
364 int sz = 0;
365 int isRepeat, hasSelfRefTag = 0;
366 Blob bUuid = BLOB_INITIALIZER;
367 static Bag seen;
368 const char *zErr = 0;
369
370 if( rid==0 ){
371 isRepeat = 1;
@@ -404,10 +405,15 @@
405 if( verify_z_card(z, n)==2 ){
406 blob_reset(pContent);
407 blob_appendf(pErr, "incorrect Z-card cksum");
408 return 0;
409 }
410
411 /* Store the UUID (before modifying the blob) only for error
412 ** reporting purposes.
413 */
414 sha1sum_blob(pContent, &bUuid);
415
416 /* Allocate a Manifest object to hold the parsed control artifact.
417 */
418 p = fossil_malloc( sizeof(*p) );
419 memset(p, 0, sizeof(*p));
@@ -945,13 +951,18 @@
951 if( !seenZ ) SYNTAX("missing Z-card on control");
952 p->type = CFTYPE_CONTROL;
953 }
954 md5sum_init();
955 if( !isRepeat ) g.parseCnt[p->type]++;
956 blob_reset(&bUuid);
957 return p;
958
959 manifest_syntax_error:
960 if(bUuid.nUsed){
961 blob_appendf(pErr, "manifest [%.40s] ", blob_str(&bUuid));
962 blob_reset(&bUuid);
963 }
964 if( zErr ){
965 blob_appendf(pErr, "line %d: %s", lineNo, zErr);
966 }else{
967 blob_appendf(pErr, "unknown error on line %d", lineNo);
968 }
@@ -1734,11 +1745,14 @@
1745
1746 if( (p = manifest_cache_find(rid))!=0 ){
1747 blob_reset(pContent);
1748 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
1749 assert( blob_is_reset(pContent) || pContent==0 );
1750 if( (flags & MC_NO_ERRORS)==0 ){
1751 fossil_error(1, "syntax error in manifest [%s]",
1752 db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
1753 }
1754 return 0;
1755 }
1756 if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
1757 manifest_destroy(p);
1758 assert( blob_is_reset(pContent) );
@@ -1747,11 +1761,12 @@
1761 }
1762 if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
1763 manifest_destroy(p);
1764 assert( blob_is_reset(pContent) );
1765 if( (flags & MC_NO_ERRORS)==0 ){
1766 fossil_error(1, "cannot fetch baseline for manifest [%s]",
1767 db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid));
1768 }
1769 return 0;
1770 }
1771 db_begin_transaction();
1772 if( p->type==CFTYPE_MANIFEST ){
1773
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201201
if( rid==0 ){
202202
blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203203
blob_reset(&content);
204204
}else{
205205
if( !isPriv ) content_make_public(rid);
206
- manifest_crosslink(rid, &content, MC_NONE|MC_NO_ERRORS);
206
+ manifest_crosslink(rid, &content, MC_NO_ERRORS);
207207
}
208208
assert( blob_is_reset(&content) );
209209
remote_has(rid);
210210
}
211211
212212
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201 if( rid==0 ){
202 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203 blob_reset(&content);
204 }else{
205 if( !isPriv ) content_make_public(rid);
206 manifest_crosslink(rid, &content, MC_NONE|MC_NO_ERRORS);
207 }
208 assert( blob_is_reset(&content) );
209 remote_has(rid);
210 }
211
212
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201 if( rid==0 ){
202 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203 blob_reset(&content);
204 }else{
205 if( !isPriv ) content_make_public(rid);
206 manifest_crosslink(rid, &content, MC_NO_ERRORS);
207 }
208 assert( blob_is_reset(&content) );
209 remote_has(rid);
210 }
211
212

Keyboard Shortcuts

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