[sr-dev] [kamailio/kamailio] kamctl: make jsonrpc filter portable (#1669)

micmac1 notifications at github.com
Sun Oct 7 19:22:59 CEST 2018


The filter has a regex looking for a literal '{' in the beginning of a
line. Some awk implementations interpret this as a meta character, so
the regex is deemed broken. Example with busybox awk (POSIX):

`root at hank2:~# kamctl ps`
`awk: bad regex '^{.+"id"[ 	]*:[ 	]*[0-9]+[ 	]*}$': Invalid contents of {}`
`root at hank2:~#`

To fix this enclose the character in square brackets. This always
matches for a literal '{' and is portable.

Signed-off-by: Sebastian Kemper <sebastian_ml at gmx.net>

#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

#### Checklist:
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to issue #1429 

#### Description

Hi all,

I was trying to run kamctl on OpenWrt and the regex failed. I found a (closed) issue and the remedy was to use gawk. But it's actually easy to fix in the regex and when I can run busybox awk I can't save the space which would be needed for gawk. OpenWrt is usually run on embedded so space is often an issue :)

Thanks for looking at this!

Kind regards,
Seb
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1669

-- Commit Summary --

  * kamctl: make jsonrpc filter portable

-- File Changes --

    M utils/kamctl/kamctl.base (2)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/1669.patch
https://github.com/kamailio/kamailio/pull/1669.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1669
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181007/06dad6bb/attachment.html>


More information about the sr-dev mailing list