X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Thu, 8 Sep 2011 10:27:02 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: debugging SIGSEV on pclose Message-ID: <20110908142702.GA28918@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4E64BE96 DOT 5020107 AT gmail DOT com> <4E68CE13 DOT 6010106 AT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4E68CE13.6010106@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Thu, Sep 08, 2011 at 04:15:47PM +0200, Marco atzeri wrote: >On 9/5/2011 2:20 PM, Marco atzeri wrote: >> Hi, >> I am trying to identify the octave segfault, last reported on >> http://cygwin.com/ml/cygwin-announce/2011-08/msg00003.html >> >> To reproduce: run octave from xterm and at prompt >> ------------------------- >> graphics_toolkit ("fltk") >> x=1:10; >> plot(x,x) >> print("fltk.png","-dpng") >> ------------------------- >> the plot is built and printed as file but octave crashes. >> >> >> After builiding cygwin (cvs), octave and fltk with >> gcc-4.5.3 I was able to identify the SIGSEV in cygwin pclose. >> >> Program received signal SIGSEGV, Segmentation fault. >> [Switching to Thread 5980.0x164c] >> pclose (fp=0x7ffdf000) at >> /pub/cygwin/cvs/src_new/winsup/cygwin/syscalls.cc:4026 >> 4026 if (fh->get_device () != FH_PIPEW && fh->get_device () != FH_PIPER) >> (gdb) l >> 4021 int >> 4022 pclose (FILE *fp) >> 4023 { >> 4024 fhandler_pipe *fh = (fhandler_pipe *) cygheap->fdtab[fileno(fp)]; > >Answering myself while kicking the head on the wall > >the SIGSEV on 4026 is obvious as fh is NULL > >(gdb) p fh >$7 = (fhandler_pipe *) 0x0 >(gdb) p fp >$8 = (FILE *) 0x20204f94 > >> 4025 >> 4026 if (fh->get_device () != FH_PIPEW && fh->get_device () != FH_PIPER) > >Question: >is a mistake in pclose to assume that fh could be invalid I'm not sure what you're asking here. It's not a mistake to assume that pclose is being passed a valid fp. Linux also crashes if the fp is closed twice. >or something is just trashing cygheap->fdtab ? Who knows? strace should show if the fp is closed twice. cgf -- 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