Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1720

pt-pmp parses configuration files that lead to errors

    Details

    • Type: Bug
    • Status: Pending Release
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0
    • Component/s: None
    • Labels:
      None

      Description

      agustin@bm-support01 ~ $ cat .percona-toolkit.conf
      password=aoeu
      agustin@bm-support01 ~ $ pt-pmp
      Unknown option: --password=aoeuUsage: pt-pmp [OPTIONS] [FILES]For more information, 'man pt-pmp' or 'perldoc /usr/bin/pt-pmp'. 

       

      pt-pmp does not use variables typically used in other Percona Toolkit tools like defaults-file or password, but it still parses configuration files that are used for other tools:

         if [ $# -ge 2 ] &&  [ "$1" = "--config" ]; then
            shift  # --config
            local user_config_files="$1"
            shift  # that ^
            local IFS=","
            for user_config_file in $user_config_files; do
               _parse_config_files "$user_config_file"
            done
         else
            _parse_config_files "/etc/percona-toolkit/percona-toolkit.conf" "/etc/percona-toolkit/$TOOL.conf"
            if [ "${HOME:-}" ]; then
               _parse_config_files "$HOME/.percona-toolkit.conf" "$HOME/.$TOOL.conf"
            fi
         fi 

       

      This happens when the "else" above is taken, which means that a workaround for this is to actually force using another configuration file, so the default ones (like percona-toolkit.conf files shown above) are not used:

      agustin@bm-support01 ~ $ touch .empty-percona-toolkit.conf
      agustin@bm-support01 ~ $ pt-pmp --config .empty-percona-toolkit.conf
      Wed Apr 17 17:52:26 EDT 2019
      ptrace: Operation not permitted.
            1 

       

      Given the reduced set of options supported by pt-pmp, does it make sense for it to read the default files?

      I'm not sure how to fix this bug, other than completely removing parsing these configuration files by default. For instance, pt-align seems to be using another parse_options logic (although I haven't extensively looked at this).

       

      Files used by pt-pmp currently are:

      agustin@bm-support01 ~ $ cat ./pt-pmp | grep "\.conf"
            _parse_config_files "/etc/percona-toolkit/percona-toolkit.conf" "/etc/percona-toolkit/$TOOL.conf"
               _parse_config_files "$HOME/.percona-toolkit.conf" "$HOME/.$TOOL.conf" 

      Maybe we can only leave the $TOOL.conf files there, since these would be pt-pmp-specific either way.

        Smart Checklist

          Attachments

            Activity

              People

              • Assignee:
                carlos.salguero Carlos Salguero
                Reporter:
                agustin.gallego Agustín Gallego
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 1 hour
                  1h