Skip to content

deleter: handle non-openpilot created files - #94

Closed
elkoled wants to merge 7 commits into
masterfrom
pr-37354
Closed

elkoled wants to merge 7 commits into
masterfrom
pr-37354

Conversation

@elkoled

@elkoled elkoled commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Upstream PR: commaai/openpilot pull/37354


Summary

Fixes 30102. The deleter would ignore (or potentially crash on) non-standard entries in the log root directory, such as .tar.gz archives, broken symlinks, and other files a user might place there.

Changes to deleter.py:

  • Before processing segment directories, scan for non-directory entries (regular files, broken symlinks, FIFOs) and remove them with os.remove()
  • Wrap the .lock file check (os.listdir) in try/except to handle race conditions where a directory is removed between listing and processing

New tests in test_deleter.py:

  • test_delete_stray_file — .tar.gz archive in log root
  • test_delete_broken_symlink — symlink to non-existent target
  • test_delete_valid_symlink_to_file — symlink pointing to a real file
  • test_delete_empty_file — zero-byte file
  • test_delete_hidden_file — dotfile (.hidden_temp)
  • test_delete_fifo — named pipe
  • test_stray_files_deleted_before_segments — stray files cleaned up alongside segments
  • test_mixed_entries_no_crash — combination of segments, stray files, symlinks, FIFOs, and empty directories

Test plan

  • Existing deleter tests pass (no behavior change for normal segment directories)
  • New robustness tests pass with the updated deleter
  • Verified broken symlink detection uses os.path.lexists (not Path.exists)

sshane and others added 7 commits February 23, 2026 01:21
* disable forget for tethering

* nets

* put in wifiman

* batch

* revert

* draw
…37344)

* disable forget for tethering

* nets

* put in wifiman

* batch

* Revert "batch"

This reverts commit 9af20c1.

* clean up

* more

* more
* disable forget for tethering

* nets

* put in wifiman

* batch

* revert

* clean up
Clean up stray files, broken symlinks, FIFOs, and other non-directory
entries that listdir_by_creation skips. Also wrap the lock-file check
in try/except to handle race conditions and permission errors.

Fixes commaai30102

Signed-off-by: SolariSystems <solari@solari.systems>
Tests the deleter with stray files (.tar.gz), broken symlinks,
valid symlinks to files, empty files, dotfiles, FIFOs, and
mixed combinations of all entry types alongside normal segments.

Signed-off-by: SolariSystems <solari@solari.systems>
@github-actions

Copy link
Copy Markdown

Process replay diff report

Replays driving segments through this PR and compares the behavior to master.
Please review any changes carefully to ensure they are expected.

✅ 0 changed, 66 passed, 0 errors

@github-actions

Copy link
Copy Markdown

This PR has had no activity for 24 days. It will be automatically closed in 7 days if there is no activity.

@github-actions github-actions Bot added the stale label Mar 25, 2026
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.

1 similar comment
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

This PR has been automatically closed due to inactivity. Feel free to re-open once activity resumes.

@github-actions github-actions Bot closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants