Skip to content
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

Ensure tests/setup.sh is only ever run inside the test-image #3552

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pmatilai
Copy link
Member

This can do dangerous stuff, its better not to even pretend it can be run from outside the image. Add a safeguard and drop the pretense of $DESTDIR support. Makes it much nicer too.

Pretending this can be meaningfully run outside the image is just that,
pretense. When it also makes things more complicated for no benefit,
it's just a bad idea. Drop it, and clarify the running environment in the
comments.
The setup can do any number of dangerous things like nuking parts of
your system, make sure nobody accidentally runs it by placing a flag
file from make_install and checking on setup.sh.
@pmatilai pmatilai requested a review from a team as a code owner January 31, 2025 13:00
@pmatilai pmatilai requested review from ffesti and removed request for a team January 31, 2025 13:00
mkdir -p $DESTDIR/build
ln -sf ../data/SOURCES $DESTDIR/build/
# Make sure nobody runs this accidentally outside the environment
if [ ! /.rpmtestsuite ]; then
Copy link
Contributor

@dmnks dmnks Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, this is missing an -f. Without it, the conditional is always false (i.e. the file isn't actually required to exist for the script to continue) 😅

It's funny because this is the kind of thing that you just don't want to test locally 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants