I think this is the bug:

##
# Writes a string to the file object.
#
# This function writes a string to the file object and a new line is appended
# afterwards. It may optionally wraps the string for better readability.
#
# @File                      The file object to write
# @String                    The string to be written to the file
# @Wrapper                   Indicates whether to wrap the string
#
def FileWrite(File, String, Wrapper=False):
    if Wrapper:
        String = textwrap.fill(String, 120)
    File.write(String + "\r\n")

It should be “\n” so Python can do the right thing. 

Thanks,

Andrew Fish

On Dec 4, 2013, at 10:05 AM, Andrew Fish <af...@apple.com> wrote:

> When I build a log file I noticed that it has line ending issues. Most of the 
> file seems to have 0x0d 0x0a, but some cases have 0x0a 0x0d 0x0a which my 
> editor thinks is a upside-down question mark. I’m guessing this is an OS 
> specific line ending issue with the Python code? As you can see in the PS OS 
> X uses LF for newline. 
> 
> given:
> 0x0a -> LF
> 0x0d -> CR 
> 
> The sequence is strange as I thought Windows was CR+LF? I wonder what it 
> looks like on Linux?
> 
> hexdump -C of chunks of the log file:
> 
> 00000000  50 6c 61 74 66 6f 72 6d  20 53 75 6d 6d 61 72 79  |Platform Summary|
> 00000010  0d 0a 50 6c 61 74 66 6f  72 6d 20 4e 61 6d 65 3a  |..Platform Name:|
> 
> 00000230  3d 3d 3d 3d 3d 3d 3d 3d  3c 0a 0d 0a 50 6c 61 74  |========<...Plat|
> 
> 000033d0  7b 20 30 78 42 37 2c 20  30 78 44 36 2c 20 30 78  |{ 0xB7, 0xD6, 0x|
> 000033e0  37 41 2c 20 30 78 43 35  2c 20 30 78 31 35 2c 20  |7A, 0xC5, 0x15, |
> 000033f0  30 78 30 35 2c 20 30 78  41 38 2c 20 30 78 34 30  |0x05, 0xA8, 0x40|
> 00003400  2c 20 30 78 39 44 2c 0a  20 30 78 32 31 2c 20 30  |, 0x9D,. 0x21, 0|
> 00003410  78 35 35 2c 20 30 78 31  36 2c 20 30 78 35 32 2c  |x55, 0x16, 0x52,|
> 00003420  20 30 78 38 35 2c 20 30  78 34 45 2c 20 30 78 33  | 0x85, 0x4E, 0x3|
> 00003430  37 20 7d 0d 0a 20 20 20  20 50 63 64 49 73 61 42  |7 }..    PcdIsaB|
> 
> Thanks,
> 
> Andrew Fish
> 
> PS
> 
> (master)>python
> Python 2.7.5 (default, Sep 12 2013, 21:33:34) 
> [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> fo = open("foo.txt", "wb")
> >>> fo.write( "Python is a great language.\nYeah its great!!\n");
> >>> fo.close()
> >>> ^D
> (master)>cat foo.txt 
> Python is a great language.
> Yeah its great!!
> (master)>hexdump -C foo.txt 
> 00000000  50 79 74 68 6f 6e 20 69  73 20 61 20 67 72 65 61  |Python is a grea|
> 00000010  74 20 6c 61 6e 67 75 61  67 65 2e 0a 59 65 61 68  |t language..Yeah|
> 00000020  20 69 74 73 20 67 72 65  61 74 21 21 0a           | its great!!.|
> 0000002d
> 
> ------------------------------------------------------------------------------
> Sponsored by Intel(R) XDK 
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk_______________________________________________
> edk2-buildtools-devel mailing list
> edk2-buildtools-de...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-buildtools-devel

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to