[Grub-dev] Small error in protocol definition

chris hall followingthepath at gmail.com
Mon Jan 19 10:39:03 UTC 2009


I think this is the case, atleast for the 401s i was having on windows in
http://grub.org/?q=en/node/237
Where EVERY file would be a 401 error.

As the arcfile is opened in text mode when it is coutned, the \r are not
included in this count. When the server, written in perl (which always opens
in binary mode), counts the arcfile the counts are different due to one
including the \r and the other excluding it.

This is a simple fix involving changes the arcfile opening mode from 'w' to
'wb' which will then never write \r into the files :)

Hope this helps,
Chris

On Mon, Jan 19, 2009 at 2:18 AM, chris hall <followingthepath at gmail.com>wrote:

> In windows \r\n is the native newline character.
> If you open a file in python in text mode (default) whenever you use a \n
> it gets translated to a \r.
> When you open a file in binary mode, a \n is truly a \n
>
> This means that if you open a file in text mode (default) every newline
> character you use instead of being \n (1 byte long) it is actually \r\n (2
> bytes long)
>
> Also, the grub client opens its arcfile in w mode, which is text mode.
> So in windows systems this means that the \n characters are being
> transferred to \r\n
>
> Could this explain the 401 errors?
> I cannot beleive this has not occures to me before.
> -Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wikia.com/pipermail/grub-dev/attachments/20090119/40ab4dac/attachment.html 


More information about the Grub-dev mailing list