CVS commit: src/bin/sh
"Robert Elz" <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module Name: src Committed By: kre Date: Sat Apr 18 14:35:37 UTC 2026 Modified Files: src/bin/sh: expand.c Log Message: Remove CHECKSTACKSTR() defect workaround When reading the output from a command substitution, the code defers adding embedded \n's to the result (just counting them instead) until some other character appears - this effectively achieves the "trailing \n's are removed" semantic without needing to actually remove anything, as without a following char, the \n's aren't ever added. That's fine, but the number of \n's counted, that will need to be added when another char appears, is unbounded - and could be (and at least once, was) more than the old CHECKSTACKSTR() could handle. To fix that, if the newline count was "too big" (arbitrarily set at 20) the code used a slow path, which avoided CHECKSTACKSTR() and was correct. Now CHECKSTACKSTR() has been fixed, that workaround is no longer required, so remove it. Since long runs of embedded \n's don't often appear in command substitution output, avoiding the slow path is unlikely to make any noticeable speed difference, but not having that code at all makes the shell smaller - enough smaller to compensate for the minor increase that the CHECKSTACKSTR() correction added, and even a bit more. To generate a diff of this commit: cvs rdiff -u -r1.150 -r1.151 src/bin/sh/expand.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.