bug-make
[Top][All Lists]
Advanced

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

misinterpretation of shell $'...' escape form


From: Poor Yorick
Subject: misinterpretation of shell $'...' escape form
Date: Sat, 15 Oct 2022 22:41:09 +0300

Given the following Makefile,

<code>
define newline


endef

define cmd1
        thing1
        thing2
endef

help:
        echo '$(subst $(newline),'$$'\n'',$(cmd1))'
.PHONY: help
</code>


, on an Ubuntu 22.04 system, GNU Make 4.3, Bash 5.1.16(1), and the Makefile below, "make help" produces the following


<verbatim>
echo '  thing1'$\n''    thing2'
    thing1$
    thing2
</verbatim>

I believe the output should instead have been:

<verbatim>
echo '  thing1'$\n''    thing2'
    thing1
    thing2
</verbatim>


And indeed, an an Arch Linux system with the same version of Make and Bash, it
does.

Furthermore, replacing "$\n" with "$\x0A" produced the following on the
"broken" Ubuntu system:

<verbatim>
echo '  thing1'$\n''    thing2'
    thing1$\x0A    thing2
</verbatim>

I'm at a loss to explain why the output is different on these two systems, and why that extra "$" character appears in the output on the first system, which
seems even more wrong than the first example.

Can anyone reproduce this, and has anyone got any insights about what the issue
might be?

--
Yorick





reply via email to

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