Hello Kristis, others,

Actually I don't fully understand what causes the "binmode problem"
during a commit. All I know now is that replacing ":crlf" with ":text"
fixes the problem for me.

The cause seems to be related to CGI.pm setting binmode to :raw for
stdin, stdout and stderr. At first I tried to disable the lines in
C:\Perl\bin\CGI.pm that set the $needs_binmode variable and instead
force it to a value of 0 so that stdin, stdout and stderr are no longer
set to binmode :raw. When I did that, SCMBug had no problems reading the
results from the svnlook and other commands. Unfortunately it made
Bugzilla to report errors in certain .cgi scripts in the webbrowser.
Therefore I had to undo this dirty fix, but then SCMBug would complain,
since it is unable to read the svnlook output. Then I found your scmbug
users email thread discussing the commit problem and that gave me the
idea to try to use ":text" instead of ":crlf".

According to "Programming Perl - O'Reilly", 3rd edition, table 29-2, the
following "I/O disciplines" are available:

:raw     Binary mode; do no processing
:text    Default text processing
:def     Default declared by "use open"
:latin1  File should be ISO-8859-1
:ctype   File should be LC_CTYPE
:utf8    File should be UTF-8
:utf16   File should be UTF-16
:utf32   File should be UTF-32
:uni     Intuit Unicode (UTF-*)
:any     Intuit Unicode/Latin1/LC_CTYPE
:xml     Use encoding specified in file
:crlf    Intuit newlines
:para    Paragraph mode
:slurp   Slurp mode

It explains:
"Unless instructed otherwise, Perl will assume your freshly opened file
should be read or written in text mode."

It further explains somewhere else:
"The displine ":text" will tell Perl to do generic text processing
without telling Perl which kind of text processing to do. But
disciplines like ":utf8" and ":latin1" tell Perl which text format to
read and write."


I can't explain why :crlf does not work as expected, but :text is
obviously the normal mode in Perl for reading text files. Somehow CGI.pm
interferes by overriding this mode by setting stdin to :raw. Maybe this
has something to do with the fact that some disciplines can be
'stacked'. According to O'Reilly:

"You'll be able to stack disciplines that make sense to stack, so, for
instance, you could say:
  open(FH,"<:para:crlf:uni",$path) or die "can't open $path: $!";
..."

So maybe :crlf is stacked on top of the :raw that is set by CGI.pm.

But again, whatever the actual reason behind :crlf not working, :text
works fine on my machine. Probably the use of :text is platform
independent, so then it should work fine for others as well. Maybe
someone is able to verify that.

Henk Dekker

p.s. Kristis, as soon as I find the time for it I will post a separate
mail to the list concerning the eval problem that I ran into. On my
machine the return value appears to be incorrect. And if you look in the
Bugzilla code, you will notice that they don't use the return value from
eval(). They use another way (checking the version) to determine whether
a package exists.

FYI, my versions are:
SCMBug 0-26-13
Subversion 1.5.5
Bugzilla 3.2.2
ActivePerl 5.8.9
MySQL 4.1
Apache 2.2
(Running Windows XP)


-----Oorspronkelijk bericht-----
Van: Kristis Makris [mailto:[email protected]] 
Verzonden: donderdag 2 april 2009 17:45
Aan: Henk Dekker; [email protected]; Aleksey Pershin
CC: [email protected]
Onderwerp: Re: Binmode problem

Hi Henk,

Please send all communication to the mailing list. I'm not sure what the
mailing list problem you are referring to is. You seem to be subscribed.

Thanks for the feeback. This should certainly interest Jaydeep.

http://bugzilla.mkgnu.net/show_bug.cgi?id=1337

Is there documentation that explains the difference between ":text" and
":crlf". I'm having trouble finding some. I also wonder if Aleksey knows
more about this -- he brought up the need to use ":crlf".

Also, could you please provide a more specific description of the eval()
problem you encountered ? I thought this was fixed in 0.26.13.

On Thu, 2009-04-02 at 09:24 +0200, Henk Dekker wrote:
> Hello Kristis,
> 
>  
> 
> I ran into the same "binmode" problem as discussed here:
> 
> http://www.mail-archive.com/[email protected]/msg01814.html
> 
>  
> 
> I don't know if this bug is already fixed, but it seems that I found a
> simple solution that fixes this problem.
> 
> I simply changed all the ":crlf" arguments passed to binmode() to
> ":text" in Subversion.pm and then commit works without any problems on
> my machine.
> 
> FYI: I am running on Windows XP, with the following versions: SCMBug
> 0-26-13, Subversion 1.5.5 and Bugzilla 3.2.2.
> 
>  
> 
> Note that I just tried to register to the mailing list to post my
> contribution to this thread, but probably I am only able to reply to
> messages that I received directly via email?! 
> 
> Anyway, I hope this info is of any use for you.
> 
>  
> 
> By the way, earlier I ran into the "eval" problem, where SCMBug does
> not get a proper return value for its calls to eval(). For the time
> being I simply fixed this the dirty way by not checking the return
> value at.
> 
> I wonder if there already is a proper fix for this problem, or maybe a
> new SCMBug release that fixes this?
> 
>  
> 
> Kind regards,
> 
>  
> 
> ing. Henk Dekker
> 
> Senior engineer
> 
> [email protected]
> 
>  
> 
> Inspiro BV
> 
> Velperweg 134
> 
> 6824 HN  Arnhem
> 
> The Netherlands
> 
> tel: +31 26 361 2729
> 
> www.inspiro.nl
> 
>  
> 
> 
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users

Reply via email to