[Home]

Summary:ASTERISK-29163: STRPTIME does not work at all
Reporter:Peter Katzmann (pk16208)Labels:
Date Opened:2020-11-13 06:45:12.000-0600Date Closed:2020-11-16 11:10:54.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Functions/func_strings
Versions:16.14.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:ubuntu 16/18Attachments:
Description:The following examples shows the problem:
Asterisk 13 delivers results as expected asterisk 16 always 0, Even when you use the example of the documentation

{noformat}
[local-custom]
exten=>s,1,NoOp(test for epoch)
exten=>s,n,SET(STEP1=${STRFTIME(,MEZ,%Y:%m:%d %H:%M:%S)})
exten=>s,n,Set(START=${STRPTIME(${STEP1},MEZ,%Y:%m:%d %H:%M:%S)})
exten=>s,n,Set(START2=${STRPTIME(2020:11:13 12:17:13,MEZ,%Y:%m:%d %H:%M:%S)})
exten=>s,n,NoOp(Result -- ${STEP1} -- ${START} --)
exten=>s,n,SET(ORG=${STRPTIME(2006-03-01 07:30:35,America/Chicago,%Y-%m-%d %H:%M:%S)})

Result with asterisk 16:
xb06-asterisk70-5*CLI> console dial s@local-custom
   -- Executing [s@local-custom:1] NoOp("Console/default", "test for epoch") in new stack
   -- Executing [s@local-custom:2] Set("Console/default", "STEP1=2020:11:13 12:41:26") in new stack
   -- Executing [s@local-custom:3] Set("Console/default", "START=0") in new stack
   -- Executing [s@local-custom:4] Set("Console/default", "START2=0") in new stack
   -- Executing [s@local-custom:5] NoOp("Console/default", "Result -- 2020:11:13 12:41:26 -- 0 --") in new stack
   -- Executing [s@local-custom:6] Set("Console/default", "ORG= 0") in new stack


with asterisk 13:
x06-jenkinstest1-1*CLI> console dial s@local-custom
   -- Executing [s@local-custom:1] NoOp("Console/default", "test for epoch") in new stack
   -- Executing [s@local-custom:2] Set("Console/default", "STEP1=2020:11:13 12:42:56") in new stack
   -- Executing [s@local-custom:3] Set("Console/default", "START=1605271376") in new stack
   -- Executing [s@local-custom:4] Set("Console/default", "START2=1605269833") in new stack
   -- Executing [s@local-custom:5] NoOp("Console/default", "Result -- 2020:11:13 12:42:56 -- 1605271376 --") in new stack
   -- Executing [s@local-custom:6] Set("Console/default", "ORG=1141219835") in new stack
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2020-11-13 06:45:13.093-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: George Joseph (gjoseph) 2020-11-13 08:18:32.824-0600

I just tried your sample and it works fine for me.   Can you try without using chan_console?  I'm not sure if that has anything to do with it but it would eliminate it as a possibility.

By: Peter Katzmann (pk16208) 2020-11-13 08:44:57.229-0600

I made the example to keep it simple,
The problem popped out on a quite more complex dialplan scenario.
Works on asterisk 13 and fails on asterisk 16

By: Sean Bright (seanbright) 2020-11-13 08:59:32.681-0600

The machines are also different (xb06-asterisk70-5 vs. x06-jenkinstest1-1). I would wager that the machine running 16 doesn't know what the {{MEZ}} timezone is.

By: Peter Katzmann (pk16208) 2020-11-13 09:13:06.986-0600

Hmm,
i digged down a little bit further, it seems a problem with the builds on ubuntu 18, which fails and ubuntu 16 which works

By: Sean Bright (seanbright) 2020-11-13 09:17:56.228-0600

You can re-open this issue by commenting on it.

By: Peter Katzmann (pk16208) 2020-11-16 09:35:20.397-0600

It is not a timezone problem because strftime works.
I poked around a little bit in the internet and there are a few messages about the similar problem.

One mentioned he had to disable optimization to get it working again.
So i changed the default compiler to the one who is standard for ubuntu xenial (gcc 5) instead of the standard bionic one (gcc 7) .

The gcc 5 version works as expected under bonic, also with gcc-8.

So it seems a problem with gcc-7 and optimization.

By: Asterisk Team (asteriskteam) 2020-11-16 09:35:20.766-0600

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: George Joseph (gjoseph) 2020-11-16 11:10:39.582-0600

There's not much we can do about that unfortunately.