RestComm / jain-slee

The World's #1 Open Source JAIN-SLEE (JSLEE) 1.1 Implementation
http://www.restcomm.com/
GNU Affero General Public License v3.0
24 stars 50 forks source link

[Twiddle] Profile attribute setting problem. #40

Closed SergeyLee closed 7 years ago

SergeyLee commented 8 years ago

This problem causes when attribute value has braces and is not quotation.

For example: this command is setting wrong value

./twiddle.sh profile.edit MyTable MyProfile --set --name=Info --value=0{2,3}[1-9][0-9][0-9]{9,10}

but this command works well

./twiddle.sh profile.edit MyTable MyProfile --set --name=Info --value="0{2,3}[1-9][0-9][0-9]{9,10}"

SergeyLee commented 8 years ago

Notes: Problem is in ProfileEditCommand/SetAttributeOperation buildOperation() method.

SergeyLee commented 7 years ago

When we use option value as --value=0{2}[1-9][0-9][0-9]{9,10} then we get args from Twiddle main method like this:

execute args: [[resTable, resProfile, --set, --name=Info, --value=0{2}[1-9][0-9][0-9]9, --value=0{2}[1-9][0-9][0-9]10]]

So we have problem with Getopt. I did not find any info about using curly brackets in getopt arguments.

jaimecasero commented 7 years ago

this is bash tweaking argument before passing into command [root@restcomm ~]# echo 0{2}[1-9][0-9][0-9]{9,10} 0{2}[1-9][0-9][0-9]9 0{2}[1-9][0-9][0-9]10 [root@restcomm ~]#

Brace expansion -> http://wiki.bash-hackers.org/syntax/expansion/brace

SergeyLee commented 7 years ago

Ok. With curly braces we have Bash Brace expansion. So we can only update twiddle doc for this case.