[sork] vacation problem - DOS line endings

Eric Rostetter eric.rostetter@physics.utexas.edu
Wed, 28 Aug 2002 14:02:09 -0500


Quoting Lars Hecking <lhecking@nmrc.ie>:

> Lars Hecking writes:
> >
> > > >  I just installed vacation, and it works beautifully, but there is one
> > > >  major annoyance: the generated .vacation.msg has DOS line endings
> > > >  (those dreaded ^M's). The overall effect is that the headers below
> > > >  the Subject: header are duplicated in the body of the vacation
> > > >  message.

Reproduced.

>  Any further updates on this? Even a piece of code that allows me to run
>  tr on the generated file would help lot. At the moment, we sysadmins need
>  to set up vacation for all non-Unix lusers, and at this time of the year,
>  we're simpy being swamped with requests :-/

Quick fix, not the final solution by any means, follows:

Apply the following diff (from CVS HEAD) which will convert the ^M characters
to space characters.  The ^M shown is an actual ^M character, not the two
characters "^" and "M".  This will leave a trailing space on each line, but
that should be preferable to the MSDOS return character.

Index: forwards.php
===================================================================$
RCS file: /repository/vacation/lib/Driver/forwards.php,v
retrieving revision 1.4
diff -u -r1.4 forwards.php
--- forwards.php^I13 Aug 2002 04:15:20 -0000  1.4
+++ forwards.php^I28 Aug 2002 18:50:59 -0000
@@ -183,9 +183,10 @@
         if ( !$this->check_config(&$realm) ) return false;
 
         $conf = &$GLOBALS['conf'];
         $dbfile = VACATION_BASE . "/files/empty." .
                   $this->params['dbtype'] . ".bin";
 
         $message = strtr($message, "^M", " ");
         $myFile = $this->_writeTempFile($message);
         if (!file_exists($myFile)) return false;
         $status = $this->_ftpCopy($user, $realm, $pass, $myFile,

Since the mail will probably totally distroy the diff, the idea is to 
add a line which reads:

         $message = strtr($message, "^M", " ");

in vacation/lib/Driver/forwards.php at line 189, again where the "^M" is
the control-M character, not the two characters "^" and "M".

> --
> Sork mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: sork-unsubscribe@lists.horde.org


-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

"TAD (Technology Attachment Disorder) is an unshakable, impractical devotion
to a brand, platform, product line, or programming language. It's relatively
harmless among the rank and file, but when management is afflicted the damage
can be measured in dollars. It's also contagious -- someone with sufficient
political clout can infect an entire organization."

--"Enterprise Strategies" columnist Tom Yager.