-
Notifications
You must be signed in to change notification settings - Fork 542
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
An uncaught exception when add_copy_spec adds big files twice and reaches sizelimit #3686
Comments
Would something like this be ok? |
That will work only for a standalone plugin trying to grab the same file "twice". Original problem would be fixed, while the other issue behind apache.py#L64 would remain there. No strong preference.. |
I had some time to look at that "better approach". I'm probably missing a lot, but I think that the entries added by |
I feel the requirement to have a all-plugins-wide solution is too strong when we respect plugin's independence. So resolving the problem inside a plugin seems reasonable compromise to me. The main...pierg75:pier-sosreport:do_not_copy_again_tailed_files will result in collecting just shorter content of the "conflicting" file, right? That can be OK, or maybe we can collect whole file (which would mean replacing symlink by full file, removing I would vote for the proposed patch as a sufficient solution. |
Under specific circumstances, collecting files from
self.add_copy_spec(["/var/log/foo.*", "/var/log/foo.bar"])
raises plugin's uncaught exceptionValueError: path .. exists and is not a symbolic link
.Reproducer:
/var/log/foo.bar
file/var/log/foo.txt
fileself.add_copy_spec(["/var/log/foo.*", "/var/log/foo.bar"])
sos report -o YOURPLUGIN --batch --build --log-size=60
The problem is, collecting
/var/log/foo.*
will collect whole/var/log/foo.txt
and tail of/var/log/foo.bar
, which creates the symlinkvar/log/foo.bar -> sos_strings/....
. BUT thensos report
attempts to collect whole/var/log/foo.bar
that is under the limit alone, and fails..The easiest approach is to ensure no such "duplicit copy_spec entries" can exist (see #3685), what is another requirement to plugin authors. Better approach would be overwrite symlinks to
sos_strings
(which means we collected tails instead of whole file) by full files - and dont raise exception "I want to create symlink (for a shorter file) but a real file (with bigger content) exists".The "better approach" can have some gotchas I dont oversee. But it would resolve the problem of different plugins collecting same file and stepping on each other's toes (cf. https://github.com/sosreport/sos/blob/main/sos/report/plugins/apache.py#L64 as our "reaction").
The text was updated successfully, but these errors were encountered: