Fossil SCM
In client_sync(), act on uvfile and uvigot cards only in a sync of unversioned content or in a clone. A server could otherwise replace an unversioned file in the client during an ordinary pull, and a uvigot card ended an ordinary pull with an SQL error.
Commit
c149b999e88e11401e9d579d33cf62c0b33dc5e3709650c8cf98937ef14ce0da
Parent
2e20f2fc4ddd2f8…
1 file changed
+4
-1
+4
-1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -2582,11 +2582,13 @@ | ||
| 2582 | 2582 | |
| 2583 | 2583 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2584 | 2584 | ** |
| 2585 | 2585 | ** Client accepts an unversioned file from the server. |
| 2586 | 2586 | */ |
| 2587 | - if( blob_eq(&xfer.aToken[0], "uvfile") ){ | |
| 2587 | + if( blob_eq(&xfer.aToken[0], "uvfile") | |
| 2588 | + && (syncFlags & (SYNC_UNVERSIONED|SYNC_CLONE))!=0 | |
| 2589 | + ){ | |
| 2588 | 2590 | xfer_accept_unversioned_file(&xfer, 1); |
| 2589 | 2591 | nArtifactRcvd++; |
| 2590 | 2592 | nUvFileRcvd++; |
| 2591 | 2593 | if( syncFlags & SYNC_VERBOSE ){ |
| 2592 | 2594 | fossil_print("\rUnversioned-file received: %s\n", |
| @@ -2662,10 +2664,11 @@ | ||
| 2662 | 2664 | ** (indicating that the file has been deleted) and MTIME is newer, |
| 2663 | 2665 | ** then do the deletion. |
| 2664 | 2666 | */ |
| 2665 | 2667 | if( xfer.nToken==5 |
| 2666 | 2668 | && blob_eq(&xfer.aToken[0], "uvigot") |
| 2669 | + && (syncFlags & (SYNC_UNVERSIONED|SYNC_CLONE))!=0 | |
| 2667 | 2670 | && blob_is_filename(&xfer.aToken[1]) |
| 2668 | 2671 | && blob_is_int64(&xfer.aToken[2], &mtime) |
| 2669 | 2672 | && blob_is_int(&xfer.aToken[4], &size) |
| 2670 | 2673 | && (blob_eq(&xfer.aToken[3],"-") || blob_is_hname(&xfer.aToken[3])) |
| 2671 | 2674 | ){ |
| 2672 | 2675 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2582,11 +2582,13 @@ | |
| 2582 | |
| 2583 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2584 | ** |
| 2585 | ** Client accepts an unversioned file from the server. |
| 2586 | */ |
| 2587 | if( blob_eq(&xfer.aToken[0], "uvfile") ){ |
| 2588 | xfer_accept_unversioned_file(&xfer, 1); |
| 2589 | nArtifactRcvd++; |
| 2590 | nUvFileRcvd++; |
| 2591 | if( syncFlags & SYNC_VERBOSE ){ |
| 2592 | fossil_print("\rUnversioned-file received: %s\n", |
| @@ -2662,10 +2664,11 @@ | |
| 2662 | ** (indicating that the file has been deleted) and MTIME is newer, |
| 2663 | ** then do the deletion. |
| 2664 | */ |
| 2665 | if( xfer.nToken==5 |
| 2666 | && blob_eq(&xfer.aToken[0], "uvigot") |
| 2667 | && blob_is_filename(&xfer.aToken[1]) |
| 2668 | && blob_is_int64(&xfer.aToken[2], &mtime) |
| 2669 | && blob_is_int(&xfer.aToken[4], &size) |
| 2670 | && (blob_eq(&xfer.aToken[3],"-") || blob_is_hname(&xfer.aToken[3])) |
| 2671 | ){ |
| 2672 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2582,11 +2582,13 @@ | |
| 2582 | |
| 2583 | /* uvfile NAME MTIME HASH SIZE FLAGS \n CONTENT |
| 2584 | ** |
| 2585 | ** Client accepts an unversioned file from the server. |
| 2586 | */ |
| 2587 | if( blob_eq(&xfer.aToken[0], "uvfile") |
| 2588 | && (syncFlags & (SYNC_UNVERSIONED|SYNC_CLONE))!=0 |
| 2589 | ){ |
| 2590 | xfer_accept_unversioned_file(&xfer, 1); |
| 2591 | nArtifactRcvd++; |
| 2592 | nUvFileRcvd++; |
| 2593 | if( syncFlags & SYNC_VERBOSE ){ |
| 2594 | fossil_print("\rUnversioned-file received: %s\n", |
| @@ -2662,10 +2664,11 @@ | |
| 2664 | ** (indicating that the file has been deleted) and MTIME is newer, |
| 2665 | ** then do the deletion. |
| 2666 | */ |
| 2667 | if( xfer.nToken==5 |
| 2668 | && blob_eq(&xfer.aToken[0], "uvigot") |
| 2669 | && (syncFlags & (SYNC_UNVERSIONED|SYNC_CLONE))!=0 |
| 2670 | && blob_is_filename(&xfer.aToken[1]) |
| 2671 | && blob_is_int64(&xfer.aToken[2], &mtime) |
| 2672 | && blob_is_int(&xfer.aToken[4], &size) |
| 2673 | && (blob_eq(&xfer.aToken[3],"-") || blob_is_hname(&xfer.aToken[3])) |
| 2674 | ){ |
| 2675 |