GNU bug report logs - #10616
flush procedure for soft ports isn't called

Previous Next

Package: guile;

Reported by: Ian Price <ianprice90 <at> googlemail.com>

Date: Thu, 26 Jan 2012 22:19:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 10616 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw <at> netris.org>
Cc: Ian Price <ianprice90 <at> googlemail.com>, 10616 <at> debbugs.gnu.org
Subject: Re: bug#10616: flush procedure for soft ports isn't called
Date: Sat, 10 Mar 2012 23:14:39 +0100
Hi Mark,

Mark H Weaver <mhw <at> netris.org> skribis:

> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> Ian Price <ianprice90 <at> googlemail.com> skribis:
>>
>>>  
>>> -  if (pt->write_pos > pt->write_buf)
>>> -    {
>>> -      /* write the byte. */
>>> -      scm_call_1 (SCM_SIMPLE_VECTOR_REF (stream, 0),
>>> -		  SCM_MAKE_CHAR (*pt->write_buf));
>>> -      pt->write_pos = pt->write_buf;
>>> -  
>>> -      /* flush the output.  */
>>> -      {
>>> -	SCM f = SCM_SIMPLE_VECTOR_REF (stream, 2);
>>> +  SCM f = SCM_SIMPLE_VECTOR_REF (stream, 2);
>>> +
>>> +  if (scm_is_true (f))
>>> +    scm_call_0 (f);
>>>  
>>> -	if (scm_is_true (f))
>>> -	  scm_call_0 (f);
>>> -      }
>>> -    }
>>>  }
>>
>> It’s a bit late to reply (sorry, Ian!), but the reason it took me so
>> long, is that I wanted to understand the rationale for the ‘if’, and the
>> implications of dropping it (which I never got around to, as you can
>> see.  ;-))
>>
>> Mark: what’s your take on this?  I’m especially concerned with
>> undesirable side effects in user code.
>
> I searched libguile for occurrences of 'write_pos' and 'write_buf', and
> convinced myself that Ian's analysis was indeed correct.  The write
> buffer is not used by the core ports code.  Writes are forwarded
> directly to the write function of the specific port type, which may use
> the write buffer if it wishes to, but need not.  The write buffer is
> used only by certain types of ports: currently string ports and file
> ports.  It is not used by soft ports.

OK.  Thanks for the detailed analysis!

Ludo’.




This bug report was last modified 13 years and 131 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.