Bug 90 - infinite loop in Makerules
Summary: infinite loop in Makerules
Status: RESOLVED DUPLICATE of bug 333
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-24 18:41 UTC by Boris Kolpackov
Modified: 2019-04-10 12:15 UTC (History)
0 users

See Also:
Host: x86-gnu-linux
Target: x86-gnu-linux
Build: x86-gnu-linux
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Kolpackov 2004-03-24 18:41:38 UTC
In Makerules somewhere around line 1097 there is the following fragment.

$(addprefix $(inst_includedir)/,$(headers)): $(inst_includedir)/%: % $(+force)
	echo "doing header installation"
	$(do-install)

When configured with --enable-force-install +force variable contains .PHONY
target force-install. This makes $(addprefix $(inst_includedir)/,$(headers))
always outdated which makes make always try to rebuild them and also (here is
the catch) makes anything that depends on any header from $(addprefix
$(inst_includedir)/,$(headers)) outdated too.

Now let's take a look at tls.make.c or rather at the makefile fragment
(tls.make) that get's generated from it. There we see something like this:

tls.make: some-path/limits.h

And now the last piece of the puzzle from Makerules:

-include $(common-objpfx)tls.make

Putting it all together gives the following effect:

1. make tries to include tls.make - it does not exist

2. but there is a rule to build it from tls.make.c so make does that

3. make re-executes itself and reads tls.make in

4. inside tls.make there is a rule that says tls.make depends on limits.h

5. and there is a rule how to build limits.h which also makes limits.h always
   outdated

6. make has no choice but to rebuild limits.h and as a result tls.make
  
7. now make has to re-execute again because tls.make has changed, so goto (3)

The bottom line: depending real tragets (files) on phony targets is a bad idea ;-)

hth,
-boris
Comment 1 GOTO Masanori 2004-09-27 12:37:53 UTC
Compilation problem is to be duplicated to #333.

*** This bug has been marked as a duplicate of 333 ***