pt-stalk warns about bad "find" usage

Bug #942114 reported by Marcos Albe
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
Medium
Brian Fraser

Bug Description

When running like:

kolita@lilith:/tmp$ ./pt-stalk --log=/tmp/pt-stalk-21884.log --pid=/tmp/pt-stalk-21884.pid --dest=/tmp/pt-stalk-collected-21884 --function=/tmp/slow-query-detect.sh for every iteration it shows:

...
2012_02_27_15_30_49 Check results: Threads_running=0, matched=no, cycles_true=0
find: warning: you have specified the -depth option after a non-option argument -type, but options are not positional (-depth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

2012_02_27_15_30_50 Check results: Threads_running=0, matched=no, cycles_true=0
find: warning: you have specified the -depth option after a non-option argument -type, but options are not positional (-depth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
...

lilith:/tmp$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.10
Release: 10.10
Codename: maverick

lilith:/tmp$ uname -a
Linux lilith 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux

lilith:/tmp$ ./pt-stalk --version
pt-stalk 2.0.3

lilith:/tmp$ perl --version
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
(with 40 registered patches, see perl -V for more detail)

Related branches

tags: added: pt-stalk
tags: added: wrong-option
Changed in percona-toolkit:
status: New → Triaged
Changed in percona-toolkit:
milestone: none → 2.1.4
importance: Undecided → Medium
Brian Fraser (fraserbn)
Changed in percona-toolkit:
assignee: nobody → Brian Fraser (fraserbn)
Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: Triaged → In Progress
Revision history for this message
Aurimas Mikalauskas (aurimas-mikalauskas) wrote :

Note also that -depth doesn't have an argument, there should be an integer specifying a depth for a search.

Revision history for this message
Aurimas Mikalauskas (aurimas-mikalauskas) wrote :

my bad, it is -maxdepth that would require an argument, -depth does not. Simply moving -depth before -type does the right thing:

--- /usr/bin/pt-stalk 2012-08-24 06:46:38.000000000 -0300
+++ pt-stalk 2012-08-24 07:00:00.000000000 -0300
@@ -1037,8 +1037,8 @@
    if [ -d "$oprofile_dir" ]; then
       # "pt_collect_" here needs to match $CMD_OPCONTROL --save=pt_collect_$p
       # in collect(). TODO: fix this
- find "$oprofile_dir" -type d -name 'pt_collect_*' \
- -depth -mtime +$retention_time -exec rm -rf '{}' \;
+ find "$oprofile_dir" -depth -type d -name 'pt_collect_*' \
+ -mtime +$retention_time -exec rm -rf '{}' \;
    fi
 }

Revision history for this message
Brian Fraser (fraserbn) wrote :

Aurimas: Thanks for the followup! That's practically the fix on the branch, now I have outside confirmation that it works : D

Brian Fraser (fraserbn)
Changed in percona-toolkit:
status: In Progress → Fix Committed
Brian Fraser (fraserbn)
summary: - bad "find" usage in pt-stalk
+ pt-stalk warns about bad "find" usage
Brian Fraser (fraserbn)
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-486

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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