diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-08-31 12:58:01 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-09-03 16:44:44 +0100 |
commit | 75d759066e8ee0a469abc37f48f7bfcdfe8182b5 (patch) | |
tree | bb7fa0698ff6b592398947fe3b052318596bbbe1 /LICENSE | |
parent | ca422720b74181b2433473428e29e90af59b3cf8 (diff) | |
download | sos-75d759066e8ee0a469abc37f48f7bfcdfe8182b5.tar.gz |
[archive] replace FileCacheArchive._makedirs()
The Python os.makedirs() implementation is inadequate for sos's
needs: it will create leading directories given an intended path
destination, but it is not able to reflect cases where some of
the intermediate paths are actually symbolic links.
Replace the use of os.makedirs() with a method that walks over
the path, and either creates directories, or symbolic links (and
their directory target) to better correspond with the content of
the host file system.
This fixes a situation where two plugins can race in the archive,
leading to an exception in the plugin that runs last:
- /foo/bar exists and is a link to /foo/bar.qux
- One plugin attempts to collect /foo/bar
- Another plugin attempts to collect a link /foo/qux -> /foo/bar/baz
If the 2nd plugin happens to run first it will create the path
"/foo/bar" as a _directory_ (via _makedirs()). Since the archive
now checks for matching object types when a path collision occurs,
the first plugin will arrive at add_dir(), note that "/foo/bar" is
present and is not a symbolic link, and will raise an exception.
Correct this by ensuring that whichever plugin executes first, the
correct link/directory path structure will be set up.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'LICENSE')
0 files changed, 0 insertions, 0 deletions