Date: Fri, 28 Jul 2000 09:47:08 +0200 From: Martin Cracauer <cracauer@cons.org> To: Hajimu UMEMOTO <ume@FreeBSD.ORG> Cc: kuriyama@FreeBSD.ORG, cracauer@FreeBSD.ORG, FreeBSD-current@FreeBSD.ORG Subject: Re: /bin/sh dumps core with here-document of 8bit text Message-ID: <20000728094707.A10655@cons.org> In-Reply-To: <20000728.150627.74708840.ume@mahoroba.org>; from ume@FreeBSD.ORG on Fri, Jul 28, 2000 at 03:06:27PM %2B0900 References: <7mr98fq7b4.wl@waterblue.imgsrc.co.jp> <20000728.150627.74708840.ume@mahoroba.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii In <20000728.150627.74708840.ume@mahoroba.org>, Hajimu UMEMOTO wrote: > >>>>> On Fri, 28 Jul 2000 12:09:51 +0900 > >>>>> Jun Kuriyama <kuriyama@FreeBSD.org> said: > > kuriyama> Shell script which contains here-document of 8bit text sometimes dumps > kuriyama> core. For example, please test this script in 4.1 or -current. > > I'm using this for workaround on IMASY's main server. 3.5-RELEASE or > later have this problem. > > --- bin/sh/parser.c.orig Mon Mar 20 19:51:04 2000 > +++ bin/sh/parser.c Fri Jun 30 17:15:38 2000 > @@ -909,9 +909,11 @@ > for (;;) { /* until end of line or end of word */ > CHECKSTRSPACE(3, out); /* permit 3 calls to USTPUTC */ > > +#if 0 > if (c < 0 && c != PEOF) > synentry = CWORD; > else > +#endif > synentry = syntax[c]; > > switch(synentry) { Hm, looks like I broke that in my 8-bit fixes. This code is native in that it passed control chars further down in the hope noone will execute them anymore, just taking them for real chars. Nice try. The problem is also not limited to here-documents: echo \202 # A real \202 will also dump core. Since literal strings cannot be made 8-bit clean without further cleanup, I think we should make this official, although in the following form, otherwise wrong characters are echoed. Anyone for whom this fix doesn't work? Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/ BSD User Group Hamburg, Germany http://www.bsdhh.org/ --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=sh-8bit ? test2 ? test1 ? l ? Makefile.cra ? builtins.c ? builtins.h ? mknodes ? nodes.h ? nodes.c ? mksyntax ? syntax.c ? syntax.h ? token.h ? y.tab.h ? y.tab.c ? arith.c ? arith_lex.c ? sh ? l4 ? mkinit ? init.c ? sh.1.gz ? .depend ? l3 ? l2 ? foo ? l5 Index: parser.c =================================================================== RCS file: /home/CVS-FreeBSD/src/bin/sh/parser.c,v retrieving revision 1.31 diff -c -r1.31 parser.c *** parser.c 2000/05/15 13:02:07 1.31 --- parser.c 2000/07/28 07:46:22 *************** *** 909,918 **** for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(3, out); /* permit 3 calls to USTPUTC */ ! if (c < 0 && c != PEOF) synentry = CWORD; ! else ! synentry = syntax[c]; switch(synentry) { case CNL: /* '\n' */ --- 909,923 ---- for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(3, out); /* permit 3 calls to USTPUTC */ ! if (c >= CTLESC && c <= CTLQUOTEMARK) { synentry = CWORD; ! fprintf(stderr, ! "Warning: internal control character in " ! "literal text, using '?' instead\n"); ! c = '?'; ! } ! ! synentry = syntax[c]; switch(synentry) { case CNL: /* '\n' */ --qMm9M+Fa2AknHoGS-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000728094707.A10655>