From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q2LCQbJm030827 for ; Wed, 21 Mar 2012 13:26:37 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmoGADHIaU+wCYo3/2dsb2JhbABDgxmCMbE7gQeCCQEBBSMdAQE2Ag8LGAICBRYLAgIJAwIBAgFFEwgCF4dzq1Fugz8BhmwGgS+MMIIMgRaVY4VtijqCaQ X-IronPort-AV: E=Sophos;i="4.73,623,1325458800"; d="scan'208";a="150524044" Received: from mail.etorok.net ([176.9.138.55]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 Mar 2012 13:26:32 +0100 Received: from [192.168.1.101] (unknown [79.114.95.112]) by mail.etorok.net (Postfix) with ESMTPSA id 8728E46A2 for ; Wed, 21 Mar 2012 13:26:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=etorok.net; s=MAILOUT; t=1332332791; bh=zm4w4P4Hre9hRNZJ9BxrbBqWUY2ymr0UpJfc3E0ehUE=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Lz/8yErhTqqoE+cNc63o3XREXIkjFZwylrARwvYEMco9MuqXgRyO3b5PnlGCFVEj9 VPurAxvIw9t8xxcMdxIb52AQBV9medlTig1KXOEfzHpx9iruzwZBc9QinXpuSOlgHD BCEoPnh44xixI1Bj9nvBIfpNfSZDjBS8InUFv4hQ= Message-ID: <4F69C8F6.2050408@etorok.net> Date: Wed, 21 Mar 2012 14:26:30 +0200 From: =?UTF-8?B?VMO2csO2ayBFZHdpbg==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <20120320175113.GC935@viper.local> <20120320180759.GE935@viper.local> <4F68CC67.3020207@janestreet.com> <20120320224525.GE3352@siouxsie> In-Reply-To: <20120320224525.GE3352@siouxsie> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.3 at mail X-Virus-Status: Clean Subject: Re: [Caml-list] Re: Unix.getlogin () fails when stdin is redirected On 03/21/2012 12:45 AM, oliver wrote: > Are there so many bugs in glibc that fixing this one means waiting > in a long, long queue... and bugfixes will need months or years? > > Are there any reasons this bug is not already fixed? > And since when is it known? Using stdin might be on purpose, this is what a glibc comment says: /* Get name of tty connected to fd 0. Return NULL if not a tty or if fd 0 isn't open. Note that a lot of documentation says that getlogin() is based on the controlling terminal---what they really mean is "the terminal connected to standard input". The getlogin() implementation of DEC Unix, SunOS, Solaris, HP-UX all return NULL if fd 0 has been closed, so this is the compatible thing to do. Note that ttyname(open("/dev/tty")) on those systems returns /dev/tty, so that is not a possible solution for getlogin(). */ --Edwin