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 q2LI0PpS020898 for ; Wed, 21 Mar 2012 19:00:26 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgciAAYXak9N6B+kW2dsb2JhbABEgxGwZoMqFwoKCBUnggkBAQQBOj8QCw4KJwdDAxEGE4gFCbgLkQEEiFCFMI1MjSY X-IronPort-AV: E=Sophos;i="4.73,623,1325458800"; d="scan'208";a="150582904" Received: from fe01x03-cgp.akado.ru (HELO akado.ru) ([77.232.31.164]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 Mar 2012 19:00:01 +0100 Received: from [10.0.66.9] ([10.0.66.9] verified) by fe01-cgp.akado.ru (CommuniGate Pro SMTP 5.2.13) with ESMTPS id 335143803; Wed, 21 Mar 2012 22:00:00 +0400 Date: Wed, 21 Mar 2012 21:59:54 +0400 (MSK) From: malc X-X-Sender: malc@linmac To: Gerd Stolpmann cc: =?ISO-8859-15?Q?=22Ricardo_Catalinas_Jim=E9nez=22?= , caml-list@inria.fr In-Reply-To: <21e18417ea60387375a493c44907735e.squirrel@gps.dynxs.de> Message-ID: References: <20120320175113.GC935@viper.local> <21e18417ea60387375a493c44907735e.squirrel@gps.dynxs.de> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Caml-list] Unix.getlogin () fails when stdin is redirected On Wed, 21 Mar 2012, Gerd Stolpmann wrote: > > > On Tue, 20 Mar 2012, Ricardo Catalinas Jim?nez wrote: > > > >> I found out the next issue in this simple code: > >> > >> let () = > >> print_endline "Hello"; > >> print_endline (Unix.getlogin ()) > >> > >> Running in the normal case, with `./a.out' gives: > > > > FWIW on my machine (linux) calling getlogin from any PTY always fails > > (be it screen or some sort of X terminal) > > I guess /var/run/utmp is not world-readable - which is a perfectly > reasonable configuration, and means that you disabled getlogin > administratively. > > Does "last -f /var/run/utmp" give an output? Yep ~$ last -f /var/run/utmp malc tty1 Wed Mar 21 21:57 still logged in reboot system boot Wed Mar 21 21:57 (00:01) utmp begins Wed Mar 21 21:57:23 2012 ~$ ls -l /var/run/utmp -rw-r--r-- 1 root root 3840 2012-03-21 21:57 /var/run/utmp [..snip..] -- mailto:av1474@comtv.ru