You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When archive._make_leading_paths is called to a path containing a symlink to an absolute path, the method creates a symlink outside the archive directory (to the absolute path of the destination of the symlink). Copying that archive to a different machine then causes broken symlink.
and see that /var/tmp/sosreport-myhostname-2019-06-25-wpyemcm/var/lib/mistral/config-download-latest is a symlink to /var/lib/mistral/overcloud, while the archive directory itself does not contain a copy of the logfile.
This works well for symlinks with relative destination. For absolute path destination, something like:
if os.path.isabs(target):
target = target.strip(os.path.commonpath([target, src_path])).strip(os.sep)
must be called in between. This will make the target relative from absolute.
BUT this works well only when target and src_path are in common subdirectory. If e.g. /var/lib/mistral/config-download-latest would be a symlink to /var/log, we must set target to ../../log and create that relative path via self._make_leading_paths first.
The above proposal is sufficient for the real world scenario (Openstack Instack having /var/lib/mistral/config-download-latest: symbolic link to /var/lib/mistral/overcloud per my understanding), but it is not ideal.
The text was updated successfully, but these errors were encountered:
Calling _make_leading_paths for a symlink with absolute symlink target
must create the symlink relative to the source. This will prevent
creating symlinks outside sosreport build dir.
Resolves: sosreport#1710
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Calling _make_leading_paths for a symlink with absolute symlink target
must create the symlink relative to the source. This will prevent
creating symlinks outside sosreport build dir.
Resolves: sosreport#1710
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
When
archive._make_leading_paths
is called to a path containing a symlink to an absolute path, the method creates a symlink outside the archive directory (to the absolute path of the destination of the symlink). Copying that archive to a different machine then causes broken symlink.Reproducer:
Now, call:
and see that
/var/tmp/sosreport-myhostname-2019-06-25-wpyemcm/var/lib/mistral/config-download-latest
is a symlink to/var/lib/mistral/overcloud
, while the archive directory itself does not contain a copy of the logfile.Root cause of the problem: https://github.com/sosreport/sos/blob/master/sos/archive.py#L221-L237 calls:
This works well for symlinks with relative destination. For absolute path destination, something like:
must be called in between. This will make the
target
relative from absolute.BUT this works well only when
target
andsrc_path
are in common subdirectory. If e.g./var/lib/mistral/config-download-latest
would be a symlink to/var/log
, we must settarget
to../../log
and create that relative path viaself._make_leading_paths
first.The above proposal is sufficient for the real world scenario (Openstack Instack having
/var/lib/mistral/config-download-latest: symbolic link to /var/lib/mistral/overcloud
per my understanding), but it is not ideal.The text was updated successfully, but these errors were encountered: