procmail
[Top] [All Lists]

Re: vacation problems..sigh

2000-10-18 10:33:42
Collin was helping someone else with a problem in a post I don't remember,
and he said,

| So far so good.  Now, note the space between the '"' and the
| '/usr/bin/formail' in the next line.  There was no space above, but
| there is one here, I think because a character from SHELLMETAS was
| found in the command string.

Good catch.  The left bracket is it, so the logfile's "Executing" line shows
the arguments separated with spaces instead of commas.

| A command without SHELLMETAS executes fine, but every command line
| containing SHELLMETAS causes exitcode 255.  Hence it's likely that the 255
| has to do with the shell itself rather than with the command.  

Sounds very likely.

| Uh, what is the value of $SHELL in your environment?  Since it seems
| to fail regardless of the command, I'm guessing something is wrong
| with the $SHELL variable.

The usual reason that shell calls from a procmail rcfile bomb is that the
person has not set SHELL so procmail looks up the login shell for that user
and it is one that uses an initialization file; or the person, used to
his/her login shell, has explicitly set SHELL to it.  Then the initialization
file (~/.cshrc or ~/.bashrc or whatever) includes some code that depends on
being connected to a terminal or on the user's being actively logged in.

The solutions are to set SHELL to /bin/sh, which doesn't use such a file; to
remove terminal-dependent code from the shell initialization file and put it
into .login or .profile instead; or to wrap all terminal-dependent code in
the initialization file in an if or case structure that allows it to run only
on interactive shells.  For example, in csh or tcsh (I don't know the exact
syntax) one checks the value of $prompt; in ksh $- will include an "i" if the
shell is interactive, so in one's .kshrc one can do this:

  case "$-" in
  *i*) code for interactive shells goes here ;;
  esac

In this particular case, the formail command didn't need a shell but one was
called only because of the left bracket in one of the arguments, so tempora-
raily unsetting SHELLMETAS would also have avoided the problem.  However, I
would recommend curing it instead.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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