[sr-dev] [kamailio/kamailio] kamctl - shell interpreter selection (#2019)

Daniel-Constantin Mierla notifications at github.com
Mon Jul 29 12:39:07 CEST 2019



### Description

The `kamctl` tool seems to require `bash`, while trying to use `/bin/sh`, which can point to `dash` or other shell interpreters.

For example, the output of `kamdbctl create`:

```
MySQL password for root:
-e \E[37;33mINFO: creating database kamailio_simple_db ...
-e \E[37;33mINFO: granting privileges to database kamailio_simple_db ...
-e \E[37;33mINFO: creating standard tables into kamailio_simple_db ...
-e \E[37;33mINFO: Core Kamailio tables succesfully created.
Install presence related tables? (y/n): n
/usr/sbin/kamdbctl: 216: /usr/sbin/kamdbctl: Bad substitution
```

It seems that the issue is expanding the variable when getting the answer for y/n question:

  * https://github.com/kamailio/kamailio/blob/master/utils/kamctl/kamdbctl.base#L216-L218

Such expression seems to be specific for bash:

  * https://mywiki.wooledge.org/Bashism



### Troubleshooting

#### Reproduction

Run `kamctl` with `/bin/sh` pointing to `bash`.

### Possible Solutions

Decide what to do to have an acceptable solution: enforce `bash`, remove bashisms`...

Or maybe focus to make `kamcli` a (full) replacement for `kamctl/kamdbctl` and get rid of those old-style shell/bash scripts:

  * https://github.com/kamailio/kamcli


-- 
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/issues/2019
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190729/4aca2525/attachment.html>


More information about the sr-dev mailing list