You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Ádám Szita (Jira)" <ji...@apache.org> on 2020/01/20 16:12:00 UTC

[jira] [Commented] (PIG-5362) Parameter substitution of shell cmd results doesn't handle backslash

    [ https://issues.apache.org/jira/browse/PIG-5362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17019575#comment-17019575 ] 

Ádám Szita commented on PIG-5362:
---------------------------------

[~wlauer@yahoo-inc.com], I just had a look on [^pig5.patch]. In general the changes in the .jj files look good to me.

However:
 * The new patch should only contain the difference from the current trunk HEAD (so as I see it now: only the .jj files), because the original change was not reverted.
 * I'd also like to see a testcase that is failing without this fix, but passing with it. The current one (TestPreprocessorContext#testEscaping) is passing now.

> Parameter substitution of shell cmd results doesn't handle backslash	
> ---------------------------------------------------------------------
>
>                 Key: PIG-5362
>                 URL: https://issues.apache.org/jira/browse/PIG-5362
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>            Reporter: Will Lauer
>            Assignee: Will Lauer
>            Priority: Major
>             Fix For: 0.18.0
>
>         Attachments: pig.patch, pig2.patch, pig3.patch, pig4.patch, pig5.patch, test-failure.txt
>
>
> 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:
> {code:java}
> %DECLARE A `echo \$foo\\bar`
> B = LOAD $A 
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)