[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #11, bug #16505 (project make): I can understand everything you are saying -- the backward incompatibility, the suggestion to add an explicit warning, the works. The only thing I do NOT understand is why do you insist on telling about the EOF error etc., when you have at least two ways of working around the problem: either use double quotes instead of single quotes, or put the entire multi-line script into a Make variable (in which case you can keep the single quotes)? It should not be too hard to modify your Makefile to work with the new release of Make, without breaking the old releases as well. ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #12, bug #16505 (project make): I understand the workarounds. (Make variables are probably the way to go, because double-quoting script languages tends to be cumbersome.) My makefiles won't be that much of a problem, anyway, compared to those of others---I first encountered this new feature in running a makefile from XScreenSaver. Doubtful that'll be the only instance. I kept mentioning the unexpected-EOF errors just to emphasize how brain-dead the POSIX behavior is, because those are what you get if you (reasonably) think that POSIX treats single-quoted EOL backslashes as literal characters (such that all you need to do so that they don't appear in your inline scripts is, well, delete them). ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
URL: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 Summary: Line-continuation backslashes are not stripped Project: make Submitted by: None Submitted on: Wednesday 05/03/06 at 06:45 UTC Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Component Version: CVS Operating System: POSIX-Based Fixed Release: None ___ Details: Scenario: A makefile command (i.e. a shell command executed for some target) that makes use of a quoted string spanning multiple lines via continuation backslashes. E.g. an in-place awk or perl program. Problem: make 3.81 and CVS do not strip the backslashes before passing the string to the shell. This is a regression from make 3.80. The attached makefile clearly illustrates the bug, and the havoc that it can play on a perl program. (Reporter: Daniel Richard G. [EMAIL PROTECTED]) ___ File Attachments: --- Date: Wednesday 05/03/06 at 06:45 UTC Name: Makefile Size: 109B By: None Bug test case http://savannah.gnu.org/bugs/download.php?file_id=9881 ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #1, bug #16505 (project make): This is not a regression, but a deliberate change whose purpose is to follow the Posix specifications. From NEWS: - quotation -- * WARNING: Backward-incompatibility! In order to comply with POSIX, the way in which GNU make processes backslash-newline sequences in command strings has changed. If your makefiles use backslash-newline sequences inside of single-quoted strings in command scripts you will be impacted by this change. See the GNU make manual subsection Splitting Command Lines (node Splitting Lines), in section Command Syntax, chapter Writing the Commands in Rules, for details. - end quotation --- So your Makefile is in violation of Posix. The simplest change to get it to work is to use double quotes instead of single quotes (and escape the inner double quotes as appropriate). ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #5, bug #16505 (project make): Sorry; I wasn't too clear there. My point was, basically, that the POSIX behavior sucks }:-) Okay, so multi-line single-quoted strings now retain the backslashes. This implies that removing the backslashes is all you need to do, that they are superfluous, that the behavior is now Bourne-shell-like in that an open quote automatically causes a continuation at the end of the line. But no; when you remove the backslashes, there's no continuation at all, hence the EOF error. So the situation is, backslashes are still your continuation character, except that they're useless---unless you don't mind them showing up in the string. So for all but a tiny minority of cases, multi-line single-quoted strings in command scripts have been removed as an usable idiom in GNU Make. I recognize the value of POSIX compliance, especially in regulatory contexts, but the approach usually taken by other GNU tools when the POSIX behavior is annoying/limiting is to enable it only when POSIXLY_CORRECT is defined. I'm wondering why that wasn't done here, especially when the POSIX behavior disallows a useful/common idiom, and breaks a number of existing makefiles. ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #6, bug #16505 (project make): The Posix behavior has its merits: without it, how does one pass a command line with embedded newlines from a Makefile? The Posix handling of newlines in single quotes permits this. ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #8, bug #16505 (project make): I think the INTENT was to allow embedded newlines. However, the implementation only works for tools which will ignore the backslash as well. Some UNIX tools do this; many don't. You _have_ to have the newline in the makefile, because make does not and absolutely cannot parse the contents of your command line to determine whether the newline is inside single-quotes or not. Make needs a 100% objective criteria as to whether to continue a line, and a backslash/newline is it. What I suppose you REALLY want is that, for backslash/newline pairs in a command script, the BACKSLASH is removed but the NEWLINE is preserved when make invokes the shell. This allows for all possible options: you can preserve newlines (which is important in some situations!) and you can choose to not have a backslash before the newline (the default) or to have one (by adding \\ before the backslash/newline). But, that's not what POSIX defines, and it's not how any other version of make I'm aware of works. So... :-/ ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make
[bug #16505] Line-continuation backslashes are not stripped
Follow-up Comment #9, bug #16505 (project make): Argh. I mean You _have_ to have the BACKSLASH in the makefile, in the second paragraph of the previous comment :-/ ___ Reply to this item at: http://savannah.gnu.org/bugs/?func=detailitemitem_id=16505 ___ Message sent via/by Savannah http://savannah.gnu.org/ ___ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make