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
[archive] symlinks not copied when directory of the same name created automatically before #1404
Comments
It's a result of how we handle intermediate path components in symbolic link resolution. I don't have a fix right now (or rather, there's a possible hack, and a much more complex fix). |
Fixed in commit 75d7590 |
Sadly this causes uncaught exceptions in several plugins. I was able to limit it to running only a plugin that collects only
and the error is:
Here, |
Fix the creation of leading path components for both paths that contain intermediate components that are symbolic links (with both absolute and relative targets), and those that contain only directory components. Since symlinks may link to other files, and other symlinks, it is necessary to handle these paths recursively and to include any intermediate symlinked directories, or symlink targets in the set of paths added to the archive. Related: #1404 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Since we may be dealing with paths that contain intermediate symlinked directories, it is necessary to canonicalize the path for the link target in order to eliminate additional levels of symbolic links, and to calculate the correct relative path to use within the archive. Related: #1404 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Reproducer (of Fedora):
returns in sos_logs/system-plugin-errors.txt :
The cause is:
yum
plugin does its work beforesystem
plugin here; callingsosreport
with 1 thread prevents this but it is just matter of renaming plugins to see the same error, then)yum
plugin copies the file (here target of a symlink but that doesnt matter much) from within/etc/sysconfig/rhn
_makedirs
method in https://github.com/sosreport/sos/blob/master/sos/archive.py#L347 creates relative destination directoryetc/sysconfig/rhn
instead of creating that as symlinksystem
plugin attempts to collect/etc/sysconfig/rhn
as a symlink, but detects it was collected as directory already, and raises the above exceptionTwo possible approaches:
_makedirs
method shallstat
all source subpaths before it creates them and if these are symlinks, it creates relevant symlink insteadsystem
plugin will not attempt to copy the symlink (and its content) as the symlink will be there, already - thus content of the symlink target will not be copiedThe text was updated successfully, but these errors were encountered: