|
From: SF/projects/mingw n. l. <min...@li...> - 2013-01-11 18:36:28
|
Bugs item #802736, was opened at 2003-09-08 13:47 Message generated for change (Settings changed) made by earnie You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=802736&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: binutils >Group: Aged issue >Status: Closed >Resolution: Out of Date Priority: 5 Private: No Submitted By: Don Stauffer (donstauffer) Assigned to: Nobody/Anonymous (nobody) Summary: Double quotes inside single quotes interpreted as escape Initial Comment: This looks the same as bug 546547, but that bug has "invalid" as "Resolution" and is closed, but the bug does still exist. It also seems like the real problem is that double quotes inside single quotes are interpreted as an escape, the same as a backslash. In the attached example makefile, the last test string before the workaround shows that the sequence '"n' is interpreted as a newline. Double quotes inside single quotes should be considered literal characters, probably whether or not they are preceded by a single backslash, though definitely when they are not. The example makefile produces the following output with MinGW make version 3.80: Should be a literal double quote: printf 'abc"xyz' abcprintf: missing hexadecimal number in escape mingw32-make: [example] Error 1 (ignored) Should be a literal double quote: printf 'abc\"xyz\n\n' abc\xyz Should be a newline: printf 'abc\nxyz' abc xyz Should be a literal backslash and double quote: printf 'abc\\"xyz' abc\printf: missing hexadecimal number in escape mingw32-make: [example] Error 1 (ignored) Should be a literal double quote and n printf 'abc"nxyz' abc xyz Workaround: printf 'abc'"\""'xyz' abc"xyz With Cygwin make 3.79, it produces the following output: Should be a literal double quote: printf 'abc"xyz' abc"xyz Should be a literal double quote: printf 'abc\"xyz\n\n' abc"xyz Should be a newline: printf 'abc\nxyz' abc xyz Should be a literal backslash and double quote: printf 'abc\\"xyz' abc\"xyz Should be a literal double quote and n printf 'abc"nxyz' abc"nxyz Workaround: printf 'abc'"\""'xyz' abc"xyz ---------------------------------------------------------------------- Comment By: Don Stauffer (donstauffer) Date: 2003-09-14 22:39 Message: Logged In: YES user_id=861460 Sorry, what do you mean by "not mine"? Actually, I downloaded the source and fixed this and another bug, only to find out someone just uploaded almost the exact same patch on Friday! ---------------------------------------------------------------------- Comment By: Danny Smith (dannysmith) Date: 2003-09-12 03:51 Message: Logged In: YES user_id=11494 Not mine. Danny ---------------------------------------------------------------------- Comment By: Don Stauffer (donstauffer) Date: 2003-09-08 14:25 Message: Logged In: YES user_id=861460 The cause of the problem appears to be that make removes the single quotes from any command arguments containing a double quote character. Looking at the debugging output of make, the CreateProcess for printf is missing the single quotes around the argument to printf whenever that argument contains double quotes. The last example, "Workaround", does not contain double quotes inside single quotes - they are inside their own set of double quotes. For "Workaround", CreateProcess uses printf 'abc'\"\\\"\"'xyz' which has the single quotes intact. So, what should be (and is, in Cygwin make) printf 'abc"nxyz' comes out printf abc\"nxyz. When I type that at a command prompt, the output is abc newline xyz, just as with MinGW make. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=802736&group_id=2435 |