Skip to content

dissect: add --manifest switch to generate a UAPI.16 manifest file fr… - #41990

Closed
poettering wants to merge 4 commits into
systemd:mainfrom
poettering:uapi16
Closed

poettering wants to merge 4 commits into
systemd:mainfrom
poettering:uapi16

Conversation

@poettering

@poettering poettering commented May 8, 2026 •

Copy link
Copy Markdown
Member

…om a directory tree

The UAPI.16 spec is being discussed here:

uapi-group/specifications#213

@poettering

Copy link
Copy Markdown
Member Author

Do not merge until the spec is also good to be merged.

@github-actions

github-actions Bot commented May 8, 2026 •

Copy link
Copy Markdown

Claude review failed (workflow run)

Claude review of PR #41990 (97448c7)

Must fix

  • Unused variable escaped — src/dissect/dissect.c:1348 — declared but never used in manifest_print_item(), will fail with -Werror
  • S_ISDIR(sx->stx_mask) should be S_ISDIR(sx->stx_mode) — src/dissect/dissect.c:1386 — uses wrong struct field for file type check, causing directories to incorrectly enter the hardlink processing path
  • fd leak on lseek failure in rm_rf_children — src/shared/rm-rf.c:313-315 — when REMOVE_REWIND lseek fails, returns -errno without closing the fd, violating the function's ownership contract
  • Non-UTF-8 filename aborts entire manifest — src/dissect/dissect.c:1585 — a single non-UTF-8 name makes sd_json_buildo() fail with -EUCLEAN and aborts the whole recurse_dir() walk

Suggestions

  • NULL from inode_type_to_string() — src/dissect/dissect.c:1397 — can return NULL for unknown inode types, producing a JSON null instead of a string
  • name_to_handle_at_try_fid hard failure — src/dissect/dissect.c:1418 — non-fatal errors (e.g. -EOPNOTSUPP) abort the entire manifest, could gracefully skip hardlink detection instead
  • Missing log on sd_json_buildo failure — src/dissect/dissect.c:1543 — error returned without logging, unlike the analogous call earlier in the file
  • stx_size accessed without STATX_SIZE mask check — src/dissect/dissect.c:1543 — in the S_IFREG case, sx->stx_size is used after only checking STATX_TYPE, inconsistent with mtree_print_item which checks both
  • --mtree-hash flag reused for manifest — src/dissect/dissect.c:1453 — the flag name and description reference mtree output only, but it now also controls manifest hashing
  • get_entry() helper has no failure guard — test/units/TEST-50-DISSECT.dissect.sh:1143 — if no entry matches, produces empty output leading to confusing assertion failures
  • --manifest on image only checks exit code — test/units/TEST-50-DISSECT.dissect.sh:1219 — output is discarded; consider verifying non-empty output or expected content
  • type vocabulary vs UAPI.16 spec — src/dissect/dissect.c:1578 — confirm inode_type_to_string() tokens (dir/lnk/chr/blk/fifo/sock) match the spec's type enum
  • Symlink target via contents/literal — src/dissect/dissect.c:1588 — confirm the spec sanctions reusing the regular-file contents/literal mechanism for symlink targets
  • python3 bind unguarded under errexit — test/units/TEST-50-DISSECT.dissect.sh:1125 — a bind failure aborts the whole test even though socket coverage is best-effort

Nits

  • Double blank line — src/dissect/dissect.c:1380-1382 — extra blank line between break; and case S_IFLNK:
  • Misleading error message — src/dissect/dissect.c:1427 — says "Failed to symlink" but the operation is readlinkat_malloc on the hardlink database
  • Pointer star style — src/dissect/dissect.c:1383 — const char* type should be const char *type
  • Operator spacing — src/dissect/dissect.c:1475 — colon +1 should be colon + 1
  • Hardcoded SHA256 for empty file — test/units/TEST-50-DISSECT.dissect.sh:1162 — could compute dynamically like done for regular.txt
  • Hardcoded symlink size — test/units/TEST-50-DISSECT.dissect.sh:1179 — "11" is strlen of target, would be more maintainable computed
  • Missing comma in man page — man/systemd-dissect.xml:272 — "Like --mtree this" should be "Like --mtree, this"
  • FID error message missing path — src/dissect/dissect.c:1395 — doesn't include the file path for debugging
  • Cycle avoidance startswith too broad — src/dissect/dissect.c:1525 — startswith(path, "Uapi16Manifest.") also skips non-manifest files
  • Redundant db_path guard — src/dissect/dissect.c:1358 — rmdir_and_free(NULL) is a no-op, the if (hd->db_path) check is unnecessary
  • Possibly dead spec URL — man/systemd-dissect.xml:267 — the UAPI.16 spec is still an unmerged proposal, the linked URL may 404
  • JSON-Lines conversion assumes single-line records — test/units/TEST-50-DISSECT.dissect.sh:1146 — tr/head -n1 break if the dump ever emits multi-line records

Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
@bluca bluca added ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR labels May 8, 2026
@github-actions github-actions Bot removed the ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR label May 10, 2026
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/shared/rm-rf.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread test/units/TEST-50-DISSECT.dissect.sh Resolved
Comment thread test/units/TEST-50-DISSECT.dissect.sh Resolved
Comment thread man/systemd-dissect.xml Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread test/units/TEST-50-DISSECT.dissect.sh Resolved
@yuwata

yuwata commented May 26, 2026

Copy link
Copy Markdown
Member

Making this as draft, as this has the do-not-merge tag.

@yuwata
yuwata marked this pull request as draft May 26, 2026 19:00
@yuwata yuwata added needs-rebase and removed please-review PR is ready for (re-)review by a maintainer labels May 26, 2026
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread src/dissect/dissect.c Resolved
Comment thread man/systemd-dissect.xml Resolved
Comment thread test/units/TEST-50-DISSECT.dissect.sh Resolved
Comment thread test/units/TEST-50-DISSECT.dissect.sh Resolved
@poettering poettering added the downstream/amutable Issues that apply to downstream amutable distribution label Sep 21, 2026
@poettering

Copy link
Copy Markdown
Member Author

obsoleted by #44292 which includes this work and a lot more

@poettering poettering closed this Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants