[asterisk-bugs] [Asterisk 0015208]: [patch] The CUT function does not show the leading field-separators until it finds a value.

Asterisk Bug Tracker noreply at bugs.digium.com
Wed May 27 14:29:50 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15208 
====================================================================== 
Reported By:                ramonpeek
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   15208
Category:                   Functions/func_cut
Reproducibility:            sometimes
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.4.25 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-05-27 13:47 CDT
Last Modified:              2009-05-27 14:29 CDT
====================================================================== 
Summary:                    [patch] The CUT function does not show the leading
field-separators until it finds a value.
Description: 
The CUT function does not show the leading field-separators if the first
values are NULL and will start functioning normal if it does find a value.

For example: 
1 - ${CUT(1---4-5-6--8--,,1-5)} results in: 1---4-5 (CORRECT)
2 - ${CUT(1---4-5-6--8--,,6-10)} results in: 6--8-- (CORRECT)
3 - ${CUT(1---4-5-6--8--,,2-10)} results in: 4-5-6--8-- (INCORRECT!,
should be: --4-5-6--8--)

In second and third statement the TRAILING separators are shown.
However the third statement should also show the LEADING separators, which
it doesn't.

I've added a small dialplan example to test.
And uploaded a patch I created for latest func_cut.c for Asterisk 1.4
trunk.
The patch should also work on 1.6.2 (with offset) since this part has not
been changed since.

====================================================================== 

---------------------------------------------------------------------- 
 (0105573) svnbot (reporter) - 2009-05-27 14:29
 https://issues.asterisk.org/view.php?id=15208#c105573 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 197244

_U  branches/1.6.0/
U   branches/1.6.0/funcs/func_cut.c

------------------------------------------------------------------------
r197244 | tilghman | 2009-05-27 14:29:49 -0500 (Wed, 27 May 2009) | 19
lines

Recorded merge of revisions 197209 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r197209 | tilghman | 2009-05-27 14:20:56 -0500 (Wed, 27 May 2009) | 12
lines
  
  Recorded merge of revisions 197194 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5
lines
    
    Use a different determinator on whether to print the delimiter, since
leading fields may be blank.
    (closes issue https://issues.asterisk.org/view.php?id=15208)
     Reported by: ramonpeek
     Patch by me, though inspired in part by a patch from ramonpeek
  ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=197244 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-05-27 14:29 svnbot         Checkin                                      
2009-05-27 14:29 svnbot         Note Added: 0105573                          
======================================================================




More information about the asterisk-bugs mailing list