From owner-freebsd-current Fri Feb 7 2:37:47 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3183737B401; Fri, 7 Feb 2003 02:37:45 -0800 (PST) Received: from melusine.cuivre.fr.eu.org (melusine.cuivre.fr.eu.org [62.212.105.185]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4720C43FDD; Fri, 7 Feb 2003 02:37:44 -0800 (PST) (envelope-from thomas@FreeBSD.ORG) Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000) id A2B552C3D2; Fri, 7 Feb 2003 11:37:42 +0100 (CET) Date: Fri, 7 Feb 2003 11:37:42 +0100 From: Thomas Quinot To: Tim Robbins Cc: CHOI Junho , current@FreeBSD.ORG, roberto@freebsd.org Subject: Re: 5.0 cron problem Message-ID: <20030207103742.GA61102@melusine.cuivre.fr.eu.org> Reply-To: Thomas Quinot References: <20030205.175730.55903839.cjh@kr.FreeBSD.org> <20030205204250.A12276@dilbert.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20030205204250.A12276@dilbert.robbins.dropbear.id.au> User-Agent: Mutt/1.4i X-message-flag: WARNING! Using Outlook can damage your computer. Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Le 2003-02-05, Tim Robbins écrivait : > Since revision 1.11 of src/usr.sbin/cron/lib/env.c, you need to put the > value of the environment variable inside quotes if it contains any spaces. > I suspect that this change of behaviour was unintentional given that the > implementation differs from the manual page. I'll investigate and fix > it if it's a bug. In the mean time, use something like this instead: > CVSUP="/usr/local/bin/cvsup -g -L2 -h localhost" Right, the according to the man page inner whitespace in the unquoted right-hand part of an environment variable assignment should be preserved. Please try the following patch: Index: lib/env.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/cron/lib/env.c,v retrieving revision 1.11 diff -u -r1.11 env.c --- lib/env.c 23 May 2002 13:16:30 -0000 1.11 +++ lib/env.c 7 Feb 2003 10:34:48 -0000 @@ -193,14 +193,16 @@ break; } } else { - if (isspace (*c)) { - state++; - c++; - break; - } - if (state == NAME && *c == '=') { - state++; - break; + if (state == NAME) { + if (isspace (*c)) { + c++; + state++; + break; + } + if (*c == '=') { + state++; + break; + } } } *str++ = *c++; @@ -232,9 +234,14 @@ Set_LineNum(fileline); return (FALSE); } + if (state == VALUE) { + /* End of unquoted value: trim trailing whitespace */ + c = val + strlen (val); + while (c > val && isspace (*(c - 1))) + *(--c) = '\0'; + } - /* 2 fields from parser; looks like an env setting - */ + /* 2 fields from parser; looks like an env setting */ if (strlen(name) + 1 + strlen(val) >= MAX_ENVSTR-1) return (FALSE); -- Thomas.Quinot@Cuivre.FR.EU.ORG To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message