pt-stalk find -warn option is not portable

Bug #1494082 reported by Jervin R on 2015-09-10
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
Frank Cizmich

Bug Description

When running on FreeBSD where find has no -warn option, you get an error below and stalk data is not monitored for purge.

+ find /var/lib/pt-stalk -warn -type f -mtime +30 -exec rm -f '{}' ';'
find: -warn: unknown primary or operator

I do see code like this (version 2.2.11):

   1210 purge_samples() {
   1211 local dir="$1"
   1212 local retention_time="$2"
   1213
   1214 # Delete collect files which more than --retention-time days old.
   1215 find "$dir" -warn -type f -mtime +$retention_time -exec rm -f '{}' \;
   1216
   1217 local oprofile_dir="/var/lib/oprofile/samples"
   1218 if [ -d "$oprofile_dir" ]; then
   1219 # "pt_collect_" here needs to match $CMD_OPCONTROL --save=pt_colle
ct_$p
   1220 # in collect(). TODO: fix this
   1221 find "$oprofile_dir" -warn -depth -type d -name 'pt_collect_*' \
   1222 -mtime +$retention_time -exec rm -rf '{}' \;
   1223 fi
   1224 }

Indeed, option is not supported on FreeBSD:

root@freebsd91:/usr/home/openxs # find /var/lib/pt-stalk -warn -type f -mtime +30 -exec rm -f '{}' ';'
find: -warn: unknown primary or operator
root@freebsd91:/usr/home/openxs # uname -a
FreeBSD freebsd91 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec 4 06:55:39 UTC 2012 <email address hidden>:/usr/obj/usr/src/sys/GENERIC i386
root@freebsd91:/usr/home/openxs #

Changed in percona-toolkit:
status: New → Confirmed
Frank Cizmich (frank-cizmich) wrote :

The warnings seem superfluous.

From man page:
"These warnings apply only to the command line usage, not to any conditions that find might encounter when it searches directories."

Removed them.

Changed in percona-toolkit:
status: Confirmed → Fix Committed
importance: Undecided → Medium
assignee: nobody → Frank Cizmich (frank-cizmich)
milestone: none → 2.3.1
tags: added: pt-stalk
Changed in percona-toolkit:
milestone: 2.3.1 → 2.2.16
Changed in percona-toolkit:
status: Fix Committed → Fix Released

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

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

Other bug subscribers