zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: cbuckley@cs.tcd.ie (Colm Buckley)
Cc: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: Re: "read" broken in 2.6-beta21?
Date: Thu, 27 Jun 1996 23:42:50 +0200 (MET DST)	[thread overview]
Message-ID: <199606272142.XAA00788@hzoli.ppp.cs.elte.hu> (raw)
In-Reply-To: <199606270011.BAA07863@picasso.cs.tcd.ie> from Colm Buckley at "Jun 27, 96 01:11:06 am"

> 
> This has been affecting me recently; I just tracked it down to the
> following:
> 
> The "read" command in zsh2.6-beta21 behaves strangely when the input
> exceeds 63 characters; the remaining characters in the line are
> truncated.  For example :
> 
> $ read x
> 1234567890123456789012345678901234567890123456789012345678901234567890
> $ echo $x
> 123456789012345678901234567890123456789012345678901234567890123
> $
> 
> I don't *think* this affected previous versions of zsh.  If a static
> buffer is being used for "read", might I suggest that it be increased in
> size to something greater than 64 bytes?

Yes, this bug appeared in beta21 but not because of static buffers.  The
patch below should fix that.

Zoltan


*** Src/builtin.c	1996/06/26 22:32:07	2.47
--- Src/builtin.c	1996/06/27 21:25:38
***************
*** 4976,4983 ****
  		*bptr++ = c;
  	    /* increase the buffer size, if necessary */
  	    if (bptr >= buf + bsiz - 1) {
  		buf = realloc(buf, bsiz *= 2);
! 		bptr = buf + (bsiz / 2);
  	    }
  	}
  	/* handle EOF */
--- 4976,4985 ----
  		*bptr++ = c;
  	    /* increase the buffer size, if necessary */
  	    if (bptr >= buf + bsiz - 1) {
+ 		int blen = bptr - buf;
+ 
  		buf = realloc(buf, bsiz *= 2);
! 		bptr = buf + blen;
  	    }
  	}
  	/* handle EOF */
***************
*** 5055,5062 ****
  		*bptr++ = c;
  	    /* increase the buffer size, if necessary */
  	    if (bptr >= buf + bsiz - 1) {
  		buf = realloc(buf, bsiz *= 2);
! 		bptr = buf + (bsiz / 2);
  	    }
  	}
      while (bptr > buf && iwsep(bptr[-1]))
--- 5057,5066 ----
  		*bptr++ = c;
  	    /* increase the buffer size, if necessary */
  	    if (bptr >= buf + bsiz - 1) {
+ 		int blen = bptr - buf;
+ 
  		buf = realloc(buf, bsiz *= 2);
! 		bptr = buf + blen;
  	    }
  	}
      while (bptr > buf && iwsep(bptr[-1]))



      reply	other threads:[~1996-06-27 23:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-27  0:11 Colm Buckley
1996-06-27 21:42 ` Zoltan Hidvegi [this message]

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=199606272142.XAA00788@hzoli.ppp.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=cbuckley@cs.tcd.ie \
    --cc=zsh-workers@math.gatech.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).