Bug 220306 - Weird issue with date
Weird issue with date
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: audit (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Steve Grubb
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-20 05:43 EST by Raoul
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-22 16:54:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Raoul 2006-12-20 05:43:52 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

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 06:22:11 EST
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 06:31:18 EST
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 07:09:27 EST
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 09:31:35 EST
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-21 23:21:44 EST
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 16:54:57 EST
Closing as not a bug. Hope the explanation helped.

Note You need to log in before you can comment on or make changes to this bug.