-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dev.icinga.com #11147] "day -X" time specifications are parsed incorrectly #3932
Comments
Updated by mfriedrich on 2016-03-18 13:25:55 +00:00
|
Updated by mfriedrich on 2016-03-18 13:26:02 +00:00
|
Updated by mfriedrich on 2016-03-18 13:26:19 +00:00
|
Updated by gbeutner on 2016-05-11 06:52:21 +00:00 The mktime(3) manpage seems to suggest that this is in fact supported:
However, obviously "day-1" should refer to the last day - as opposed to the second-to-last day, so this is definitely still a bug. |
Updated by gbeutner on 2016-05-11 07:26:11 +00:00
|
Updated by gbeutner on 2016-05-11 07:26:20 +00:00
|
Updated by gbeutner on 2016-05-11 07:26:42 +00:00
Applied in changeset ed27130. |
This issue has been migrated from Redmine: https://dev.icinga.com/issues/11147
Created by atj on 2016-02-11 15:40:15 +00:00
Assignee: gbeutner
Status: Resolved (closed on 2016-05-11 07:26:42 +00:00)
Target Version: 2.4.8
Last Update: 2016-05-11 07:26:42 +00:00 (in Redmine)
Please refer to #11132, #11141 and #11146 for additional context.
Based on the available documentation, time specifications of the form "day -1" should be parsed as "the last day of the month". However LegacyTimePeriod::ParseTimeSpec currently parses "day -1" as the second to last day of the month. This is due to the following code (repeated a couple of times):
The decrementing of
tm_mday
is causing the issue, however it should be noted that valid values fortm_mday
are 1..31 and 0..11 fortm_mon
. It seems thatmktime
in glibc normalises the invalid values but I don't think it is safe to rely on this behaviour.My suggestion would be to add a method to return the number of days in a month, so the code looked something like:
Please let me know if this is acceptable and I will write a patch.
Changesets
2016-05-11 07:23:55 +00:00 by gbeutner ed27130
2016-05-12 09:09:49 +00:00 by gbeutner 89c7b5a
Relations:
The text was updated successfully, but these errors were encountered: