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

Parameter substitution of shell cmd results doesn't handle backslash

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 0.18.0
    • Component/s: parser
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Hadoop Flags:
      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. test-failure.txt
          12 kB
          Satish Saley
        5. pig4.patch
          8 kB
          Will Lauer
        6. pig5.patch
          8 kB
          Will Lauer

          Activity

            People

            • Assignee:
              wlauer@yahoo-inc.com Will Lauer
              Reporter:
              wlauer@yahoo-inc.com Will Lauer
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: