Bug#1061155: closed by Debian FTP Masters (reply to Georges Khaznadar ) (Bug#1061155: fixed in cron 3.0pl1-186)

2024-03-03 Thread Georges Khaznadar
Jonathan H N Chin a écrit :
> Since there is an existing "standard" for crontab error reporting
> ( check_error() diagnostic + non-zero exit ), I am suggesting
> not inventing a new one ( warning message + zero exit ).

Looks fine; I shall use check_error() in the future release (3.0pl1-187)

Best regards,   Georges.



signature.asc
Description: PGP signature


Bug#1061155: closed by Debian FTP Masters (reply to Georges Khaznadar ) (Bug#1061155: fixed in cron 3.0pl1-186)

2024-03-01 Thread Jonathan H N Chin
Since there is an existing "standard" for crontab error reporting
( check_error() diagnostic + non-zero exit ), I am suggesting
not inventing a new one ( warning message + zero exit ).


The crontab(1) manpage does not mention exit code; but it is
very common for zero to mean success / non-zero to mean failure.

I have no idea how other people use crontab, but I can easily
imagine someone has written automation code along the lines of:

if crontab -n newfile 2>&-; then
# looks good, do it for real now
crontab - https://github.com/sourcemage/grimoire/blob/9c3932d181e16dc2c0320f7bb189e42d445fd4d7/utils/fcrontabs/fcrontab#L25

https://github.com/brsf11/mugen-riscv/blob/9c474e23beb4834d6d87b7434edf94e0689d6a8d/testcases/cli-test/crontabs/oe_test_crontabs.sh#L56

I would like to support users; not belittle them.


-jonathan




georges.khaznadar wrote:
> To: Jonathan H N Chin , 1061...@bugs.debian.org
> From: Georges Khaznadar 
> Date: Fri, 1 Mar 2024 14:08:08 +0100
> Subject: Re: Bug#1061155: closed by Debian FTP Masters
>   (reply to Georges Khaznadar
>  ) (Bug#1061155: fixed in cron 3.0pl1-186)
> 
> Dear Jonathan,
> 
> what is the right message to feed back to the user?
> 
> Warning ?
> 
> +-+
> | Warning | ?
> +-+
> 
> +-+
> | +-+ |
> | | POOR MISGUIDED, YOU MADE AN ERROR ! | | ?
> | +-+ |
> +-+
> 
> All in all, if the user does not want to read feedback messages, I
> ignore how to tell them the proper way.
> 
> About the exit status with -n: if one runs `crontab -n`, one expects
> somme feedback message, because nothing else is going to happen. The
> exit status is just an integer, far less expressive than a warning which
> points out some defect. Do you always check "$?" when you get an error
> or a warning message?
> 
> 
> 
> Jonathan H N Chin a écrit :
> > Hi, I just received the new package and tried it. Thanks.
> > 
> > It detects unacceptable MAILTO/MAILFROM, but because unacceptable
> > values will cause an error later, issuing only a warning feels
> > inadequate to me.
> > 
> > For usability, perhaps it would be better to use check_error().
> > Currently, warnings could be missed since the exit status with
> > `-n` is still 0.
> > 
> > Something like:
> > 
> > case TRUE:
> > /* here MAILTO and MAILFROM are checked */
> > if (
> >   strncmp(envstr, "MAILTO=", 7) == 0 ||
> >   strncmp(envstr, "MAILFROM=", 9) == 0
> > ){
> >   if (! safe_p("", strstr(envstr,"=")+1)){
> > check_error("unsafe mail");
> >   }
> > }
> > break;
> > 
> > 
> > 
> > The current safe_p() implementation may cause a syslog entry to be
> > generated with no associated username when called here, which feels
> > slightly wrong to me. It could be confusing to someone auditing logs
> > to see spurious "() UNSAFE MAIL" messages when `-n` is used.
> > 
> > 
> > 
> > -jonathan
> 
> -- 
> Georges KHAZNADAR et Jocelyne FOURNIER
> 22 rue des mouettes, 59240 Dunkerque France.
> Téléphone +33 (0)3 28 29 17 70
> 



Bug#1061155: closed by Debian FTP Masters (reply to Georges Khaznadar ) (Bug#1061155: fixed in cron 3.0pl1-186)

2024-03-01 Thread Georges Khaznadar
Dear Jonathan,

what is the right message to feed back to the user?

Warning ?

+-+
| Warning | ?
+-+

+-+
| +-+ |
| | POOR MISGUIDED, YOU MADE AN ERROR ! | | ?
| +-+ |
+-+

All in all, if the user does not want to read feedback messages, I
ignore how to tell them the proper way.

About the exit status with -n: if one runs `crontab -n`, one expects
somme feedback message, because nothing else is going to happen. The
exit status is just an integer, far less expressive than a warning which
points out some defect. Do you always check "$?" when you get an error
or a warning message?



Jonathan H N Chin a écrit :
> Hi, I just received the new package and tried it. Thanks.
> 
> It detects unacceptable MAILTO/MAILFROM, but because unacceptable
> values will cause an error later, issuing only a warning feels
> inadequate to me.
> 
> For usability, perhaps it would be better to use check_error().
> Currently, warnings could be missed since the exit status with
> `-n` is still 0.
> 
> Something like:
> 
> case TRUE:
> /* here MAILTO and MAILFROM are checked */
> if (
>   strncmp(envstr, "MAILTO=", 7) == 0 ||
>   strncmp(envstr, "MAILFROM=", 9) == 0
> ){
>   if (! safe_p("", strstr(envstr,"=")+1)){
> check_error("unsafe mail");
>   }
> }
> break;
> 
> 
> 
> The current safe_p() implementation may cause a syslog entry to be
> generated with no associated username when called here, which feels
> slightly wrong to me. It could be confusing to someone auditing logs
> to see spurious "() UNSAFE MAIL" messages when `-n` is used.
> 
> 
> 
> -jonathan

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



signature.asc
Description: PGP signature


Bug#1061155: closed by Debian FTP Masters (reply to Georges Khaznadar ) (Bug#1061155: fixed in cron 3.0pl1-186)

2024-02-29 Thread Jonathan H N Chin
Hi, I just received the new package and tried it. Thanks.

It detects unacceptable MAILTO/MAILFROM, but because unacceptable
values will cause an error later, issuing only a warning feels
inadequate to me.

For usability, perhaps it would be better to use check_error().
Currently, warnings could be missed since the exit status with
`-n` is still 0.

Something like:

case TRUE:
/* here MAILTO and MAILFROM are checked */
if (
  strncmp(envstr, "MAILTO=", 7) == 0 ||
  strncmp(envstr, "MAILFROM=", 9) == 0
){
  if (! safe_p("", strstr(envstr,"=")+1)){
check_error("unsafe mail");
  }
}
break;



The current safe_p() implementation may cause a syslog entry to be
generated with no associated username when called here, which feels
slightly wrong to me. It could be confusing to someone auditing logs
to see spurious "() UNSAFE MAIL" messages when `-n` is used.



-jonathan