procmail
[Top] [All Lists]

Re: tcsh problems (was Re: procmail documentation problem)

1998-08-16 02:59:04
I'm BCC:ing this to my local admins because I think it documents a
local anomaly. Skipatkaa vaan Procmailiin liittyvät tarinat, folks.

On Sat, 15 Aug 1998 12:35:01 -0500 (CDT), "David W. Tamkin"
<dattier(_at_)Mcs(_dot_)Net> wrote:
New groom Era Eriksson wrote,
| I get the feeling some sites are running procmail+tcsh almost without
| any problems. Other sites, including mine, get really mysterious
| errors such as | cat file1 file2 | formail in a recipe simply not
| working. It is unclear to me whether this is a "feature" of tcsh, a
| bug in Procmail, or a combination of the two. Anybody have any idea
| why this is happening?
There are two general classes of problems in using csh or a
derivative as your procmailrc's shell:
1. terminal-dependent commands in .cshrc that should be either
placed in .login or wrapped in an if structure that skips them if
the shell is not attached to a terminal;
2. csh's general problems as a scripting shell.

I would still like to postulate a third case, but I've had only
limited success in repeating problems I've had with tcsh before. Most
recently, I took out my .cshrc completely, and that really did seem to
fix some problems. This is just a middle report with some hints for
people who are forced to live with tcsh, nothing really new.

Here is my test recipe:

SHELL=/bin/tcsh
LOG=`ls -l ~/.cshrc ~/.home; cat ~/.cshrc`"
"
:0w
| cat - | formail >>/dev/null
:0
/dev/null

Here's a test run with no .cshrc:

 $ procmail VERBOSE=yes ./tcsh.rc </dev/null
 procmail: [27605] Sun Aug 16 12:22:25 1998
 procmail: Assigning "MAILDIR=."
 procmail: Rcfile: "./tcsh.rc"
 procmail: Assigning "SHELL=/bin/tcsh"
 procmail: Executing "ls -l ~/.cshrc ~/.home; cat ~/.cshrc"
 /h/3/ykiel/reriksso/.cshrc not found
 /h/3/ykiel/reriksso/.home not found
 cat: cannot open /h/3/ykiel/reriksso/.cshrc
 procmail: Assigning "LOG=
 "

 procmail: Executing " cat - | formail >>/dev/null"
 procmail: Assigning "LASTFOLDER= cat - | formail >>/dev/null"
   Folder:  cat - | formail >>/dev/null                                       1

Okay, no problem (but that doesn't mean there never will be any).
Here we are with the .cshrc back in place:

 $ procmail VERBOSE=yes ./tcsh.rc </dev/null
 procmail: [2713] Sun Aug 16 12:23:15 1998
 procmail: Assigning "MAILDIR=."
 procmail: Rcfile: "./tcsh.rc"
 procmail: Assigning "SHELL=/bin/tcsh"
 procmail: Executing "ls -l ~/.cshrc ~/.home; cat ~/.cshrc"
 /h/3/ykiel/reriksso/.home not found
 procmail: [2713] Sun Aug 16 12:23:16 1998
 procmail: Assigning "LOG=-r-x------   1 reriksso ykiel        745 Jan 12  1996 
/h/3/ykiel/reriksso/.cshrc
 ######################################################################
 #
 #  This file is read and executed every time a new shell is started.
 #  Keep it quite short, for efficiency
 #
 ######################################################################
 source $HOME/../../local/lib/Cshrc

 # eriksson-matic own stuff

 test -r $HOME/.debug && echo '### .cshrc'

 test -r $HOME/.home/setenv     && source $HOME/.home/setenv
 test -r $HOME/.home/set        && source $HOME/.home/set
 test -r $HOME/.home/alias      && source $HOME/.home/alias
 test -r $HOME/.home/bindings   && source $HOME/.home/bindings

 # Remove Emacs ^M junk from shell-buffer (per Emacs FAQ, Question 65)
 if ($?EMACS) then 
         if ("$EMACS" == t) then
                 if ($?tcsh) unset edit
                 stty nl
         endif
 endif
 "
 -r-x------   1 reriksso ykiel        745 Jan 12  1996 
/h/3/ykiel/reriksso/.cshrc
 ######################################################################
 #
 #  This file is read and executed every time a new shell is started.
 #  Keep it quite short, for efficiency
 #
 ######################################################################
 source $HOME/../../local/lib/Cshrc

 # eriksson-matic own stuff

 test -r $HOME/.debug && echo '### .cshrc'

 test -r $HOME/.home/setenv     && source $HOME/.home/setenv
 test -r $HOME/.home/set        && source $HOME/.home/set
 test -r $HOME/.home/alias      && source $HOME/.home/alias
 test -r $HOME/.home/bindings   && source $HOME/.home/bindings

 # Remove Emacs ^M junk from shell-buffer (per Emacs FAQ, Question 65)
 if ($?EMACS) then 
         if ("$EMACS" == t) then
                 if ($?tcsh) unset edit
                 stty nl
         endif
 endif
 procmail: Executing " cat - | formail >>/dev/null"
 inst emulated pid=15819 <formail> va=0x1200028c8 pc=0x1200074f8 inst=0x284b0000
 procmail: Assigning "LASTFOLDER= cat - | formail >>/dev/null"
   Folder:  cat - | formail >>/dev/null                                       1

See this message which gets printed after formail finished? Apparently
this is some sort of kernel trap message -- I've never seen anything
like this before (usually I'd see something like an error return code
from formail and "rescue of unfiltered data succeeded") but there is
indeed something very funny going on.

I'd rather not go into details about what happens in
../../local/lib/Cshrc because I don't understand it. Suffice it to say
that yes, there's a lot of odd stuff pertaining to setting up the
terminal and windowing system correctly.

(For the record, I took out everything except the local/lib/Cshrc line
and tried again, and still got the same odd diagnostic printout.)

What's discomforting is that I only notice the apparent problems with
this .cshrc when I end up running tcsh from inside Procmail, and then
only sometimes, and often with very mysterious results. An interactive
tcsh is a pain to use, but it seems to work more or less
deterministically all the time, whereas when I run it under Procmail,
some of the symptoms are +really+ strange. And it's one of the most
annoying things to end up doing by mistake because it's not something
you immediately think of and so you often end up spending a lot of
time debugging recipes which are perfectly okay, only running under
the wrong shell.

(Allow me to once again publically bemoan the fact that my local
admins really seem to think they have to force us all to use tcsh as
our login shell. My .login obviously execs bash first thing in the
morning, but I'm not even allowed to change my passwd entry to say my
login shell is /bin/sh!)

/* era */

-- 
Bot Bait: It shouldn't even matter whether  (`')  Just  (`')  http://www.iki
I am a resident of the State of Washington   \/ Married! \/   .fi/~era/

<Prev in Thread] Current Thread [Next in Thread>