parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in version 20170322: certain functions in the Bash environment b


From: Michael Klement
Subject: Re: Bug in version 20170322: certain functions in the Bash environment break invocation of env_parallel on macOS 10.12.4
Date: Sat, 15 Apr 2017 09:06:11 -0400

Thank you, Hans.

I'm aware of that workaround, but I thought you'd want to know that env_parallel is not fully robust and fails in obscure ways.
Is env_parallel deprecated? The man page doesn't seem to say so.

Note that the workaround only works in Bash, because other shells do not support exporting functions.

Best,

Michael


On Apr 15, 2017, at 4:36 AM, Hans Schou <chlor@schou.dk> wrote:

Try add "export -f doIt" in your chain.

This is my test command:

  doIt() { echo "$$: [$*]"; } ; export -f doIt ; { echo hi; echo there; echo you; echo too; } | parallel -n 1 -j 12 doIt {}

  27659: [hi]
  27660: [there]                                                                                                                                                                                                  
  27661: [you]                                                                                                                                                                                                    
  27662: [too]                                                                                                                                                                                                    

Read more in the man page chapter "EXAMPLE: Calling Bash functions"

2017-04-14 20:53 GMT+02:00 Michael Klement <michael.klement@usa.net>:
* The version number: 20170322
* The bugid: open3-GLOB(0x7fec07207648) 

Note: The cause are the specific functions defined in my Bash environment.
If I manually modify function env_parallel() in /usr/local/bin/env_parallel.bash, to only include the one function of interest - local _list_function_BODIES="typeset -f doIt"  - , everything works fine.

* The command line being run:

 . /usr/local/bin/env_parallel.bash; doIt() { echo "$$: [$*]"; }; { echo hi; echo there; echo you; echo too; } | env_parallel  -n 1 -j 12 doIt {}

In my macOS 10.12.4 the command breaks with both the stock Bash version (3.2.57) as well as a Homebrew-installed recent version bash (4.4.5)
  • v3.2.57: only stderr output:
    • -bash: /usr/bin/which: Argument list too long
    • -bash: -n: command not found
  • v4.4.5: only stderr output:
    • The auto-detected bug condition with environment information included, including all function bodies (see attached file): 


As you can see, with the stock macOS Bash even the bug-detection mechanism failed - the `which parallel` command in function env_parallel() malfunctions and parallel never even gets to execute.

Regards,

Michael






reply via email to

[Prev in Thread] Current Thread [Next in Thread]