libcnb.rs
libcnb.rs copied to clipboard
libcnb-test: `app::copy_app` does not preserve symlinked directories
Iff an app_dir_preprocessor
is set in the TestConfig
, app::copy_app
is used to copy the fixture directory to a temporary location, so that it can then be modified by the specified closure.
However, app::copy_app
currently uses fs_extra::dir::copy
to perform this copy, which is buggy.
Specifically, if the fixture contains symlinks to directories, then during copying these symlinks are not preserved, and instead converted to real directories with duplicate contents of the original files.
This means:
- The temporary fixture no longer matches the original fixture, which depending on what the fixture is to be used for, may affect the intention of the test. (For example, imagine a test that checks the buildpack handles weird symlink situations correctly, except this test is now just testing normal files, defeating the purpose of the test.)
- Adding an
app_dir_preprocessor
is no longer a transparent thing - and actually affects the fixture even before a single line of code is written in the passed closure. This seems like something that could cause confusion when debugging.
I've filed a bug upstream (https://github.com/webdesus/fs_extra/issues/61), however this seems like yet another reason we should drop this crate and implement the copying ourselves for this simple single use-case.