Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Store "fingerprint" and "checkout-hash" in the VVAR table whenever the working checkout changes. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | repo-fingerprint |
Files: | files | file ages | folders |
SHA3-256: |
e07139a05a361ed6c7619e50826bf3b0 |
User & Date: | drh 2019-01-10 21:07:29.022 |
Context
2019-01-11
| ||
03:31 | Verify the repository fingerprint whenever a repository is opened from a checkout database. For now, abort with an error if the fingerprint is incorrect. To do: have Fossil automatically adjust RIDs in the checkout database if the fingerprint is incorrect. ... (Closed-Leaf check-in: 6036bc62 user: drh tags: repo-fingerprint) | |
2019-01-10
| ||
21:07 | Store "fingerprint" and "checkout-hash" in the VVAR table whenever the working checkout changes. ... (check-in: e07139a0 user: drh tags: repo-fingerprint) | |
19:54 | Add the db_fingerprint() interface for computing a repository fingerprint. ... (check-in: f5043617 user: drh tags: repo-fingerprint) | |
Changes
Changes to src/checkin.c.
︙ | ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);" "DELETE FROM vmerge;" "UPDATE vfile SET vid=%d;" "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL" " WHERE is_selected(id);" , vid, nvid ); | | | 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 | "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND is_selected(id);" "DELETE FROM vmerge;" "UPDATE vfile SET vid=%d;" "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL" " WHERE is_selected(id);" , vid, nvid ); db_set_checkout(nvid); /* Update the isexe and islink columns of the vfile table */ db_prepare(&q, "UPDATE vfile SET isexe=:exec, islink=:link" " WHERE vid=:vid AND pathname=:path AND (isexe!=:exec OR islink!=:link)" ); db_bind_int(&q, ":vid", nvid); |
︙ | ︙ |
Changes to src/checkout.c.
︙ | ︙ | |||
302 303 304 305 306 307 308 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); ensure_empty_dirs_created(); | | | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); if( !keepFlag ){ vfile_to_disk(vid, 0, !g.fQuiet, promptFlag); } checkout_set_all_exe(vid); manifest_to_disk(vid); ensure_empty_dirs_created(); db_set_checkout(vid); undo_reset(); db_multi_exec("DELETE FROM vmerge"); if( !keepFlag && db_get_boolean("repo-cksum",1) ){ vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b); vfile_aggregate_checksum_disk(vid, &cksum2); if( blob_compare(&cksum1, &cksum2) ){ fossil_print("WARNING: manifest checksum does not agree with disk\n"); |
︙ | ︙ |
Changes to src/db.c.
︙ | ︙ | |||
2870 2871 2872 2873 2874 2875 2876 | ** point, this will probably be the setting value from the ** repository or global configuration databases. */ g.allowSymlinks = db_get_boolean("allow-symlinks", db_allow_symlinks_by_default()); } db_lset("repository", g.argv[2]); db_record_repository_filename(g.argv[2]); | | | 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 | ** point, this will probably be the setting value from the ** repository or global configuration databases. */ g.allowSymlinks = db_get_boolean("allow-symlinks", db_allow_symlinks_by_default()); } db_lset("repository", g.argv[2]); db_record_repository_filename(g.argv[2]); db_set_checkout(0); azNewArgv[0] = g.argv[0]; g.argv = azNewArgv; if( !emptyFlag ){ g.argc = 3; if( g.zOpenRevision ){ azNewArgv[g.argc-1] = g.zOpenRevision; }else{ |
︙ | ︙ | |||
3721 3722 3723 3724 3725 3726 3727 | ** ** The fingerprint is based on the RCVFROM table. When constructing a ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to ** accomplish this.) When verifying an old fingerprint, use the same ** RCVFROM entry that generated the fingerprint in the first place. ** ** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of | | > > > | 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 | ** ** The fingerprint is based on the RCVFROM table. When constructing a ** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to ** accomplish this.) When verifying an old fingerprint, use the same ** RCVFROM entry that generated the fingerprint in the first place. ** ** The fingerprint consists of the rcvid, a "/", and the MD5 checksum of ** the remaining fields of the RCVFROM table entry. MD5 is used for this ** because it is 4x faster than SHA3 and 5x faster than SHA1, and there ** are no security concerns - this is just a checksum, not a security ** token. */ char *db_fingerprint(int rcvid){ char *z = 0; Blob sql = BLOB_INITIALIZER; Stmt q; blob_append_sql(&sql, "SELECT rcvid, quote(uid), quote(mtime), quote(nonce), quote(ipaddr)" |
︙ | ︙ | |||
3767 3768 3769 3770 3771 3772 3773 | if( g.argc==3 ){ rcvid = atoi(g.argv[2]); }else if( g.argc!=2 ){ fossil_fatal("wrong number of arguments"); } fossil_print("%z\n", db_fingerprint(rcvid)); } | > > > > > > > > > > > > > > > > | 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 | if( g.argc==3 ){ rcvid = atoi(g.argv[2]); }else if( g.argc!=2 ){ fossil_fatal("wrong number of arguments"); } fossil_print("%z\n", db_fingerprint(rcvid)); } /* ** Set the value of the "checkout" entry in the VVAR table. ** ** Also set "fingerprint" and "checkout-hash". */ void db_set_checkout(int rid){ char *z; db_lset_int("checkout", rid); z = db_text(0,"SELECT uuid FROM blob WHERE rid=%d",rid); db_lset("checkout-hash", z); fossil_free(z); z = db_fingerprint(0); db_lset("fingerprint", z); fossil_free(z); } |
Changes to src/undo.c.
︙ | ︙ | |||
162 163 164 165 166 167 168 | "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" ); } } ncid = db_lget_int("undo_checkout", 0); ucid = db_lget_int("checkout", 0); db_lset_int("undo_checkout", ucid); | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" ); } } ncid = db_lget_int("undo_checkout", 0); ucid = db_lget_int("checkout", 0); db_lset_int("undo_checkout", ucid); db_set_checkout(ncid); } /* ** Reset the undo memory. */ void undo_reset(void){ static const char zSql[] = |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
571 572 573 574 575 576 577 | }else{ ensure_empty_dirs_created(); if( g.argc<=3 ){ /* All files updated. Shift the current checkout to the target. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); checkout_set_all_exe(tid); manifest_to_disk(tid); | | | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | }else{ ensure_empty_dirs_created(); if( g.argc<=3 ){ /* All files updated. Shift the current checkout to the target. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); checkout_set_all_exe(tid); manifest_to_disk(tid); db_set_checkout(tid); }else{ /* A subset of files have been checked out. Keep the current ** checkout unchanged. */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); } if( !internalUpdate ) undo_finish(); if( setmtimeFlag ) vfile_check_signature(tid, CKSIG_SETMTIME); |
︙ | ︙ |