You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hawq.apache.org by YoungForest <gi...@git.apache.org> on 2018/01/24 03:12:26 UTC

[GitHub] incubator-hawq pull request #1333: HAWQ-1582. hawq ssh cmd bug when pipe in ...

GitHub user YoungForest opened a pull request:

    https://github.com/apache/incubator-hawq/pull/1333

    HAWQ-1582. hawq ssh cmd bug when pipe in cmd

    # Bug description
    [HAWQ-1582](https://issues.apache.org/jira/browse/HAWQ-1582)
    
    # Bug reason
    https://github.com/apache/incubator-hawq/blob/037be68ffacdac09dbecef22951ffa97bd9acb4a/tools/bin/hawq#L94
    Joining all arguments with space raises this bug when there is space in a argument. For example, argument`'ls -1 | wc -l'` becomes several arguments `'ls', '-1', '|', 'wc', '-l'`, which are feed into `subprocess.Popen`
    https://github.com/apache/incubator-hawq/blob/037be68ffacdac09dbecef22951ffa97bd9acb4a/tools/bin/hawq#L41
    For example, when executing `hawk ssh -h localhost -e 'ls -1 | wc -l'`, the `gpssh -h localhost -e ls -1 | wc -l` is feed into `subprocess.Popen` as cmd, while cmd is expected to be `gpssh -h localhost -e 'ls -1 | wc -l'`.
    
    # How I fix it
    [commit](https://github.com/YoungForest/incubator-hawq/commit/9ce5be82dcab0c53ab848178e1b4d8ec99a91a2e)
    Not just join arguments with space simply, while keep its integrity when the argument has space in it.
    
    Fix result:
    ``` bash
    hawq ssh -h sdw2 -h localhost -e 'ls -1 | wc -l'
    ``` 
    gets expected result.
    
    ``` bash
    hawq ssh -h sdw2 -h localhost -e 'kill -9 \$(pgrep lava)'
    ```
    gets expected result too after adding escape before `$`.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/YoungForest/incubator-hawq HAWQ-1582

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hawq/pull/1333.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1333
    
----
commit 9ce5be82dcab0c53ab848178e1b4d8ec99a91a2e
Author: YoungForest <ya...@...>
Date:   2018-01-24T02:46:18Z

    HAWQ-1582. hawq ssh cmd bug when pipe in cmd

----


---

[GitHub] incubator-hawq issue #1333: HAWQ-1582. hawq ssh cmd bug when pipe in cmd

Posted by stanlyxiang <gi...@git.apache.org>.
Github user stanlyxiang commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1333
  
    +1


---

[GitHub] incubator-hawq issue #1333: HAWQ-1582. hawq ssh cmd bug when pipe in cmd

Posted by yaoj2 <gi...@git.apache.org>.
Github user yaoj2 commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1333
  
    The change looks good to me. 


---

[GitHub] incubator-hawq pull request #1333: HAWQ-1582. hawq ssh cmd bug when pipe in ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-hawq/pull/1333


---

[GitHub] incubator-hawq issue #1333: HAWQ-1582. hawq ssh cmd bug when pipe in cmd

Posted by wcl14 <gi...@git.apache.org>.
Github user wcl14 commented on the issue:

    https://github.com/apache/incubator-hawq/pull/1333
  
    +1


---