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@hank2:~# kamctl ps`
`awk: bad regex '^{.+"id"[      ]*:[    ]*[0-9]+[       ]*}$': Invalid contents 
of {}`
`root@hank2:~#`

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

Signed-off-by: Sebastian Kemper <[email protected]>

#### 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
_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to