bug-make
[Top][All Lists]
Advanced

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

backslash-newline mishandled in some commands


From: Paul Eggert
Subject: backslash-newline mishandled in some commands
Date: Tue, 4 Oct 2016 00:59:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

With the attached Makefile in an otherwise-empty directory, GNU 'make' 4.2.1 outputs:

V=$(expr " " : '\(.*[^ ]\)') && printf '%s\n' "$V"
make: *** [Makefile:2: this-should-work] Error 1

It should output:

V=$(expr " " : '\(.*[^\
]\)') && printf '%s\n' "$V"


(The line after the 'printf' line consists of a single space.)

The problem is that GNU 'make' transforms a newline into a space, even though POSIX says the newline should be preserved; see the last paragraph of "Makefile Syntax" <http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html#tag_20_76_13_01>.

Solaris 10 /usr/ccs/bin/make works correctly (if SHELL=/bin/bash is also specified). Also, 'make this-works' works correctly with GNU 'make'.

This bug has been in GNU 'make' for some time; I can reproduce it with version 
3.81.

Attachment: Makefile
Description: Text document


reply via email to

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