You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build_manifest: UnicodeDecodeError on small non-UTF-8 blobs #16
`scripts/emit_manifest.py:232` calls `run(["git", ..., "cat-file", "blob", sha])` for any regular blob ≤ 512 bytes to detect unlocked-mode git-annex pointers. `run()` (`scripts/emit_manifest.py:97`) wraps `subprocess.check_output(..., text=True)`, which decodes the blob as UTF-8.
If a dataset commits a non-UTF-8 file smaller than 512 bytes (a binary calibration sidecar, a thumbnail, etc.), `build_manifest()` crashes with:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
The entire publish workflow then dies before any output is written.
Reproduction
Add a small binary file at the BIDS root and tag it:
Discovered while authoring the binary-README test for PR #15 (epic nemarOrg/nemar-cli#618). The test fixture sidesteps the bug by padding payloads > 512 bytes; this issue tracks the real fix.
Proposed fix
The pointer-detection check only needs to compare the first ~50 bytes against the literal `/annex/objects/` pattern. Read the blob as bytes (omit `text=True`) and decode only the leading prefix with `errors="replace"` or `errors="ignore"`. Optionally skip the check entirely if the first byte isn't `/`.
Impact
Latent for now: most BIDS datasets don't have <512-byte binary files at submission time, so it hasn't been hit in production.
Will hit if anyone publishes a dataset with binary calibration files (common in MEG/EEG) ≤ 512 bytes.
Activity