Menu

#109 sel set time acts differently between command line and exec

version-1.8.10
closed-fixed
unknown (6)
5
2012-11-26
2012-09-18
No

ipmitool version: 1.8.10
operating system reproduced on: OpenEmbedded Linux and Red Hat Enterprise Linux Server release 5.6 (Tikanga)

How to reproduce:
Create an exec file with the line 'sel time set "09/18/2012 10:10:00"' (any correctly formatted time string will do)

Execute the same 'sel time set' command from the ipmitool command line.
Execute the exec file you created.
Note that there is one hour time difference between the time that is set by these two commands.

Discussion

  • Richard Detweiler

     
  • Zdenek Styblik

    Zdenek Styblik - 2012-09-19

    The reason, is tm.tm_isdst being set to random value. Setting tm.tm_isdst to (-1) prior calling mktime() gives, at least, deterministic behaviour.

    From mktime() man page:
    ``The value specified in the tm_isdst field informs mktime() whether
    or not daylight saving time (DST) is in effect for the time supplied
    in the tm structure: a positive value means DST is in effect;
    zero means that DST is not in effect; and a negative value means that
    mktime() should (use timezone information and system databases to)
    attempt to determine whether DST is in effect at the specified time.''

    The following change should force mktime() to check whether DST is in use or not instead of using random value.
    One way or another, use of random value set in/to tm.tm_isdst should be eliminated!

    ~~~ snip lib/ipmi_sel.c
    if (strptime(time_string, time_format, &tm) == 0) {
    lprintf(LOG_ERR, "Specified time could not be parsed");
    return -1;
    }
    tm.tm_isdst = (-1);
    t = mktime(&tm);
    if (t < 0) {
    lprintf(LOG_ERR, "Specified time could not be parsed");
    return -1;
    }
    ~~~ snip lib/ipmi_sel.c

     
  • Zdenek Styblik

    Zdenek Styblik - 2012-09-28

    The fix has been committed to CVS.

     
  • Zdenek Styblik

    Zdenek Styblik - 2012-10-19
    • milestone: --> version-1.8.10
    • assigned_to: nobody --> stybla
     
  • Zdenek Styblik

    Zdenek Styblik - 2012-10-19

    Please, can you try out ipmitool-cvs, so we can close this one? Thanks.

     
  • Zdenek Styblik

    Zdenek Styblik - 2012-11-26
    • status: open --> closed-fixed
     
  • Zdenek Styblik

    Zdenek Styblik - 2012-11-26

    Confirmed via e-mail as fixed.

     

Log in to post a comment.