Fossil SCM

Fix "fossil sync -u" failing with "bad command: uvigot" when an unversioned file is pushed and the outgoing message is already full, as it is after a large commit. The client now always sends a "uvfile" card; only a server may substitute "uvigot".

dmestas 2026-11-12 04:04 UTC small-fixes
Commit 7266ff3e93e834161ba67de3a6baa214dbf35fbd2118dcb5be44b03372961598
1 file changed +12 -5
+12 -5
--- src/xfer.c
+++ src/xfer.c
@@ -699,19 +699,26 @@
699699
**
700700
** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
701701
**
702702
** If the noContent flag is set, omit the CONTENT and set the 0x0004
703703
** flag in FLAGS.
704
+**
705
+** A server that has already reached its send size limit sends a short
706
+** "uvigot" card in place of the file, and the client asks again. A
707
+** client must not do that, because a server does not accept "uvigot".
708
+** So the client sets isClient and always gets a "uvfile" card.
704709
*/
705710
static void send_unversioned_file(
706711
Xfer *pXfer, /* Transfer context */
707712
const char *zName, /* Name of unversioned file to be sent */
708
- int noContent /* True to omit the content */
713
+ int noContent, /* True to omit the content */
714
+ int isClient /* True if sending from client to server */
709715
){
710716
Stmt q1;
717
+ int isFull = !isClient && (int)blob_size(pXfer->pOut)>=pXfer->mxSend;
711718
712
- if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ) noContent = 1;
719
+ if( isFull ) noContent = 1;
713720
if( noContent ){
714721
db_prepare(&q1,
715722
"SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q",
716723
zName
717724
);
@@ -728,11 +735,11 @@
728735
if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){
729736
xfer_cannot_send_sha3_error(pXfer);
730737
db_reset(&q1);
731738
return;
732739
}
733
- if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ){
740
+ if( isFull ){
734741
/* If we have already reached the send size limit, send a (short)
735742
** uvigot card rather than a uvfile card. This only happens on the
736743
** server side. The uvigot card will provoke the client to resend
737744
** another uvgimme on the next cycle. */
738745
blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
@@ -1436,11 +1443,11 @@
14361443
if( blob_eq(&xfer.aToken[0], "uvgimme")
14371444
&& xfer.nToken==2
14381445
&& blob_is_filename(&xfer.aToken[1])
14391446
){
14401447
if( g.perm.Read ){
1441
- send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0);
1448
+ send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0, 0);
14421449
}
14431450
}else
14441451
14451452
/* igot HASH ?ISPRIVATE?
14461453
**
@@ -2369,11 +2376,11 @@
23692376
Stmt uvq;
23702377
int rc = SQLITE_OK;
23712378
db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend");
23722379
while( (rc = db_step(&uvq))==SQLITE_ROW ){
23732380
const char *zName = db_column_text(&uvq, 0);
2374
- send_unversioned_file(&xfer, zName, db_column_int(&uvq,1));
2381
+ send_unversioned_file(&xfer, zName, db_column_int(&uvq,1), 1);
23752382
nCardSent++;
23762383
nArtifactSent++;
23772384
db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName);
23782385
if( syncFlags & SYNC_VERBOSE ){
23792386
fossil_print("\rUnversioned-file sent: %s\n", zName);
23802387
--- src/xfer.c
+++ src/xfer.c
@@ -699,19 +699,26 @@
699 **
700 ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
701 **
702 ** If the noContent flag is set, omit the CONTENT and set the 0x0004
703 ** flag in FLAGS.
 
 
 
 
 
704 */
705 static void send_unversioned_file(
706 Xfer *pXfer, /* Transfer context */
707 const char *zName, /* Name of unversioned file to be sent */
708 int noContent /* True to omit the content */
 
709 ){
710 Stmt q1;
 
711
712 if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ) noContent = 1;
713 if( noContent ){
714 db_prepare(&q1,
715 "SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q",
716 zName
717 );
@@ -728,11 +735,11 @@
728 if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){
729 xfer_cannot_send_sha3_error(pXfer);
730 db_reset(&q1);
731 return;
732 }
733 if( (int)blob_size(pXfer->pOut)>=pXfer->mxSend ){
734 /* If we have already reached the send size limit, send a (short)
735 ** uvigot card rather than a uvfile card. This only happens on the
736 ** server side. The uvigot card will provoke the client to resend
737 ** another uvgimme on the next cycle. */
738 blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
@@ -1436,11 +1443,11 @@
1436 if( blob_eq(&xfer.aToken[0], "uvgimme")
1437 && xfer.nToken==2
1438 && blob_is_filename(&xfer.aToken[1])
1439 ){
1440 if( g.perm.Read ){
1441 send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0);
1442 }
1443 }else
1444
1445 /* igot HASH ?ISPRIVATE?
1446 **
@@ -2369,11 +2376,11 @@
2369 Stmt uvq;
2370 int rc = SQLITE_OK;
2371 db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend");
2372 while( (rc = db_step(&uvq))==SQLITE_ROW ){
2373 const char *zName = db_column_text(&uvq, 0);
2374 send_unversioned_file(&xfer, zName, db_column_int(&uvq,1));
2375 nCardSent++;
2376 nArtifactSent++;
2377 db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName);
2378 if( syncFlags & SYNC_VERBOSE ){
2379 fossil_print("\rUnversioned-file sent: %s\n", zName);
2380
--- src/xfer.c
+++ src/xfer.c
@@ -699,19 +699,26 @@
699 **
700 ** uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT
701 **
702 ** If the noContent flag is set, omit the CONTENT and set the 0x0004
703 ** flag in FLAGS.
704 **
705 ** A server that has already reached its send size limit sends a short
706 ** "uvigot" card in place of the file, and the client asks again. A
707 ** client must not do that, because a server does not accept "uvigot".
708 ** So the client sets isClient and always gets a "uvfile" card.
709 */
710 static void send_unversioned_file(
711 Xfer *pXfer, /* Transfer context */
712 const char *zName, /* Name of unversioned file to be sent */
713 int noContent, /* True to omit the content */
714 int isClient /* True if sending from client to server */
715 ){
716 Stmt q1;
717 int isFull = !isClient && (int)blob_size(pXfer->pOut)>=pXfer->mxSend;
718
719 if( isFull ) noContent = 1;
720 if( noContent ){
721 db_prepare(&q1,
722 "SELECT mtime, hash, encoding, sz FROM unversioned WHERE name=%Q",
723 zName
724 );
@@ -728,11 +735,11 @@
735 if( pXfer->remoteVersion<20000 && db_column_bytes(&q1,1)>HNAME_LEN_SHA1 ){
736 xfer_cannot_send_sha3_error(pXfer);
737 db_reset(&q1);
738 return;
739 }
740 if( isFull ){
741 /* If we have already reached the send size limit, send a (short)
742 ** uvigot card rather than a uvfile card. This only happens on the
743 ** server side. The uvigot card will provoke the client to resend
744 ** another uvgimme on the next cycle. */
745 blob_appendf(pXfer->pOut, "uvigot %s %lld %s %d\n",
@@ -1436,11 +1443,11 @@
1443 if( blob_eq(&xfer.aToken[0], "uvgimme")
1444 && xfer.nToken==2
1445 && blob_is_filename(&xfer.aToken[1])
1446 ){
1447 if( g.perm.Read ){
1448 send_unversioned_file(&xfer, blob_str(&xfer.aToken[1]), 0, 0);
1449 }
1450 }else
1451
1452 /* igot HASH ?ISPRIVATE?
1453 **
@@ -2369,11 +2376,11 @@
2376 Stmt uvq;
2377 int rc = SQLITE_OK;
2378 db_prepare(&uvq, "SELECT name, mtimeOnly FROM uv_tosend");
2379 while( (rc = db_step(&uvq))==SQLITE_ROW ){
2380 const char *zName = db_column_text(&uvq, 0);
2381 send_unversioned_file(&xfer, zName, db_column_int(&uvq,1), 1);
2382 nCardSent++;
2383 nArtifactSent++;
2384 db_multi_exec("DELETE FROM uv_tosend WHERE name=%Q", zName);
2385 if( syncFlags & SYNC_VERBOSE ){
2386 fossil_print("\rUnversioned-file sent: %s\n", zName);
2387

Keyboard Shortcuts

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