Skip to content

stat collects mount info even when it is not needed for the given output format #9072

@rlee287

Description

@rlee287

In the Stater struct of stat.rs, mount_list always gets populated if show_fs is false. However, the only function using the resulting list, find_mount_point, is only used for the m format specifier. The reading of mount point information in other contexts breaks assumptions made by security tools like AppArmor, with example breakage being reported at https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2127851 regarding an invocation of stat -c '0%#a' "$CONFIG_FILE" in wg-quick, with the mount point reading being blocked by an AppArmor profile for wg-quick and resulting in spurious warnings.

The logic around populating mount_list should be reworked so that it only attempts to gather that information if required by the format string for the information being outputted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions