bug-make
[Top][All Lists]
Advanced

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

Segmentation Fault on Exported Resursively Expanded Variable


From: MIAOW Miao
Subject: Segmentation Fault on Exported Resursively Expanded Variable
Date: Mon, 15 Jan 2024 11:21:12 +0000

Hi,
I found name of exported resursively expanded variable with $(shell ...) cannot be too long in gnu make version >= 4.4, otherwise a segmentation fault is triggled. 
I'm not sure if variable-name-too-long is a bug. However, make is supposed to tell me what's going wrong.

Here is a Makefile that can reproduce the segmentation fault:
THIS_LONG_VARIABLE_NAME_PREDUCE_THE_ERROR= $(shell echo hello)
export THIS_LONG_VARIABLE_NAME_PREDUCE_THE_ERROR

all: ; echo "abc"
Commands log:
user@fedora:~$ make
echo "abc"
Segmentation fault (core dumped)

user@fedora:~$ make --version
GNU Make 4.4.1
Built for x86_64-redhat-linux-gnu
...

user@fedora:~$ make --help
...
This program built for x86_64-redhat-linux-gnu
Report bugs to <bug-make@gnu.org>

The error can be reproduced on fedora 39 with the following 2 official builds of make by fedora project:
  • make-4.4-1.fc38: https://kojipkgs.fedoraproject.org//packages/make/4.4/1.fc38/x86_64/make-4.4-1.fc38.x86_64.rpm
  • make-4.4.1-2.fc39: https://kojipkgs.fedoraproject.org//packages/make/4.4.1/2.fc39/x86_64/make-4.4.1-2.fc39.x86_64.rpm

There is NO error with gnu make 4.3, tested both on Ubuntu 23.04 (make 4.3-4.1build1) and fedora39 (make-4.3-1.fc33):

I think it may be caused by the new feature "shell-export". As is the "NEWS" file of Version 4.4 (31 Oct 2022):
* WARNING: Backward-incompatibility!
  Previously makefile variables marked as export were not exported to command
  started by the $(shell ...) function.  Now, all exported variables are
  exported to $(shell ...).  If this leads to recursion during expansion, the
  for backward-compatibility the value from the original environment is used.
  To detect this change search for 'shell-export' in the .FEATURES variable.
Best regards,
Yiren Guo

Attachment: Makefile
Description: Makefile


reply via email to

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