Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Cooked/Raw transition bug
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Tobin  
View profile  
 More options Mar 31 1992, 8:07 am
Newsgroups: comp.unix.bsd
From: rich...@aiai.ed.ac.uk (Richard Tobin)
Date: 31 Mar 92 13:07:17 GMT
Local: Tues, Mar 31 1992 8:07 am
Subject: Cooked/Raw transition bug
There is a bug in kern/tty.c that leaves the ring buffers in a bogus
state when switching from cooked to raw mode.  This is probably the
cause of the bash/more problems.

The following code is at about line 485 (indentation reduced!):

        catb(&tp->t_raw, &tp->t_can);
        tb = tp->t_raw;
        tp->t_raw = tp->t_can;
        tp->t_can = tb;

The intention appears to be to put the contents of the canonical buffer
at the front of the raw buffer.  It does this by appending the raw buffer
to the canonical buffer, and then switching the buffers.

Unfortunately, a ringb structure contains head and tail pointers that
point into the buffer contained in the structure itself, so copying the
structures doesn't work.  The pointers need to be adjusted.

To fix, replace the lines above with this:

        catb(&tp->t_raw, &tp->t_can);

    #define copy_rb(from,to) (to = from, \
                          to.rb_hd = to.rb_buf + (from.rb_hd-from.rb_buf), \
                          to.rb_tl = to.rb_buf + (from.rb_tl-from.rb_buf))

        copy_rb(tp->t_raw, tb);
        copy_rb(tp->t_can, tp->t_raw);
        copy_rb(tb, tp->t_can);

In fact, since the call to catb empties the raw buffer, the following should
be adequate and saves some copying (though I haven't actually tried it):

    catb(&tp->t_raw, &tp->t_can);

    tp->t_raw = tp->t_can;
    tp->t_raw.rb_hd = tp->t_raw.rb_buf + (tp->t_can.rb_hd - tp->t_can.rb_buf);
    tp->t_raw.rb_tl = tp->t_raw.rb_buf + (tp->t_can.rb_tl - tp->t_can.rb_buf);

    initrb(&tp->t_can);

-- Richard
--
Richard Tobin,
AI Applications Institute,                                R.To...@ed.ac.uk
Edinburgh University.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »