Skip to content

[Breaking change]: DriveInfo.DriveFormat Linux values. #46831

Open
@tmds

Description

@tmds

Description

On Linux systems, DriveInfo.DriveFormat changes to return Linux kernel filesystem type strings. These strings represent a more granular representation of the filesystem type than the previous implementation. For example: it is possible to distinguish between ext3 and ext4.

Version

.NET 10 Preview 6

Previous behavior

.NET returned a string representation by mapping magic constants to strings. Because several different filesystem types use the same magic constants, it was not possible to distinguish between them.

New behavior

.NET returns the string representation used by the Linux kernel for the filesystem type.

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

Provide more granular filesystem type information.

Recommended action

Check and update usages of System.IO.DriveInfo.DriveFormat to include the Linux filesystem type strings. On a Linux system, the type strings of the drives can be read from the /proc/self/mountinfo file. On each line, the filesystem type string is the first field after the --separator.

For cgroup file systems, DriveFormat changes from cgroupfs/cgroup2fs to cgroup/cgroups. For the SELinux filesystem the value changes from selinux to selinuxfs.

Feature area

Core .NET libraries

Affected APIs

System.IO.DriveInfo.DriveFormat

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions