NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/38004: /bin/sh truncates a message for unobvious reasons

The following reply was made to PR bin/38004; it has been noted by GNATS.

From: David Holland <>
Subject: Re: bin/38004: /bin/sh truncates a message for unobvious reasons
Date: Sun, 13 Apr 2008 21:34:14 +0000

 On Sun, Apr 13, 2008 at 08:35:04PM +0000, David Laight wrote:
  >>>  IIRC the purpose of the test is to speed up shell scripts - where it
  >>>  is really pointless regenerating the command line in this form at all.
  >>  Shouldn't the proper fix for that to be to either save a copy of the
  >>  original command line string, or to only produce the string when it's
  >>  needed? Or am I missing something obvious?
  >  It needs the command string after substitutions, this only exits as a
  >  tree, and the tree nodes are allocated from a 'stack allocator' and
  >  are all thrown away (by resetting the base) once the comand is started.
  >  Thus you have to walk the tree nodes to generate a printable string.
 Ah. Well, probably it ought to keep the tree around, or at least
 enough of it to generate the string.
 One of these days I'm intending to rework the parser, since it does
 quite a lot of unclean things (see for example PRs 19832 and 35423)
 and I'll fix this properly then.
 In the meantime, I think a better hack for speeding up scripts would
 be to traverse the tree only to the first word and then stop.
  >  (I'm sure Mr Bourne's shell didn't use this sort of parser!)
 You think? :-)
 David A. Holland

Home | Main Index | Thread Index | Old Index