Possible fix for Midnight Commander FIFO problem under tcsh

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Possible fix for Midnight Commander FIFO problem under tcsh

Ken Brown-6
Marco,

Corinna reported a failure of mc to open a FIFO when it is run under tcsh.  See

   https://cygwin.com/ml/cygwin/2019-12/msg00185.html

and my response.  To summarize, mc tries to open a FIFO as O_RDWR twice, and
this fails because Cygwin's FIFO implementation currently allows only one reader
(but multiple writers).  As a result, mc doesn't use a subshell when it is run
under tcsh.

There is a simple fix for the problem (attached).  Unfortunately, when I apply
this fix, mc is very slow to start up (about 10 seconds on my system) under
tcsh.  I'm not a tcsh user, but I simply ran 'tcsh -l' and then 'mc'.  I have no
tcsh or csh startup files in my home directory.

Running mc under strace shows that the forked tcsh subshell lists every
directory in my PATH.  The strace output shows that the subshell calls readdir
more than 77,000 times.  By contrast, the bash subshell doesn't call readdir at
all when I run mc under bash.

I hope someone more familiar with tcsh can explain this and provide a
workaround.  Otherwise, I think the fix is probably useless.

Ken

4.8.23-fifo.patch (1K) Download Attachment