delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/20/09:43:51

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
MIME-Version: 1.0
Cc: "Gerrit @ cygwin" <cygwin AT cygwin DOT com>,
Perl 5 Porters <perl5-porters AT perl DOT org>
Subject: Re: Cygwin /dev/null problem or perl 5.8.0 problem? (was: Re: autom4te and perl 5.8.0)
In-Reply-To: <20020619233222.8ABA.H.M.BRAND@hccnet.nl> from H.Merijn Brand
on Wed, 19 Jun 2002 23:35:44 +0200
References: <076601c217d6$d4405020$6132bc3e AT BABEL> <119964355610 DOT 20020619232858 AT familiehaase DOT de> <20020619233222 DOT 8ABA DOT H DOT M DOT BRAND AT hccnet DOT nl>
To: h DOT m DOT brand AT hccnet DOT nl
Message-Id: <20020620134305.15949.2@bactrian.elixent.com>
Date: Thu, 20 Jun 2002 14:43:05 +0100
From: Nick Ing-Simmons <nick DOT ing-simmons AT elixent DOT com>
Reply-To: Nick Ing-Simmons <nick DOT ing-simmons AT elixent DOT com>

H.Merijn Brand <h DOT m DOT brand AT hccnet DOT nl> writes:
>On Wed 19 Jun 2002 23:28, "Gerrit P. Haase" <gp AT familiehaase DOT de> wrote:
>> Hallo Conrad,
>> 
>> Am Mittwoch, 19. Juni 2002 um 23:18 schriebst du:
>> 
>> > "Gerrit P. Haase" <gp AT familiehaase DOT de> wrote:
>> 
>> Segfaulting with perl 5.8.0 on Cygwin:
>> 
>>  use IO::File;
>>  my $out = new IO::File;
>>  $out->open("/dev/null", O_CREAT | O_WRONLY | O_TRUNC, 0666);
>> 

It is a perl5.7+ problem of uncertain vintage.

The root cause is fixed by: 

--- doio.c.ship	Thu Jun 20 14:35:53 2002
+++ doio.c	Thu Jun 20 14:14:27 2002
@@ -663,7 +663,10 @@
     if (writing) {
 	if (IoTYPE(io) == IoTYPE_SOCKET
 	    || (IoTYPE(io) == IoTYPE_WRONLY && fd >= 0 && S_ISCHR(PL_statbuf.st_mode)) ) {
-	    mode[0] = 'w';
+	    char *s = mode;
+	    if (*s == 'I' || *s == '#')
+	     s++;
+	    *s = 'w';
 	    if (!(IoOFP(io) = PerlIO_openn(aTHX_ type,mode,fd,0,0,NULL,0,svp))) {
 		PerlIO_close(fp);
 		IoIFP(io) = Nullfp;


Otherwise in this case "mode" is passed as "ww" rather than "#w", PerlIOBase_push
objects and returns a NULL and we get the SEGV.

(I am testing a change which makes perlio.c more defensive with returned NULL 
as well.)

I am slightly confused by the condition though - this is the IoIFP and IoOFP need
their own PerlIO * logic - fine if it is a socket but why do we need that 
for the WRONLY case of a char-device? Did we mean RDWR case?

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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