Shell tools TMPDIR may break
Bug #945079 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
|
Low
|
Brian Fraser |
Bug Description
The tmpdir shell library uses the following:
else
local tool=`basename $0`
local pid="$$"
TMPDIR=
|| die "Cannot make secure tmpdir"
fi
This can break if $0 is "-bash", which I've seen. In this case basename will complain because of an unknown option -b. It could also happen if $0 is something like "/path/to/directory -withspace/
In addition, I wonder if we should use $TEMP instead of hard-coding /tmp/. On my Mac, for example, $TEMP is not set to /tmp/. If $TEMP isn't set for some reason, we could fall back to /tmp/ as a default.
Related branches
lp:~percona-toolkit-dev/percona-toolkit/fix-945079-tmpdir-should-use-TEMP
- Daniel Nichter: Approve
- Brian Fraser: Pending requested
-
Diff: 3247 lines (+617/-595)30 files modifiedbin/pt-ioprofile (+22/-22)
bin/pt-mext (+7/-7)
bin/pt-mysql-summary (+17/-17)
bin/pt-pmp (+9/-9)
bin/pt-sift (+17/-17)
bin/pt-stalk (+11/-11)
bin/pt-summary (+26/-26)
lib/bash/collect_mysql_info.sh (+2/-2)
lib/bash/collect_system_info.sh (+5/-5)
lib/bash/parse_options.sh (+7/-7)
lib/bash/report_mysql_info.sh (+2/-2)
lib/bash/report_system_info.sh (+11/-11)
lib/bash/summary_common.sh (+3/-3)
lib/bash/tmpdir.sh (+11/-11)
t/lib/bash/alt_cmds.sh (+2/-2)
t/lib/bash/collect.sh (+11/-11)
t/lib/bash/collect_mysql_info.sh (+33/-33)
t/lib/bash/collect_system_info.sh (+74/-74)
t/lib/bash/daemon.sh (+9/-9)
t/lib/bash/log_warn_die.sh (+8/-8)
t/lib/bash/parse_options.sh (+2/-2)
t/lib/bash/report_mysql_info.sh (+94/-94)
t/lib/bash/report_system_info.sh (+153/-153)
t/lib/bash/safeguards.sh (+12/-12)
t/lib/bash/summary_common.sh (+2/-2)
t/lib/bash/tmpdir.sh (+29/-7)
t/pt-ioprofile/summarize_strace.sh (+5/-5)
t/pt-ioprofile/tabulate_strace.sh (+5/-5)
t/pt-pmp/aggregate_stacktrace.sh (+19/-19)
util/test-bash-functions (+9/-9)
Changed in percona-toolkit: | |
status: | Confirmed → In Progress |
assignee: | nobody → Brian Fraser (fraserbn) |
milestone: | none → 2.1.2 |
tags: | added: shell-tools sys-cmd |
summary: |
- tmpdir library has potential bugs + Shell tools TMPDIR may break |
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.
Percona now uses JIRA for bug reports so this bug report is migrated to: https:/ /jira.percona. com/browse/ PT-769