Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo
Status: New
Owner: ----

New issue 3458 by mmk.bbt: bug in the class MultiByteFileStream when Pharo  
running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

PharoCore-1.2beta-12272, Windows

Steps to reproduce:
(MultiByteFileStream new)
  wantsLineEndConversion: true;
  open: 'c:\temp\1.txt' forWrite: true;
  cr;
  close.


  File c:\temp\1.txt contains 3 characters (cr lf lf) instead of two (cr lf).
  This is due to the fact that the method MultiByteFileStream>> nextPut:  
There is a double conversion of Cr to CrLf.
  I think this can be corrected as follows:

  "
  MultiByteFileStream>> nextPut: aCharacter
        aCharacter isInteger
                  ifTrue: [^ super nextPut: aCharacter].
        (wantsLineEndConversion == true and: [lineEndConvention notNil]) "#  
doConversion is inlined here"
                   ifTrue: [
                               aCharacter = Cr
                                      ifTrue: [converter nextPutAll:  
(LineEndStrings at: # cr) toStream: self]
                                      ifFalse: [converter nextPut:  
aCharacter toStream: self].
                               ^ aCharacter].
        ^ Self converter nextPut: aCharacter toStream: self
  "

  Sincerely,
  Maxim




Paste or attach stack trace if applicable (look at the file PharoDebug.log
located in the same directory as your image):



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo
Updates:
        Status: Accepted
        Labels: Milestone-1.2

Comment #1 on issue 3458 by stephane.ducasse: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

Tx


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo

Comment #2 on issue 3458 by stephane.ducasse: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

Could somebody with a Windows confirm and provide a changeset?


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo

Comment #3 on issue 3458 by stephane.ducasse: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

Could somebody with a Windows confirm and provide a changeset?


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo

Comment #4 on issue 3458 by siguctua: bug in the class MultiByteFileStream  
when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

The real bug is in TextConverted, which
honors the line end convention if you using #nextPutAll:...
but ignoring it, if you using #nextPut:


| s |
s := '' writeStream.
UTF8TextConverter new
installLineEndConvention: String crlf;
nextPut: Character cr toStream: s;
nextPutAll: String cr toStream: s.
s contents


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo

Comment #5 on issue 3458 by [hidden email]: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

Is this a bug in 1.1 already? Then we should move it to 1.3 (a bug in 1.1  
that nobody bothered to fix is by definition not a show-stopper, else  
someone would invest to have it fixed)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo

Comment #6 on issue 3458 by [hidden email]: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

When I try "Pharo-1.1.1--Latest update: #11414"

and run

(MultiByteFileStream new)
  wantsLineEndConversion: true;
  open: 'c:\temp\1.txt' forWrite: true;
  cr;
  close.

I get a file with hex: 0D 0A 0A

So it existed in 1.1 already and looks like it is not a show stopper.
Marcus: You should move it to 1.3


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3458 in pharo: bug in the class MultiByteFileStream when Pharo running under Windows

pharo
Updates:
        Labels: -Milestone-1.2 Milestone-1.3

Comment #7 on issue 3458 by [hidden email]: bug in the class  
MultiByteFileStream when Pharo running under Windows
http://code.google.com/p/pharo/issues/detail?id=3458

Moved to 1.3