-
Notifications
You must be signed in to change notification settings - Fork 537
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
Deal with CopySpecs that include kernel file system directories better #71
Comments
Can we not use the addForbiddenPath method to avoid these paths? |
Yes - that's what I've been doing for e.g. the deprecated sysctls, see commit 8db01b2 on rhel-6 branch. The problem with this approach is it gets hairy when you have a large number of such paths to manage. For now it may be the best way forward but there are a number of deprecated paths to avoid in proc and a much larger set of paths that we shouldn't attempt to copy in sysfs - sys is ten years old now and we really should up our game in terms of the information we collect from there. Right now we have bigger problems (our recursive copy function isn't safe for trees containing looping symlinks for e.g.) but this is something that I think we need to improve. |
Symlinks need special treatment when we're copying them into the report. The target path stored in the report must always be relative but we need to pass an absolute path for the target to the recursive doCopyFileOrDir() call that picks up the target for us. There are further problems with the current code but these cannot be fixed trivially: symbolic links to directories are currently ignored but are fundamental to the layout of file systems like sys (and to a lesser extent proc). Supporting this properly requires an algorithm that can cope with arbitrary symlink loops in the tree being copied and that correctly copies-in any links that may point outside of the tree currently being copied. See Issues #71, #72 for more details.
This is now about 90% fixed. We now handle symlinks that point to directories (but we don't copy the target by default - that way lies madness) and block and character device nodes and other special node types are now handled properly. This means it's now safe to do e.g.: self.add_copy_spec("/sys")
self.add_copy_spec("/dev")
self.add_copy_spec("/proc") There's still some work required to make this robust; in particular scooping up the whole of |
The fix for Issue #266 means that we handle unreadable files correctly. I'll do some more testing on this today and close the issue out if there's nothing more to do. |
Symlinks need special treatment when we're copying them into the report. The target path stored in the report must always be relative but we need to pass an absolute path for the target to the recursive doCopyFileOrDir() call that picks up the target for us. There are further problems with the current code but these cannot be fixed trivially: symbolic links to directories are currently ignored but are fundamental to the layout of file systems like sys (and to a lesser extent proc). Supporting this properly requires an algorithm that can cope with arbitrary symlink loops in the tree being copied and that correctly copies-in any links that may point outside of the tree currently being copied. See Issues sosreport#71, sosreport#72 for more details.
Currently scooping up a whole directory tree from /sys or /proc can trigger lots of ugly errors in -v mode. There's also an associated problem of triggering dmesg warnings when we touch deprecated files (e.g. several ipv6 sysctls).
There's a few ways we could deal with this:
The last is probably a more maintainable way to cope with these problems long-term but in the short term the others are much easier to implement with our current structure.
The text was updated successfully, but these errors were encountered: