On Sat, Dec 19, 2009 at 02:38:29PM +0100, Jürgen Spitzmüller wrote:
> Peter Kümmel wrote:
> > I could not reproduce this bug with trunk:
> > - USB-stick name : Stick'N'Go
> > - copied BRANCH_1_4_X/lib to stick
> > - opened UserGuide.lyx from stick
> > - PDF is generated without errors
> > 
> > Is this the right way to reproduce?
> > If yes then, it is not a bug for trunk any more.

The bug is also in trunk when disabling QProcess.

> I couldn't reproduce the original bug (processing a document with a single 
> quote in the path) in branch either.

As this is a quoting problem, it manifest itself only in certain circumstances.
For example, try to include an xfig graphics with a single-quote in its name.

> However, I still can reproduce problems with a file name containing this 
> char, 
> such as a'b.lyx.

The attached patch (for branch) fixes the problem for me.

> Furthermore, lyx2lyx still fails if the path contains a ' 
> character. This is branch. I didn't test trunk.

Then, there's a quoting problem in python, too.

I've reworked the parser for QProcess in order to implement a shell-like parser
also accounting for single-quote quoting in a platform independent way. I am
going to commit the patch, but the last changes by Abdel broke output generation
as I am not able to produce dvi or pdf anymore :(

-- 
Enrico
Index: src/support/filetools.cpp
===================================================================
--- src/support/filetools.cpp	(revisione 32586)
+++ src/support/filetools.cpp	(copia locale)
@@ -129,15 +129,12 @@ string const quoteName(string const & na
 {
 	switch(style) {
 	case quote_shell:
-		// This does not work for filenames containing " (windows)
-		// or ' (all other OSes). This can't be changed easily, since
-		// we would need to adapt the command line parser in
-		// Forkedcall::generateChild. Therefore we don't pass user
-		// filenames to child processes if possible. We store them in
-		// a python script instead, where we don't have these
-		// limitations.
+		// This does not work on native Windows for filenames
+		// containing ", and can't be made to work, as, according to
+		// http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
+		// it is a reserved character (along with < > : / \ | ? * ).
 		return (os::shell() == os::UNIX) ?
-			'\'' + name + '\'':
+			'\'' + subst(name, "'", "\'\\\'\'") + '\'' :
 			'"' + name + '"';
 	case quote_python:
 		return "\"" + subst(subst(name, "\\", "\\\\"), "\"", "\\\"")

Reply via email to