rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: John (I've got some bad news for you, sunshine) Mackin <john@vetsci.su.oz.au>
To: Byron Rakitzis <byron@archone.tamu.edu>
Cc: The rc Mailing List <rc@archone.tamu.edu>
Subject: really bad order of evaluation bug
Date: Wed, 29 Jan 1992 06:08:59 -0600	[thread overview]
Message-ID: <199201291936.423.rc.badas@vetsci.su.oz.au> (raw)

Byron,

I got your mail this morning but haven't had time to reply today, and I have
to get off and sleep soon.  But before I do I thought I had better mail you
this one.  I spent four hours tracking this down today -- sigh.  I thought
I should copy it to the list since it's so very drastic.

The symptom here was that on one particular type of machine -- Sony News,
but the 68000 one, not the MIPS one -- redirection wasn't working right.
If you did

ls thisisntthere >xxxx >[2=1]

then the error message -- which was most definitely getting printed on
fd 2 -- came out _on the terminal_, and xxxx ended up with nothing in it.
This didn't happen on any other machine I had easy access to.  Actually,
having found it, I'm really surprised that it isn't broken in more
places: perhaps it is and people just haven't noticed.  This is an
order of evaluation bug in glom.c, which was introduced between 0.9
and 1.0 -- 1.0 has new code here and it has been broken ever since.
Here is the fix:

*** glom.c-BUG	Wed Jan 29 18:42:34 1992
--- glom.c	Wed Jan 29 18:41:48 1992
***************
*** 516,522 ****
  			}
  			words = words->u[0].p;
  		}
! 		return append(append(glom(words), last), glom(n->u[1].p));
  	case BACKQ:
  		return backq(n->u[0].p,n->u[1].p);
  	case CONCAT:
--- 516,523 ----
  			}
  			words = words->u[0].p;
  		}
! 		first = append(glom(words), last);
! 		return append(first, glom(n->u[1].p));
  	case BACKQ:
  		return backq(n->u[0].p,n->u[1].p);
  	case CONCAT:

I guess that either damn near every compiler out there evaluates
function arguments left-to-right (where _are_ the pcc-based ones
any more? :), or else the people who use right-to-left compilers
don't use `fancy' redirections....

I'll reply to your other mail tomorrow my time.  Say 10-12 hours.

OK,
John.


                 reply	other threads:[~1992-01-29 12:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=199201291936.423.rc.badas@vetsci.su.oz.au \
    --to=john@vetsci.su.oz.au \
    --cc=byron@archone.tamu.edu \
    --cc=rc@archone.tamu.edu \
    /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).