delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/09/12/12:19:10

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CG,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4E6E30DF.7010308@gmail.com>
Date: Mon, 12 Sep 2011 18:18:39 +0200
From: Marco atzeri <marco DOT atzeri AT gmail DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: debugging SIGSEV on pclose
References: <4E64BE96 DOT 5020107 AT gmail DOT com> <4E68CE13 DOT 6010106 AT gmail DOT com> <20110908142702 DOT GA28918 AT ednor DOT casa DOT cgf DOT cx> <4E68DB48 DOT 3050906 AT gmail DOT com> <4E68EB4A DOT 5040406 AT gmail DOT com> <20110908165203 DOT GB28918 AT ednor DOT casa DOT cgf DOT cx> <4E68F861 DOT 5090309 AT gmail DOT com> <20110908182210 DOT GA30425 AT ednor DOT casa DOT cgf DOT cx>
In-Reply-To: <20110908182210.GA30425@ednor.casa.cgf.cx>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 9/8/2011 8:22 PM, Christopher Faylor wrote:
> On Thu, Sep 08, 2011 at 07:16:17PM +0200, Marco atzeri wrote:
>> On 9/8/2011 6:52 PM, Christopher Faylor wrote:
>>> As I said, on Linux, if you call pclose twice in succession you get a
>>> SEGV.  I am comfortable with Cygwin's behavior especially since you
>>> seem to be seeing an actual program problem.
>>
>> unlikely a octave issue as it SEGFAULT's only on cygwin, and all the
>> other platforms are fine: Linux, BSD, Apple.
>>
>> I suspect more a borderline cygwin issue that octave is just hitting.
>> But of course I could be wrong.
>
> Sure it could be but adding a band-aid to work around the issue is not
> the way to go.
>
> cgf
>

Cgf,

If I am not fooling myself, octave sequence is this:

- popen , creating pipe 5 and 6 (handle 0x20204F9C)
   (pipe 5 is closed as the communication is unidirectional)

- fdopen (6) duplicating the handle (new handle 0x2020500C)

- a lot of writing to 6

- fclose (0x2020500C)
   this is causing fclose to call : close(6)
-----------------------------------------------
Run till exit from #0  fclose (fp=0x2020500c)
     at ../../../../../src_new/newlib/libc/stdio/fclose.c:116

Breakpoint 6, close (fd=6)
     at /pub/cygwin/cvs/src_new/winsup/cygwin/syscalls.cc:1214
------------------------------------------------

- pclose(0x20204F9C)
   that SEGFAULT's as fd=6 is already closed

The close(6) seems an abnormal beahviour of fclose as there is another
FILE handle still open.

How does cygwin track the number of open FILE handles for each
file descriptor  ?

Regards
Marco





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019