-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Freitag, 21. August 2009 23:20:12 schrieb Patrick McCarty:
> On 2009-08-21, Ian Hulin wrote:
> >    * You've identified a rare case which needs a fix to some pretty
> >      basic code.
>
> How do we know it's rare?  I don't think it's worth breaking PDF
> generation based on an assumption.

It's not so rare, even a file name "a b.ly" broke with the old patch... And 
with Ians updated patch, this would result in a_b.ps as output file...

> The real issue is that double quotes are not escaped, so in your
> patch, you should use
>
>   (filtered-name (string-regexp-substitute "\"" "\\\"" name))
>
> instead.  If you look at the "escape-string" procedure in
> scm/output-socket.scm, you'll see another place where this technique
> is used.

Actually, I've now implemented a basic ~s formatting placeholder for 
ly:format, which wraps its argument in double quotes and escapes all 
backslashes and double quotes. I don't think we need/should print all other 
chars as \x..., should we?

Patch can be found in Rietvield:
http://codereview.appspot.com/109070

This works also with pathologic file names like:
a b.ly
b'c.ly
c"d.ly
d'e".ly
e"f'.ly
f\"g.ly
f\"g.pdf
g\'h.ly

Okay to apply.

Cheers,
Reinhold

PS: The patch needs the latest master, because I just fixed an endless loop: 
replace_all (&str, "\"", "\\\") would never terminate!
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFKjxzxTqjEwhXvPN0RApn+AKCysACddVKDBHDdVkd40LgIOPY/9wCgyinb
+BjTNp4hiWQXHHtqTqe5gV0=
=TPm9
-----END PGP SIGNATURE-----


_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to