Bug #546
New nick autocreation doesn't work
100%
Description
I updated to the Feb 11 snapshot. Purged the system and deleted the quassel dir in .config. The new identity I got had the correct real name, but the nick was still quassel###. I deleted, tried again, and got a quassel### with a different number, so I know it wasn't just something old hanging around.
Associated revisions
History
#1 Updated by Sputnick almost 16 years ago
Uh, judging from the code, this could only be happening if the POSIX call getlogin() returned an empty string on your box (which frankly I find hard to believe). Any way to test/confirm that?
#2 Updated by kitterma almost 16 years ago
Perhaps. Using Python (sorry, don't do C++), I found three potential ways to get my login. Two worked:
print os.environ['LOGNAME']
kitterma
print pwd.getpwuid(os.getuid())[0]
kitterma
print os.getlogin()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory
The Python documentation recommends using the environment variable LOGNAME for this:
#3 Updated by Sputnick almost 16 years ago
- Status changed from New to Assigned
- Assignee set to Sputnick
- Target version set to 0.4.0
Wow. And here I was, thinking that any Linux system should implement POSIX at least... very strange. Would be interesting to know where that comes from (or if it's maybe just a py issue? But the facts seem to indicate that this call is indeed missing...)
Could you please check if you have a manpage for that?
man 3 getlogin
If I can't assume full POSIX to be present on all Linux systems, I will at least add a fallback, but first I'd like to get to the root of this issue.
#4 Updated by Sputnick almost 16 years ago
Thinking about that, the C syscall must be there (otherwise compilation would fail), but why it returns an empty string on kubuntu is beyond me :/
#5 Updated by kitterma almost 16 years ago
Works on a different box (also Ubuntu Intrepid):
print os.getlogin()
kitterma
No idea why.
#6 Updated by Sputnick almost 16 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Applied in changeset 734f29b6efd9aaea6347c2f27f4095a399168e61.
Get user name from getpwuid, fixes #546