9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] email header screwup (and fix)
@ 2010-09-09 20:13 erik quanstrom
  2010-09-11 22:15 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2010-09-09 20:13 UTC (permalink / raw)
  To: 9fans

lately, i've been seeing email with gigantic headers.
120 header lines are not that uncommon.  unfortunately
upas has sometimes inserts a blank line about
(but not exactly) 4k into the file.  a bit of digging, upas/send
was assuming that if yacc didn't stop at a blank line, one should
be inserted. unfortunately, yacc was stopping because it ran out of stack
space.  the hack is to increase YYMAXDEPTH.  ideally,
each line should be parsed independently, thus making
yacc's depth depend only on the complexity of a line.

nupas on sources has the fix.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] email header screwup (and fix)
  2010-09-09 20:13 [9fans] email header screwup (and fix) erik quanstrom
@ 2010-09-11 22:15 ` Russ Cox
  2010-09-13 17:37   ` erik quanstrom
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2010-09-11 22:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, Sep 9, 2010 at 4:13 PM, erik quanstrom <quanstro@quanstro.net> wrote:
> lately, i've been seeing email with gigantic headers.
> 120 header lines are not that uncommon.  unfortunately
> upas has sometimes inserts a blank line about
> (but not exactly) 4k into the file.  a bit of digging, upas/send
> was assuming that if yacc didn't stop at a blank line, one should
> be inserted. unfortunately, yacc was stopping because it ran out of stack
> space.  the hack is to increase YYMAXDEPTH.  ideally,
> each line should be parsed independently, thus making
> yacc's depth depend only on the complexity of a line.

or change the grammar not to need unlimited stack space.
it says

fields		: '\n'
			{ yydone = 1; }
		| field '\n'
		| field '\n' fields
		;

but i think you can change it to

fields	: fieldlist '\n'
			{ yydone = 1; }
		;

fieldlist	:
		| fieldlist field '\n'
		;

russ


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] email header screwup (and fix)
  2010-09-11 22:15 ` Russ Cox
@ 2010-09-13 17:37   ` erik quanstrom
  0 siblings, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2010-09-13 17:37 UTC (permalink / raw)
  To: 9fans

> or change the grammar not to need unlimited stack space.
> it says

yes.  you're right.  i should have fixed this properly
before posting.

> fields		: '\n'
> 			{ yydone = 1; }
> 		| field '\n'
> 		| field '\n' fields
> 		;
>
> but i think you can change it to
>
> fields	: fieldlist '\n'
> 			{ yydone = 1; }
> 		;
>
> fieldlist	:
> 		| fieldlist field '\n'
> 		;

i actually used this to avoid shift/reduce conflict
warnings

msg		: fields
		| unixfrom '\n' fields
		;
fields		: fieldlist '\n'
			{ yydone = 1; }
		;
fieldlist		: field '\n'
		| fieldlist field '\n'
		;

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-13 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09 20:13 [9fans] email header screwup (and fix) erik quanstrom
2010-09-11 22:15 ` Russ Cox
2010-09-13 17:37   ` erik quanstrom

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