New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change local and remote file system detection #1573
Conversation
The previous way was unreliable because some remote file systems were detected as local. For example, the SMB mounts that used paths with backslashes were not recognized as remote file systems. The `getmntent` function returns a file system type, so we can use it for detection of remote file systems. The new solution is inspired by systemd, function `fstype_is_network`: https://github.com/systemd/systemd/blob/21fd6bc263f49b57867d90d2e1f9f255e5509134/src/basic/mountpoint-util.c#L290 It also handles FUSE file systems. Also, we are canceling the TODO idea of providing the data at the build time and removing the dead code (if 0). Resolves: RHBZ#1869195
const char *fstype = ment->mnt_type; | ||
if (oscap_str_startswith(fstype, "fuse.")) { | ||
fstype += strlen("fuse."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. I would suggest to add a comment that points to the source of the inspiration, so it could be easily revised later.
Alternatively, we could consider calling the systemd function if it is possible, but that may be too risky, so maybe not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matejak I have added a comment.
"ncpfs", | ||
"ncp", | ||
"nfs", | ||
"nfs4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an issue with gpfs
filesystems, so I would add that one here. This link indicates that gpfs
is the right type string: https://www.ibm.com/developerworks/systems/library/es-gpfs/index.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matejak I have added gpfs to the list.
that points out to the original source for reference
This link indicates that gpfs is the right type string: https://www.ibm.com/developerworks/systems/library/es-gpfs/index.html Resolves: RHBZ#1840575, RHBZ#1840578
This is a nice, streamlined approach for the local/network logic. Thank you for the PR! |
The previous way was unreliable because some remote file systems were
detected as local. For example, the SMB mounts that used paths with
backslashes were not recognized as remote file systems. The
getmntent
function returns a file system type, so we can use it for detection of
remote file systems.
The new solution is inspired by systemd, function
fstype_is_network
:https://github.com/systemd/systemd/blob/21fd6bc263f49b57867d90d2e1f9f255e5509134/src/basic/mountpoint-util.c#L290
It also handles FUSE file systems. Also, we are cancelling the TODO idea
of providing the data at the build time and removing the dead code (if
0).
GPFS is also treated as remote system because we have multiple reports that GPFS shouldn't be scanned.
Resolves: RHBZ#1869195, RHBZ#1870087, RHBZ#1840575, RHBZ#1840578