Skip to content

fix: check disk space on the work directory filesystem - #4846

Open
cfilipescu wants to merge 1 commit into
actions:mainfrom
cfilipescu:fix/work-directory-disk-space
Open

cfilipescu wants to merge 1 commit into
actions:mainfrom
cfilipescu:fix/work-directory-disk-space

Conversation

@cfilipescu

Copy link
Copy Markdown

On Linux, Directory.GetDirectoryRoot(workDirectory) returns /, so the low-disk-space warning checks the root filesystem even when the runner's work directory is on another mount. This produces false warnings on immutable/composefs roots and can miss low space on a separate work filesystem.

Pass the full work directory to DriveInfo. .NET's Unix implementation preserves this path and passes it to statfs/statvfs, so the kernel checks the filesystem backing the directory, including when the path traverses a symlink. No additional native interop is needed.

Fixes #4380.

Validation:

  • cd src && ./dev.sh format
  • cd src && ./dev.sh test: all 1,165 tests passed on Linux with .NET SDK 8.0.427.
  • Isolated regression harness using CheckDiskSpaceAsync extracted verbatim from the original and updated source, with a nested work directory on a 16 MiB tmpfs: the original code misses the warning at a 32 MiB threshold; the fix reports 16 MiB available. An 8 MiB threshold produces no warning. Both cases also pass through a symlink to the work directory.

@cfilipescu
cfilipescu requested a review from a team as a code owner November 9, 2026 18:29
@cfilipescu
cfilipescu force-pushed the fix/work-directory-disk-space branch from 052a4ce to f036318 Compare November 9, 2026 18:35
@cfilipescu cfilipescu changed the title Fix disk space check for work directories on separate filesystems fix: check disk space on the work directory filesystem Nov 9, 2026
@cfilipescu

Copy link
Copy Markdown
Author

@salmanmkc @nikola-jokic @TingluoHuang

Any feedback on this PR? I feel like it's an easy review, but it can improve the github-runner on the Fedora IoT system, which is an immutable system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False disk space warning on immutable/composefs root filesystems (Directory.GetDirectoryRoot always returns / on Linux)

1 participant