Fossil SCM
Fix to the /hash-collisions page: Only consider the SHA1 hashes in the BLOB table, not the random hexadecimal identifiers assigned to tickets and tech-notes. The latter two live in a different namespace.
Commit
327eee14525ff1c98f4f36e73c8ed24ded7fc55c
Parent
3234cf1efe96ad6…
1 file changed
+6
-8
+6
-8
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -104,10 +104,15 @@ | ||
| 104 | 104 | ** If zType is NULL or "" or "*" then any type of artifact will serve. |
| 105 | 105 | ** If zType is "br" then find the first check-in of the named branch |
| 106 | 106 | ** rather than the last. |
| 107 | 107 | ** zType is "ci" in most use cases since we are usually searching for |
| 108 | 108 | ** a check-in. |
| 109 | +** | |
| 110 | +** Note that the input zTag for types "t" and "e" is the SHA1 hash of | |
| 111 | +** the ticket-change or event-change artifact, not the randomly generated | |
| 112 | +** hexadecimal identifier assigned to tickets and events. Those identifiers | |
| 113 | +** live in a separate namespace. | |
| 109 | 114 | */ |
| 110 | 115 | int symbolic_name_to_rid(const char *zTag, const char *zType){ |
| 111 | 116 | int vid; |
| 112 | 117 | int rid = 0; |
| 113 | 118 | int nTag; |
| @@ -1079,18 +1084,11 @@ | ||
| 1079 | 1084 | login_check_credentials(); |
| 1080 | 1085 | if( !g.perm.Read ){ login_needed(); return; } |
| 1081 | 1086 | memset(aCollide, 0, sizeof(aCollide)); |
| 1082 | 1087 | for(i=0; i<ArraySize(aCollide); i++) blob_init(&aCollide[i].ex,0,0); |
| 1083 | 1088 | memset(zPrev, 0, sizeof(zPrev)); |
| 1084 | - db_prepare(&q, | |
| 1085 | - "SELECT tkt_uuid FROM ticket\n" | |
| 1086 | - "UNION ALL\n" | |
| 1087 | - "SELECT substr(tagname,7) FROM tag WHERE tagname GLOB 'event-*'\n" | |
| 1088 | - "UNION ALL\n" | |
| 1089 | - "SELECT uuid FROM blob\n" | |
| 1090 | - "ORDER BY 1" | |
| 1091 | - ); | |
| 1089 | + db_prepare(&q,"SELECT uuid FROM blob ORDER BY 1"); | |
| 1092 | 1090 | while( db_step(&q)==SQLITE_ROW ){ |
| 1093 | 1091 | const char *zUuid = db_column_text(&q,0); |
| 1094 | 1092 | int n = db_column_bytes(&q,0); |
| 1095 | 1093 | int i; |
| 1096 | 1094 | nHash++; |
| 1097 | 1095 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -104,10 +104,15 @@ | |
| 104 | ** If zType is NULL or "" or "*" then any type of artifact will serve. |
| 105 | ** If zType is "br" then find the first check-in of the named branch |
| 106 | ** rather than the last. |
| 107 | ** zType is "ci" in most use cases since we are usually searching for |
| 108 | ** a check-in. |
| 109 | */ |
| 110 | int symbolic_name_to_rid(const char *zTag, const char *zType){ |
| 111 | int vid; |
| 112 | int rid = 0; |
| 113 | int nTag; |
| @@ -1079,18 +1084,11 @@ | |
| 1079 | login_check_credentials(); |
| 1080 | if( !g.perm.Read ){ login_needed(); return; } |
| 1081 | memset(aCollide, 0, sizeof(aCollide)); |
| 1082 | for(i=0; i<ArraySize(aCollide); i++) blob_init(&aCollide[i].ex,0,0); |
| 1083 | memset(zPrev, 0, sizeof(zPrev)); |
| 1084 | db_prepare(&q, |
| 1085 | "SELECT tkt_uuid FROM ticket\n" |
| 1086 | "UNION ALL\n" |
| 1087 | "SELECT substr(tagname,7) FROM tag WHERE tagname GLOB 'event-*'\n" |
| 1088 | "UNION ALL\n" |
| 1089 | "SELECT uuid FROM blob\n" |
| 1090 | "ORDER BY 1" |
| 1091 | ); |
| 1092 | while( db_step(&q)==SQLITE_ROW ){ |
| 1093 | const char *zUuid = db_column_text(&q,0); |
| 1094 | int n = db_column_bytes(&q,0); |
| 1095 | int i; |
| 1096 | nHash++; |
| 1097 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -104,10 +104,15 @@ | |
| 104 | ** If zType is NULL or "" or "*" then any type of artifact will serve. |
| 105 | ** If zType is "br" then find the first check-in of the named branch |
| 106 | ** rather than the last. |
| 107 | ** zType is "ci" in most use cases since we are usually searching for |
| 108 | ** a check-in. |
| 109 | ** |
| 110 | ** Note that the input zTag for types "t" and "e" is the SHA1 hash of |
| 111 | ** the ticket-change or event-change artifact, not the randomly generated |
| 112 | ** hexadecimal identifier assigned to tickets and events. Those identifiers |
| 113 | ** live in a separate namespace. |
| 114 | */ |
| 115 | int symbolic_name_to_rid(const char *zTag, const char *zType){ |
| 116 | int vid; |
| 117 | int rid = 0; |
| 118 | int nTag; |
| @@ -1079,18 +1084,11 @@ | |
| 1084 | login_check_credentials(); |
| 1085 | if( !g.perm.Read ){ login_needed(); return; } |
| 1086 | memset(aCollide, 0, sizeof(aCollide)); |
| 1087 | for(i=0; i<ArraySize(aCollide); i++) blob_init(&aCollide[i].ex,0,0); |
| 1088 | memset(zPrev, 0, sizeof(zPrev)); |
| 1089 | db_prepare(&q,"SELECT uuid FROM blob ORDER BY 1"); |
| 1090 | while( db_step(&q)==SQLITE_ROW ){ |
| 1091 | const char *zUuid = db_column_text(&q,0); |
| 1092 | int n = db_column_bytes(&q,0); |
| 1093 | int i; |
| 1094 | nHash++; |
| 1095 |