Skip to content

Drive: disk parent, mmcblk/loop names, password lsblk/cancel - #12717

Open
chessing234 wants to merge 5 commits into
omacom:quattrofrom
chessing234:fold/drive-info-format-partition
Open

chessing234 wants to merge 5 commits into
omacom:quattrofrom
chessing234:fold/drive-info-format-partition

Conversation

@chessing234

@chessing234 chessing234 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Spot-check each folded PR's test plan still applies

Fixes #7974

Fixes #8918

@chessing234 chessing234 changed the title Drive: resolve to disk parent; name mmcblk/loop partitions correctly Drive: disk parent, mmcblk/loop names, password lsblk/cancel Sep 21, 2026
@llstrk

llstrk commented Sep 23, 2026

Copy link
Copy Markdown

Verified by source inspection: the disk/physical-partition lookup, digit-suffixed partition naming and cancelled-picker exit changes address the intended paths. No new production regression was established. One new test overstates support for directly queried device-mapper mappings.

Changed path Before This PR
Disk with an encrypted descendant Last descendant's parent can hide the disk model Query the disk itself; physical partitions resolve to their disk
Partition name for /dev/mmcblk0 /dev/mmcblk01 /dev/mmcblk0p1
Empty drive-picker selection Exit 0 Exit 1

Test/documentation correction: In drive-info-test.sh, the mapping case passes because the stub invents a parent for lsblk -dno PKNAME /dev/root. In util-linux v2.42, a directly queried dm device is a root without a whole-disk parent; -d suppresses dependency traversal and PKNAME is empty.

Direct dm query, source-derived behavior (not a hardware test):
new stub:  mapping -> partition -> disk model
lsblk -d: mapping -> empty PKNAME -> loop stops at mapping

This mapping limitation is pre-existing, not a regression in the disk/physical-partition fix. Suggested change: Make the stub and mapping claim reflect that scope, or implement mapping-aware traversal with an explicit policy for multiple backing devices if that capability is intended.


Review information

Test scope: Pinned head 1bbc2484; production/caller inspection and upstream util-linux source. Synthetic drive-info comparisons support the disk/partition result and mapping limitation. LUKS discovery was assessed against its exact filesystem-type filter and udev-backed metadata path. No real disks, formatting, encryption changes, udev inventory or interactive password UI were exercised.

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Automated AI review: Astra Medium initial inspection and synthesis; independent Opus 5.5 High and GPT 6 Sol Xhigh technical assessments; claims checked against source and targeted evidence, followed by a fresh Astra Medium editorial check.

@chessing234

Copy link
Copy Markdown
Contributor Author

toned down the dm mapping test claim

@chessing234

Copy link
Copy Markdown
Contributor Author

