-
Notifications
You must be signed in to change notification settings - Fork 519
Lsof improvements (show deleted as in lsof output) + files_only argument #1827
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Thanks for this, a couple of things fell out of it. Firstly, messing with the core linux extensions can have knock on effects, which is why we version everything. There is a way of updating it so that not everything breaks, but that one's a show stopper.
The other is just about appending to filenames to represent information about the file. If we're going to do that, it has to be unambiguously separable from the filename (ie, you could always tell what was the tag and what was the filename).
@@ -204,6 +207,9 @@ def do_get_path(cls, rdentry, rmnt, dentry, vfsmnt) -> Union[None, str]: | |||
# path would be /foo/bar/baz, but bar is missing due to smear the results | |||
# returned here will show /foo//baz. Note the // for the missing dname. | |||
return f"<potentially smeared> {path}" | |||
|
|||
if inode and inode.is_readable() and inode.is_valid() and inode.i_nlink == 0: | |||
path = f"{LinuxUtilities.deleted} {path}" |
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 tend to put constants into the constants.linux
module, as all caps? Again, I'm not sure it's worthwhile for a tag like this?
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.
what if the tag value will change in the future? I can see other modules rely on this tag to check specifics...
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.
not sure if it fits there, I have only seen constants from linux kernel header files
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.
Much improved, last little bits and then it should be good to go.
Improvements for Lsof to show deleted files as in lsof output on live system.
its probably shouldnt be in that function directly as its no longer mimic
prepend_path
kernel functionthis PR breaks commit 68b51e8 but it can easily be fixed if desired.