Hello Dan,

I patched crontab.5 to take your advice in count.

Just hoping that no other purist would notify me that lining up columns
can be done with spaces rather that with zeroes.

I uploaded release 3.0pl1-182 right now.

Best regards,                   Georges.


Dan Jacobson a écrit :
> >>>>> "GK" == Georges Khaznadar <georges.khazna...@free.fr> writes:
> GK> Hello Dan,
> 
> GK> I would like to get more information about your intent, for this bug
> GK> report.
> 
> Looking at the crontab(5) man page,
> everything lines up very pretty:
> 
> 
>        17 * * * *  root  cd / && run-parts --report /etc/cron.hourly
>        25 6 * * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.daily )
>        47 6 * * 7  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.weekly )
>        52 6 1 * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.monthly )
> 
> But that is because the author picked 6 hours for each.
> 
> Let's see what would happen otherwise:
>        17 * * * *  root  cd / && run-parts --report /etc/cron.hourly
>        25 16 * * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.daily )
>        47 6 * * 7  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.weekly )
>        52 6 1 * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.monthly )
> Oh darn, that looks ugly.
> 
> The question that crosses users minds is: "Can I rewrite it
>        17  * * * *  root  cd / && run-parts --report /etc/cron.hourly
>        25 16 * * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.daily )
>        47 06 * * 7  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.weekly )
>        52 06 1 * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.monthly )
> or will that be taken as octal (even if octal 6 is just 6), or illegal?
> Please don't force me to test to find the answer."
> 
> I'm just saying the man page needs to state clearly what will happen.
> 
> Sure, one could just add spaces instead of zeros to make the columns
> line up. But that would just be avoiding the issue.
> 
> GK> Should leading zeroes be supported for the sake of making columns line
> GK> up, or should leading zeroes be used to introduce octal constants, in
> GK> your opinion?
> 
> Nobody wants octal. I'm just trying to make columns line up.
> 
> GK> As far as I understand the code of the file entry.c, numbers are parsed
> GK> by the function atoi:
> GK> -------------8<- file entry.c's excerpt --
> GK>   if (all_digits) {
> GK>           *numptr = atoi(temp);
> GK>           return ch;
> GK>   }
> GK> -------------8<---------------------------
> 
> GK> ... which means that numbers prefixed by zeroes are considered as
> GK> decimal.
> 
> OK that's great. Please mention so on crontab(5). Thanks.
> 
> In fact perhaps add an example saying one can use spaces and zeros to make the
> columns line up:
> 
>        25 16 * * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.daily )
>        47 06 * * 7  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.weekly )
>        52  4 1 * *  root  test -x /usr/sbin/anacron || ( cd / && run-parts 
> --report /etc/cron.monthly )

-- 
Georges KHAZNADAR et Jocelyne FOURNIER
22 rue des mouettes, 59240 Dunkerque France.
Téléphone +33 (0)3 28 29 17 70

Attachment: signature.asc
Description: PGP signature

Reply via email to