reassign 69678 libc0.1 2.13-37
retitle 69678 getlogin() fails (sometimes) on kfreebsd
thanks

For reference: Christoph tried to use dput-ng on kFreeBSD but it failed
with:

On 27.12.2012 04:16, Christoph Egger wrote:
> [CRITICAL] 1356578085.464574: (<module>) unable to determine login name

This output comes from os.getlogin() in Python. By talking to you, you
confirmed that this command fails for you indeed. However, it works for
me on both kFreeBSD and FreeBSD 8.2:

[root@kfreebsd:/home/arno]# uname -a
GNU/kFreeBSD kfreebsd 9.0-2-amd64 #0 Sat Sep 22 19:00:52 UTC 2012 x86_64
amd64 Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz GNU/kFreeBSD
[root@kfreebsd:/home/arno]# python -c 'import os; print os.getlogin()'
arno


[root@fbsd-test /home/arno]# uname -a
FreeBSD fbsd-test.fritz.box 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb
17 02:41:51 UTC 2011
[email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
[root@fbsd-test /home/arno]# python -c 'import os; print os.getlogin()'
arno


Digging further, we revealed that this program does not work either for
Christoph:

#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

int main()
{
        char * login = getlogin();
        if (login)
                printf("%s", login);
        else
                printf("getlogin(): %s", strerror(errno));
}


while it does work for me. Christoph gets:

./a.out
getlogin():Success%

At this point, my knowledge ends. I know that getlogin(3) is not very
reliable, but hopefully it might be a little better than that. At very
least I lack the understanding why it works for me, but fails for
Christoph.


-- 
with kind regards,
Arno Töll
IRC: daemonkeeper on Freenode/OFTC
GnuPG Key-ID: 0x9D80F36D

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to