Subject: | t/05_cleanpdf.t randomly fails on PDF files with \r\n in PDF objects |
I noticed t/05_cleanpdf.t fails randomly with:
t/05_cleanpdf.t .. 1/13
# Failed test 'Foobar.pdf contains only unix newlines'
# at t/05_cleanpdf.t line 73.
# '%PDF-1.4
# %��͵
[...]
# %%EOF
# '
# matches '(?^:\r\n)'
The reason is that the generated and tested Foobar.pdf changes at each run (e.g. font object identifiers contains random characters) ans a /Filter object sometimes contains "\r\n" sequence and that triggers the test failure:
000002c0 6f 62 6a 0a 37 20 30 20 6f 62 6a 20 3c 3c 20 2f |obj.7 0 obj << /|
000002d0 46 69 6c 74 65 72 20 5b 20 2f 46 6c 61 74 65 44 |Filter [ /FlateD|
000002e0 65 63 6f 64 65 20 5d 20 2f 4c 65 6e 67 74 68 20 |ecode ] /Length |
000002f0 34 32 37 20 3e 3e 20 73 74 72 65 61 6d 0a 78 9c |427 >> stream.x.|
00000300 cd 97 c1 52 c2 30 10 86 5f 65 8f 38 a3 31 9b a4 |...R.0.._e.8.1..|
00000310 0d e5 46 11 95 03 88 da 17 40 ac a5 5a a8 62 71 |..F......@..Z.bq|
00000320 46 0f 3e bb 8b e2 45 68 65 67 1a a6 d3 69 2f c9 |F.>...Eheg...i/.|
00000330 6e be fd 93 dd 6c 01 c2 08 e0 f4 32 0e f3 5e d8 |n....l.....2..^.|
00000340 fd 44 cf 37 ba ad 24 2a 40 09 d1 03 40 9f 86 e1 |.D.7..$*@...@...|
00000350 05 be a7 21 48 7a 10 4c 5b 0a ad c1 5a 05 d1 bc |...!Hz.L[...Z...|
00000360 c2 b8 35 7c 1f e6 f7 ab 2c 16 cf f3 23 88 1e 37 |..5|....,...#..7|
00000370 de ae 37 de 24 4d fa a8 30 ff 5d 6e fd a5 75 24 |..7.$M..0.]n..u$|
00000380 24 f4 5e 70 61 3d 34 c2 fa e0 cb 7f 58 c7 93 24 |$.^pa=4.....X..$|
00000390 06 ac 15 33 7b eb 85 e1 b6 41 e5 c8 f6 22 aa 7a |...3{....A...".z|
000003a0 a4 64 87 c0 7a de 0f ce fa 59 26 15 1e 5a a3 ee |.d..z....Y&..Z..|
000003b0 b0 cf 0b 5c d5 1c f8 ce 20 02 1f ac 0e fe 06 51 |...\.... ......Q|
000003c0 e2 a1 75 9e e7 9d 4e 38 59 56 05 52 62 5b 12 c8 |..u...N8YV.Rb[..|
000003d0 4e 28 d4 46 68 8f 03 06 ce 89 ac 40 cd 21 3a 71 |N(.Fh......@.!:q|
000003e0 4d 64 a4 30 ac cd 73 ae 91 d1 42 19 0e d1 78 55 |Md.0..s...B...xU|
000003f0 14 e9 22 71 cd 65 e9 34 d9 46 29 65 e9 34 b1 ce |.."q.e.4.F)e.4..|
00000400 77 31 8b 5d 33 05 28 64 b3 72 2e d0 a2 cd ca 39 |w1.]3.(d.r.....9|
00000410 2a 4f 8e 99 14 92 4a 8d ca 3a 85 a4 12 2b eb d2 |*O....J..:...+..|
00000420 45 e1 5c 26 15 08 de cd e2 5c 26 ad 84 65 c9 54 |E.\&.....\&..e.T|
00000430 eb 35 77 a0 76 04 b7 a2 2b 6b 47 ce fa b7 bd 9b |.5w.v...+kG.....|
00000440 c1 38 1a 5c 8d 1a da 95 48 bd ef 4e 0d 0a d7 95 |.8.\....H..N....|
^^^^^
00000450 48 a2 f0 58 48 ce 6b a3 a4 3b cd 70 88 d2 57 d7 |H..XH.k..;.p..W.|
00000460 48 d8 38 91 90 2b 52 96 3e 39 bf 67 a9 34 f2 a0 |H.8..+R.>9.g.4..|
00000470 dc f7 b6 4a 90 21 83 68 3a cb a7 79 36 29 e2 e3 |...J.!.h:..y6)..|
00000480 03 34 4a b6 51 5a d1 5f f9 ba d0 ee 4f 74 b7 72 |.4J.QZ._....Ot.r|
00000490 5e 9d 02 3a e6 2c 26 f7 9d 1b f5 b7 ac 52 b0 c8 |^..:.,&......R..|
000004a0 0b 51 37 d4 17 e1 0e de 63 0a 65 6e 64 73 74 72 |.Q7.....c.endstr|
000004b0 65 61 6d 20 65 6e 64 6f 62 6a 0a 38 20 30 20 6f |eam endobj.8 0 o|
The offensive PDF is attached.
I believe the t/05_cleanpdf.t should examine Foobar.pdf for new-lines unless it can parse PDF properly.
I believe that the t/05_cleanpdf.t
Subject: | Foobar.pdf.bad |
Message body not shown because it is not plain text.