pt-ioprofile leaves behind temp directory

Bug #940733 reported by Baron Schwartz
6
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=$(mktemp....)
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.

Tags: pt-ioprofile
tags: added: pt-ioprofile
Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

The trap I showed won't work. We need to reverse the quotes:

trap "rm -rf '${TMPDIR}'......" EXIT

Changed in percona-toolkit:
status: Confirmed → In Progress
importance: Undecided → Medium
assignee: nobody → Brian Fraser (fraserbn)
milestone: none → 2.1.3
Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: In Progress → Fix Committed
Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-484

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.