Shell command failures due to spaces in paths require careful handling across multiple files.
The issue involves shell commands failing when paths contain spaces, affecting multiple files. The proposed fix is to use `shlex.quote()` for paths and executables, but this requires changes across several areas. The scope is somewhat clear, but the cross-cutting nature and potential for regressions increase the difficulty.
When paths or executable locations contain spaces (e.g. bench in ~/My Documents/frappe-bench), shell commands built with string concatenation fail. The shell splits on spaces, causing errors like:
/bin/bash: /path/to/My: is a directory
frappe/utils/backups.py – GPG enc/dec, tar, SQLite/MariaDB dumpfrappe/database/db_manager.py – restore pipelinefrappe/utils/__init__.py – get_disk_usagefrappe/installer.py – validate_database_sqlfrappe/commands/site.py – restore/partial-restore file detectionUse shlex.quote() for all paths and executables passed to execute_in_shell().
Fix branch: https://github.com/debugHere/frappe/tree/fix/shell-path-quoting-spaces
Patch file: shell-path-quoting-fix.patch
Claim this issue to let others know you're working on it. You'll earn 25 points when you complete it!