Fix uninformative hp2ps error when the command args contains double quotes
ClosedPublic

Authored by watashi on Nov 16 2018, 3:11 PM.

Details

Summary

The format of hp file didn't allow double quotes inside strings, and
under prof build, we include args in JOB, which may have double quotes.
When this happens, the error message is confusing to the user. This can
also happen under normal build if the executable name contains double
quite, which is unlikely though.

We fix this issue by introducing escaping for double quotes inside a
string by repeating it twice.

We also fix a buffer overflow bug when the lenght of the string happen
to be multiple of 5000.

Test Plan

new tests, which used to fail with error message:

hp2ps: "T15904".hp, line 2: integer must follow identifier

use new ghc and hp2ps to profile a simple program.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.