diff options
author | Jean Delvare <jdelvare@suse.de> | 2019-03-14 16:42:37 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2019-03-14 16:42:37 +0100 |
commit | cb1c50af1792ea482857d82dec825e4312657410 (patch) | |
tree | 1ba73f48482f8925acad7ed19b472595a640254e /test/import2.test | |
parent | 991d4e55ad6409b4b3fb893dfbab3907601ba594 (diff) | |
download | quilt-cb1c50af1792ea482857d82dec825e4312657410.tar.gz |
test: Prevent test cases from escaping
By default, we continue running tests even after a failure, to make
diagnostics easier. If a chdir command fails, there is a chance that
subsequent chdir commands could accidentally move outside the
temporary directory where the test is being run, and then we start
messing up with the host's files.
In general, the consequence is to leave garbage files and directories
behind. However, some of the files can have side effects (for example
a "series" file or a "patches" directory could confuse quilt later),
and in theory this could also lead to the corruption or deletion of
existing files, which is pretty bad.
So add a safety check after every chdir command that we are still
inside the test case's working directory. If not, stop the test
immediately.
Note: this is not about being 100% safe and bullet-proof. The only
way to achieve this would be to use chroot or even containers. We
still need to trust the test cases to not do anything nasty on
purpose. This is only protecting against good test cases going wild on
failure.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'test/import2.test')
0 files changed, 0 insertions, 0 deletions