Page MenuHomePhabricator

Some ghostscript failures will return binary output to logs
Open, Needs TriagePublic

Description

When requesting files like /wikipedia/commons/thumb/0/0c/Ducato_di_Parma_1620.pdf/page1-300px-Ducato_di_Parma_1620.pdf.jpg, there is a ghostscript failure when running ['/usr/bin/gs', '-sDEVICE=jpeg', '-dJPEG=90', '-sstdout=%stderr', '-sOutputFile=%stdout', '-dFirstPage=1', '-dLastPage=1', '-r150', '-dUseCropBox', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-q', '-f/tmp/tmp6v9_yhhw'].

I have yet to debug this particular issue, but of more pressing importance is the fact that an uncaught CommandError is just an Exception - meaning that the binary output dumped to stdout will be logged, causing a huge amount of output spam. We replicate this pattern in a few places. This is a side-effect of the issues highlighted in T335790, but isn't a related problem. Binary output in logs is close to useless, we should be more terse in what we log.