Red Hat Bugzilla – Bug 220306
Weird issue with date
Last modified: 2007-11-30 17:11:51 EST
Description of problem:
This is the issue by example:
As root I run the following to get the successful login events, for example,
from Dec 19 till now:
/sbin/aureport -l -ts 12/19/2006 --success
If I run (date is with 2-digit year):
/sbin/aureport -l -ts 12/19/06 --success
It will _not_ work.
Now, if this command is issued from within a cron job, the opposite thing
happens. Only the second form (with 2-digit year) works.
*/1 * * * * root /sbin/aureport -l -ts 12/19/2006 --success
The above job will _not_ work, while the following job will:
*/1 * * * * root /sbin/aureport -l -ts 12/19/06 --success
It is weird or I miss something.
Version-Release number of selected component (if applicable):
Tested only the FC5 build, but probably the fc6 build will have the same strange
I bet there's a difference in locale. The audit code uses the default time
format for your locale...which means it could be different between login shell
and cron job.
You are probably right. I'll investigate it more with my locales.
Thanks and sorry for the false bug submission.
Just a quick additional note. I don't know if this is a correct way to check this.
The following prints the strftime format for the current locale.
As root I run:
python -c "import locale; print locale.nl_langinfo(locale.D_FMT)"
I add it as a cronjob:
*/1 * * * * root python -c "import locale; print
Still get %m/%d/%y in my inbox.
I don't know how to evaluate this result.
Aureport, when run directly from the CLI, expects a 4-digit year.
Use the locale command and you'll see the difference:
The python code's output must have got me confused.
Thanks a lot for all the information about this.
Closing as not a bug. Hope the explanation helped.