bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ghostscript fails with special characters in filename


From: Reinhold Kainhofer
Subject: Re: Ghostscript fails with special characters in filename
Date: Sat, 22 Aug 2009 00:17:19 +0200
User-agent: KMail/1.11.4 (Linux/2.6.29-02062906-generic; KDE/4.2.4; i686; ; )

-----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, address@hidden, 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-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]