mpremote romfs deploy: Directory handling is arguably inconsistent with cp -r
Port, board and/or hardware
Board independent. Tested on RP2040
MicroPython version
MicroPython v1.25.0-dirty on 2025-04-19; Raspberry Pi Pico with RP2040
Built with romfs
Reproduction
Issue
$ mpremote deploy foo
where foo is a directory on the PC containing subdirectories
Expected behaviour
The command
$ mpremote cp -r foo :
copies the directory foo with contents and subdirectories to the host. This is consistent with
$ cp -r foo bar
Observed behaviour
By contrast
$ mpremote deploy foo
copies the contents of foo as per
$ cp -r foo/* bar
A typical project might consist of a Python package foo where the executable foo is contained in a directory holding documentation and other resources. The requirement is to copy foo and its contents. Currently this requires a workround involving a temporary directory and a symlink.
Additional Information
Options are either to change this behaviour or provide means of deploying either the directory + contents or contents alone.
Code of Conduct
Yes, I agree
"mpremote -rv :/" can remove files from host
Port, board and/or hardware
any
MicroPython version
mpremote v1.25.0
Reproduction
- use mpremote mount .
- Ctrl-C to terminate connection
- run
mpremote rm -rv :
Minimal repro: ⚠️ destructive ⚠️
mpremote mount . + rm -rv :
Expected behaviour
-rm -r :/ not to affect the local filesystem
Observed behaviour
apparently the mount was retained - and therefore the /remote , hosts filesystem, started be removed
rm :
removed directory: './.venv/Lib/site-packages/Deprecated-1.2.18.dist-info'
removed directory: './.venv/Lib/site-packages/adodbapi/examples'
removed directory: './.venv/Lib/site-packages/adodbapi/test'
removed directory: './.venv/Lib/site-packages/adodbapi'
removed directory: './.venv/Lib/site-packages/annotated_types-0.7.0.dist-info/licenses'
removed directory: './.venv/Lib/site-packages/annotated_types-0.7.0.dist-info'
removed directory: './.venv/Lib/site-packages/annotated_types/__pycache__'
removed directory: './.venv/Lib/site-packages/annotated_types'
removed directory: './.venv/Lib/site-packages/ansicon-1.89.0.dist-info'
removed directory: './.venv/Lib/site-packages/ansicon'
removed directory: './.venv/Lib/site-packages/anyio-4.9.0.dist-info'
removed directory: './.venv/Lib/site-packages/anyio/_backends'
removed directory: './.venv/Lib/site-packages/anyio/_core'
removed directory: './.venv/Lib/site-packages/anyio/abc'
removed directory: './.venv/Lib/site-packages/anyio/streams'
removed directory: './.venv/Lib/site-packages/anyio'
Additional Information
I think \remote should be special cased in mpremote rm -r to guard against this behavior
Code of Conduct
Yes, I agree