feat(os): volumes - Volume.all, space and containing #523
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/128-os-volumes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #128
Task
OS slice 4 of docs/design/OS.md (torbscript loop item #128):
Volume.all,Volume.space,Volume.containing,VolumeKind,VolumeSpace, with the Windows, Linux and macOS halves.What
feat(os): volumes and mount enumeration: the types,Volume.allover/proc/self/mountinfo(pureparseMountInfo),getmntinfo(macOS, text from C) andFindFirstVolumeW/GetVolumeInformationW(Windows); nativesWindows.volumeMountPoints,Windows.volumeInformation,Bsd.mountedFileSystems.feat(os): Volume.space, Volume.containing and the volumes docs: nativesWindows.volumeSpace(GetDiskFreeSpaceExW) andPosix.fileSystemSpace(statvfs);Volume.space;Volume.containing(absolute + normalized path, probed so a missing path isOsError.Missing, longest mount-point prefix via purevolumeContaining); host tests;docs/standard-library/os.mdand the skills copies; OS.md slice 4 Done; NATIVES.md rows (keep 196, total 552); generatedmachine_natives.c/torb_natives.h.Verification
CI only: nothing was compiled on the worker host (no
torbthere), so expect fixes on this branch from the first CI run. Commit messages checked withtools/check-commits.sh.CI red on
6cc1ce3: tier A (linux-x64), tools/release-sync and tools/registry (linux-x64), the playground (torb as WebAssembly), gates - cause not visible to me (job logs not readable with the review token). The PR body expects fixes after the first CI run; push them and I will review the new head.b18f48067cbe3ceb3121Fixed on
be3ceb31(rebased on main142293fd), from the logs of the first CI run: calls written as commands in operand/head positions now have parentheses (Path.from(...),Fail(...),Some(...),kindOfFileSystem(...),mountPointsOf(...)); no?.on aResultinVolume.containing; the discardedspaceAtresult isconst _ =; the space test awaits at the top level; command-call and joined-line forms fortorb format --check;std/ossummary shortened to 237 characters (docs check). Tier A errors were all in the five volumes files, so the failing compiler/tests whole-repository check, the playground and thestd/oslanes followed from them. The one registry test failure (file: registry has no accounts,loginToDirectory.code == 1) is not visible in the volumes code: if it stays red on this head it is the next thing to look at. Nothing could be compiled on the worker host, so CI on this head is the check.68219fee6c92a7de01d9Approved on
92a7de0(CI combined status success: tier A/B, tools, playground, C agreement, gates, pdisc, commit messages).Checklist
volumes.test.trbcovers the pure halves (mountinfo parser incl. escapes, optional fields, malformed lines; getmntinfo parser; drive types;volumeContainingincl. nesting, same-place, case);host.test.trbcoversVolume.containing/space/allon the real machine.\134decoded last, longest-prefix with later-wins,statvfsf_frsizefallback, bsd buffer sizing and Windows buffer bounds read correctly.SEM_FAILCRITICALERRORSavoids dialogs.Non-blocking
runtime/os/windows.c,runtime/os/bsd.cand their .trb halves are not compiled by CI on this head; the first run on those runners is the check.torb_os_windows_append_linesilently drops a mount path once the 32768-char buffer is full; harmless in practice.Volume.containingdoc says links are not followed, but the existence probe usesstatvfs, which follows them, so a dangling link isMissing. Worth one doc sentence.torb_os_bsd_mounted_file_systemsreturnserrnoas the failure whengetmntinforeturns <= 0, which may be 0.