9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* (no subject)
@ 2000-07-12 18:44 bobf
  0 siblings, 0 replies; only message in thread
From: bobf @ 2000-07-12 18:44 UTC (permalink / raw)
  To: 9fans

> The following commands:
>    awk '{print substr($0,1,8)}' bigfile >crud
>        and
>    awk '{print length($0,1,8)}' bigfile >crud
>
> Seem to lock up awk on Plan9.   If I launch either one there will be a
> flurry of hard disk activity then nothing.  A "ps" will reveal the
> process is "ready", but the crud file stops growing at 8647 for the
> first and 8192 for the second.   Rebooting doesn't change these numbers.

illegal utf values caused an infinite loop in the length() function.
thanks to rsc for finding this.

apply the following patch to /sys/src/cmd/awk/re.c:

301c301
< 	int i, j;
---
> 	int i;
304,309c304,305
< 	for (i = 0, end = s+n; *s && s < end; i++){
< 		j = mblen(s, n);
< 		if(j <= 0)
< 			j = 1;
< 		s += j;
< 	}
---
> 	for (i = 0, end = s+n; *s && s < end; i++)
> 		s += mblen(s, n); 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-12 18:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-12 18:44 bobf

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