Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cmd/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ func unpackTarball(cmd *cobra.Command, args []string) {
if !common.DirExists(Basedir) {
common.Exit(1,
fmt.Sprintf(globals.ErrDirectoryNotFound, Basedir),
"You should create it or provide an alternate base directory using --sandbox-binary")
"Create it by running:",
" dbdeployer init --skip-all-downloads",
"or manually with:",
fmt.Sprintf(" mkdir -p %s", Basedir),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Make the suggested mkdir command shell-safe.

The help text currently prints mkdir -p <path> without quoting, so copy-paste may fail when the base directory contains spaces/shell characters. Quote or escape Basedir in the displayed command.

Suggested fix
-           fmt.Sprintf("    mkdir -p %s", Basedir),
+           fmt.Sprintf("    mkdir -p %q", Basedir),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fmt.Sprintf(" mkdir -p %s", Basedir),
fmt.Sprintf(" mkdir -p %q", Basedir),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/unpack.go` at line 74, The help text prints an unquoted mkdir command
which breaks for Basedir values with spaces or special chars; update the
fmt.Sprintf call that builds the help string (the line using fmt.Sprintf("   
mkdir -p %s", Basedir) in cmd/unpack.go) to produce a shell-safe path by quoting
or escaping Basedir (e.g., wrap it in single quotes or escape shell
metacharacters) so the printed command can be copy-pasted safely.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The suggested mkdir -p command may fail or behave unexpectedly if the Basedir path contains spaces or special characters. It is safer to wrap the path in double quotes to ensure the command is robust and copy-pasteable for all valid directory paths.

Suggested change
fmt.Sprintf(" mkdir -p %s", Basedir),
fmt.Sprintf(" mkdir -p \"%s\"", Basedir),

"or provide an alternate base directory using --sandbox-binary")
}

err = ops.UnpackTarball(ops.UnpackOptions{
Expand Down
Loading