in reply to Re^2: getlogin works on debian but not ubuntu?
in thread getlogin works on debian but not ubuntu?

well getlogin worked for me, so getpwuid was never executed, just putting scalar in front seems to solve the issue for both of us (I wasn't thinking about print's list context)

perl -e 'print scalar getpwuid($<) ' lanx

Cheers Rolf

Replies are listed 'Best First'.
Re^4: getlogin works on debian but not ubuntu?
by bcrowell2 (Friar) on Jan 07, 2013 at 01:51 UTC
    Yeah, that works. I wonder if I should file a bug report on this...I'm not convinced I understand what's going on well enough to file a useful one. I assume per's getlogin() is just a wrapper for the C function, so maybe this is a bug in the C libraries in ubuntu precise?
      Works for me even on Ubuntu PP:
      mb@dennis ~ $ perl -E'say getlogin' mb mb@dennis ~ $ cat gl.c #include <unistd.h> #include <stdio.h> int main(void) { puts(getlogin()); return 0; } mb@dennis ~ $ gcc gl.c mb@dennis ~ $ ./a.out mb
        Looks like an OS or library bug.
        $ cat >gl.c #include <unistd.h> #include <stdio.h> int main(void) { puts(getlogin()); return 0; } ---- rintintin ~ $ gcc gl.c ---- rintintin ~ $ ./a.out Segmentation fault (core dumped)
        Maybe it's the same thing as this? https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1067779