pt-ioprofile leaves behind temp directory
Bug #940733 reported by
Baron Schwartz
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Brian Fraser |
Bug Description
If pt-ioprofile exits with an error (i.e. strace isn't installed), it never cleans up its temp directory. This might affect other tools too.
What we should probably do is use this standard shell-scripting idiom:
TMPDIR=
trap 'rm -rf "${TMPDIR}" >/dev/null 2>&1' EXIT
This can get a little bit fancier as well; I've seen some places online where subsequent creations of other temp files will add the filename to a list that the trap command is supposed to remove, etc. We might not need this level of fanciness.
Related branches
lp:~percona-toolkit-dev/percona-toolkit/fix-940733-pt-ioprofile-clean-tempdir-on-error
- Daniel Nichter: Approve
-
Diff: 18 lines (+7/-0)1 file modifiedbin/pt-ioprofile (+7/-0)
tags: | added: pt-ioprofile |
Changed in percona-toolkit: | |
status: | Confirmed → In Progress |
importance: | Undecided → Medium |
assignee: | nobody → Brian Fraser (fraserbn) |
milestone: | none → 2.1.3 |
Changed in percona-toolkit: | |
status: | In Progress → Fix Committed |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The trap I showed won't work. We need to reverse the quotes:
trap "rm -rf '${TMPDIR}'......" EXIT