Celeste problem during import

Lex Spoon lex at cc.gatech.edu
Mon Jul 10 12:09:51 UTC 2000


Bert Freudenberg <bert at isgnw.CS.Uni-Magdeburg.De> wrote:
> On Sat, 8 Jul 2000, Ned Konz wrote:
> 
> > Daniel Vainsencher wrote:
> > > 
> > > If you're working in unix, you should probably be using CrLfFileStream.
> > > See FileStream concreteStream. Higher level code (like that utility)
> > > should stay blissfully ignorant... ;-)
> > 
> > I'd agree, but for a couple of things:
> > 
> > * it's not my code; it's part of Celeste, and
> > 
> > * Unix mailbox format (with just a LF at the ends of lines) is used
> > on platforms whose native line termination is not merely LF. Thus,
> > Eudora on Windows (where CR/LF typically terminate text lines) uses LF
> > at the ends of lines in its mailboxes (as I recall).
> 
> Very true. I also don't use CrLfFileStream by default on my Unix box. The
> fix is to use CrLfStream explicitely: In MailInboxFile>>mailMessagesDo:, I
> replaced the first line
> 	fileStream _ FileStream fileNamed: filename.
> with
> 	fileStream _ CrLfFileStream readOnlyFileNamed: filename.
> 
> Maybe you could include this in your next Celeste enhancement, Daniel.
> Along with the still outstanding final-attachment-delimiter fix ;-)
> 

Much better, would be to have a line-end-fixing filter, instead of using
a subclass of FileStream for this at all.  Files and line-end-fixing are
orthogonal and shouldn't be taken care of in the same class hierarchy.

That aside, a "text" file should contain "text", and "text" for Squeak
means lines with CR's at the end.  If you do "f text" and f keeps
spitting back LF's at you, then this behavior is just wierd all around. 
In typical C implemnetations, "text" mode is really treated this way --
\n means whatever the line-end convention is for your OS.  Squeak should
do the same thing, or back off from having a "text" mode at all.

It's bogus that Celeste would have to do anything other than state its
intent to open a file in text mode.  If Celeste says "text mode please"
and doesn't get it, let's try not to hack Celeste to work around
it--let's fix how text processing works.


-Lex





More information about the Squeak-dev mailing list