
google-glog - issue #12
User name is not detected on Windows and set to 'invalid-user'
What steps will reproduce the problem? 1. cd glog-0.2.1\src 2. cl /Iwindows /D "GOOGLE_GLOG_DLL_DECL=" /Gm /EHsc /RTC1 /MDd /W3 /nologo /ZI /TP main.cc logging.cc windows\port.cc raw_logging.cc utilities.cc vlog_is_on.cc 3. run 'run.cmd' (run.cmd and main.cc are attached)
What is the expected output? What do you see instead?
I expect to get a log file in the current directory named similar to this:
main..jago.log.INFO.20090710-004203.5680
where 'jago' is the current Windows user name, but I am getting the log file named:
main..invalid-user.log.INFO.20090710-004203.5680
What version of the product are you using? On what operating system?
glog-0.2.1 Windows XP SP3 Visual Studio 2008 SP1
Please provide any additional information below.
This patch fixes the problem:
--- utilities.cc 2009-04-10 11:25:14.000000000 +0400 +++ utilities.cc 2009-07-10 00:31:16.402625000 +0400 @@ -281,7 +281,11 @@ } static void MyUserNameInitializer() { // TODO(hamaji): Probably this is not portable. +#if defined(OS_WINDOWS) + const char* user = getenv("USERNAME"); +#else const char* user = getenv("USER"); +#endif if (user != NULL) { g_my_user_name = user; } else {
- main.cc 136
- run.cmd 25
Comment #1
Posted on Jul 27, 2009 by Massive WombatThanks for the patch! Sorry for the latency. I'd like to apply it to fix this issue.
Could you sign our Individual Contributor License Agreement, please? We need to ask you to sign this to avoid any troubles. The process is just submitting an HTML form, and it shouldn't take your time so much.
http://code.google.com/legal/individual-cla-v1.0.html
Please note that these forms do not transfer copyright: the contributor retains her ownership in the work. The CLA just grants Google a "perpetual, non-exclusive, royalty-free, etc..." right to use the work, sublicense it, and so on.
Thanks!
Comment #2
Posted on Jul 29, 2009 by Happy CatI remember I had already signed that form for contributing to the Google Test but I have done again now to make it fresh.
Comment #3
Posted on Jul 29, 2009 by Massive WombatAh, I didn't notice that... Anyway, I checked this patch in. Thanks again for the patch!
Status: Fixed
Labels:
Type-Defect
Priority-Medium