[asterisk-bugs] [JIRA] (ASTERISK-26481) Major issues with FILE and LEN functions
Jonathan Harris (JIRA)
noreply at issues.asterisk.org
Tue Oct 18 06:42:01 CDT 2016
Jonathan Harris created ASTERISK-26481:
------------------------------------------
Summary: 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
Severity: Critical
Something appears wrong (by the way, Component with id 'functions/func_len' does not exist)
This bit of dialplan.....
exten => 5,1,Verbose(Context: ${CONTEXT} Exten:${EXTEN})
same => n,Set(featurefile=/home/test/feature-1.txt)
same => n,set(myList=1,12,123,1234,12345,123456,A,AB,ABC,ABCD,ABCDE,ABC123)
same => n,While($["${SET(rawVar=${SHIFT(myList)})}" != ""])
same => n,SET(FILE(${featurefile})=${rawVar})
same => n,SET(fileVar=${FILE(${featurefile},0,1,l,u)})
same => n,SET(hexDump=${SHELL(hd ${featurefile})})
same => n,Verbose(Before file: ---${rawVar}--- len ${LEN(rawVar)} after file: ---${fileVar}--- len ${LEN(fileVar)} hexdump:${hexDump})
same => n,EndWhile()
same => n,Hangup()
...produces this output: (tidied only for posting) - this is messed up in so many ways.
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
Before file: ---1--- len 6 after file: ---1▒--- len 7 hexdump:00000000 31|1| 00000001
Before file: ---12--- len 6 after file: ---12--- len 7 hexdump:00000000 31 32 |12| 00000002
Before file: ---123--- len 6 after file: ---123--- len 7 hexdump:00000000 31 32 33 |123| 00000003
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773 ast_channel_publish_varset: Error creating message
Before file: ---1234--- len 6 after file: ---1234--- len 7 hexdump:00000000 31 32 33 34 |1234| 00000004
Before file: ---12345--- len 6 after file: ---1234--- len 7 hexdump:00000000 31 32 33 34 35|12345| 00000005
Before file: ---123456--- len 6 after file: ---123456--- len 7 hexdump:00000000 31 32 33 34 35 36 |123456| 00000006
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773 ast_channel_publish_varset: Error creating message
Before file: ---A--- len 6 after file: ---A▒--- len 7 hexdump:00000000 41|A| 00000001
Before file: ---AB--- len 6 after file: ---AB--- len 7 hexdump:00000000 41 42 |AB| 00000002
Before file: ---ABC--- len 6 after file: ---ABC--- len 7 hexdump:00000000 41 42 43 |ABC| 00000003
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: json.c:704 ast_json_vpack: Error building JSON from '{s: s, s: s}': Invalid UTF-8 string.
[Oct 18 12:23:53] ERROR[8584][C-0000001a]: stasis_channels.c:773 ast_channel_publish_varset: Error creating message
Before file: ---ABCD--- len 6 after file: ---ABCD--- len 7 hexdump:00000000 41 42 43 44 |ABCD| 00000004
Before file: ---ABCDE--- len 6 after file: ---ABCD--- len 7 hexdump:00000000 41 42 43 44 45|ABCDE| 00000005
Before file: ---ABC123--- len 6 after file: ---ABC123--- len 7 hexdump:00000000 41 42 43 31 32 33 |ABC123|
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list