Stamatis Zampetakis created HIVE-30258:
------------------------------------------

             Summary: TRANSFORM runs wrong script when PATH contains file 
entries
                 Key: HIVE-30258
                 URL: https://issues.apache.org/jira/browse/HIVE-30258
             Project: Hive
          Issue Type: Bug
          Components: HiveServer2
    Affects Versions: 4.2.1
            Reporter: Stamatis Zampetakis
            Assignee: Stamatis Zampetakis


The 
[TRANSFORM|https://hive.apache.org/docs/latest/language/languagemanual-transform/]
 query returns wrong results when the PATH environment variable contains simple 
file entries (instead of directories).

{code:sql}
SELECT TRANSFORM('Stam') USING 'cat' as fname;
{code}

+Expected result+
PATH=/usr/bin:/sbin:/bin
{noformat}
+--------+
| fname  |
+--------+
| Stam   |
+--------+
{noformat}

+Wrong result+
PATH=/usr/bin/wc:/usr/bin:/sbin:/bin
{noformat}
+--------------------------+
|          fname           |
+--------------------------+
|       1       1       5  |
+--------------------------+
{noformat}

In the second example the PATH environment variable contains a direct path to 
the {{wc}} process and TRANSFORM ends up running this process instead of 
looking for the correct {{cat}} process under the {{/usr/bin}} directory.

In most cases the PATH environment variable only contain directories so this 
problem should be rather rare. However users may wrongly configure the PATH 
variable and this can potentially lead to big problems if a dangerous process 
is part of the path (e.g., rm).

I hit this problem while running Hive tests with TRANSFORM and noticed that 
unrelated processes were launched.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to