Bug 220306

Summary: Weird issue with date
Product: [Fedora] Fedora Reporter: Raoul <xraoul>
Component: auditAssignee: Steve Grubb <sgrubb>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-12-22 21:54:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Raoul 2006-12-20 10:43:52 UTC
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

It works.

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.

For example:

*/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):
1.3-2

Additional info:
Tested only the FC5 build, but probably the fc6 build will have the same strange
behaviour.

Comment 1 Steve Grubb 2006-12-20 11:22:11 UTC
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.

Comment 2 Raoul 2006-12-20 11:31:18 UTC
You are probably right. I'll investigate it more with my locales.

Thanks and sorry for the false bug submission.

Comment 3 Raoul 2006-12-20 12:09:27 UTC
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)"

prints:  %m/%d/%y

I add it as a cronjob:

*/1 * * * *     root    python -c "import locale; print
locale.nl_langinfo(locale.D_FMT)"

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.

Comment 4 Steve Grubb 2006-12-20 14:31:35 UTC
Use the locale command and you'll see the difference:

cron:
LC_TIME="POSIX"

commandline:
LC_TIME="en_US.UTF-8"

Comment 5 Raoul 2006-12-22 04:21:44 UTC
The python code's output must have got me confused.
Thanks a lot for all the information about this.

Comment 6 Steve Grubb 2006-12-22 21:54:57 UTC
Closing as not a bug. Hope the explanation helped.