[asterisk-bugs] [JIRA] (ASTERISK-26481) Major issues with FILE and LEN functions

Jonathan Harris (JIRA) noreply at issues.asterisk.org
Fri Oct 21 03:48:02 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-26481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=232803#comment-232803 ] 

Jonathan Harris edited comment on ASTERISK-26481 at 10/21/16 3:46 AM:
----------------------------------------------------------------------

Thanks - re patch, running patches is a little beyond me. However, I would hasten to point out that the loop I ran was just to generate files of varying lengths to demonstrate that it appears at consistent lengths.

Regarding newlines, you cannot have a newline in a file when used to get a variable by FILE, because it always adds in the newline, even if FILE is only told to get 1 line, and given the correct file format.

In other words, unless you either have exactly one line with no line return, OR you use the workaround from the mailing list, terminate the line with "," and use CUT. then you can never check on a variable returned by FILE as it always includes newline character. Does that make sense?

Can I just check if that is also the intended behaviour?


was (Author: lardconcepts):
Thanks - re patch, running patches is a little beyond me. However, I would hasten to point out that the loop I ran was just to generate files of varying lengths to demonstrate that it appears at consistent lengths.

Regarding newlines, you cannot have a newline from a FILE statement, because it always adds in the newline, even if FILE is only told to get 1 line, and given the correct file format.

In other words, unless you either have exactly one line with no line return, OR you use the workaround from the mailing list, terminate the line with "," and use CUT. then you can never check on a variable returned by FILE as it always includes newline character. Does that make sense?

Can I just check if that is also the intended behaviour?

> Major issues with FILE and LEN functions
> ----------------------------------------
>
>                 Key: ASTERISK-26481
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26481
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Functions/func_cut
>    Affects Versions: 14.0.1
>         Environment: Linux 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>            Reporter: Jonathan Harris
>            Assignee: Rusty Newton
>            Severity: Critical
>              Labels: dialplan, file, len, string, variables
>         Attachments: ASTERISK-26481_workaround_fixes_only_half_the_code.patch
>
>
> Something appears wrong with both the FILE and LEN functions
> This bit of dialplan shows some examples: (edited to replace code with links as this trackers messes up code)
> https://gist.githubusercontent.com/lardconcepts/2b6eb371748c4bb2202082a44e5be871/raw/f67b202223cb2ae3b539259b7e047c60cb0c2543/test-dp
> ...produces this output: (tidied only for posting) - this is messed up in so many ways.
> https://gist.githubusercontent.com/lardconcepts/9a8c0b601bccde18f857eb6fe09b73ed/raw/139579ac70034178f7a0a7e9eeb84d33bba462a9/dp-output
> LEN is showing the wrong length. 
> 1 character gets a weird character added.
> 23, and 4  characters OK
> 5 characters loses a character - BUT LOOK! Even though hexdump prints the correct contents and length, have a close look at this: 35|12345|  whereas normally it would have a space before the pipe.
> 6 characters is OK
>  (by the way, Component with id 'functions/func_len' does not exist)



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list