9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Martin Neubauer <m.ne@gmx.net>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Strange rc bug for the 9fans bug-squashing squad
Date: Tue, 17 Mar 2009 02:31:42 +0100	[thread overview]
Message-ID: <20090317013142.GA990@shodan.homeunix.net> (raw)
In-Reply-To: <5d375e920903161626o78226952j8a6088c1373cfbe3@mail.gmail.com>

Hi,

I think the following gives a clue:

	% cmp f f2
	f f2 differ: char 8193

The following snippet from the Xbackq code seems to be the culprit:

	char wd[8193];
	int c;
	char *s, *ewd=&wd[8192], *stop;

	...

		while((c = rchr(f))!=EOF){
			if(strchr(stop, c) || s==ewd){
				if(s!=wd){
					*s='\0';
					v = newword(wd, v);
					s = wd;
				}
			}
			else *s++=c;
		}

Keeping the loop from dropping characters is trivial.  Getting rid of
the inserted space probably requires a dynamic buffer.  I might give
it a shot.

Regards,
	Martin

* Uriel (uriel99@gmail.com) wrote:
> At first I thought very big rc variables seem to become strangely corrupted.
>
> % for(i in `{seq 1000}) { echo 0123456789 >> f }
> % ifs='' {x=`{cat f}}
> % echo -n $x > f2
> % diff f f2
> 745c745
> < 0123456789
> ---
> > 01234567 9
>
> But the bug seems to be in `{ } because replacing the use of the x var
> with simply:
>
> % ifs='' { echo -n `{cat f} > f2}
>
> Produces the same results.
>
> Longer strings get more random(?) characters 'blanked'.
>
> The results are identical in p9p and native plan9.
>
> I looked a bit around the rc source that seemed relevant, but didn't
> see any obvious errors, but I don't fully understand the code.
>
> Peace
>
> uriel



  reply	other threads:[~2009-03-17  1:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 23:26 Uriel
2009-03-17  1:31 ` Martin Neubauer [this message]
2009-03-17  2:01   ` Martin Neubauer
2009-03-17 22:27     ` Uriel
2009-03-17 22:43       ` erik quanstrom
2009-03-17 23:23         ` Uriel
2009-03-17 23:26           ` erik quanstrom
2009-03-18  0:26             ` Uriel
2009-03-18  1:23               ` Russ Cox
2009-03-18  7:31                 ` Gabriel Díaz López de la Llave
2009-03-18 10:31                 ` maht
2009-03-18 15:27                   ` erik quanstrom
2009-03-18  1:25               ` erik quanstrom
2009-03-18 11:30                 ` Uriel
2009-03-18 10:53         ` roger peppe
2009-03-18 13:18           ` erik quanstrom
2009-03-18 13:52             ` roger peppe
2009-03-18 14:16               ` erik quanstrom
2009-03-18 14:36                 ` roger peppe
2009-03-17  0:40 geoff
2009-03-17 22:16 ` Uriel
2009-03-17 22:24   ` erik quanstrom
2009-03-17 23:14     ` Uriel

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=20090317013142.GA990@shodan.homeunix.net \
    --to=m.ne@gmx.net \
    --cc=9fans@9fans.net \
    /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).