[mapserver-dev] msautotest-wxs: how to suppress the header
information?
Normand Savard
nsavard at mapgears.com
Thu Mar 19 08:45:33 EDT 2009
Tamas Szekeres wrote:
> 2009/3/17 Normand Savard <nsavard at mapgears.com>
>
>
>> Tamas,
>>
>> I checked how the tests works in mstestlib.py and the generated output.
>> When it's an wxs tests, if the output result is a png file, it's passed
>> through the demime_file() function. This function is called when
>> [RESULT_DEMIME] is part of the RUN_PARMS request. It removes the
>> Content-type.
>>
>> For the other tests like the ones in gdal or misc, shp2img is used and
>> there is no such thing as Content-type in the png generated.
>>
>> Maybe I'm missing something so please do not hesitate to comment.
>>
>>
>>
>>
>
>
> Uh, that explains many things but not all. It appears that this problem
> should be dedicated to the difference of the line ending interpretation of
> Windows and the Linux OS. On Windows we actually have 2 bytes to represent
> the line endings (0x0D 0x0A) which should also be stripped. So the following
> function would yield better results:
>
> def demime_file( filename ):
> print ' demime %s' % filename
> data = open(filename,'rb').read()
>
> for i in range(len(data)-1):
> if data[i] == '\n' and data[i+2] == '\n':
> open(filename,'wb').write(data[i+3:])
> return
> return
>
> But I have further issues with the de-stripped png images. It appears that
> the result provides invalid image unless I replace each 0x0D 0x0A with
> 0x0A in the png image file.
>
>
Tamas,
I did further investigation by comparing the hexdump of
wms_time_pattern13d.png generated on my Windows machine, the
Yewondwossen machine and yours (see below). It appears that in your file
all carriage return characters (hex0D) have been replaced by carriage
return (hex0D) and a line feed characters (0A). I cannot substitute
these characters to a carriage returns character because this will break
the output file on my machine, on Yewondwossen's one and possibly on
many others. For instance if you look to the first line Yewondwossen
file, the 'OD OA' characters would be changed to '0A' which will make
the file unreadable. The '0D' character before the '0A' character is
legitimate at this position and has a specific meaning in this png file.
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
^^^^
I discussed with Daniel about this and he told me that the function
msIO_needBinaryStdout() should take care of setting output in binary
mode on Windows to avoid this CR/LF problem. Since Assefa and I do not
have the same problem as you with the MS4W builds, it may be that
something is different with your builds that prevents this function from
doing its job?
What do you think?
Norm
Yewondwossen and mine:
00000010─────────────────────────────────────────────────┐^┌────────────────┐
│00000000 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
│◆│.PNG........IHDR│
│00000010 00 00 01 2C 00 00 01 2C 08 02 00 00 01 81 18 29
│▒│...,...,.......)│
│00000020 B4 00 00 08 68 49 44 41 54 78 9C ED DD DB 72 9B
│▒│....hIDATx....r.│
│00000030 4A 14 04 50 50 E5 FF 7F 59 E7 81 98 83 AC 4B 40
│▒│J..PP...Y.....K@│
│00000040 12 B3 A7 61 AD 87 54 92 72 79 32 69 35 D7 01 8F
│▒│...a..T.ry2i5...│
│00000050 D7 EB 75 68 EB D2 78 3C 43 1A D2 90 86 EC 64 C8
│▒│..uh..x<C.....d.│
│00000060 71 6C 3E 64 93 4D FC DD 2C F7 9F E8 E5 EF 48 B3
│▒│ql>d.M..,.....H.│
│00000070 FD 27 3A 76 B0 BF 6C F4 1F DB D6 DD 90 FB FF 3F
│▒│.':v..l........?│
│00000080 3F 9A E5 CE 9F DB 3F 0F FE 6E E7 89 F6 90 A5 21
│▒│?.....?..n.....!│
│00000090 0D 69 48 43 1A D2 90 BD 0F D9 FA 08 AF F5 14 8D
│▒│.iHC............│
│000000A0 67 3C E3 19 AF CD 78 2D CE 55 9B 5C 51 59 8C 67
│▒│g<....x-.U.\QY.g│
│000000B0 FF 10 3F DE FC 91 B9 5E F7 FE F8 5C FE 0E 33 DB
│▒│..?....^...\..3.│
│000000C0 79 C8 1E F2 DB B3 21 3D CC CF 78 C6 33 9E F1 8C
│▒│y.....!=..x.3...│
│000000D0 67 BC D6 E3 15 DC 81 6A AC E0 A2 4F 63 66 98 CF
│▒│g......j...Ocf..│
│000000E0 0C F3 99 61 3E 33 CC 77 FC 19 3E 5A F8 31 69 BB
│▒│...a>3.w..>Z.1i.│
│000000F0 7E 69 3F 77 8B B1 66 D3 AC AE D7 E8 E9 0D 0F AE
│▒│~i?w..f.........│
│00000100 E4 CD A6 69 B7 BD 0E BD 87 E7 9F D2 21 FB C3 39
│▒│...i........!..9│
│00000110 7B BE A5 D9 FF 4A 70 1B C7 DF 96 FE CC F0 E1 5A
│▒│{....Jp........Z│
│00000120 BD 29 C6 F0 24 7F 66 F8 6C 9B 99 5F C5 97 5B 9A
│▒│.)..$.f.l.._..[.│
│00000130 C9 B2 90 81 13 5E D7 C3 79 DF 18 68 F5 96 26 73
│▒│.....^..y..h..&s│
│00000140 7A C3 99 B6 A5 C7 65 86 F9 CC 30 9F 19 E6 33 C3
│▒│z.....e...0...3.│
└─────────────────────────────────────────────────────────┘v└────────────────┘
Help Save Open Goto Find Hex Addr Hex Edit Quit
Yours:
00000000─────────────────────────────────────────────────┐^┌────────────────┐
│00000000 89 50 4E 47 0D 0D 0A 1A 0D 0A 00 00 00 0D 49 48
│◆│.PNG..........IH│
│00000010 44 52 00 00 01 2C 00 00 01 2C 08 02 00 00 01 81
│▒│DR...,...,......│
│00000020 18 29 B4 00 00 08 68 49 44 41 54 78 9C ED DD DB
│▒│.)....hIDATx....│
│00000030 72 9B 4A 14 04 50 50 E5 FF 7F 59 E7 81 98 83 AC
│▒│r.J..PP...Y.....│
│00000040 4B 40 12 B3 A7 61 AD 87 54 92 72 79 32 69 35 D7
│▒│K at ...a..T.ry2i5.│
│00000050 01 8F D7 EB 75 68 EB D2 78 3C 43 1A D2 90 86 EC
│▒│....uh..x<C.....│
│00000060 64 C8 71 6C 3E 64 93 4D FC DD 2C F7 9F E8 E5 EF
│▒│d.ql>d.M..,.....│
│00000070 48 B3 FD 27 3A 76 B0 BF 6C F4 1F DB D6 DD 90 FB
│▒│H..':v..l.......│
│00000080 FF 3F 3F 9A E5 CE 9F DB 3F 0F FE 6E E7 89 F6 90
│▒│.??.....?..n....│
│00000090 A5 21 0D 69 48 43 1A D2 90 BD 0F D9 FA 08 AF F5
│▒│.!.iHC..........│
│000000A0 14 8D 67 3C E3 19 AF CD 78 2D CE 55 9B 5C 51 59
│▒│..g<....x-.U.\QY│
│000000B0 8C 67 FF 10 3F DE FC 91 B9 5E F7 FE F8 5C FE 0E
│▒│.g..?....^...\..│
│000000C0 33 DB 79 C8 1E F2 DB B3 21 3D CC CF 78 C6 33 9E
│▒│3.y.....!=..x.3.│
│000000D0 F1 8C 67 BC D6 E3 15 DC 81 6A AC E0 A2 4F 63 66
│▒│..g......j...Ocf│
│000000E0 98 CF 0C F3 99 61 3E 33 CC 77 FC 19 3E 5A F8 31
│▒│.....a>3.w..>Z.1│
│000000F0 69 BB 7E 69 3F 77 8B B1 66 D3 AC AE D7 E8 E9 0D
│▒│i.~i?w..f.......│
│00000100 0F AE E4 CD A6 69 B7 BD 0E BD 87 E7 9F D2 21 FB
│▒│.....i........!.│
│00000110 C3 39 7B BE A5 D9 FF 4A 70 1B C7 DF 96 FE CC F0
│▒│.9{....Jp.......│
│00000120 E1 5A BD 29 C6 F0 24 7F 66 F8 6C 9B 99 5F C5 97
│▒│.Z.)..$.f.l.._..│
│00000130 5B 9A C9 B2 90 81 13 5E D7 C3 79 DF 18 68 F5 96
│▒│[......^..y..h..│
│00000140 26 73 7A C3 99 B6 A5 C7 65 86 F9 CC 30 9F 19 E6
│▒│&sz.....e...0...│
└─────────────────────────────────────────────────────────┘v└────────────────┘
Help Save Open Goto Find Hex Addr Hex Edit Quit
More information about the mapserver-dev
mailing list