bug-make
[Top][All Lists]
Advanced

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

[bug #63016] Recursive variable references itself (eventually) when expo


From: Martin Dorey
Subject: [bug #63016] Recursive variable references itself (eventually) when exporting to $(shell)
Date: Sat, 12 Oct 2024 21:39:24 -0400 (EDT)

Follow-up Comment #2, bug #63016 (group make):

I may come to regret posting this, as the current git code is working well for
me here.  I did ask for this change.  That's why I feel duty-bound to report
that it bit me today.

martind@stormy:~/tmp/D160959$ cat Makefile 
generate = $(or $(1),$(call generate,flag))
FLAGS += $(or $(call generate),$(error why did my recursion produce the empty
string?))
UNRELATED := $(shell :)
all:;
martind@stormy:~/tmp/D160959$ make
make: 'all' is up to date.
martind@stormy:~/tmp/D160959$ 

All good... until one particular call causes FLAGS to be inherited from the
environment:

martind@stormy:~/tmp/D160959$ FLAGS= make --debug=v
GNU Make 4.4.90
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Makefile:1: not recursively expanding generate to export to shell function
Makefile:3: *** why did my recursion produce the empty string?.  Stop.
martind@stormy:~/tmp/D160959$ 

I could work around it, no problem, but it took me hours to understand what
was going on... and I'm one of the two principals here.

The shell invocation that bit me today was the same "2004" (actually 2005) one
that bit me in my original post here, but it could easily have been something
more compelling.

I can try to explain my use case for the recursion if that would help, but I
lean towards thinking there's nothing to be done here.  There is already a
diagnostic, as we see demonstrated here, though I only thought of asking for
it when I found my way back to this bug report.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63016>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

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