bugGNU Parallel - Bugs: bug #49970, Python child process dies if --env...

 
 

bug #49970: Python child process dies if --env is used

Submitter:  Ole Tange <tange>
Submitted:  Sun 01 Jan 2017 04:05:11 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  tange
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 01 Jan 2017 06:33:42 PM UTC, comment #4: 

Fixed in [9f7eaa5].

Ole Tange <tange>
Group administrator
Sun 01 Jan 2017 04:39:14 PM UTC, comment #3: 

#!/usr/bin/perl                                                                                   
use MIME::Base64;                                                                                 
$SIG{CHLD}="IGNORE";
$eval=q(
       $bashfunc = "fu() {
  echo \$1
 };
export -f fu >/dev/null;";
       @a="python -c \"import os;f = os.popen('uname -p');output = f.read();rc = f.close()\"";
       exec "/bin/bash","-c",($bashfunc."@a");
       die"exec:$!\n";);
eval$eval;

Ole Tange <tange>
Group administrator
Sun 01 Jan 2017 04:09:49 PM UTC, comment #2: 

The setuptool spans a shell, and the signal handler is apparently inherited.

The fix is simple, but can we make an example that does not use 'setuptools' - which can be used in the test suite?

Ole Tange <tange>
Group administrator
Sun 01 Jan 2017 04:07:01 PM UTC, comment #1: 

This fails:

#!/usr/bin/perl
use MIME::Base64;
$SIG{CHLD}="IGNORE";
$eval=q(
       $bashfunc = "fu() {
  echo \$1
 };
export -f fu >/dev/null;";
       @a="python -c \"import setuptools\" 2";
       exec "/bin/bash","-c",($bashfunc."@a");
       die"exec:$!\n";);
eval$eval;

Works:


#!/usr/bin/perl
use MIME::Base64;
$chld=$SIG{CHLD};
$SIG{CHLD}="IGNORE";
$eval=q(
       $bashfunc = "fu() {
  echo \$1
 };
export -f fu >/dev/null;";
       @a="python -c \"import setuptools\" 2";
       exec "/bin/bash","-c",($bashfunc."@a");
       die"exec:$!\n";);
$SIG{CHLD}=$chld;
eval$eval;

Ole Tange <tange>
Group administrator
Sun 01 Jan 2017 04:05:11 PM UTC, original submission:  

http://lists.gnu.org/archive/html/parallel/2016-12/msg00018.html


function fun {
    echo $1
}
export -f fun

## Works fine
parallel  'python -c "import setuptools"' ::: 2

## Breaks
parallel --env fun 'python -c "import setuptools"' ::: 2

Ole Tange <tange>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tange (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-01 tange StatusConfirmed Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code