[asterisk-bugs] [Asterisk 0015557]: [patch] Gosub() dequotes once more than Macro()

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Aug 5 11:50:35 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15557 
====================================================================== 
Reported By:                rain
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   15557
Category:                   Applications/app_stack
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           Older 1.6.0 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-07-22 15:33 CDT
Last Modified:              2009-08-05 11:50 CDT
====================================================================== 
Summary:                    [patch] Gosub() dequotes once more than Macro()
Description: 
Since Gosub started accepting "macro" arguments (before 1.6.0-beta1), it
has been dequoting arguments one more time than Macro does.

Since Gosub() is meant to supplant Macro() in 1.6 and is already used by
AEL to implement macros, this breaks compatibility with 1.4.  This behavior
also makes it impossible to fetch arguments without quotes being
interpreted, which IS possible in a Macro() call through ${ARGn}.  It also
requires an obnoxious level of quoting if you want quotes to survive all
the way to a named macro argument in AEL -- e.g.
&macro(${QUOTE(${QUOTE(${CALLERID(all)})})});

Behind the scenes, Gosub() uses AST_STANDARD_APP_ARGS, which causes
ast_app_separate_args() to eat the quotes; Macro() does its own argument
parsing.  I think the best solution is probably to make Gosub() use
non-standard argument parsing as well, but I haven't written a patch yet
since I think this warrants more discussion.

I verified that this problem exists in 1.6.0-beta1, 1.6.0.10, and 1.6.11. 
It does not exist in 1.4 because Gosub() doesn't accept extra arguments.

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

---------------------------------------------------------------------- 
 (0108660) rain (reporter) - 2009-08-05 11:50
 https://issues.asterisk.org/view.php?id=15557#c108660 
---------------------------------------------------------------------- 
Argh!  I'm terribly sorry, I should've waited until I had a clearer head to
submit the bug.  I dug into this some more today, and it turns out that I
accidentally reverted part of your patch while I was making a patch for bug
0015617.  I've reapplied it, and now the quoting (" or \) is passed along
to (M)Set along with those commas, which prevents any errors.

FWIW, I tried the second patch anyway - it works and preserves quotes all
the way to the named argument variables (so ${arg} would be '"Hello,
world"' in the earlier example), but that behavior was rejected in bug
0011329, so I guess it's all for naught unless you want to reexamine that
behavior.  I also noticed that the second patch removes \ escapes ('\,' ->
',') when app_set = 1.6, but not when app_set = 1.4 (that's probably moot,
though.)

I did notice that my example doesn't actually work (AEL doesn't consider
quotes at all when separating macro arguments - in my local testing, I was
actually using a variable with a comma in its value), but that doesn't
really have anything to do with this patch. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-08-05 11:50 rain           Note Added: 0108660                          
======================================================================




More information about the asterisk-bugs mailing list