-
-
Notifications
You must be signed in to change notification settings - Fork 827
Open
Description
Summary
do_debug_format_objinsrc/borg/archiver/debug_cmd.py:268hardcodes the repo object type toROBJ_FILE_STREAM- The TODO at line 268:
# TODO: support misc repo object types other than ROBJ_FILE_STREAM - This breaks the debug round-trip (
get-obj → parse-obj → [edit] → format-obj → put-obj) for non-file-stream objects borg debug parse-objalready handles all object types (usesROBJ_DONTCARE) and outputs the"type"field in the metadata JSONRepoObj.format()is fully generic and accepts anyro_type
Current state
| Debug command | Object type support |
|---|---|
debug parse-obj |
All types (ROBJ_DONTCARE) |
debug format-obj |
ROBJ_FILE_STREAM only (hardcoded) |
debug get-obj / debug put-obj |
Raw bytes (no type handling) |
All 6 repo object types exist (constants.py): ROBJ_MANIFEST, ROBJ_ARCHIVE_META, ROBJ_ARCHIVE_CHUNKIDS, ROBJ_ARCHIVE_STREAM, ROBJ_FILE_STREAM,
ROBJ_DONTCARE.
Proposed fix
Extract ro_type from the metadata dict, matching the pattern already used in repo_compress_cmd.py:46:
ro_type = meta.pop("type", ROBJ_FILE_STREAM)
data_encrypted = repo_objs.format(id=id, meta=meta, data=data, ro_type=ro_type)
┌────────────────────────────────┬───────────────────────────────────────────────────────────────────────────┐
│ File │ Change │
├────────────────────────────────┼───────────────────────────────────────────────────────────────────────────┤
│ src/borg/archiver/debug_cmd.py │ Extract ro_type from metadata JSON instead of hardcoding ROBJ_FILE_STREAM │
└────────────────────────────────┴───────────────────────────────────────────────────────────────────────────┘References
- TODO in src/borg/archiver/debug_cmd.py:268
- Existing pattern: src/borg/archiver/repo_compress_cmd.py:46
- Original debug commands: add debug commands for repoobj id_hash/parse/format #7406
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels