jesparza/peepdf

Redirecting output from command in interactive PeepDF session creates hundreds of files (1 for each byte of output!)

KurtPfeifle opened this issue · 1 comments

I came across this issue when playing with the current PeepDF code from the Git repo....

You can use this sample PDF file (handcoded by me) to reproduce the issue of this report:

The following is from an interactive peepdf session (I know I haven't installed PyV8 and pylibemu on this system, but this shouldn't matter for this issue):

kp@mbp:mrmcd15>  peepdf.py -fli  manuallycoded.pdf
Warning: PyV8 is not installed!!
Warning: pylibemu is not installed!!

File: manuallycoded.pdf
MD5: 758869f79d4fe30496db43b3bef8b708
SHA1: 4821d74bf84b6a0b757fd6c152c2e0a6d5fd3fa9
SHA256: 73016c523779e344ad45ee07dadd6812c14bde2015e6ba2e8e2638ef730c870e
Size: 2656 bytes
Version: 1.0
Binary: False
Linearized: False
Encrypted: False
Updates: 0
Objects: 9
Streams: 2
Comments: 0
Errors: 1

Version 0:
    Catalog: 1
    Info: 2
    Objects (9): [1, 2, 3, 4, 5, 7, 8, 9, 10]
    Streams (2): [8, 9]
        Encoded (1): [9]


PPDF> object 9

<< /Length 503
/Filter [ /ASCIIHexDecode /ASCIIHexDecode /FlateDecode /LZWDecode /ASCIIHexDecode ] >>
stream
BT
    /F1 60              Tf
    30  400             Td
    1 0 0               rg
    (Hallo, MRMCD 2015) Tj
ET

endstream

PPDF> filters 9

[ /ASCIIHexDecode /ASCIIHexDecode /FlateDecode /LZWDecode /ASCIIHexDecode ]

PPDF> filters 9 ahx

<< /Length 228
/Filter /ASCIIHexDecode >>
stream
42540a202020202f4631203630202020202020202020202020202054660a20202020333020203430302020202020202020202020202054640a20202020312030203020202020202020202020202020202072670a202020202848616c6c6f2c204d524d434420323031352920546a0a45540a
endstream

PPDF> filters 9 ahx > stream9.ahx

PPDF> quit

Leaving the Peepdf interactive console...Bye! ;)

Now look at the file(s) named stream9.ahx created by the last PeepDF command with its output re-directed:

kp@mbp:mrmcd15>  ls -l stream9.ahx_* | wc -l
     286

