From mboxrd@z Thu Jan 1 00:00:00 1970 From: dexen deVries To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Date: Mon, 25 Jul 2011 17:58:27 +0200 User-Agent: KMail/1.13.6 (Linux/3.0.0-l35+; KDE/4.5.5; x86_64; ; ) References: <201107251700.19492.dexen.devries@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_jKZLOZG7D7OpIXw" Message-Id: <201107251758.27437.dexen.devries@gmail.com> Subject: Re: [9fans] [p9p] problem with mk: variable being truncated Topicbox-Message-UUID: 0608b1a6-ead7-11e9-9d60-3106f5b1d025 --Boundary-00=_jKZLOZG7D7OpIXw Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 25 of July 2011 17:12:03 Russ Cox wrote: > cd $PLAN9/src/cmd/mk > g 16384 thank you a lot, Russ. will you accept the attached patch for p9p? nb., i'm still curious why the output from debug print() was truncated as=20 well. =2D-=20 dexen deVries [[[=E2=86=93][=E2=86=92]]] =46or example, if the first thing in the file is: an XML parser will recognize that the document is stored in the traditional= =20 ROT13 encoding. (( Joe English, http://www.flightlab.com/~joe/sgml/faq-not.txt )) --Boundary-00=_jKZLOZG7D7OpIXw Content-Type: text/x-patch; charset="UTF-8"; name="0001-mk-do-not-truncate-environmental-variable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-mk-do-not-truncate-environmental-variable.patch" mk: do not truncate environmental variable use smprint() to support arbitrary long environmental variables Signed-off-by: dexen deVries --- src/cmd/mk/unix.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cmd/mk/unix.c b/src/cmd/mk/unix.c index c63d3ce..6a1312a 100644 --- a/src/cmd/mk/unix.c +++ b/src/cmd/mk/unix.c @@ -55,16 +55,14 @@ exportenv(Envy *e, Shell *sh) { int i; char **p; - static char buf[16384]; p = 0; for(i = 0; e->name; e++, i++) { p = (char**) Realloc(p, (i+2)*sizeof(char*)); if(e->values) - snprint(buf, sizeof buf, "%s=%s", e->name, wtos(e->values, sh->iws)); + p[i] = smprint("%s=%s", e->name, wtos(e->values, sh->iws)); else - snprint(buf, sizeof buf, "%s=", e->name); - p[i] = strdup(buf); + p[i] = smprint("%s=", e->name); } p[i] = 0; environ = p; -- 1.7.4.1 --Boundary-00=_jKZLOZG7D7OpIXw--