Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-5362

Parameter substitution of shell cmd results doesn't handle backslash

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 0.18.0
    • parser
    • None
    • Patch Available
    • Reviewed

    Description

      It looks like there is a bug in how parameter substitution is handled in PreprocessorContext.java that causes parameter values that contain backslashed to not be processed correctly, resulting in the backslashes being lost. For example, if you had the following:

      %DECLARE A `echo \$foo\\bar`
      B = LOAD $A 
      

      You would expect the echo command to produce the output $foo\bar but the actual value that gets substituted is \$foobar. This is happening because the substitute method in PreprocessorContext.java uses a regular expression replacement instead of a basic string substitution and $ and \ are special characters. The code attempts to escape $, but does not escape backslash.

      Attachments

        1. pig.patch
          2 kB
          Will Lauer
        2. pig2.patch
          2 kB
          Will Lauer
        3. pig3.patch
          3 kB
          Will Lauer
        4. pig4.patch
          8 kB
          Will Lauer
        5. pig5.patch
          8 kB
          Will Lauer
        6. PIG-5362.addendum.0.patch
          6 kB
          Ádám Szita
        7. test-failure.txt
          12 kB
          Satish Saley

        Activity

          People

            wlauer@yahoo-inc.com Will Lauer
            wlauer@yahoo-inc.com Will Lauer
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: