libc6 isn't returning a valid user in char *getlogin()

Bug #1032740 reported by Jayson Reis
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
eglibc (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

A simple c program in my machine demonstrate what is happening.

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

int main( int argc, char *argv[] ) {
    char *name;
    name = getlogin();
    if (name != NULL)
        printf("%s\n", name);
    else
        printf("name is null\n");
    return 0;
}

I'm just compiling and running it and name aways come as NULL;
Note that i'm not a C developer, i got this when my python tests broke with os.getlogin.

Thank you

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: libc6 2.15-0ubuntu10
ProcVersionSignature: Ubuntu 3.2.0-27.43-generic-pae 3.2.21
Uname: Linux 3.2.0-27-generic-pae i686
ApportVersion: 2.0.1-0ubuntu11
Architecture: i386
Date: Fri Aug 3 14:16:20 2012
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
ProcEnviron:
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: eglibc
UpgradeStatus: Upgraded to precise on 2012-07-02 (32 days ago)

Revision history for this message
Jayson Reis (jaysonsantos2003) wrote :
Revision history for this message
bcrowell (launchpadcrowell07) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in eglibc (Ubuntu):
status: New → Confirmed
Revision history for this message
bcrowell (launchpadcrowell07) wrote :

---- rintintin ~ $ lsb_release -a
LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
---- rintintin ~ $ cat >gl.c
#include <unistd.h>
#include <stdio.h>

int main(void) {
   puts(getlogin());
   return 0;
}
---- rintintin ~ $ gcc gl.c && ulimit -c unlimited && ./a.out
Segmentation fault (core dumped)

I'll attach the core dump.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.