summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-09-26 13:59:56 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-09-26 13:59:56 +0800
commitd88ed8c49aa7a8560523c0421812258ee6c2591d (patch)
treed296e063b0d55676eed043815e57a36627f5311e /src
parent[MAN] Clarify syntax of the for command (diff)
downloaddash-d88ed8c49aa7a8560523c0421812258ee6c2591d.tar.gz
dash-d88ed8c49aa7a8560523c0421812258ee6c2591d.zip
[EXPAND] Refresh stack pointers after makestrspace in _rmescapes
dash-0.5.3 has an issue reading some line lengths [1].
This is reproducable on amd64, but not on other arches for some reason.

$ cat bug.sh
(read line; echo "${line%%=*}") <<EOF
TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EOF
printf "\
TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
" | (read line; echo "${line%%=*}")
$ bash bug.sh
TITLE
TITLE
$ dash bug.sh
TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TITLE

Attahced is a patch to fix the issue

Thanks

Roy

[1] http://bugs.gentoo.org/show_bug.cgi?id=180680
Diffstat (limited to '')
-rw-r--r--src/expand.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/expand.c b/src/expand.c
index 8c6c7f9..98ad718 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1631,7 +1631,11 @@ _rmescapes(char *str, int flag)
 		size_t fulllen = len + strlen(p) + 1;
 
 		if (flag & RMESCAPE_GROW) {
+			int strloc = str - (char *)stackblock();
+
 			r = makestrspace(fulllen, expdest);
+			str = (char *)stackblock() + strloc;
+			p = str + len;
 		} else if (flag & RMESCAPE_HEAP) {
 			r = ckmalloc(fulllen);
 		} else {