Re: 5.0 cron problem

2003-02-08 Thread Thomas Quinot
Le 2003-02-08, CHOI Junho écrivait :

> Oh sorry... I didn't restart cron :P. It works well. 'cron -x pars'
> says that whitespaces is correctly parsed.

OK, that's reassuring! Ollivier can you review the posted patch please?

Thanks,
Thomas.

-- 
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-07 Thread CHOI Junho

Oh sorry... I didn't restart cron :P. It works well. 'cron -x pars'
says that whitespaces is correctly parsed.

From: Thomas Quinot <[EMAIL PROTECTED]>
Subject: Re: 5.0 cron problem
Date: Fri, 7 Feb 2003 14:07:24 +0100

> Le 2003-02-07, CHOI Junho écrivait :
> 
> > Oops. It doesn't solve the problem. There is no error when editing
> > crontab, but the variable is not substituted correctly(just blank).
> 
> Hum, strange, it seemed to work here. Can you send me your crontab and
> the output of 'cron -x pars' ?
> 
> Thomas.
> 
> -- 
> [EMAIL PROTECTED]

--
CHOI Junho <http://www.kr.FreeBSD.org/~cjh> KFUG 
FreeBSD Project Web Data Bank 
Key fingerprint = 1369 7374 A45F F41A F3C0  07E3 4A01 C020 E602 60F5

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-07 Thread Thomas Quinot
Le 2003-02-07, CHOI Junho écrivait :

> Oops. It doesn't solve the problem. There is no error when editing
> crontab, but the variable is not substituted correctly(just blank).

Hum, strange, it seemed to work here. Can you send me your crontab and
the output of 'cron -x pars' ?

Thomas.

-- 
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-07 Thread CHOI Junho
From: CHOI Junho <[EMAIL PROTECTED]>
Subject: Re: 5.0 cron problem
Date: Fri, 07 Feb 2003 19:43:04 +0900 (KST)

> 
> I tried it to 5.0-RELEASE. It works with my previous crontab file.
> 

Oops. It doesn't solve the problem. There is no error when editing
crontab, but the variable is not substituted correctly(just blank).

--
CHOI Junho <http://www.kr.FreeBSD.org/~cjh> KFUG 
FreeBSD Project Web Data Bank 
Key fingerprint = 1369 7374 A45F F41A F3C0  07E3 4A01 C020 E602 60F5

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-07 Thread CHOI Junho

I tried it to 5.0-RELEASE. It works with my previous crontab file.

From: Thomas Quinot <[EMAIL PROTECTED]>
Subject: Re: 5.0 cron problem
Date: Fri, 7 Feb 2003 11:37:42 +0100

> 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 -  1.11
> +++ lib/env.c 7 Feb 2003 10:34:48 -
> @@ -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);
> 
> -- 
> [EMAIL PROTECTED]

--
CHOI Junho <http://www.kr.FreeBSD.org/~cjh> KFUG 
FreeBSD Project Web Data Bank 
Key fingerprint = 1369 7374 A45F F41A F3C0  07E3 4A01 C020 E602 60F5

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-07 Thread Thomas Quinot
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 -  1.11
+++ lib/env.c   7 Feb 2003 10:34:48 -
@@ -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);

-- 
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-05 Thread CHOI Junho

Ok, the problem solved. Thanks.

crontab(5) page of 4.7-RELEASE and 5.0-RELEASE cite the same thing
about variable assignment:

  The name string may also be placed in quote(single or double, but
  matching) to preserver leading, trailing or inner blanks.

I think the current implementation(r1.11 of env.c) is right according
to the manual. But 4-stable is still r1.7.2.1, so it'll be good to
wait until MFC...

From: Tim Robbins <[EMAIL PROTECTED]>
Subject: Re: 5.0 cron problem
Date: Wed, 5 Feb 2003 20:42:50 +1100

> On Wed, Feb 05, 2003 at 05:57:30PM +0900, CHOI Junho wrote:
> [...]
> > --
> > CVSUP=/usr/local/bin/cvsup -g -L2 -h localhost
> > CVSUPDIR=/b/FreeBSD/cvsup
> > 
> > # source sync
> > 0   */1 *   *   *   $CVSUP $CVSUPDIR/4_7-supfile > /dev/null
> > 20  */1 *   *   *   $CVSUP $CVSUPDIR/5_0-supfile > /dev/null
> > 40  */1 *   *   *   $CVSUP $CVSUPDIR/current-supfile > /dev/null
> > --
> > 
> > When I install this crontab:
> > 
> >  # crontab my-crontab
> >  "my-crontab":0: bad minute
> >  crontab: errors in crontab file, can't install
> > 
> > "0" means line number. It means variable setting doesn't work...
> > 
> > I used this crontab over years on 4.[4567]-RELEASE happily. What
> > happen to cron? I suspected updating procedure(/usr/src/UPDATING)
> > because my -current desktop(starting from -current snapshot a year
> > ago) doesn't have such problem.
> 
> 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"
> 
> 
> Tim
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message

--
CHOI Junho <http://www.kr.FreeBSD.org/~cjh> KFUG 
FreeBSD Project Web Data Bank 
Key fingerprint = 1369 7374 A45F F41A F3C0  07E3 4A01 C020 E602 60F5

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: 5.0 cron problem

2003-02-05 Thread Tim Robbins
On Wed, Feb 05, 2003 at 05:57:30PM +0900, CHOI Junho wrote:
[...]
> --
> CVSUP=/usr/local/bin/cvsup -g -L2 -h localhost
> CVSUPDIR=/b/FreeBSD/cvsup
> 
> # source sync
> 0 */1 *   *   *   $CVSUP $CVSUPDIR/4_7-supfile > /dev/null
> 20*/1 *   *   *   $CVSUP $CVSUPDIR/5_0-supfile > /dev/null
> 40*/1 *   *   *   $CVSUP $CVSUPDIR/current-supfile > /dev/null
> --
> 
> When I install this crontab:
> 
>  # crontab my-crontab
>  "my-crontab":0: bad minute
>  crontab: errors in crontab file, can't install
> 
> "0" means line number. It means variable setting doesn't work...
> 
> I used this crontab over years on 4.[4567]-RELEASE happily. What
> happen to cron? I suspected updating procedure(/usr/src/UPDATING)
> because my -current desktop(starting from -current snapshot a year
> ago) doesn't have such problem.

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"


Tim

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message