kp@mbp:mrmcd15>  ls stream9.ahx_*
stream9.ahx_1   stream9.ahx_118 stream9.ahx_137 stream9.ahx_156 stream9.ahx_175 stream9.ahx_194 stream9.ahx_212 stream9.ahx_231 stream9.ahx_250 stream9.ahx_27  stream9.ahx_30  stream9.ahx_5   stream9.ahx_69  stream9.ahx_88
stream9.ahx_10  stream9.ahx_119 stream9.ahx_138 stream9.ahx_157 stream9.ahx_176 stream9.ahx_195 stream9.ahx_213 stream9.ahx_232 stream9.ahx_251 stream9.ahx_270 stream9.ahx_31  stream9.ahx_50  stream9.ahx_7   stream9.ahx_89
stream9.ahx_100 stream9.ahx_12  stream9.ahx_139 stream9.ahx_158 stream9.ahx_177 stream9.ahx_196 stream9.ahx_214 stream9.ahx_233 stream9.ahx_252 stream9.ahx_271 stream9.ahx_32  stream9.ahx_51  stream9.ahx_70  stream9.ahx_9
stream9.ahx_101 stream9.ahx_120 stream9.ahx_14  stream9.ahx_159 stream9.ahx_178 stream9.ahx_197 stream9.ahx_215 stream9.ahx_234 stream9.ahx_253 stream9.ahx_272 stream9.ahx_33  stream9.ahx_52  stream9.ahx_71  stream9.ahx_90
stream9.ahx_102 stream9.ahx_121 stream9.ahx_140 stream9.ahx_16  stream9.ahx_179 stream9.ahx_198 stream9.ahx_216 stream9.ahx_235 stream9.ahx_254 stream9.ahx_273 stream9.ahx_34  stream9.ahx_53  stream9.ahx_72  stream9.ahx_91
stream9.ahx_103 stream9.ahx_122 stream9.ahx_141 stream9.ahx_160 stream9.ahx_18  stream9.ahx_199 stream9.ahx_217 stream9.ahx_236 stream9.ahx_255 stream9.ahx_274 stream9.ahx_35  stream9.ahx_54  stream9.ahx_73  stream9.ahx_92
stream9.ahx_104 stream9.ahx_123 stream9.ahx_142 stream9.ahx_161 stream9.ahx_180 stream9.ahx_2   stream9.ahx_218 stream9.ahx_237 stream9.ahx_256 stream9.ahx_275 stream9.ahx_36  stream9.ahx_55  stream9.ahx_74  stream9.ahx_93
stream9.ahx_105 stream9.ahx_124 stream9.ahx_143 stream9.ahx_162 stream9.ahx_181 stream9.ahx_20  stream9.ahx_219 stream9.ahx_238 stream9.ahx_257 stream9.ahx_276 stream9.ahx_37  stream9.ahx_56  stream9.ahx_75  stream9.ahx_94
stream9.ahx_106 stream9.ahx_125 stream9.ahx_144 stream9.ahx_163 stream9.ahx_182 stream9.ahx_200 stream9.ahx_22  stream9.ahx_239 stream9.ahx_258 stream9.ahx_277 stream9.ahx_38  stream9.ahx_57  stream9.ahx_76  stream9.ahx_95
stream9.ahx_107 stream9.ahx_126 stream9.ahx_145 stream9.ahx_164 stream9.ahx_183 stream9.ahx_201 stream9.ahx_220 stream9.ahx_24  stream9.ahx_259 stream9.ahx_278 stream9.ahx_39  stream9.ahx_58  stream9.ahx_77  stream9.ahx_96
stream9.ahx_108 stream9.ahx_127 stream9.ahx_146 stream9.ahx_165 stream9.ahx_184 stream9.ahx_202 stream9.ahx_221 stream9.ahx_240 stream9.ahx_26  stream9.ahx_279 stream9.ahx_4   stream9.ahx_59  stream9.ahx_78  stream9.ahx_97
stream9.ahx_109 stream9.ahx_128 stream9.ahx_147 stream9.ahx_166 stream9.ahx_185 stream9.ahx_203 stream9.ahx_222 stream9.ahx_241 stream9.ahx_260 stream9.ahx_28  stream9.ahx_40  stream9.ahx_6   stream9.ahx_79  stream9.ahx_98
stream9.ahx_11  stream9.ahx_129 stream9.ahx_148 stream9.ahx_167 stream9.ahx_186 stream9.ahx_204 stream9.ahx_223 stream9.ahx_242 stream9.ahx_261 stream9.ahx_280 stream9.ahx_41  stream9.ahx_60  stream9.ahx_8   stream9.ahx_99
stream9.ahx_110 stream9.ahx_13  stream9.ahx_149 stream9.ahx_168 stream9.ahx_187 stream9.ahx_205 stream9.ahx_224 stream9.ahx_243 stream9.ahx_262 stream9.ahx_281 stream9.ahx_42  stream9.ahx_61  stream9.ahx_80
stream9.ahx_111 stream9.ahx_130 stream9.ahx_15  stream9.ahx_169 stream9.ahx_188 stream9.ahx_206 stream9.ahx_225 stream9.ahx_244 stream9.ahx_263 stream9.ahx_282 stream9.ahx_43  stream9.ahx_62  stream9.ahx_81
stream9.ahx_112 stream9.ahx_131 stream9.ahx_150 stream9.ahx_17  stream9.ahx_189 stream9.ahx_207 stream9.ahx_226 stream9.ahx_245 stream9.ahx_264 stream9.ahx_283 stream9.ahx_44  stream9.ahx_63  stream9.ahx_82
stream9.ahx_113 stream9.ahx_132 stream9.ahx_151 stream9.ahx_170 stream9.ahx_19  stream9.ahx_208 stream9.ahx_227 stream9.ahx_246 stream9.ahx_265 stream9.ahx_284 stream9.ahx_45  stream9.ahx_64  stream9.ahx_83
stream9.ahx_114 stream9.ahx_133 stream9.ahx_152 stream9.ahx_171 stream9.ahx_190 stream9.ahx_209 stream9.ahx_228 stream9.ahx_247 stream9.ahx_266 stream9.ahx_285 stream9.ahx_46  stream9.ahx_65  stream9.ahx_84
stream9.ahx_115 stream9.ahx_134 stream9.ahx_153 stream9.ahx_172 stream9.ahx_191 stream9.ahx_21  stream9.ahx_229 stream9.ahx_248 stream9.ahx_267 stream9.ahx_286 stream9.ahx_47  stream9.ahx_66  stream9.ahx_85
stream9.ahx_116 stream9.ahx_135 stream9.ahx_154 stream9.ahx_173 stream9.ahx_192 stream9.ahx_210 stream9.ahx_23  stream9.ahx_249 stream9.ahx_268 stream9.ahx_29  stream9.ahx_48  stream9.ahx_67  stream9.ahx_86
stream9.ahx_117 stream9.ahx_136 stream9.ahx_155 stream9.ahx_174 stream9.ahx_193 stream9.ahx_211 stream9.ahx_230 stream9.ahx_25  stream9.ahx_269 stream9.ahx_3   stream9.ahx_49  stream9.ahx_68  stream9.ahx_87

Each output file contains exactly 1 Byte. (Concatenating these file in the correct order will give the same output as seen in the interactive PeepDF session without re-directing the output.)

I also tried this command variation for re-directing the output: filters 9 ahx >> stream9.ahx.

But it doesn't make a difference.

@KurtPfeifle, this should be fixed ;) Thanks!