Fossil

Check-in [e38c068029]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:PoC for the previous check-in: use UUIDs for project-code and server-code.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | gen-uuid
Files: files | file ages | folders
SHA3-256: e38c068029173d4597eb66cf4a60853301ccd240d6ed814b3e892617a510735b
User & Date: danield 2025-07-07 15:16:43.030
Context
2025-07-23
16:01
Replace a call to mprintf() with fossil_strdup(). Leaf check-in: 44e5125f8f user: danield tags: gen-uuid
2025-07-07
15:16
PoC for the previous check-in: use UUIDs for project-code and server-code. check-in: e38c068029 user: danield tags: gen-uuid
15:11
Add a function for generating a random (v4) UUID and a test command using it. check-in: 9472f708c9 user: danield tags: gen-uuid
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/clone.c.
253
254
255
256
257
258
259
260
261

262
263
264
265
266
267
268
      db_set("ssl-identity", blob_str(&fn), 0);
      db_protect_pop();
      blob_reset(&fn);
    }
    db_unprotect(PROTECT_CONFIG);
    db_multi_exec(
      "REPLACE INTO config(name,value,mtime)"
      " VALUES('server-code', lower(hex(randomblob(20))), now());"
      "DELETE FROM config WHERE name='project-code';"

    );
    db_protect_pop();
    url_enable_proxy(0);
    clone_ssh_db_set_options();
    url_get_password_if_needed();
    g.xlinkClusterOnly = 1;
    nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0,0);







|
|
>







253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
      db_set("ssl-identity", blob_str(&fn), 0);
      db_protect_pop();
      blob_reset(&fn);
    }
    db_unprotect(PROTECT_CONFIG);
    db_multi_exec(
      "REPLACE INTO config(name,value,mtime)"
      " VALUES('server-code', %Q, now());"
      "DELETE FROM config WHERE name='project-code';",
      fossil_generate_uuid()
    );
    db_protect_pop();
    url_enable_proxy(0);
    clone_ssh_db_set_options();
    url_get_password_if_needed();
    g.xlinkClusterOnly = 1;
    nErr = client_sync(syncFlags,CONFIGSET_ALL,0,0,0);
Changes to src/db.c.
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215

3216
3217
3218
3219
3220
3221
3222

  db_unprotect(PROTECT_ALL);
  db_set("content-schema", CONTENT_SCHEMA, 0);
  db_set("aux-schema", AUX_SCHEMA_MAX, 0);
  db_set("rebuilt", get_version(), 0);
  db_multi_exec(
      "INSERT INTO config(name,value,mtime)"
      " VALUES('server-code', lower(hex(randomblob(20))),now());"
      "INSERT INTO config(name,value,mtime)"
      " VALUES('project-code', lower(hex(randomblob(20))),now());"

  );
  db_create_default_users(0, zDefaultUser);
  if( zDefaultUser ) g.zLogin = zDefaultUser;
  user_select();

  if( zTemplate ){
    /*







|

|
>







3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223

  db_unprotect(PROTECT_ALL);
  db_set("content-schema", CONTENT_SCHEMA, 0);
  db_set("aux-schema", AUX_SCHEMA_MAX, 0);
  db_set("rebuilt", get_version(), 0);
  db_multi_exec(
      "INSERT INTO config(name,value,mtime)"
      " VALUES('server-code', %Q, now());"
      "INSERT INTO config(name,value,mtime)"
      " VALUES('project-code', %Q, now());",
      fossil_generate_uuid(), fossil_generate_uuid()
  );
  db_create_default_users(0, zDefaultUser);
  if( zDefaultUser ) g.zLogin = zDefaultUser;
  user_select();

  if( zTemplate ){
    /*
Changes to src/rebuild.c.
891
892
893
894
895
896
897
898
899
900
901

902
903
904
905
906
907
908
    "  ('peer-*'),"
    "  ('subrepo:*'),"
    "  ('sync-*'),"
    "  ('syncfrom:*'),"
    "  ('syncwith:*'),"
    "  ('ssl-*')"
    ") SELECT name FROM config, pattern WHERE name GLOB x);"
    "UPDATE config SET value=lower(hex(randomblob(20)))"
    " WHERE name='project-code';"
    "UPDATE config SET value='detached-' || value"
    " WHERE name='project-name' AND value NOT GLOB 'detached-*';"

  );
  db_protect_pop();
  db_end_transaction(0);
  fossil_print("New project code: %s\n", db_get("project-code",""));
}

/*







|


|
>







891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
    "  ('peer-*'),"
    "  ('subrepo:*'),"
    "  ('sync-*'),"
    "  ('syncfrom:*'),"
    "  ('syncwith:*'),"
    "  ('ssl-*')"
    ") SELECT name FROM config, pattern WHERE name GLOB x);"
    "UPDATE config SET value=%Q"
    " WHERE name='project-code';"
    "UPDATE config SET value='detached-' || value"
    " WHERE name='project-name' AND value NOT GLOB 'detached-*';",
    fossil_generate_uuid()
  );
  db_protect_pop();
  db_end_transaction(0);
  fossil_print("New project code: %s\n", db_get("project-code",""));
}

/*