Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rabbitmqctl unable to pass arguments containing '*' #325

Closed
CVTJNII opened this issue Sep 24, 2015 · 2 comments
Closed

rabbitmqctl unable to pass arguments containing '*' #325

CVTJNII opened this issue Sep 24, 2015 · 2 comments

Comments

@CVTJNII
Copy link
Contributor

CVTJNII commented Sep 24, 2015

Rabbitmqctl is unable to pass arguments containing '*' as the shell expands them. For example, running the user setup commands from the Sensu install guide fails:

root@c20dc47d849f:/# rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"
Setting permissions for user "sensu" in vhost "/sensu" ...
root@c20dc47d849f:/# tail -n 2 /var/log/rabbitmq/[email protected]
=INFO REPORT==== 24-Sep-2015::17:09:21 ===
Setting permissions for 'sensu' in '/sensu' to '....dockerenv.dockerinit', '....dockerenv.dockerinit', '....dockerenv.dockerinit'

The wrapper is expanding .* as a path. This appears to be bug introduced by 7fe2c61 when 'printf %s $arg' was added. Note that $arg is unescaped.

The following resolves this for my particular use case, however I have not tested the other use cases for which the print was added:

diff --git a/packaging/common/rabbitmq-script-wrapper b/packaging/common/rabbitmq-script-wrapper
index 67fa669..ed4c276 100644
--- a/packaging/common/rabbitmq-script-wrapper
+++ b/packaging/common/rabbitmq-script-wrapper
@@ -22,7 +22,7 @@ fi

 for arg in "$@" ; do
     # Wrap each arg in single quotes and wrap single quotes in double quotes, so that they're passed through cleanly.
-    arg=`printf %s $arg | sed $SED_OPT -e "s/'/'\"'\"'/g"`
+    arg=`printf %s "$arg" | sed $SED_OPT -e "s/'/'\"'\"'/g"`
     CMDLINE="${CMDLINE} '${arg}'"
 done
@ben-page
Copy link
Contributor

You're right. My PR broke that. I was just about to create a PR to fix it, but @CVTJNII beat me to it.

@dumbbell
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants