Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread Gabriel Díaz López de la Llave
Hello http://plan9.aichi-u.ac.jp/pegasus/cgitools/formparse.html It works well for me, seems than Kenji Arisawa thought about this when developing his http tools pegasus and rit. Take a look a it, may be it helps you. Slds. Gabi On 18/03/09 2:23, Russ Cox r...@swtch.com wrote: On Tue,

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread maht
not every environment is Plan 9 so /env is not an option. Arbitrary limits seem a bit, well, arbitrary ! (not that I'm complaining). With a flat memory address space and Gbs of memory chucking a realloc in there is not totally out of technical bounds. Using rc in werc neutralizes OS

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread roger peppe
2009/3/17 erik quanstrom quans...@quanstro.net: it is unreasonable to expect to be able to generate tokens that are bigger than 8k. i'm not sure i agree. they're not just tokens, they're strings, and there are lots of reasons why one might wish to have a string longer than 8k read from a file.

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread Uriel
But parsing is not the big issue (thanks Charles for sending me a small program that does just that), the issue here is sticking the results in a variable (or variables), Russ' suggestion would work, but only in native Plan 9 and not in p9p. Still, I might be able to hack something up if

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread erik quanstrom
2009/3/17 erik quanstrom quans...@quanstro.net: it is unreasonable to expect to be able to generate tokens that are bigger than 8k. i'm not sure i agree. they're not just tokens, they're strings, and there are lots of reasons why one might wish to have a string longer than 8k read from a

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread roger peppe
2009/3/18 erik quanstrom quans...@quanstro.net: -                               ewd = wd+l+100-1; one small comment, based on a totally superficial scan of that diff: might it not be better to grow the buffer by some multiplicative factor, to avoid linear behaviour when reading large files? i

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread erik quanstrom
On Wed Mar 18 09:54:54 EDT 2009, rogpe...@gmail.com wrote: 2009/3/18 erik quanstrom quans...@quanstro.net: -                               ewd = wd+l+100-1; one small comment, based on a totally superficial scan of that diff: might it not be better to grow the buffer by some multiplicative

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-18 Thread roger peppe
2009/3/18 erik quanstrom quans...@coraid.com: the total cost is O(maximum token length) for the whole input.  how could this be a problem? well, if there's only one token (e.g. when ifs=''), it's actually O(n^2), assuming that realloc copies every time. but your first argument is sufficient. i

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread Uriel
Thanks Geoff for the prompt explanation, but I'm getting the same results with ifs=() Not sure why, but I'm not sure I understand the difference between setting ifs to '' and (). Thanks again uriel On Tue, Mar 17, 2009 at 1:40 AM, ge...@plan9.bell-labs.com wrote: Setting ifs='' defeats rc's

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread erik quanstrom
On Tue Mar 17 18:17:53 EDT 2009, urie...@gmail.com wrote: Thanks Geoff for the prompt explanation, but I'm getting the same results with ifs=() Not sure why, but I'm not sure I understand the difference between setting ifs to '' and (). in your test, try this echo $#x - erik

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread erik quanstrom
On Tue Mar 17 18:29:14 EDT 2009, urie...@gmail.com wrote: Thanks martin for your analysis, this makes some sense to me, but as I pointed out, even setting ifs to () doesn't solve the issue, so it would be nice to find a solution to this. Right now having the output of `{} corrupted can be

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread Uriel
On Tue, Mar 17, 2009 at 11:43 PM, erik quanstrom quans...@quanstro.net wrote: On Tue Mar 17 18:29:14 EDT 2009, urie...@gmail.com wrote: Thanks martin for your analysis, this makes some sense to me, but as I pointed out, even setting ifs to () doesn't solve the issue, so it would be nice to

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread Uriel
in your test, try this        echo $#x I tried that too, I'm getting the same result for an ifs of '' or (). % ifs=() {x=`{cat f}; echo $#x} 2 % ifs='' {x=`{cat f}; echo $#x} 2 I'm doing something else wrong? uriel

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread erik quanstrom
Right now having the output of `{} corrupted can be quite inconvenient... it is unreasonable to expect to be able to generate tokens that are bigger than 8k. Well, I would prefer if such limit didn't exist ;) But it doesn't seem like a totally unreasonable limit either. why can't you

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread Uriel
why can't you just let ifs = $newline (formatted to fit your screen) ? Unfortunately that doesn't work in this case, my input is HTTP post data, which is a single line of URL-encoded text which I have to decode into multiple parameters of arbitrary length. Still, if no characters were getting

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread Russ Cox
On Tue, Mar 17, 2009 at 5:26 PM, Uriel urie...@gmail.com wrote: Unfortunately that doesn't work in this case, my input is HTTP post data, which is a single line of URL-encoded text which I have to decode into multiple parameters of arbitrary length. writing a shell script doesn't mean you have

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-17 Thread erik quanstrom
On Tue Mar 17 20:29:50 EDT 2009, urie...@gmail.com wrote: why can't you just let ifs = $newline (formatted to fit your screen) ? Unfortunately that doesn't work in this case, my input is HTTP post data, which is a single line of URL-encoded text which I have to decode into multiple

[9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-16 Thread Uriel
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:

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-16 Thread geoff
Setting ifs='' defeats rc's tokenisation, so the result of `{} will be a series of rc `words', each limited to Wordmax (8192) bytes and with the next byte of the input stream after each word set to NUL. Did you perhaps intend to write ifs=(), which has different meaning?

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-16 Thread Martin Neubauer
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){

Re: [9fans] Strange rc bug for the 9fans bug-squashing squad

2009-03-16 Thread Martin Neubauer
On second thought (and in the light of Geoffs reply) I probably won't. If you do care, the following change to the loop in question will at least preserve all input: while((c = rchr(f))!=EOF){ if(strchr(stop, c)){ if(s!=wd){