[net.bugs.usg] 5.2.0 printf bugs

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/29/85)

Some time ago, I posted bug fixes for UNIX System V Release 2.0
*printf.c sources, involving changing a bogus | bit-test into an &.
I just discovered that these fixes were incomplete; there were TWO
such coding errors per source file, and I had missed the second.

For example, from fprintf.c:

/*	@(#)fprintf.c	1.5	*/
...
	if (!(iop->_flag & _IOWRT)) {	/* DAG -- bug fix (was |) */
...
		if (iop->_flag & _IORW) {	/* DAG -- bug fix (was |) */
...

These are in addition to the bug fixes posted by Phil Chadwick,
which I believe are correct (but I'm still looking at them).

All BRL UNIX System V emulation for 4.2BSD packages mailed before
today (not to mention real UNIX System V systems) have these bugs..

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (07/31/85)

I looked into Phil Chadwick's *printf() bug fixes,
which involved invoking _WRTCHK() in each *printf()
routine, and decided that they are not necessary.
My reasoning is:
	*printf() call _doprnt() to do the work;
	_doprnt() uses fwrite() for all output
		(via PUT() and PAD() macros);
	fwrite() does a _WRTCHK().

Perhaps the bugs Phil was seeing were the ones I
posted fixes for yesterday.  Certainly invoking
_WRTCHK() would have straightened out the _IOWRT
bit that was being missed due to the bugs.

Summary:  Use my fixes, such as:

/*	@(#)fprintf.c	1.5	*/
...
	if (!(iop->_flag & _IOWRT)) {	/* DAG -- bug fix (was |) */
...
		if (iop->_flag & _IORW) {	/* DAG -- bug fix (was |) */
...

and don't install any invocations of _WRTCHK().

HEY, AT&T USDL or whatever -- fix this in 5.3.0!

phil@qfdts.oz (Phil Chadwick) (08/06/85)

In article <330@brl-tgr.ARPA> gwyn@brl-tgr.ARPA (Doug Gwyn) writes:
    
    >I looked into Phil Chadwick's *printf() bug fixes,
    >which involved invoking _WRTCHK() in each *printf()
    >routine, and decided that they are not necessary.
    >.
    >.
    >Summary:  Use my fixes, such as:
    >
    >/*	@(#)fprintf.c	1.5	*/
    >...
    >	if (!(iop->_flag & _IOWRT)) {	/* DAG -- bug fix (was |) */
    >...
    >		if (iop->_flag & _IORW) {	/* DAG -- bug fix (was |) */
    >...
    >
    >and don't install any invocations of _WRTCHK().
    >
    >HEY, AT&T USDL or whatever -- fix this in 5.3.0!

Correct.  My fix was overkill.  It's only redeeming feature was that it
did work.

----
Phil Chadwick		  Australia: (07) 2296500
Department of Forestry	  International: +61 7 2296500
PO Box 5		  ACSnet: phil@qfdts.oz
Brisbane, Roma Street	  ARPA: decvax!mulga!qfdts.oz!phil@UCB-VAX.ARPA
AUSTRALIA	4001	  UUCP: {decvax,vax135,eagle,pesnta}!mulga!qfdts.oz!phil