tests: remove temporary file
Florian Westphal
maintainerPATCH 1/1 tests: remove temporary file
0002-relative leaves a temporary file in the current working directory, at the time the "trap" argument is expanded, tmpfile2 isn't set.
Signed-off-by Florian Westphal <[email protected]>
--- tests/shell/testcases/include/0002relative_0 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tests/shell/testcases/include/0002relative_0 +7 -2
@@ -7,9 +7,14 @@ if [ ! -w "$tmpfile1" ] ; then exit 77 fi -trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted -set -e +cleanup() +{ + rm -f "$tmpfile1" "$tmpfile2" +} + +trap cleanup EXIT +set -e tmpfile2=$(mktemp -p .) RULESET1="add table x"
Signature · 1 line
2.48.1
Quoted 5 lines · Florian Westphal
0002-relative leaves a temporary file in the current working directory, at the time the "trap" argument is expanded, tmpfile2 isn't set.
Signed-off-by Florian Westphal <[email protected]>
Quoted 29 lines
--- tests/shell/testcases/include/0002relative_0 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)tests/shell/testcases/include/0002relative_0 +7
-2@@ -7,9 +7,14 @@ if [ ! -w "$tmpfile1" ] ; then exit 77 fi -trap "rm -rf $tmpfile1 $tmpfile2" EXIT # cleanup if aborted -set -e +cleanup() +{ + rm -f "$tmpfile1" "$tmpfile2" +} + +trap cleanup EXIT +set -e tmpfile2=$(mktemp -p .) RULESET1="add table x"Signature · 1 line
2.48.1