Skip to content

Commit

Permalink
tests/libtest: Fix logic error in creation test-repo file
Browse files Browse the repository at this point in the history
`test -n` would always be true.  Also while I have the patient open
let's make writing the file atomic.  Maybe someday I'll be motivated
enough to write an `O_TMPFILE` patch for bash.
  • Loading branch information
cgwalters committed Dec 1, 2017
1 parent 7c82088 commit 2abc8d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/common/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,13 @@ EOF
--define "_rpmdir $test_tmpdir/yumrepo/packages" \
--define "_buildrootdir $PWD")
(cd yumrepo && createrepo_c --no-database .)
if test -n yumrepo.repo; then
cat > yumrepo.repo << EOF
if test '!' -f yumrepo.repo; then
cat > yumrepo.repo.tmp << EOF
[test-repo]
name=test-repo
baseurl=file:///$PWD/yumrepo
EOF
mv yumrepo.repo{.tmp,}
fi
}

Expand Down

0 comments on commit 2abc8d5

Please sign in to comment.