Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-4553

Quoting problems in contrib/maint_events.sh

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.10
    • Fix Version/s: 1.8.12, 1.9.8
    • Component/s: Command-Line Tools
    • Security Level: Default (Default Security Scheme)
    • Labels:
    • Environment:
      Seen in the wild on Oracle Enterprise Linux 5.5 (essentially CentOS 5.5) and on Mac OS X 10.6

      Description

      Running this script as distributed results in a pretty nasty pile of barf:

      maint_events.sh: line 52: syntax error near unexpected token `('
      maint_events.sh: line 52: ` runsql "DELETE FROM events e WHERE e.eventid IN (SELECT o.svcregainedeventid FROM outages o WHERE o.svcregainedeventid IS NOT NULL AND (ifregainedservice - iflostservice)::interval < interval '35 seconds');"'

      Turns out to be a quoting problem. If I change out the double quotes around the argument to runsql, replacing them with single quotes (and of course backslash-escaping the single quote characters inside the token) then the script proceeds to the next place where runsql is called with double quotes around its sole token arg.

        Attachments

          Activity

            People

            • Assignee:
              ranger Benjamin Reed
              Reporter:
              jeffg Jeff Gehlbach
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: