Bash hangs searching the "." PATH for a pipe in a function

Lundberg Christer christer.lundberg@scania.com
Wed Feb 17 10:34:00 GMT 2016


I am getting hard bash (64-bit) hangs, where the bash process occupies one full cpu part and Windows Task Manager must be used to stop it; 'kill -KILL' has no effect.

I have reduced it to the following case, where b.sh is in the same directory and just does a 'cat':

  export PATH=/usr/bin:.
  a(){ { echo a; } | b.sh; }
  a

Now bash hangs. The hang disappears if the function is redefined as:

  a(){ :; { echo a; } | (b.sh); }

but comes back for any of

  a(){ :; { echo a; } | b.sh; }
  a(){ { echo a; } | (b.sh); }

The problem appears to come when the '.' directory is searched:
If '.' is replaced by the full $PWD path in PATH, there is no hang.
If b.sh is moved to another directory, and this one is put before '.' in $PATH, there is no hang.
If b.sh is removed so that '.' needs to be searched without a hit, there is hang again.

It seems related to some setting of a network directory:
If I create a new empty directory next to the problematic one using Windows Explorer and call the troubled a() inside, it hangs there too.
Created with cygwin mkdir gives no hang.
Created with Windows Explorer at most other places, including local disk, gives no hang.

The scripts are now getting patched with colons and parentheses here and there to keep them running but we are curious and grateful for a better way!

Kind regards

Christer Lundberg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 445276 bytes
Desc: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160217/11c2c18e/attachment.obj>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list