Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 4 Aug 2003 20:58:46 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: [BUG] pututline () & rxvt: rxvt leaves stale utmp entries Message-ID: <20030805005846.GA30749@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <32529 DOT 1060040748 AT www44 DOT gmx DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32529.1060040748@www44.gmx.net> User-Agent: Mutt/1.4.1i On Tue, Aug 05, 2003 at 01:45:48AM +0200, Pavel Tsekov wrote: >Hello, Hi Pavel, nice to see a message from you. >On rxvt startup two utmp entries are created - the first one is created by >Cygwin and the second one is created by rxvt itself: > >$ who >Administ tty1 Aug 5 01:26 (MORDOR) >Administ tty2 Aug 5 01:26 (:0) > >After rxvt shutdown: > >$ who >Administ tty2 Aug 5 01:26 (:0) > >The cause for this seems to be that rxvt assumes that the return value >of getutid () is usable in a call to pututline (), which doesn't seem >to hold true on Cygwin. It turns out that Cygwin uses the same static >variable to return utmp entries to the caller and also for its own >internal purposes i.e. searching for the right utmp entry. I don't >know if Cygwin is right or not in this case, and there doesn't seem to >be a lot of documentation on this topic. The linux man pages tells >that the return value of getutid(), getutline() and getutent() is a >static memory but doesn't say anything about what could possibly happen >if one uses it back in a call to pututline(). So I guess the behaviour >is pretty much undefined. On the other hand there is a comment in the >Cygwin source of logout() which indicates that the author of putline () >was aware of this behaviour so I draw the conclusion that it is not a >bug in Cygwin: > > /* We can't use ut further since it's a pointer to the static utmp_data > area (see below) and would get overwritten in pututline(). So we > copy it back to the local ut_buf. */ > >I've created a simple testcase (attached) which when ran on Linux >produces the results that rxvt expects. Unfortunately currently I do >not have access to any other unices on which I can run the testcase. A simple test case. Sob. A simple test case. Oh, how I've missed you. Given the good problem description and the simple test case, this shouldn't be hard to fix. I'll see what I can do. The behavior that you've described has bugged me for a while. I'm glad that you tracked down what was going on. cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/