coder999o opened a new issue, #7351:
URL: https://github.com/apache/rocketmq-dashboard/issues/7351

   ### Before Creating the Bug Report
   - [x] Searched all-state Issues and PRs, including the relevant Makefile 
patches.
   - [x] This is a RocketMQ Studio defect.
   - [x] Reproduced using the current Makefile and the real make/rm commands in 
isolated temporary directories.
   
   ### Studio Version
   `rocketmq-studio` at `127c47b06a268cc74224d5f34c56ec7c36ac0d55`.
   
   ### Runtime Environment
   macOS, GNU Make 3.81 and BSD rm. This concerns the shell recipe in 
`rmqctl/Makefile`.
   
   ### Connected RocketMQ Cluster
   Not required: `make clean` does not contact Studio or RocketMQ.
   
   ### Describe the Bug
   The CLI Makefile runs `rm -rf $(BUILD_DIR)` without quoting the directory. A 
path containing spaces is split into separate deletion operands, so cleanup can 
remove unrelated directories while leaving the requested build directory 
intact. The default `BUILD_DIR=$(CURDIR)/bin` is affected when the checkout 
path contains a space; no override is needed in that case. A wildcard in an 
override is also expanded by the shell.
   
   ### Steps to Reproduce
   1. In a fresh temporary directory, create three directories named `build 
output`, `build`, and `output`, each containing a marker file.
   2. Run `make -f /absolute/path/to/rmqctl/Makefile clean 'BUILD_DIR=build 
output'` with that temporary directory as the working directory.
   3. Observe exit status 0: `build output` remains, but the unrelated `build` 
and `output` directories have been deleted.
   
   The default path is also reproducible from an isolated `project checkout` 
working directory without a `BUILD_DIR` override: its `bin` remains while the 
two word-split operands are removed.
   
   ### What Did You Expect to See?
   Delete exactly the selected build directory, preserving unrelated 
directories and literal wildcard characters in the directory name. Treat a 
directory beginning with `-` as a path rather than an rm option.
   
   ### What Did You See Instead?
   Cleanup succeeds against the wrong paths, potentially deleting unrelated 
files.
   
   ### Additional Context
   Quote the cleanup operand and use rm's option terminator. This is a narrowly 
scoped cleanup fix, with executable tests against the existing Makefile; it 
does not require a Go compiler invocation, a package build or new dependencies.
   
   ### Are You Willing to Submit a Pull Request?
   - [x] Yes, I am willing to submit a pull request.
   


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