ctubbsii opened a new pull request, #5158:
URL: https://github.com/apache/accumulo/pull/5158

   Fix the accumulo-cluster script's quote handling by removing the extra layer 
of indirection using eval and newer bash features to quote variables while 
printing. That many layers of nested quoting makes it very hard to reason about 
what the script is actually doing. The trade-off with avoiding eval is that 
some of the quoting may not be shown correctly.
   
   This change replaces the debugAndRun method and its use of eval with a 
simpler debug implementation that merely prints the provided command when debug 
is enabled, and returns true when debug is enabled, or false when it isn't. The 
return code is then used to execute the command that was printed. For example, 
in the following command, if debug is enabled, the debug command will print 
"mycommand" and skip the execution. However, if debug is disabled, then no 
printing will be done, and instead "mycommand" will be executed.
   
       debug mycommand || mycommand
   
   To try to print debug statements that with proper quotes suitable for copy 
and pasting, one must provide a slightly different command on either side of 
the `||`, so that the one on the left will print the quotes correctly, and the 
one on the right will execute the command correctly. For example:
   
       debug "mycommand \"$1\"" || mycommand "$1"
   
   Assume `$1=="foo bar"`. The extra quotes will ensure that this prints 
`mycommand "foo bar"` instead of `mycommand foo bar` when debug is enabled, 
because `mycommand "foo bar"` is what would be executed if debug is not enabled.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to