Forum Discussion

Arie_90212's avatar
Arie_90212
Icon for Nimbostratus rankNimbostratus
Feb 06, 2015

Error: use curly braces to avoid double substitution

Upgrading from 11.3 to 11.6 I'm encountering this error:

warning: [use curly braces to avoid double substitution][[string length "/contact"]]

Code:

HTTP::path /[ string range [HTTP::path] [expr [string length "/contact"] +1 ] end ]

I've tried:

HTTP::path /[ string range [HTTP::path] [expr {[string length "/contact"] +1 }] end ]

without success.

2 Replies

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    I'm truly baffled now. To make the changes I used the iRule editor, but after some time I noticed that the errors I was seeing when I ran load sys config verify in TMSH the changes weren't reflected in the error message.

    Eventually I made the changes via the GUI and suddenly the verification passed.

    To make it even more interesting, a couple of other rules also caused the same error message and I had updated those as well (added braces) via the iRule Editor. Those also kept showing with errors when I ran the verify command, but after I saved that one iRule in the GUI all of them suddenly passed.

    iRule Editor problem?

  • Hi Arie,

    I just gave it a try on v11.6.0HF3:

     

    when HTTP_REQUEST {
        log local0. "path: [HTTP::path]; extracted <[string range [HTTP::path] [expr {[string length "/contact"] + 1}] end]>"
        HTTP::path "/[string range [HTTP::path] [expr {[string length "/contact"] + 1}] end]"
        log local0. "new path: [HTTP::path]"
    }
    

     

    Log output as expected:

     

     tail -n 0 -f /var/log/ltm | grep -oE 'Rule .*$'
    Rule /Common/rule_string : path: /contact/stephan; extracted 
    Rule /Common/rule_string : new path: /stephan
    

     

    Verification fine as well:

     

     tmsh list ltm rule rule_string > /shared/rule_verify
     tmsh load sys config merge verify file /shared/rule_verify
    Validating configuration...
      /shared/rule_verify
    
    

     

    Thanks, Stephan