toning down the dm mapping test claim next

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 5907c5b3 against quattro, and all three fixes hold up on a worker VM built from the Omarchy ISO. No defects found and nothing pushed.

  • Drive info (omarchy-drive-info loses the drive model when a nested crypt/LVM layer exists (tail -n1 picks the deepest PKNAME) #7974): I made a disk with a vfat partition and a LUKS partition, and opened a crypt mapping on the LUKS one. On quattro, omarchy-drive-info for the disk and for the LUKS partition prints no model and only [crypto_LUKS]. On this branch both print Linux scsi_debug [vfat, crypto_LUKS]. Querying the mapping directly gives the same output before and after.
  • format-drive (format-drive builds the wrong partition name for mmcblk/loop devices, leaving the drive wiped but unformatted #8918): On quattro, format-drive /dev/loop0 wipes and partitions the device, then runs mkfs.exfat on /dev/loop01, which fails. It still prints "formatted". On this branch it formats /dev/loop0p1.
  • Drive password: If root's blkid cache is missing, or doesn't yet list a drive (for example one encrypted or plugged in after boot), blkid -t TYPE=crypto_LUKS returns nothing for a normal user. quattro then says "No encrypted drives available." The lsblk lookup on this branch finds the LUKS partition. I only read the cancel exit code change; I didn't run it.
  • Tests: ./test/cli passes, and so do the three drive test files. With each fix reverted, its new test fails. The full shell suite has 3 failures (ascii-test.sh, branding-about-animation-test.sh, omarchy-kernel-migration-test.sh), and they fail the same way on quattro.

I've linked #7974 and #8918 so they close when this merges.

The review was done by Claude Opus 5.5 alone. The second opinion (Codex Medium) didn't run because today's review budget was used up. This PR is labelled verified but not ready: a second-opinion review comes first, and after that it's the maintainer's call.

@jandrusk

jandrusk commented Oct 8, 2026

Copy link
Copy Markdown

For triage: as well as #7974 and #8918, the lsblk switch in omarchy-drive-password also fixes #9384 ("No encrypted drives available" from the unprivileged blkid call), so that issue can be closed with this PR. #9148 is an older open PR for the same omarchy-drive-info parent lookup (#7974). Only one of the two should land.

@omarchybot

Copy link
Copy Markdown
Collaborator

I looked at this again because it no longer merges into quattro, so the verified label came off. The head is still 5907c5b3. Since the last review, two of its three changes have been overtaken, and only the format-drive fix is still unique to this PR.

I didn't push anything or run anything on a worker this time. Resolving the conflict here would mean replacing this PR's copy of the password script with quattro's, and choosing between this PR and #9148 is the maintainer's call. A PR with just the format-drive change and its test would merge cleanly.

This review was done by Claude Opus 5.5, with Codex Medium as the second opinion. It was asked to compare the PRs without being told my answer, and it came to the same conclusion on all three parts. It can read my session, so its agreement is not guaranteed to be independent. This now waits on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

This PR fixes drive labels for disks with encrypted partitions and fixes partition names for devices such as mmcblk0 and loop0.

  • Drive details follow parent links to show the disk behind a partition.
  • Drive formatting builds the first partition path from the device name.

Reviews (1) · Last reviewed commit: "Merge upstream quattro." · Reviewed by Greptile

@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 21, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at 7bf8ba43, the merge of quattro into this branch. It merges cleanly again, so verified is back on. The merge took quattro's bin/omarchy-drive-password whole, so the drive-password changes are gone, including the cancel exit code. What's left is the drive-info fix (#7974) and the format-drive fix (#8918). The title and description still list the password changes, so they could be updated to match.

Compared with #9148. In my last comment I preferred the older #9148 for the drive-info fix. That was wrong, because I went by the dates the two PRs were opened. This exact fix, walking up with lsblk -dno PKNAME, was first in #7982 on 24 August, which was folded in here. #9148 opened on 30 August taking the first non-empty line of lsblk -no PKNAME. That fails when lsblk lists a mapping's row before the disk's, and it switched to -dno only on 1 October. The two fixes now behave the same, and the first correct one is the one carried here, so this is the PR to take for #7974. #9148 should not land as well.

Reviewed by Claude Opus 5.5, with Codex Medium as the second opinion. Codex found no defects in the change and also put this PR forward over #9148. I gave it the history above, so its agreement is not independent of my reasoning. It also said #8926 was still open, but #8926 was closed on 21 September when it was folded in here. Waiting on the maintainer.

omarchybot added a commit to AnPod/omarchy that referenced this pull request Nov 17, 2026
The stub moves to a scratch bin/ and format-drive runs with only that on PATH, as docs/testing.md has stubs done: a future step that skips sudo then finds no real command to aim at the block device the test picks, instead of running against it.

The mkfs-failure case now checks that mkfs.exfat was reached (it grepped for wipefs, which always runs first), and the refusal check's pass line no longer says the opposite of what it checks. The exact count of eight commands and the partition name copied from the code under test are gone: one breaks on any added step, and the other asserts the very naming omacom#12717 fixes, so it would go red on a correct loop or mmcblk name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@pi.dev>
dhh pushed a commit that referenced this pull request Nov 20, 2026
…a failure (#18784)

* format-drive: refuse non-block devices and report a failed format as a failure

format-drive ran every step unchecked, announced success whatever happened,
and accepted any path: a non-block argument made dd create a regular file
under /dev and the function still claimed the drive was formatted. The
device is now checked with -b before anything runs, a failing step stops
the sequence, and the success line prints only when mkfs.exfat succeeded.

Fixes #18760

* format-drive: run non-block refusal tests even without a block device

The refusal assertions only exercise /dev/no-such-drive and need no
hardware, so move them above the device-availability gate; only the
device-backed assertions stay gated (Greptile review fix).

* Keep format-drive's test honest and off the real device

The stub moves to a scratch bin/ and format-drive runs with only that on PATH, as docs/testing.md has stubs done: a future step that skips sudo then finds no real command to aim at the block device the test picks, instead of running against it.

The mkfs-failure case now checks that mkfs.exfat was reached (it grepped for wipefs, which always runs first), and the refusal check's pass line no longer says the opposite of what it checks. The exact count of eight commands and the partition name copied from the code under test are gone: one breaks on any added step, and the other asserts the very naming #12717 fixes, so it would go red on a correct loop or mmcblk name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@pi.dev>

* Check format-drive passes the label to mkfs.exfat

The mkfs check now looks for `-n POC`, so dropping the label from the command fails the test rather than passing while the announcement still names it. The stub's two exits become an if/else per the style guide, and the PATH comment says what the confinement covers: commands looked up by name, not absolute paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: muse-wonder via pi, thinking high <noreply@pi.dev>

* Partition in one parted call, and keep the test to the refusal

The three parted steps carried the same guard, so they run as one invocation with one. The test keeps the case that fails on the base branch, a path that is not a block device, and that nothing runs before the refusal; the rest needed a real device and restated each step.

Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test the failure paths again, against a stubbed real device

Keeping only the refusal left the fix's second half untested: reverting to announcing success after a failed mkfs.exfat would have passed. The test now runs format-drive on the first block device in /dev with only the sudo stub on PATH, after checking the stub is what will run, and checks a failed wipefs stops the sequence and a failed mkfs.exfat is reported as a failure, each after confirming the step was reached. With no block device it skips.

Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex Medium <noreply@openai.com>
Co-authored-by: muse-wonder via pi, thinking high <noreply@pi.dev>
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

4 participants