The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: wlc@jctaylor.com (William Corcoran)
Subject: [TUHS] SYSTEM V R1 HELP
Date: Fri, 22 Dec 2017 23:48:01 +0000	[thread overview]
Message-ID: <11175FE5-A345-43D3-A2DF-811CE18E7230@jctaylor.com> (raw)
In-Reply-To: <1513933789.1081623.1213240800.50A34AF0@webmail.messagingengine.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

Hello Team TUHS: 

This note confirms that Random832’s System V Release 1 fix for CPIO and TAR core dump works PERFECTLY!!!

			iop->_cnt=0;


Truly, 

Bill Corcoran   


On Dec 22, 2017, at 4:09 AM, Random832 <random832 at fastmail.com> wrote:

On Thu, Dec 21, 2017, at 22:47, William Corcoran wrote:
> Could the issue be with fprintf or doprnt.c?  
> 
> I thought STDERR was unbuffered?   Please forgive me.  

I've got it. The problem is with putc (actually _flsbuf), and it is precisely *because* stderr is unbuffered.

#define putc(x, p)	(--(p)->_cnt >= 0 ? \
			((int) (*(p)->_ptr++ = (unsigned char) (x))) : \
			_flsbuf((unsigned char) (x), (p)))

Under normal circumstances for an unbuffered (or line-buffered) stream, _cnt starts as 0, and therefore every character is passed through _flsbuf.

However, _cnt is still decremented (becoming -1, -2, etc) - _flsbuf should be resetting this to zero (and does in other versions, both earlier and later), but we can see in flsbuf.c it does not. So, after 32769 characters have been output it ticks from -32768 to +32767, and putc now thinks the stream is buffered.

You'll want to add iop->cnt = 0 to the second if clause in _flsbuf.



  parent reply	other threads:[~2017-12-22 23:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 22:12 William Corcoran
2017-12-21 22:30 ` Clem Cole
2017-12-22  0:34   ` William Corcoran
2017-12-22  1:51     ` William Corcoran
2017-12-22  1:54       ` William Corcoran
2017-12-22  2:55       ` Random832
2017-12-22  3:47         ` William Corcoran
2017-12-22  9:09           ` Random832
2017-12-22 12:42             ` William Corcoran
2017-12-22 23:48             ` William Corcoran [this message]
2017-12-23  0:19             ` Dave Horsfall
2017-12-23  0:21               ` Larry McVoy
2017-12-23 12:26                 ` Clem cole
2017-12-22 15:04       ` Clem Cole
2017-12-22  1:55     ` Random832

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11175FE5-A345-43D3-A2DF-811CE18E7230@jctaylor.com \
    --to=wlc@jctaylor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).