pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Lauer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-5362) Parameter substitution of shell cmd results doesn't handle backslash
Date Wed, 28 Nov 2018 04:40:00 GMT

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

Will Lauer commented on PIG-5362:
---------------------------------

I've uploaded a new patch that changes how the parser detects and handles quoted strings.
I think this is probably the correct approach for fixing the quoting issues, but I'm not sure
yet whether there are any backward incompatibilities introduced by this fix.

> 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: Minor
>             Fix For: 0.18.0
>
>         Attachments: pig.patch, pig2.patch, pig3.patch, pig4.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
(v7.6.3#76005)

Mime
View raw message