Skip to content

to_origin_dir_path truncates directory names containing __bk #2210

Description

@Jay2006sawant

Describe the bug

trestle.common.trash.to_origin_dir_path() incorrectly truncates valid directory names that contain __bk.

The function currently splits each trash path segment on __bk and keeps only the first segment.
Because of that, a real directory name like alpha__bkbeta is recovered as alpha, which is wrong.

This is distinct from dotted-path issues (#2208 / #2187). It affects names containing the trash directory marker token itself.

To Reproduce

  1. Create a temporary trestle workspace with .trestle/.
  2. Create a directory named catalogs/alpha__bkbeta.
  3. Compute its trash directory path with:
    • trash.to_trash_dir_path(original_path)
  4. Create that trash path so reverse conversion can run.
  5. Convert back with:
    • trash.to_origin_dir_path(trash_path)
  6. Compare recovered path with original path.

Expected behavior

Recovered path should exactly match the original:
.../catalogs/alpha__bkbeta

Actual behavior

Recovered path is truncated:
.../catalogs/alpha

Verified reproduction output

trash path: /tmp/.../ws/.trestle/_trash/catalogs/alpha__bkbeta__bk
recovered origin: /tmp/.../ws/catalogs/alpha
matches original: False

Environment

  • OS: Linux
  • Python: 3.10.12
  • Repo state: current develop-based local checkout
  • Package context: local venv with compliance-trestle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions