micropython / micropython/micropython

mpremote rm -r : behavior in the presence of ROMFS

Open
#19,199 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement tools
Dominant language
C
Stars
22.1k
Forks
9k
Avg merge
6d 4h
Merged PRs (30d)
16

Description

Description

I have gotten used to mpremote rm -rv : to clear out the filesystem for those boards that do not have an "erase flash" option in the firmware loader.

Recently that has become a stumbling block when device have ROMFS
mpremote then raises : mpremote: rm: ./rom: No such file or directory.
Which is a terminating error - and stops the recursive removal,
and requires subsequent one-by-one removal of the remain files and folders.

(micropython) jos@SB26:~/micropython/tools/mpremote/tests$ mpremote rm -rf :
rm :
mpremote: rm: ./rom: No such file or directory.
(micropython) jos@SB26:~/micropython/tools/mpremote/tests$ mpremote tree
tree :
:/
├── file1.txt
├── file3.txt
├── lib
│   ├── __future__.mpy
│   ├── __future__.py
│   ├── boardname.py
│   ├── createstubs.mpy
│   ├── createstubs.py
│   ├── createstubs_db.mpy
│   ├── createstubs_db.py
│   ├── createstubs_mem.mpy
│   ├── createstubs_mem.py
│   └── modulelist.txt
├── modulelist_exclude.txt
├── petstore.py
├── rom
│   ├── bar.mpy
│   ├── foo.mpy
│   └── vector-text.svg
└── udp_client.py

I think the best way to handle this is for mpremote to:

  • treat this error on a /romxx folder as a non-blocking error , but log it as an error
  • stop traversing that folder
  • continue the rest of the rm -r
Code Size

no FW size impact

Implementation

I intend to implement this feature and would submit a Pull Request if desirable

Code of Conduct

Yes, I agree

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating mpremote's recursive rm handling and reproduce mpremote rm -rf : with a device containing a ROMFS directory. Verify that the ROMFS traversal error is logged, that traversal of that directory stops, and that removal continues for the remaining filesystem entries.

Written by the indexing model from the issue text.

Assessment

Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.