Fossil

Check-in [5de13cb1]
Login

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

Overview
Comment:Add new test-usernames command to dump all of the various sources of the current user name in the order tested.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ross-doc-env
Files: files | file ages | folders
SHA1:5de13cb19cf06c745ad8ffeaf1f9c61d326b56ca
User & Date: rberteig 2016-03-02 01:56:12
Context
2016-03-02
01:57
Rewrite the section on fossil usernames selection, fix typos and improve wording here and there. check-in: 83153a97 user: rberteig tags: ross-doc-env
01:56
Add new test-usernames command to dump all of the various sources of the current user name in the order tested. check-in: 5de13cb1 user: rberteig tags: ross-doc-env
2016-03-01
21:38
Change db_create_default_users() to align its use of environment variables to set the user name to match user_select(), and try all variables on both Unix and Windows. check-in: ace9e00f user: rberteig tags: ross-doc-env
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/user.c.

   176    176     if( z ){
   177    177       int n = (int)strlen(z);
   178    178       if( n>0 && z[n-1]=='\n' ) fossil_new_line_started();
   179    179       strip_string(pIn, z);
   180    180     }
   181    181   }
   182    182   
   183         -
   184    183   /*
   185    184   ** COMMAND: user*
   186    185   **
   187    186   ** Usage: %fossil user SUBCOMMAND ...  ?-R|--repository FILE?
   188    187   **
   189    188   ** Run various subcommands on users of the open repository or of
   190    189   ** the repository identified by the -R or --repository option.
................................................................................
   383    382     fossil_print(
   384    383       "Cannot figure out who you are!  Consider using the --user\n"
   385    384       "command line option, setting your USER environment variable,\n"
   386    385       "or setting a default user with \"fossil user default USER\".\n"
   387    386     );
   388    387     fossil_fatal("cannot determine user");
   389    388   }
          389  +
          390  +/*
          391  +** COMMAND: test-usernames
          392  +** 
          393  +** Usage: %fossil test-usernames 
          394  +**
          395  +** Print details about sources of fossil usernames.
          396  +*/
          397  +void test_usernames_cmd(void){
          398  +  db_find_and_open_repository(0, 0);
          399  +  
          400  +  fossil_print("Initial g.zLogin: %s\n", g.zLogin);
          401  +  fossil_print("Initial g.userUid: %d\n", g.userUid);
          402  +  fossil_print("checkout default-user: %s\n", g.localOpen ?
          403  +               db_lget("default-user","") : "<<no open checkout>>");
          404  +  fossil_print("default-user: %s\n", db_get("default-user",""));
          405  +  fossil_print("FOSSIL_USER: %s\n", fossil_getenv("FOSSIL_USER"));
          406  +  fossil_print("USER: %s\n", fossil_getenv("USER"));
          407  +  fossil_print("LOGNAME: %s\n", fossil_getenv("LOGNAME"));
          408  +  fossil_print("USERNAME: %s\n", fossil_getenv("USERNAME"));
          409  +  url_parse(0, 0);
          410  +  fossil_print("URL user: %s\n", g.url.user);
          411  +  user_select();
          412  +  fossil_print("Final g.zLogin: %s\n", g.zLogin);
          413  +  fossil_print("Final g.userUid: %d\n", g.userUid);
          414  +}
   390    415   
   391    416   
   392    417   /*
   393    418   ** COMMAND: test-hash-passwords
   394    419   **
   395    420   ** Usage: %fossil test-hash-passwords REPOSITORY
   396    421   **