lhotari commented on issue #21902:
URL: https://github.com/apache/pulsar/issues/21902#issuecomment-1901105376

   > I suppose, the problem is due to unexpanded with `$X_DIR` => `"${X_DIR}"` 
variables in `./bin/pulsar`.
   
   yes, it's better not to put spaces in workspace directories :) . the 
`bin/pulsar` script has a lot of quoting issues. The same applies to most bash 
scripts that are used in pulsar. 
   
   The reason why it is painful is due to the fact that this is the command 
that gets executed for "./bin/pulsar broker":
   `exec $JAVA $LOG4J2_SHUTDOWN_HOOK_DISABLED $OPTS 
-Dpulsar.log.file=$PULSAR_LOG_FILE org.apache.pulsar.PulsarBrokerStarter 
--broker-conf $PULSAR_BROKER_CONF $@`
   
   The `$OPTS` part will contain file names with spaces in many arguments . It 
would be better to refactor the solution to use bash arrays instead of 
concatenating a large string.
   
   here's an example to show how bash supports arrays and how they are handling 
for passing arguments without issues with spaces in arguments:
   ```
   args=()
   args+=("hello world")
   args+=("hello there")
   ls "${args[@]}"
   ```
   
   This outputs
   ```
   ls: cannot access 'hello world': No such file or directory
   ls: cannot access 'hello there': No such file or directory
   ```
   
   But, do we really have to support spaces in directory names?


-- 
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